Fix gestione conf variabili TSVC lette da file json

This commit is contained in:
Samuele E. Locatelli
2019-10-30 16:05:27 +01:00
parent 8995c06944
commit 7bdfd347d0
9 changed files with 226 additions and 154 deletions
Binary file not shown.
+33
View File
@@ -1129,6 +1129,39 @@ namespace IOB_UT
/// </summary>
public string value { get; set; }
}
/// <summary>
/// Struttura conf tipo dati
/// </summary>
public class dataConfTSVC: dataConf
{
/// <summary>
/// Tipo di funzione da applicare al dato
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public VC_func func { get; set; }
/// <summary>
/// Periodo campionamento
/// </summary>
public int period { get; set; }
}
/// <summary>
/// Struttura conf memorie SIEMENS
/// </summary>
public class siemensMemMap
{
/// <summary>
/// Parametri ammessi per IOB x scrittura
/// </summary>
public Dictionary<string, dataConf> mMapWrite = new Dictionary<string, dataConf>();
/// <summary>
/// Parametri ammessi per IOB x lettura
/// </summary>
public Dictionary<string, dataConfTSVC> mMapRead = new Dictionary<string, dataConfTSVC>();
}
/// <summary>
/// Elenco task ammessi
/// </summary>
-74
View File
@@ -1,74 +0,0 @@
{
"Parameters": [
{
"TKey": "kgParz",
"TValue": {
"name": "kgParz",
"type": "Int",
"index": 66,
"size": 2,
"value": "0"
}
},
//{
// "key": "set_th",
// "value": {
// "name": "set_th",
// "type": "Int",
// "index": 72,
// "size": 2,
// "value": "0"
// }
//},
//{
// "key": "set_c",
// "value": {
// "name": "set_c",
// "type": "Real",
// "index": 74,
// "size": 4,
// "value": "0"
// }
//},
//{
// "key": "aria_1",
// "value": {
// "name": "aria_1",
// "type": "Int",
// "index": 78,
// "size": 2,
// "value": "0"
// }
//},
//{
// "key": "aria_2",
// "value": {
// "name": "aria_2",
// "type": "Int",
// "index": 80,
// "size": 2,
// "value": "0"
// }
//},
//{
// "key": "setMmH20",
// "value": {
// "name": "setMmH20",
// "type": "Real",
// "index": 82,
// "size": 4,
// "value": "0"
// }
//},
{
"TKey": "rpmci",
"TValue": {
"name": "rpmci",
"type": "Int",
"index": 86,
"size": 2,
"value": "0"
}
}
]
}
-11
View File
@@ -57,17 +57,6 @@ PZCOUNT_MODE=STD.DB1275.DBDW4
DISABLE_PZCOUNT=TRUE
ENABLE_DYN_DATA=TRUE
FORCE_DYN_DATA=TRUE
TSVC_T_Attuale_Cil=MAX:5
TSVC_Bruc_0_100=MAX:5
TSVC_Dep_Cil_mmH2O=MAX:5
TSVC_Asp_0_100=MAX:5
TSVC_Ampere_Asp=MAX:5
TSVC_Temp_Filtro=MAX:5
TSVC_Ampere_Cil=MAX:5
TSVC_Flowrate=MAX:5
TSVC_Ampere_Dosat=MAX:5
TSVC_Tot_Parz_Dosatore=MAX:5
TSVC_Tot_Dosatore=MAX:5
; conf parametri x gestione invio dati "ricetta"
PARAM_CONF=INTERCL_01.json
+151 -48
View File
@@ -1,51 +1,154 @@
{
"kgParz": {
"name": "kgParz",
"tipoMem": "Int",
"index": 66,
"size": 2,
"value": "0"
"mMapWrite": {
"kgParz": {
"name": "kgParz",
"tipoMem": "Int",
"index": 66,
"size": 2,
"value": "0"
},
"set_th": {
"name": "set_th",
"tipoMem": "Int",
"index": 72,
"size": 2,
"value": "0"
},
"set_c": {
"name": "set_c",
"tipoMem": "Real",
"index": 74,
"size": 4,
"value": "0"
},
"aria_1": {
"name": "aria_1",
"tipoMem": "Int",
"index": 78,
"size": 2,
"value": "0"
},
"aria_2": {
"name": "aria_2",
"tipoMem": "Int",
"index": 80,
"size": 2,
"value": "0"
},
"setMmH20": {
"name": "setMmH20",
"tipoMem": "Real",
"index": 82,
"size": 4,
"value": "0"
},
"rpmci": {
"name": "rpmci",
"tipoMem": "Int",
"index": 86,
"size": 2,
"value": "0"
}
},
"set_th": {
"name": "set_th",
"tipoMem": "Int",
"index": 72,
"size": 2,
"value": "0"
},
"set_c": {
"name": "set_c",
"tipoMem": "Real",
"index": 74,
"size": 4,
"value": "0"
},
"aria_1": {
"name": "aria_1",
"tipoMem": "Int",
"index": 78,
"size": 2,
"value": "0"
},
"aria_2": {
"name": "aria_2",
"tipoMem": "Int",
"index": 80,
"size": 2,
"value": "0"
},
"setMmH20": {
"name": "setMmH20",
"tipoMem": "Real",
"index": 82,
"size": 4,
"value": "0"
},
"rpmci": {
"name": "rpmci",
"tipoMem": "Int",
"index": 86,
"size": 2,
"value": "0"
"mMapRead": {
"T_Attuale_Cil": {
"name": "T_Attuale_Cil",
"tipoMem": "Real",
"index": 16,
"size": 4,
"func": "MAX",
"period": 5,
"value": "0"
},
"Bruc_0_100": {
"name": "Bruc_0_100",
"tipoMem": "Int",
"index": 28,
"size": 2,
"func": "MAX",
"period": 5,
"value": "0"
},
"Dep_Cil_mmH2O": {
"name": "Dep_Cil_mmH2O",
"tipoMem": "Int",
"index": 30,
"size": 2,
"func": "MAX",
"period": 5,
"value": "0"
},
"Asp_0_100": {
"name": "Asp_0_100",
"tipoMem": "Int",
"index": 32,
"size": 2,
"func": "MAX",
"period": 5,
"value": "0"
},
"Ampere_Asp": {
"name": "Ampere_Asp",
"tipoMem": "Int",
"index": 34,
"size": 2,
"func": "MAX",
"period": 5,
"value": "0"
},
"Temp_Filtro": {
"name": "Temp_Filtro",
"tipoMem": "Int",
"index": 36,
"size": 2,
"func": "MAX",
"period": 5,
"value": "0"
},
"Ampere_Cil": {
"name": "Ampere_Cil",
"tipoMem": "Int",
"index": 38,
"size": 2,
"func": "MAX",
"period": 5,
"value": "0"
},
"Flowrate": {
"name": "Flowrate",
"tipoMem": "Int",
"index": 40,
"size": 2,
"func": "MAX",
"period": 5,
"value": "0"
},
"Ampere_Dosat": {
"name": "Ampere_Dosat",
"tipoMem": "Int",
"index": 42,
"size": 2,
"func": "MAX",
"period": 5,
"value": "0"
},
"Tot_Parz_Dosatore": {
"name": "Tot_Parz_Dosatore",
"tipoMem": "DInt",
"index": 48,
"size": 4,
"func": "MAX",
"period": 5,
"value": "0"
},
"Tot_Dosatore": {
"name": "Tot_Dosatore",
"tipoMem": "DInt",
"index": 52,
"size": 4,
"func": "MAX",
"period": 5,
"value": "0"
}
}
}
}
-3
View File
@@ -234,9 +234,6 @@
<None Include="DATA\CONF\3015.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\INTERCL_01.bck.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\INTERCL_01.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
+2 -2
View File
@@ -1986,11 +1986,11 @@ namespace IOB_WIN
// se ORA sono online riporto...
if (answ)
{
lgInfo("IOB ONLINE");
lgInfo("IOB ONLINE for server MP/IO");
}
else
{
lgInfo("IOB OFFLINE");
lgInfo("IOB OFFLINE for server MP/IO");
}
// salvo nuovo status...
IobOnline = answ;
+35 -13
View File
@@ -23,16 +23,6 @@ namespace IOB_WIN
#region area componenti base
#if false
/// <summary>
/// Configurazione valori da LEGGERE dal PLC
/// </summary>
public otherData[] memMapR;
/// <summary>
/// Configurazione valori da SCRIVERE nel PLC
/// </summary>
public otherData[] memMapW;
#endif
/// <summary>
/// Byte dimensione buffer dati memoria (da file map)
/// </summary>
@@ -53,10 +43,11 @@ namespace IOB_WIN
/// parametri di connessione
/// </summary>
protected connParamS7 parametri;
/// <summary>
/// Parametri ammessi epr IOB (opzionali da json)
/// Struttura memoria SIEMENS x lettura/scrittura da JSON file
/// </summary>
public Dictionary<string, dataConf> iobParameters = new Dictionary<string, dataConf>();
public siemensMemMap memMap = new siemensMemMap();
#endregion
@@ -640,7 +631,38 @@ namespace IOB_WIN
{
try
{
iobParameters = JsonConvert.DeserializeObject<Dictionary<string, dataConf>>(jsonData);
memMap = JsonConvert.DeserializeObject<siemensMemMap>(jsonData);
// se ho variabili read --> genero dati TSVC...
if (memMap.mMapRead.Count > 0)
{
TSVC_Data.Clear();
LastTSVC.Clear();
lgInfo($"Trovate {memMap.mMapRead.Count} chiavi TSVC");
VCData currConf;
int periodo = 0;
VC_func funz = VC_func.POINT;
// accodo nella conf...
foreach (var item in memMap.mMapRead)
{
funz = item.Value.func;
periodo = item.Value.period;
currConf = new VCData()
{
Funzione = funz,
Period = periodo,
DTStart = DateTime.Now.AddHours(-1),
dataArray = new List<double>()
};
TSVC_Data.Add(item.Key, currConf);
}
// documento...
foreach (var item in TSVC_Data)
{
lgInfo($"TSVC: {item.Key} | periodo: {item.Value.Period} | funz: {item.Value.Funzione}");
// salvo i valori PREC...
LastTSVC.Add(item.Key, 0);
}
}
}
catch (Exception exc)
{
+5 -3
View File
@@ -33,6 +33,7 @@ namespace IOB_WIN
{
lgInfo("NEW IOB SIEMENS versione VIPA");
lastPLCWatchDog = DateTime.Now.AddMinutes(-1);
#if false
// imposto i parametri speciali x calcolo...
var chiaviTSVC = findOptPar("TSVC");
if (chiaviTSVC.Count > 0)
@@ -64,7 +65,8 @@ namespace IOB_WIN
// salvo i valori PREC...
LastTSVC.Add(item.Key, 0);
}
}
}
#endif
}
#region Metodi specifici (da verificare/completare in implementazione)
@@ -208,7 +210,7 @@ namespace IOB_WIN
try
{
// campi REAL
double T_Attuale_Cil = S7.Net.Types.DInt.FromByteArray(RawInput.Skip(16).Take(4).ToArray());
double T_Attuale_Cil = S7.Net.Types.Double.FromByteArray(RawInput.Skip(16).Take(4).ToArray());
int Bruc_0_100 = S7.Net.Types.Int.FromByteArray(RawInput.Skip(28).Take(2).ToArray());
int Dep_Cil_mmH2O = S7.Net.Types.Int.FromByteArray(RawInput.Skip(30).Take(2).ToArray());
int Asp_0_100 = S7.Net.Types.Int.FromByteArray(RawInput.Skip(32).Take(2).ToArray());
@@ -216,7 +218,7 @@ namespace IOB_WIN
int Temp_Filtro = S7.Net.Types.Int.FromByteArray(RawInput.Skip(36).Take(2).ToArray());
int Ampere_Cil = S7.Net.Types.Int.FromByteArray(RawInput.Skip(38).Take(2).ToArray());
int Flowrate = S7.Net.Types.Int.FromByteArray(RawInput.Skip(40).Take(2).ToArray());
int Ampere_Dosat = S7.Net.Types.Int.FromByteArray(RawInput.Skip(38).Take(2).ToArray());
int Ampere_Dosat = S7.Net.Types.Int.FromByteArray(RawInput.Skip(42).Take(2).ToArray());
int Tot_Parz_Dosatore = S7.Net.Types.DInt.FromByteArray(RawInput.Skip(48).Take(4).ToArray());
int Tot_Dosatore = S7.Net.Types.DInt.FromByteArray(RawInput.Skip(52).Take(4).ToArray());