FIX SIM x avere dati tipo GWMS
This commit is contained in:
@@ -151,7 +151,7 @@ namespace IOB_UT_NEXT
|
||||
// controllo se ho un VETO all'invio...
|
||||
if (dtVetoSend < DateTime.Now)
|
||||
{
|
||||
callUrlNow(URL, payload);
|
||||
answ = callUrlNow(URL, payload);
|
||||
}
|
||||
// restituisco valore!
|
||||
return answ;
|
||||
@@ -197,6 +197,13 @@ namespace IOB_UT_NEXT
|
||||
client.Headers.Add("user-agent", $"{CRS("appName")}");
|
||||
try
|
||||
{
|
||||
// problema certificati locali...
|
||||
// https://living-sun.com/it/c/226351-webexception-could-not-establish-trust-relationship-for-the-ssl-tls-secure-channel-c-aspnet-web-services-ssl-webexception.html
|
||||
// hack x certificati locali in 10.74.82.*
|
||||
if (URL.Contains("10.74.82."))
|
||||
{
|
||||
System.Net.ServicePointManager.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => { return true; };
|
||||
}
|
||||
answ = client.DownloadString(URL);
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -235,7 +242,23 @@ namespace IOB_UT_NEXT
|
||||
clientPayload.Headers.Add("Content-Type", "application/json");
|
||||
try
|
||||
{
|
||||
// problema certificati locali...
|
||||
// https://living-sun.com/it/c/226351-webexception-could-not-establish-trust-relationship-for-the-ssl-tls-secure-channel-c-aspnet-web-services-ssl-webexception.html
|
||||
// hack x certificati locali in 10.74.82.*
|
||||
if (URL.Contains("10.74.82."))
|
||||
{
|
||||
System.Net.ServicePointManager.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => { return true; };
|
||||
}
|
||||
answ = clientPayload.UploadString(URL, payload);
|
||||
if (answ != "OK")
|
||||
{
|
||||
logReduxFactor--;
|
||||
if (logReduxFactor <= 0)
|
||||
{
|
||||
lg.Error($"Invio dati fallito:{Environment.NewLine}- URL{Environment.NewLine}{URL}{Environment.NewLine}- payload{Environment.NewLine}{payload}");
|
||||
logReduxFactor = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
<!--gestione coda-->
|
||||
<add key="maxQueueFLog" value="16384" />
|
||||
<!--parametri SIM-->
|
||||
<add key="waitSimPar" value="45" />
|
||||
<add key="waitSimPar" value="5" />
|
||||
<!--<add key="waitSimPar" value="45" />-->
|
||||
<!--gestione REDIS-->
|
||||
<add key="RedisConn" value="localhost,abortConnect=false,ssl=false" />
|
||||
<add key="RedisConnAdmin" value="localhost,abortConnect=false,ssl=false" />
|
||||
|
||||
@@ -68,7 +68,8 @@ CLI_INST=SteamWareSim
|
||||
;STARTLIST=PIZ08
|
||||
;STARTLIST=PIZ04
|
||||
;STARTLIST=PIZ05
|
||||
STARTLIST=FOV062
|
||||
;STARTLIST=FOV062
|
||||
STARTLIST=SIM_PIZ03
|
||||
;STARTLIST=OPC_UA
|
||||
|
||||
MAXCNC=10
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
//"mMapWrite": {
|
||||
// "setArt": {
|
||||
// "name": "setArt",
|
||||
// "description": "Articolo",
|
||||
// "memAddr": "DB150.DBB12",
|
||||
// "tipoMem": "String",
|
||||
// "index": 12,
|
||||
// "size": 20
|
||||
// },
|
||||
// "setComm": {
|
||||
// "name": "setComm",
|
||||
// "description": "Commessa",
|
||||
// "memAddr": "DB150.DBB32",
|
||||
// "tipoMem": "String",
|
||||
// "index": 32,
|
||||
// "size": 20
|
||||
// },
|
||||
// "setPzComm": {
|
||||
// "name": "setPzComm",
|
||||
// "description": "Qty",
|
||||
// "memAddr": "DB150.DBB8",
|
||||
// "tipoMem": "Int",
|
||||
// "index": 8,
|
||||
// "size": 4
|
||||
// },
|
||||
// "forceSetPzCount": {
|
||||
// "name": "forceSetPzCount",
|
||||
// "description": "Qty",
|
||||
// "memAddr": "DB150.DBB8",
|
||||
// "tipoMem": "Int",
|
||||
// "index": 8,
|
||||
// "size": 4
|
||||
// }
|
||||
//},
|
||||
"mMapRead": {
|
||||
"Level": {
|
||||
"name": "SIM_LEVEL",
|
||||
"description": "Livello Serbatoio",
|
||||
"tipoMem": "Real",
|
||||
"minVal": 5000,
|
||||
"maxVal": 250000,
|
||||
"factor": 1
|
||||
},
|
||||
"PressBH": {
|
||||
"name": "SIM_PressBH",
|
||||
"description": "Pressione ALTA Bolbole",
|
||||
"tipoMem": "Real",
|
||||
"minVal": 2000,
|
||||
"maxVal": 2300,
|
||||
"factor": 10
|
||||
},
|
||||
"PressBL": {
|
||||
"name": "SIM_PressBL",
|
||||
"description": "Pressione Media Bolbole",
|
||||
"tipoMem": "Real",
|
||||
"minVal": 2100,
|
||||
"maxVal": 2500,
|
||||
"factor": 10
|
||||
},
|
||||
"MainPress": {
|
||||
"name": "SIM_MainPress",
|
||||
"description": "Pressione principale",
|
||||
"tipoMem": "Real",
|
||||
"minVal": 30,
|
||||
"maxVal": 150,
|
||||
"factor": 10
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=SIMULA
|
||||
PING_MS_TIMEOUT=500
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=STEAMWARE
|
||||
MODEL=DEMO_SIMULATOR_GWMS
|
||||
|
||||
[CNC]
|
||||
IP=127.0.0.1
|
||||
PORT=0000
|
||||
|
||||
[SERVER]
|
||||
MPIP=https://10.74.82.240
|
||||
MPURL=/api
|
||||
CMDBASE=/IOB/input/
|
||||
CMDFLOG=/IOB/flog/
|
||||
CMDALIVE=/IOB
|
||||
CMDENABLED=/IOB/enabled/
|
||||
CMDADV1=?valore=
|
||||
CMDREBO=/IOB/sendReboot?idxMacchina=
|
||||
|
||||
CMD_ODL_STARTED=/IOB/getCurrOdlStart/
|
||||
CMD_FORCLE_SPLIT_ODL=/IOB/forceSplitOdlFull/
|
||||
CMD_IDLE_TIME=/IOB/getIdlePeriod/
|
||||
|
||||
[MEMORY]
|
||||
|
||||
[BLINK]
|
||||
MAX_COUNTER_BLINK = 15
|
||||
BLINK_FILT=0
|
||||
|
||||
[OPTPAR]
|
||||
AUTO_CHANGE_ODL=false
|
||||
DISABLE_SIM_STATUS=true
|
||||
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
|
||||
PZCOUNT_MODE=BIT
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
; per il simulatore: 50|1 = WAIT 50, DURATION 1 con riferimento al PERIODO base (PER_BASE, default 1 secondo)
|
||||
PER_BASE=9800
|
||||
SIM_PZCNT=13|1
|
||||
SIM_ALARM=200|10
|
||||
SIM_MANU=130|3
|
||||
; indica gestione e simulazione bit 5 --> slow
|
||||
SIM_SLOW=2500|20
|
||||
; indica gestione e simulazione bit 6 --> warmup/cooldown
|
||||
SIM_WUCD=8000|20
|
||||
; indica gestione e simulazione bit 7 --> emergenza
|
||||
SIM_EMRG=4000|10
|
||||
; indica simulazione delle funzionalita power ON/ OFF
|
||||
SIM_POW_ON_OFF=false
|
||||
T_ON=6
|
||||
T_OFF=22
|
||||
; gestione DynData simulati
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
NEW_DYN_DATA=TRUE
|
||||
;gestione invio pezzi in blocco
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=0
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
MIN_DURATA_ODL=240
|
||||
; indica parametri gestione TcMan
|
||||
TC_MAX_TC_FACTOR=3.9
|
||||
TC_LAMBDA=0.4
|
||||
TC_MAX_INCR=5
|
||||
MAX_PZ_INCR_PERC=1000
|
||||
|
||||
; conf parametri memoria READ/WRITE
|
||||
PARAM_CONF=SIM_PIZ00.json
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
@@ -0,0 +1,74 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=SIMULA
|
||||
PING_MS_TIMEOUT=500
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=STEAMWARE
|
||||
MODEL=DEMO_SIMULATOR_GWMS
|
||||
|
||||
[CNC]
|
||||
IP=127.0.0.1
|
||||
PORT=0000
|
||||
|
||||
[SERVER]
|
||||
MPIP=https://10.74.82.240
|
||||
MPURL=/api
|
||||
CMDBASE=/IOB/input/
|
||||
CMDFLOG=/IOB/flog/
|
||||
CMDALIVE=/IOB
|
||||
CMDENABLED=/IOB/enabled/
|
||||
CMDADV1=?valore=
|
||||
CMDREBO=/IOB/sendReboot?idxMacchina=
|
||||
|
||||
CMD_ODL_STARTED=/IOB/getCurrOdlStart/
|
||||
CMD_FORCLE_SPLIT_ODL=/IOB/forceSplitOdlFull/
|
||||
CMD_IDLE_TIME=/IOB/getIdlePeriod/
|
||||
|
||||
[MEMORY]
|
||||
|
||||
[BLINK]
|
||||
MAX_COUNTER_BLINK = 15
|
||||
BLINK_FILT=0
|
||||
|
||||
[OPTPAR]
|
||||
AUTO_CHANGE_ODL=false
|
||||
DISABLE_SIM_STATUS=true
|
||||
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
|
||||
PZCOUNT_MODE=BIT
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
; per il simulatore: 50|1 = WAIT 50, DURATION 1 con riferimento al PERIODO base (PER_BASE, default 1 secondo)
|
||||
PER_BASE=9800
|
||||
SIM_PZCNT=13|1
|
||||
SIM_ALARM=200|10
|
||||
SIM_MANU=130|3
|
||||
; indica gestione e simulazione bit 5 --> slow
|
||||
SIM_SLOW=2500|20
|
||||
; indica gestione e simulazione bit 6 --> warmup/cooldown
|
||||
SIM_WUCD=8000|20
|
||||
; indica gestione e simulazione bit 7 --> emergenza
|
||||
SIM_EMRG=4000|10
|
||||
; indica simulazione delle funzionalita power ON/ OFF
|
||||
SIM_POW_ON_OFF=false
|
||||
T_ON=6
|
||||
T_OFF=22
|
||||
; gestione DynData simulati
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
NEW_DYN_DATA=TRUE
|
||||
;gestione invio pezzi in blocco
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=0
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
MIN_DURATA_ODL=240
|
||||
; indica parametri gestione TcMan
|
||||
TC_MAX_TC_FACTOR=3.9
|
||||
TC_LAMBDA=0.4
|
||||
TC_MAX_INCR=5
|
||||
MAX_PZ_INCR_PERC=1000
|
||||
|
||||
; conf parametri memoria READ/WRITE
|
||||
PARAM_CONF=SIM_PIZ00.json
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
@@ -0,0 +1,74 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=SIMULA
|
||||
PING_MS_TIMEOUT=500
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=STEAMWARE
|
||||
MODEL=DEMO_SIMULATOR_GWMS
|
||||
|
||||
[CNC]
|
||||
IP=127.0.0.1
|
||||
PORT=0000
|
||||
|
||||
[SERVER]
|
||||
MPIP=https://10.74.82.240
|
||||
MPURL=/api
|
||||
CMDBASE=/IOB/input/
|
||||
CMDFLOG=/IOB/flog/
|
||||
CMDALIVE=/IOB
|
||||
CMDENABLED=/IOB/enabled/
|
||||
CMDADV1=?valore=
|
||||
CMDREBO=/IOB/sendReboot?idxMacchina=
|
||||
|
||||
CMD_ODL_STARTED=/IOB/getCurrOdlStart/
|
||||
CMD_FORCLE_SPLIT_ODL=/IOB/forceSplitOdlFull/
|
||||
CMD_IDLE_TIME=/IOB/getIdlePeriod/
|
||||
|
||||
[MEMORY]
|
||||
|
||||
[BLINK]
|
||||
MAX_COUNTER_BLINK = 15
|
||||
BLINK_FILT=0
|
||||
|
||||
[OPTPAR]
|
||||
AUTO_CHANGE_ODL=false
|
||||
DISABLE_SIM_STATUS=true
|
||||
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
|
||||
PZCOUNT_MODE=BIT
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
; per il simulatore: 50|1 = WAIT 50, DURATION 1 con riferimento al PERIODO base (PER_BASE, default 1 secondo)
|
||||
PER_BASE=9800
|
||||
SIM_PZCNT=13|1
|
||||
SIM_ALARM=200|10
|
||||
SIM_MANU=130|3
|
||||
; indica gestione e simulazione bit 5 --> slow
|
||||
SIM_SLOW=2500|20
|
||||
; indica gestione e simulazione bit 6 --> warmup/cooldown
|
||||
SIM_WUCD=8000|20
|
||||
; indica gestione e simulazione bit 7 --> emergenza
|
||||
SIM_EMRG=4000|10
|
||||
; indica simulazione delle funzionalita power ON/ OFF
|
||||
SIM_POW_ON_OFF=false
|
||||
T_ON=6
|
||||
T_OFF=22
|
||||
; gestione DynData simulati
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
NEW_DYN_DATA=TRUE
|
||||
;gestione invio pezzi in blocco
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=0
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
MIN_DURATA_ODL=240
|
||||
; indica parametri gestione TcMan
|
||||
TC_MAX_TC_FACTOR=3.9
|
||||
TC_LAMBDA=0.4
|
||||
TC_MAX_INCR=5
|
||||
MAX_PZ_INCR_PERC=1000
|
||||
|
||||
; conf parametri memoria READ/WRITE
|
||||
PARAM_CONF=SIM_PIZ00.json
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
@@ -0,0 +1,74 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=SIMULA
|
||||
PING_MS_TIMEOUT=500
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=STEAMWARE
|
||||
MODEL=DEMO_SIMULATOR_GWMS
|
||||
|
||||
[CNC]
|
||||
IP=127.0.0.1
|
||||
PORT=0000
|
||||
|
||||
[SERVER]
|
||||
MPIP=https://10.74.82.240
|
||||
MPURL=/api
|
||||
CMDBASE=/IOB/input/
|
||||
CMDFLOG=/IOB/flog/
|
||||
CMDALIVE=/IOB
|
||||
CMDENABLED=/IOB/enabled/
|
||||
CMDADV1=?valore=
|
||||
CMDREBO=/IOB/sendReboot?idxMacchina=
|
||||
|
||||
CMD_ODL_STARTED=/IOB/getCurrOdlStart/
|
||||
CMD_FORCLE_SPLIT_ODL=/IOB/forceSplitOdlFull/
|
||||
CMD_IDLE_TIME=/IOB/getIdlePeriod/
|
||||
|
||||
[MEMORY]
|
||||
|
||||
[BLINK]
|
||||
MAX_COUNTER_BLINK = 15
|
||||
BLINK_FILT=0
|
||||
|
||||
[OPTPAR]
|
||||
AUTO_CHANGE_ODL=false
|
||||
DISABLE_SIM_STATUS=true
|
||||
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
|
||||
PZCOUNT_MODE=BIT
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
; per il simulatore: 50|1 = WAIT 50, DURATION 1 con riferimento al PERIODO base (PER_BASE, default 1 secondo)
|
||||
PER_BASE=9800
|
||||
SIM_PZCNT=13|1
|
||||
SIM_ALARM=200|10
|
||||
SIM_MANU=130|3
|
||||
; indica gestione e simulazione bit 5 --> slow
|
||||
SIM_SLOW=2500|20
|
||||
; indica gestione e simulazione bit 6 --> warmup/cooldown
|
||||
SIM_WUCD=8000|20
|
||||
; indica gestione e simulazione bit 7 --> emergenza
|
||||
SIM_EMRG=4000|10
|
||||
; indica simulazione delle funzionalita power ON/ OFF
|
||||
SIM_POW_ON_OFF=false
|
||||
T_ON=6
|
||||
T_OFF=22
|
||||
; gestione DynData simulati
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
NEW_DYN_DATA=TRUE
|
||||
;gestione invio pezzi in blocco
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=0
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
MIN_DURATA_ODL=240
|
||||
; indica parametri gestione TcMan
|
||||
TC_MAX_TC_FACTOR=3.9
|
||||
TC_LAMBDA=0.4
|
||||
TC_MAX_INCR=5
|
||||
MAX_PZ_INCR_PERC=1000
|
||||
|
||||
; conf parametri memoria READ/WRITE
|
||||
PARAM_CONF=SIM_PIZ00.json
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
@@ -396,6 +396,21 @@
|
||||
<None Include="DATA\CONF\PIZ08_alarm.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\SIM_PIZ08.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\SIM_PIZ05.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\SIM_PIZ04.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\SIM_PIZ03.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\SIM_PIZ00.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\TEST.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@@ -870,7 +870,7 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
if (DemoOut)
|
||||
{
|
||||
answ = false;
|
||||
answ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -881,7 +881,7 @@ namespace IOB_WIN_NEXT
|
||||
string callResp = "";
|
||||
try
|
||||
{
|
||||
// chiamo URL, se restituisce "OK" è alive!
|
||||
// chiamo URL, se restituisce "OK" è alive! provo con chiamata http
|
||||
callResp = callUrl(urlAlive, false);
|
||||
answ = (callResp == "OK");
|
||||
}
|
||||
@@ -3304,7 +3304,7 @@ namespace IOB_WIN_NEXT
|
||||
else
|
||||
{
|
||||
lgError($"Attenzione! memMap è nullo, non posso eseguire task2exe!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return taskDone;
|
||||
|
||||
+102
-75
@@ -44,6 +44,8 @@ namespace IOB_WIN_NEXT
|
||||
/// </summary>
|
||||
protected int cP = 1;
|
||||
|
||||
protected bool disableSimStatus = false;
|
||||
|
||||
/// <summary>
|
||||
/// ultimo controllo decremento eventi
|
||||
/// </summary>
|
||||
@@ -138,6 +140,11 @@ namespace IOB_WIN_NEXT
|
||||
bit6 = setupSimPar("SIM_WUCD");
|
||||
bit7 = setupSimPar("SIM_EMRG");
|
||||
int.TryParse(getOptPar("MIN_DURATA_ODL"), out minDurataODL);
|
||||
var strDisableSim = getOptPar("DISABLE_SIM_STATUS");
|
||||
if (!string.IsNullOrEmpty(strDisableSim))
|
||||
{
|
||||
bool.TryParse(strDisableSim, out disableSimStatus);
|
||||
}
|
||||
}
|
||||
setParamPlc();
|
||||
// ricarico da server i dati dei pezzi fatti...
|
||||
@@ -149,6 +156,9 @@ namespace IOB_WIN_NEXT
|
||||
// imposto pezzi CNC ai pezzi contati da server...
|
||||
contapezziPLC = contapezziIOB;
|
||||
lgInfo($"Impostazione iniziale contatori: contapezzi macchina contapezziPLC: {contapezziPLC} | contapezziIOB: {contapezziIOB}");
|
||||
|
||||
// parto processando dynData
|
||||
processDynData();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -540,88 +550,91 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
// Verificare il protocollo: dovrebeb togliere SOLO i task eseguiti...
|
||||
Dictionary<string, string> taskDone = new Dictionary<string, string>();
|
||||
string taskVal = "";
|
||||
// verifico non sia null
|
||||
if (task2exe != null)
|
||||
// controlo SE sia disabilitata simulazione principale
|
||||
if (!disableSimStatus)
|
||||
{
|
||||
// cerco task specifici
|
||||
foreach (var item in task2exe)
|
||||
string taskVal = "";
|
||||
// verifico non sia null
|
||||
if (task2exe != null)
|
||||
{
|
||||
taskVal = "";
|
||||
// converto richiesta in enum...
|
||||
taskType tName = taskType.nihil;
|
||||
Enum.TryParse(item.Key, out tName);
|
||||
// controllo sulla KEY
|
||||
switch (tName)
|
||||
// cerco task specifici
|
||||
foreach (var item in task2exe)
|
||||
{
|
||||
case taskType.setArt:
|
||||
case taskType.setComm:
|
||||
case taskType.setProg:
|
||||
case taskType.setPzComm:
|
||||
memMap.mMapWrite[item.Key].value = item.Value;
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | UPDATED memMap.mMapWrite";
|
||||
break;
|
||||
taskVal = "";
|
||||
// converto richiesta in enum...
|
||||
taskType tName = taskType.nihil;
|
||||
Enum.TryParse(item.Key, out tName);
|
||||
// controllo sulla KEY
|
||||
switch (tName)
|
||||
{
|
||||
case taskType.setArt:
|
||||
case taskType.setComm:
|
||||
case taskType.setProg:
|
||||
case taskType.setPzComm:
|
||||
memMap.mMapWrite[item.Key].value = item.Value;
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | UPDATED memMap.mMapWrite";
|
||||
break;
|
||||
|
||||
case taskType.setParameter:
|
||||
// richiedo da URL i parametri WRITE da popolare
|
||||
lgInfo("Chiamata processMemWriteRequests");
|
||||
taskVal = processMemWriteRequests();
|
||||
// se restituiscce "" faccio altra prova...
|
||||
if (string.IsNullOrEmpty(taskVal))
|
||||
{
|
||||
// i parametri me li aspetto come stringa composta paramName|paramvalue
|
||||
if (item.Value.Contains("|"))
|
||||
case taskType.setParameter:
|
||||
// richiedo da URL i parametri WRITE da popolare
|
||||
lgInfo("Chiamata processMemWriteRequests");
|
||||
taskVal = processMemWriteRequests();
|
||||
// se restituiscce "" faccio altra prova...
|
||||
if (string.IsNullOrEmpty(taskVal))
|
||||
{
|
||||
string[] paramsJob = item.Value.Split('|');
|
||||
taskVal = $"REQUEST SET PARAMETERS: {paramsJob[0]} --> {paramsJob[1]}";
|
||||
// i parametri me li aspetto come stringa composta paramName|paramvalue
|
||||
if (item.Value.Contains("|"))
|
||||
{
|
||||
string[] paramsJob = item.Value.Split('|');
|
||||
taskVal = $"REQUEST SET PARAMETERS: {paramsJob[0]} --> {paramsJob[1]}";
|
||||
}
|
||||
else
|
||||
{
|
||||
taskVal = $"WRONG REQUEST FOR SET PARAMETERS: {item.Value} doesnt contain pipe for splitting key/value";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
taskVal = $"WRONG REQUEST FOR SET PARAMETERS: {item.Value} doesnt contain pipe for splitting key/value";
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case taskType.nihil:
|
||||
case taskType.fixStopSetup:
|
||||
case taskType.forceResetPzCount:
|
||||
case taskType.sendWatchDogMes2Plc:
|
||||
case taskType.startSetup:
|
||||
case taskType.stopSetup:
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
|
||||
break;
|
||||
case taskType.nihil:
|
||||
case taskType.fixStopSetup:
|
||||
case taskType.forceResetPzCount:
|
||||
case taskType.sendWatchDogMes2Plc:
|
||||
case taskType.startSetup:
|
||||
case taskType.stopSetup:
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
|
||||
break;
|
||||
|
||||
case taskType.forceSetPzCount:
|
||||
// forzo sul SIM il valore pzCount dell'IOB...
|
||||
int newPzCount = contapezziPLC;
|
||||
bool fatto = int.TryParse(item.Value, out newPzCount);
|
||||
if (fatto)
|
||||
{
|
||||
// verifico SE sia ammesso il cambio ...
|
||||
int deltaPzCount = newPzCount - contapezziPLC;
|
||||
double maxDelta = DateTime.Now.Subtract(plcLastPzRead).TotalMinutes / (plcAvgTc / 60);
|
||||
// se incremento superiore del doppio atteso --> segnalo errore e NON accetto
|
||||
if (deltaPzCount > (maxDelta * maxPzDeltaPerc) / 100)
|
||||
case taskType.forceSetPzCount:
|
||||
// forzo sul SIM il valore pzCount dell'IOB...
|
||||
int newPzCount = contapezziPLC;
|
||||
bool fatto = int.TryParse(item.Value, out newPzCount);
|
||||
if (fatto)
|
||||
{
|
||||
lgError($"[DELTA CHECK]: intremento contapezziPLC troppo elevato: lettura {newPzCount} | contapezzi attuale: {contapezziPLC} | ultima lettura PLC: {plcLastPzRead} | TCiclo medio: {plcAvgTc}s | incremento accettato ");
|
||||
// verifico SE sia ammesso il cambio ...
|
||||
int deltaPzCount = newPzCount - contapezziPLC;
|
||||
double maxDelta = DateTime.Now.Subtract(plcLastPzRead).TotalMinutes / (plcAvgTc / 60);
|
||||
// se incremento superiore del doppio atteso --> segnalo errore e NON accetto
|
||||
if (deltaPzCount > (maxDelta * maxPzDeltaPerc) / 100)
|
||||
{
|
||||
lgError($"[DELTA CHECK]: intremento contapezziPLC troppo elevato: lettura {newPzCount} | contapezzi attuale: {contapezziPLC} | ultima lettura PLC: {plcLastPzRead} | TCiclo medio: {plcAvgTc}s | incremento accettato ");
|
||||
}
|
||||
else
|
||||
{
|
||||
contapezziPLC = newPzCount;
|
||||
taskVal = $"Set new contapezziPLC: {contapezziPLC}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
contapezziPLC = newPzCount;
|
||||
taskVal = $"Set new contapezziPLC: {contapezziPLC}";
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
taskVal = "SKIPPED | NO EXEC";
|
||||
break;
|
||||
default:
|
||||
taskVal = "SKIPPED | NO EXEC";
|
||||
break;
|
||||
}
|
||||
// aggiungo task!
|
||||
taskDone.Add(item.Key, taskVal);
|
||||
}
|
||||
// aggiungo task!
|
||||
taskDone.Add(item.Key, taskVal);
|
||||
}
|
||||
}
|
||||
|
||||
return taskDone;
|
||||
}
|
||||
|
||||
@@ -659,9 +672,18 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
foreach (var item in memMap.mMapRead)
|
||||
{
|
||||
// uso factor come valore MAX ammesso
|
||||
int randVal = rnd.Next(item.Value.minVal, item.Value.maxVal);
|
||||
outVal.Add(item.Key, randVal.ToString());
|
||||
if (item.Value.factor == 1)
|
||||
{
|
||||
// uso factor come valore MAX ammesso
|
||||
int randVal = rnd.Next(item.Value.minVal, item.Value.maxVal);
|
||||
outVal.Add(item.Key, randVal.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
// uso factor come fattore di divisione x simulare decimali
|
||||
float randVal = ((float)rnd.Next(item.Value.minVal, item.Value.maxVal)) / item.Value.factor;
|
||||
outVal.Add(item.Key, randVal.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -724,10 +746,15 @@ namespace IOB_WIN_NEXT
|
||||
public override void readSemafori(ref newDisplayData currDispData)
|
||||
{
|
||||
base.readSemafori(ref currDispData);
|
||||
// decodifica e gestione
|
||||
decodeToBaseBitmap();
|
||||
decodeOtherData();
|
||||
reportRawInput(ref currDispData);
|
||||
|
||||
// controlo SE sia disabilitata simulazione principale
|
||||
if (!disableSimStatus)
|
||||
{
|
||||
// decodifica e gestione
|
||||
decodeToBaseBitmap();
|
||||
decodeOtherData();
|
||||
reportRawInput(ref currDispData);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user