Reshape conf obj and move to resource

This commit is contained in:
Samuele E. Locatelli
2020-07-02 17:46:58 +02:00
parent 717dc29b46
commit e59557e42c
6 changed files with 252 additions and 29 deletions
+17 -15
View File
@@ -1,18 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<appSettings>
<add key="appName" value="MHT-Proxy"/>
<add key="verbose" value="false"/>
<!--conf file-->
<add key="memConfPath" value="setupData.json"/>
<add key="sampleTimerMs" value="1000"/>
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib;libs"/>
</assemblyBinding>
</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<appSettings>
<add key="appName" value="IOB-WIN.FileExp"/>
<add key="verbose" value="false"/>
<!--conf file-->
<add key="csvFilePath" value="c:\\TMP\\OutputFile.csv"/>
<add key="csvHeader" value="true"/>
<add key="csvSeparator" value=";"/>
<add key="sampleTimerMs" value="500"/>
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib;libs"/>
</assemblyBinding>
</runtime>
</configuration>
+74
View File
@@ -0,0 +1,74 @@
{
"confPLC": {
"ipAdrr": "192.168.214.1",
"tipoCpu": "S7300",
"rack": 0,
"slot": 2
},
"TriggerMemConf": "DB700.DBB0",
"parametersList": {
"DB700.DBB8": {
"Column": "Valore 1",
"Index": 1,
"MemConf": "DB700.DBB8",
"DataType": "word",
"memByteSize": 2
},
"DB700.DBB10": {
"Column": "Valore 2",
"Index": 2,
"MemConf": "DB700.DBB10",
"DataType": "word",
"memByteSize": 2
},
"DB700.DBB16": {
"Column": "Valore 3",
"Index": 3,
"MemConf": "DB700.DBB16",
"DataType": "dword",
"memByteSize": 4
},
"DB700.DBB20": {
"Column": "Valore 4",
"Index": 4,
"MemConf": "DB700.DBB20",
"DataType": "dword",
"memByteSize": 4
},
"DB700.DBB32": {
"Column": "Valore 5",
"Index": 5,
"MemConf": "DB700.DBB32",
"DataType": "real",
"memByteSize": 4
},
"DB700.DBB36": {
"Column": "Valore 6",
"Index": 6,
"MemConf": "DB700.DBB36",
"DataType": "real",
"memByteSize": 4
},
"DB700.DBB40": {
"Column": "Valore 7",
"Index": 7,
"MemConf": "DB700.DBB40",
"DataType": "real",
"memByteSize": 4
},
"DB700.DBB48": {
"Column": "Valore 8",
"Index": 8,
"MemConf": "DB700.DBB48",
"DataType": "string",
"memByteSize": 20
}
//"parametersList": {
// "DB701.DBD142": {
// "Column": "Valore assoluto",
// "Index": 7,
// "MemConf": "DB701.DBD142",
// "DataType": "real"
// }
//}
}
@@ -0,0 +1,67 @@
{
"confPLC": {
"ipAdrr": "192.168.0.102",
"tipoCpu": "S71500",
"rack": 0,
"slot": 1
},
"TriggerMemConf": "DB999.DBB0",
"parametersList": {
"DB999.DBB8": {
"Column": "Valore 1",
"Index": 1,
"MemConf": "DB999.DBB8",
"DataType": "word",
"memByteSize": 2
},
"DB999.DBB10": {
"Column": "Valore 2",
"Index": 2,
"MemConf": "DB999.DBB10",
"DataType": "word",
"memByteSize": 2
},
"DB999.DBB16": {
"Column": "Valore 3",
"Index": 3,
"MemConf": "DB999.DBB16",
"DataType": "dword",
"memByteSize": 4
},
"DB999.DBB20": {
"Column": "Valore 4",
"Index": 4,
"MemConf": "DB999.DBB20",
"DataType": "dword",
"memByteSize": 4
},
"DB999.DBB32": {
"Column": "Valore 5",
"Index": 5,
"MemConf": "DB999.DBB32",
"DataType": "real",
"memByteSize": 4
},
"DB999.DBB36": {
"Column": "Valore 6",
"Index": 6,
"MemConf": "DB999.DBB36",
"DataType": "real",
"memByteSize": 4
},
"DB999.DBB40": {
"Column": "Valore 7",
"Index": 7,
"MemConf": "DB999.DBB40",
"DataType": "real",
"memByteSize": 4
},
"DB999.DBB48": {
"Column": "Valore 8",
"Index": 8,
"MemConf": "DB999.DBB48",
"DataType": "string",
"memByteSize": 20
}
}
}
+67
View File
@@ -0,0 +1,67 @@
{
"confPLC": {
"ipAdrr": "192.168.0.102",
"tipoCpu": "S71500",
"rack": 0,
"slot": 1
},
"TriggerMemConf": "DB999.DBB0",
"parametersList": {
"DB999.DBB8": {
"Column": "Valore 1",
"Index": 1,
"MemConf": "DB999.DBB8",
"DataType": "word",
"memByteSize": 2
},
"DB999.DBB10": {
"Column": "Valore 2",
"Index": 2,
"MemConf": "DB999.DBB10",
"DataType": "word",
"memByteSize": 2
},
"DB999.DBB16": {
"Column": "Valore 3",
"Index": 3,
"MemConf": "DB999.DBB16",
"DataType": "dword",
"memByteSize": 4
},
"DB999.DBB20": {
"Column": "Valore 4",
"Index": 4,
"MemConf": "DB999.DBB20",
"DataType": "dword",
"memByteSize": 4
},
"DB999.DBB32": {
"Column": "Valore 5",
"Index": 5,
"MemConf": "DB999.DBB32",
"DataType": "real",
"memByteSize": 4
},
"DB999.DBB36": {
"Column": "Valore 6",
"Index": 6,
"MemConf": "DB999.DBB36",
"DataType": "real",
"memByteSize": 4
},
"DB999.DBB40": {
"Column": "Valore 7",
"Index": 7,
"MemConf": "DB999.DBB40",
"DataType": "real",
"memByteSize": 4
},
"DB999.DBB48": {
"Column": "Valore 8",
"Index": 8,
"MemConf": "DB999.DBB48",
"DataType": "string",
"memByteSize": 20
}
}
}
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MHT_Siemens
{
public static class Constants
{
#region memorie configurate staticamente
public const string RESOURCE_DIRECTORY = @"IOB.WIN.FileExp.Config.";
public const string CONFIG_PATH = RESOURCE_DIRECTORY + @"setup.json";
#endregion
}
}
+10 -14
View File
@@ -11,24 +11,16 @@ namespace MHT_Siemens
/// </summary>
public class dataProxy
{
/// <summary>
/// Nome file da osservare
/// </summary>
public string csvFilePath { get; set; } = "";
/// <summary>
/// Indica se il CSV abbia intestazione
/// </summary>
public bool csvHasHeader { get; set; } = true;
/// <summary>
/// Indica se il CSV abbia intestazione
/// </summary>
public char csvSeparator { get; set; } = ';';
/// <summary>
/// Configurazione PLC
/// </summary>
public connParam confPLC { get; set; }
/// <summary>
/// Elenco parametri
/// Area memoria da usare come trigger x scrittura
/// </summary>
public string TriggerMemConf { get; set; } = "";
/// <summary>
/// Elenco parametri da salvare
/// </summary>
public Dictionary<string, dataConf> parametersList { get; set; } = new Dictionary<string, dataConf>();
}
@@ -47,12 +39,16 @@ namespace MHT_Siemens
/// </summary>
public int Index { get; set; } = -1;
/// <summary>
/// Area memoria in cui inserire i dati
/// Area memoria da cui leggere i dati
/// </summary>
public string MemConf { get; set; } = "";
/// <summary>
/// Tipo di dati
/// </summary>
public string DataType { get; set; } = "";
/// <summary>
/// Dimensione memoria in Byte
/// </summary>
public int memByteSize { get; set; } = 1;
}
}