Refresh post test finale cedax: aggiunto e configurato PLC di base

This commit is contained in:
Samuele Locatelli
2022-04-21 16:59:09 +02:00
parent b0396f6f1f
commit c8f1808eb1
14 changed files with 204 additions and 116 deletions
Binary file not shown.
+3 -3
View File
@@ -59,8 +59,8 @@
<Reference Include="ICSharpCode.SharpZipLib, Version=1.3.1.9, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.3.1\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="MapoSDK, Version=6.14.2202.2819, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MapoSDK.6.14.2202.2819\lib\net40\MapoSDK.dll</HintPath>
<Reference Include="MapoSDK, Version=6.14.2204.2115, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MapoSDK.6.14.2204.2115\lib\net40\MapoSDK.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
@@ -69,7 +69,7 @@
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.11\lib\net45\NLog.dll</HintPath>
<HintPath>..\packages\NLog.4.7.13\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="Pipelines.Sockets.Unofficial, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42ea0a778e13fbe2, processorArchitecture=MSIL">
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.2.0\lib\net461\Pipelines.Sockets.Unofficial.dll</HintPath>
+2 -2
View File
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MapoSDK" version="6.14.2202.2819" targetFramework="net462" />
<package id="MapoSDK" version="6.14.2204.2115" targetFramework="net462" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="6.0.0" targetFramework="net462" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net462" />
<package id="NLog" version="4.7.11" targetFramework="net462" />
<package id="NLog" version="4.7.13" targetFramework="net462" />
<package id="Pipelines.Sockets.Unofficial" version="2.2.0" targetFramework="net462" />
<package id="SharpZipLib" version="1.3.1" targetFramework="net462" />
<package id="StackExchange.Redis" version="2.2.4" targetFramework="net462" />
@@ -22,6 +22,7 @@ CMDALIVE=/IOB
CMDENABLED=/IOB/enabled/
CMDADV1=?valore=
CMDREBO=/IOB/sendReboot?idxMacchina=
;CMDREBO=/sendReboot.aspx?idxMacchina=
[MEMORY]
ADDR_READ=41001
@@ -59,16 +60,16 @@ FORCE_DYN_DATA=TRUE
DELTA_VAL=0.1
; clock base (da 10ms)
timerIntMs=20
timerIntMs=10
; conf parametri memoria READ/WRITE
PARAM_CONF=GIA_CEDAX.json
PARAM_CONF=GIACO_CEDAX_01.json
NO_PING=TRUE
; conf blocchi memoria x READ
MEM_BLOCK=GIA_CEDAX_MBlock.json
MEM_BLOCK=GIACO_CEDAX_01_MBlock.json
; conf aree allarme
ALARM_CONF=GIA_CEDAX_alarm.json
ALARM_CONF=GIACO_CEDAX_01_alarm.json
[BRANCH]
NAME=master
+146
View File
@@ -0,0 +1,146 @@
{
"mMapWrite": {
},
"mMapRead": {
"Stag_H2O": {
"name": "Stag_H2O",
"description": "Totale H2O Stagione",
"memAddr": "41001",
"tipoMem": "HLPInt",
"index": 1001,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"Stag_Prod1": {
"name": "Stag_Prod1",
"description": "Totale Prodotto 1 Stagione",
"memAddr": "40003",
"tipoMem": "HLPInt",
"index": 1003,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"Stag_Prod2": {
"name": "Stag_Prod2",
"description": "Totale Prodotto 2 Stagione",
"memAddr": "40005",
"tipoMem": "HLPInt",
"index": 1005,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"Stag_Prod3": {
"name": "Stag_Prod3",
"description": "Totale Prodotto 3 Stagione",
"memAddr": "40007",
"tipoMem": "HLPInt",
"index": 1007,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 0.01,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"Stag_Prod4": {
"name": "Stag_Prod4",
"description": "Totale Prodotto 4 Stagione",
"memAddr": "40009",
"tipoMem": "HLPInt",
"index": 1009,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 0.01,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"Giorno_H2O": {
"name": "Giorno_H2O",
"description": "Totale H2O Giorno",
"memAddr": "41011",
"tipoMem": "HLPInt",
"index": 1011,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"Giorno_Prod1": {
"name": "Giorno_Prod1",
"description": "Totale Prodotto 1 Giorno",
"memAddr": "40013",
"tipoMem": "HLPInt",
"index": 1013,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"Giorno_Prod2": {
"name": "Giorno_Prod2",
"description": "Totale Prodotto 2 Giorno",
"memAddr": "40015",
"tipoMem": "HLPInt",
"index": 1015,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"Giorno_Prod3": {
"name": "Giorno_Prod3",
"description": "Totale Prodotto 3 Giorno",
"memAddr": "40017",
"tipoMem": "HLPInt",
"index": 1017,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 0.01,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"Giorno_Prod4": {
"name": "Giorno_Prod4",
"description": "Totale Prodotto 4 Giorno",
"memAddr": "40021",
"tipoMem": "HLPInt",
"index": 1021,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 0.01,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
}
}
}
@@ -1,5 +1,5 @@
{
"ReadBlocks": {
"41001": 20
"40999": 30
}
}
@@ -6,14 +6,14 @@
"index": 999,
"size": 2,
"messages": [
"Alarm 01",
"Alarm 02",
"Alarm 03",
"Alarm 04",
"Alarm 05",
"Alarm 06",
"Alarm 07",
"Alarm 08",
"##On Pompa 1",
"Allarme Pompa 1",
"##On Pompa 2",
"Allarme Pompa 2",
"##On Pompa 3",
"Allarme Pompa 3",
"##On Pompa 4",
"Allarme Pompa 4",
"##",
"##",
"##",
-76
View File
@@ -1,76 +0,0 @@
{
"mMapWrite": {
},
"mMapRead": {
"Stag_H2O": {
"name": "Stag_H2O",
"description": "Totale H2O Stagione",
"memAddr": "41001",
"tipoMem": "Int",
"index": 1,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"Stag_Prod1": {
"name": "Stag_Prod1",
"description": "Totale Prodotto 1 Stagione",
"memAddr": "40003",
"tipoMem": "Int",
"index": 3,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"Stag_Prod2": {
"name": "Stag_Prod2",
"description": "Totale Prodotto 2 Stagione",
"memAddr": "40005",
"tipoMem": "Int",
"index": 5,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"Stag_Prod3": {
"name": "Stag_Prod3",
"description": "Totale Prodotto 3 Stagione",
"memAddr": "40007",
"tipoMem": "Int",
"index": 7,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 100,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"Stag_Prod4": {
"name": "Stag_Prod4",
"description": "Totale Prodotto 4 Stagione",
"memAddr": "40007",
"tipoMem": "Int",
"index": 9,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 100,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
}
}
}
+1 -1
View File
@@ -75,6 +75,6 @@ CLI_INST=SteamWareSim
;STARTLIST=PIZ09
;STARTLIST=VL25
;STARTLIST=SIMUL_03
STARTLIST=GIA_CEDAX
STARTLIST=GIACO_CEDAX_01
MAXCNC=10
+6 -6
View File
@@ -90,8 +90,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>ExtLib\krcc.dll</HintPath>
</Reference>
<Reference Include="MapoSDK, Version=6.14.2202.2819, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MapoSDK.6.14.2202.2819\lib\net40\MapoSDK.dll</HintPath>
<Reference Include="MapoSDK, Version=6.14.2204.2115, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MapoSDK.6.14.2204.2115\lib\net40\MapoSDK.dll</HintPath>
</Reference>
<Reference Include="MathNet.Numerics, Version=4.15.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MathNet.Numerics.4.15.0\lib\net461\MathNet.Numerics.dll</HintPath>
@@ -406,7 +406,7 @@
<None Include="DATA\CONF\IMI_50.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\GIA_CEDAX_MBlock.json">
<None Include="DATA\CONF\GIACO_CEDAX_01_MBlock.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\PIZ04_MBlock.json">
@@ -454,10 +454,10 @@
<None Include="DATA\CONF\PING.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\GIA_CEDAX.ini">
<None Include="DATA\CONF\GIACO_CEDAX_01.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\GIA_CEDAX.json">
<None Include="DATA\CONF\GIACO_CEDAX_01.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\PIZ09.ini">
@@ -466,7 +466,7 @@
<None Include="DATA\CONF\PIZ09.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\GIA_CEDAX_alarm.json">
<None Include="DATA\CONF\GIACO_CEDAX_01_alarm.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\PIZ09_alarm.json">
+26 -9
View File
@@ -81,13 +81,14 @@ namespace IOB_WIN_NEXT
public IobModbusTCP(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
{
lgInfo("NEW IOB ModBus TCP");
DateTime adesso = DateTime.Now;
memMap = new plcMemMap();
if (IOBConf != null)
{
// gestione invio ritardato contapezzi
pzCountDelay = utils.CRI("pzCountDelay");
lastPzCountSend = DateTime.Now;
lastWarnODL = DateTime.Now;
lastPzCountSend = adesso;
lastWarnODL = adesso;
// inizializzo parametri...
parametri = new connParamModBusTCP()
{
@@ -223,6 +224,19 @@ namespace IOB_WIN_NEXT
}
break;
// caso speciale x Cedax, che usa HighVal moltiplicato x 32768...
case plcDataType.HLPInt:
if (size == 4)
{
valore = ModbusClient.ConvertRegistersToLong(listInt);
}
else if (size == 2)
{
int fact = Int16.MaxValue + 1;
valore = listInt[1] * fact + listInt[0];
}
break;
case plcDataType.Int:
default:
if (size == 4)
@@ -243,7 +257,7 @@ namespace IOB_WIN_NEXT
double valDouble;
// prima faccio eventuale fattore di scala...
double.TryParse(currMem.value, out valDouble);
if (currMem.factor > 1)
if (currMem.factor != 1)
{
valDouble = valDouble * (double)currMem.factor;
}
@@ -256,9 +270,9 @@ namespace IOB_WIN_NEXT
int valInt;
// prima faccio eventuale fattore di scala...
int.TryParse(currMem.value, out valInt);
if (currMem.factor > 1)
if (currMem.factor != 1)
{
valInt = valInt * currMem.factor;
valInt = (int)(valInt * currMem.factor);
}
return valInt;
@@ -269,7 +283,7 @@ namespace IOB_WIN_NEXT
uint valUInt;
// prima faccio eventuale fattore di scala...
uint.TryParse(currMem.value, out valUInt);
if (currMem.factor > 1)
if (currMem.factor != 1)
{
valUInt = valUInt * (uint)currMem.factor;
}
@@ -638,6 +652,7 @@ namespace IOB_WIN_NEXT
/// </summary>
protected override void setParamPlc()
{
DateTime adesso = DateTime.Now;
// Creo oggetto connessione NC
parentForm.commPlcActive = true;
lgInfo($"Start init Adapter ModBus TCP all'IP {cIobConf.cncIpAddr} | port: {cIobConf.cncPort} | --> IOB {cIobConf.codIOB}");
@@ -680,7 +695,7 @@ namespace IOB_WIN_NEXT
string deltaValStr = getOptPar("DELTA_VAL");
if (!string.IsNullOrEmpty(deltaValStr))
{
double.TryParse(deltaValStr.Replace(".",","), out deltaVal);
double.TryParse(deltaValStr.Replace(".", ","), out deltaVal);
}
bool enableByApp = utils.CRB("enableContapezzi");
bool enableByIob = (getOptPar("ENABLE_PZCOUNT") == "TRUE");
@@ -721,7 +736,7 @@ namespace IOB_WIN_NEXT
}
// ora tento avvio PLC... SE PING OK...
lastPING = DateTime.Now;
lastPING = adesso;
IPStatus esitoPing = testPingMachine;
if (esitoPing == IPStatus.Success)
{
@@ -990,7 +1005,7 @@ namespace IOB_WIN_NEXT
{
foreach (var item in memSetR)
{
readBlockHoldingReg(item.Key, item.Value, HoldRegBaseAddr);
readBlockHoldingReg(item.Key, item.Value, parametri.holdRegBaseAddr);
Thread.Sleep(100);
}
}
@@ -1287,6 +1302,8 @@ namespace IOB_WIN_NEXT
}
}
connectionOk = false;
// resetto last ping...
lastPING = DateTime.Now.AddMinutes(-1);
}
/// <summary>
+3 -3
View File
@@ -142,9 +142,9 @@ namespace IOB_WIN_NEXT
int valInt;
// prima faccio eventuale fattore di scala...
int.TryParse(currMem.value, out valInt);
if (currMem.factor > 1)
if (currMem.factor != 1)
{
valInt = valInt * currMem.factor;
valInt = (int)(valInt * currMem.factor);
}
return valInt;
@@ -155,7 +155,7 @@ namespace IOB_WIN_NEXT
uint valUInt;
// prima faccio eventuale fattore di scala...
uint.TryParse(currMem.value, out valUInt);
if (currMem.factor > 1)
if (currMem.factor != 1)
{
valUInt = valUInt * (uint)currMem.factor;
}
+2 -2
View File
@@ -802,7 +802,7 @@ namespace IOB_WIN_NEXT
float.TryParse(item.Value.value, out lastVal);
if (lastVal == 0)
{
lastVal = item.Value.maxVal - item.Value.factor;
lastVal = item.Value.maxVal - (float)item.Value.factor;
}
// decremento casuale...
float newVal = lastVal - ((float)item.Value.factor * rnd.Next(40, 120) / 100);
@@ -827,7 +827,7 @@ namespace IOB_WIN_NEXT
else
{
// uso factor come fattore di divisione x simulare decimali
float randVal = ((float)rnd.Next(item.Value.minVal, item.Value.maxVal)) / item.Value.factor;
float randVal = ((float)rnd.Next(item.Value.minVal, item.Value.maxVal)) / (float)item.Value.factor;
outVal.Add(item.Key, randVal.ToString());
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
<packages>
<package id="Autoupdater.NET.Official" version="1.7.0" targetFramework="net462" />
<package id="EasyModbusTCP" version="5.6.0" targetFramework="net462" />
<package id="MapoSDK" version="6.14.2202.2819" targetFramework="net462" />
<package id="MapoSDK" version="6.14.2204.2115" targetFramework="net462" />
<package id="MathNet.Numerics" version="4.15.0" targetFramework="net462" />
<package id="Microsoft.CodeAnalysis.NetAnalyzers" version="6.0.0" targetFramework="net462" developmentDependency="true" />
<package id="Microsoft.VisualStudio.SlowCheetah" version="4.0.8" targetFramework="net462" developmentDependency="true" />