Merge branch 'release/AddAlarmCheckTorri'
This commit is contained in:
@@ -122,6 +122,22 @@ namespace IOB_UT_NEXT
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// formatta un numero in forma binaria 0/1
|
||||
/// </summary>
|
||||
/// <param name="valore"></param>
|
||||
/// <returns></returns>
|
||||
public static string binaryForm(uint valore)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = string.Format(new BinaryFormatter(), "{0:B}", valore);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua chiamata URL e restituisce risultato, SE NON E' in veto send (x mmitigare chiamate...)
|
||||
@@ -151,7 +167,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 +213,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 +258,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="30" />
|
||||
<!--<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" />
|
||||
|
||||
@@ -59,6 +59,8 @@ ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
; gestione scrittura string/char[]: true = string / false = char[]
|
||||
WRITE_PRE=TRUE
|
||||
; gestione emergenza forzata (ignora valore letto, mette sempre ARMED)
|
||||
EMERGENCY_BYPASS=true
|
||||
|
||||
; conf parametri memoria READ/WRITE
|
||||
PARAM_CONF=1033.json
|
||||
|
||||
@@ -68,7 +68,9 @@ CLI_INST=SteamWareSim
|
||||
;STARTLIST=PIZ08
|
||||
;STARTLIST=PIZ04
|
||||
;STARTLIST=PIZ05
|
||||
STARTLIST=FOV062
|
||||
;STARTLIST=OPC_UA
|
||||
;STARTLIST=SIM_PIZ03
|
||||
;STARTLIST=FOV062
|
||||
STARTLIST=3013
|
||||
|
||||
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": 25000,
|
||||
"factor": 5
|
||||
},
|
||||
"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;
|
||||
@@ -4071,12 +4071,12 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
try
|
||||
{
|
||||
string sVal = "";
|
||||
if (lastAlarm != currAlarms["CNC_ALARM"])
|
||||
{
|
||||
// salvo!
|
||||
lastAlarm = currAlarms["CNC_ALARM"];
|
||||
// per ogni valore del dizionario mostro ed accodo!
|
||||
string sVal = "";
|
||||
foreach (var item in currAlarms)
|
||||
{
|
||||
sVal = string.Format("[CNC_ALARM]{0}|{1}", item.Key, item.Value);
|
||||
@@ -4084,6 +4084,12 @@ namespace IOB_WIN_NEXT
|
||||
accodaFLog(sVal, qEncodeFLog(item.Key, item.Value));
|
||||
}
|
||||
}
|
||||
// accodo ALTRI allarmi NON CNC...
|
||||
foreach (var item in currAlarms.Where(X => X.Key != "CNC_ALARM"))
|
||||
{
|
||||
sVal = $"{item.Key} | {item.Value}";
|
||||
accodaFLog(sVal, qEncodeFLog(item.Key, item.Value));
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace IOB_WIN_NEXT
|
||||
* B0.4 Bit Manuale
|
||||
* B0.5 Bit MagOutPieno
|
||||
* B0.6 Bit MagInVuoto
|
||||
* B0.7 Bit EmergenzaArmata (0=triggered,premuta)
|
||||
* Contapezzi DInt 2
|
||||
* PezziRiman DInt 6
|
||||
*
|
||||
@@ -45,6 +46,12 @@ namespace IOB_WIN_NEXT
|
||||
*
|
||||
* -------------------------------------------------------------------------------- */
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected bool EmergencyBypass = false;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
@@ -55,6 +62,12 @@ namespace IOB_WIN_NEXT
|
||||
public IobSiemensRobotService(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
|
||||
{
|
||||
lgInfo("NEW IOB SIEMENS versione RobotService");
|
||||
|
||||
if (IOBConf.optPar.ContainsKey("EMERGENCY_BYPASS"))
|
||||
{
|
||||
bool.TryParse(IOBConf.optPar["EMERGENCY_BYPASS"], out EmergencyBypass);
|
||||
lgInfo($"Override EmergencyBypass da conf: {IOBConf.optPar["EMERGENCY_BYPASS"]} --> {EmergencyBypass}");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -95,6 +108,12 @@ namespace IOB_WIN_NEXT
|
||||
byteSignals &= ~(1 << 0);
|
||||
}
|
||||
|
||||
// se bypass emergenza attivo --> forzo a ARMED...
|
||||
if (EmergencyBypass)
|
||||
{
|
||||
byteSignals |= (1 << 7);
|
||||
}
|
||||
|
||||
// salvo!
|
||||
B_input = byteSignals;
|
||||
|
||||
|
||||
@@ -75,6 +75,12 @@ namespace IOB_WIN_NEXT
|
||||
// salvo infine variabile bit x invio
|
||||
B_input = byteSem;
|
||||
|
||||
// se ho il bit di allarme
|
||||
if ((RawInput[0] & (1 << 3)) != 0)
|
||||
{
|
||||
checkAlarms();
|
||||
}
|
||||
|
||||
// procedo SOLO SE è enabled IOB
|
||||
if (IobOnline)
|
||||
{
|
||||
@@ -202,6 +208,48 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAlarms()
|
||||
{
|
||||
// leggo i banchi allarmi : cablato D700.DBDW2 --> D700 DBDW14, sono 4 banchi a 32 bit da verificare
|
||||
|
||||
int trovati = 0;
|
||||
// ciclo nei 4 banchi...
|
||||
trovati += checkAlarmBank("DB700.DBDW2");
|
||||
trovati += checkAlarmBank("DB700.DBDW6");
|
||||
trovati += checkAlarmBank("DB700.DBDW10");
|
||||
trovati += checkAlarmBank("DB700.DBDW14");
|
||||
}
|
||||
|
||||
private int checkAlarmBank(string memAddrAlarms)
|
||||
{
|
||||
int trovato = 0;
|
||||
uint valDW = 0;
|
||||
var MemBlockPZ = new byte[4];
|
||||
bool fatto = S7ReadBB(ref MemBlockPZ, memAddrAlarms, 4);
|
||||
//if (fatto)
|
||||
//{
|
||||
valDW = S7.Net.Types.DWord.FromByteArray(MemBlockPZ.ToArray());
|
||||
// se <> 0 --> log e accodo a dynData
|
||||
if (valDW != 0)
|
||||
{
|
||||
string key = $"MTH_ALARM_{memAddrAlarms}_{valDW}";
|
||||
var biteVal = baseUtils.binaryForm(valDW);
|
||||
lgInfo($"Stato allarmi rilevati: {key} | {valDW} | {biteVal}");
|
||||
// accodo a dictionary
|
||||
string almMsg = $"{DateTime.Now} | val {valDW} | {biteVal}";
|
||||
// se non ci fosse aggiungo
|
||||
if (!lastReadAlarms.ContainsKey(key))
|
||||
{
|
||||
lastReadAlarms.Add(key, almMsg);
|
||||
}
|
||||
trovato++;
|
||||
}
|
||||
//}
|
||||
return trovato;
|
||||
}
|
||||
|
||||
protected Dictionary<string, string> lastReadAlarms = new Dictionary<string, string>();
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
@@ -277,7 +325,9 @@ namespace IOB_WIN_NEXT
|
||||
/// <returns></returns>
|
||||
public override Dictionary<string, string> getCncAlarms()
|
||||
{
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
// parto da ultimo vettore allarmi rilevato
|
||||
Dictionary<string, string> outVal = lastReadAlarms;
|
||||
// se ho altro --> accodo
|
||||
try
|
||||
{
|
||||
string almMsg = string.Format("{0} | {1}", currPLC.LastErrorCode.ToString(), currPLC.LastErrorString);
|
||||
@@ -287,6 +337,8 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
lgError(exc, "Errore in getCncAlarms");
|
||||
}
|
||||
// resetto vettore allarmi
|
||||
lastReadAlarms = new Dictionary<string, string>();
|
||||
return outVal;
|
||||
}
|
||||
|
||||
|
||||
+129
-77
@@ -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,43 @@ 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());
|
||||
// se il TIPO di valore è livello --> simulo variazione da MAX --> min, con un delta in CALO pari a factor * (80-120)%
|
||||
if (item.Value.name == "SIM_LEVEL")
|
||||
{
|
||||
// verifico last value
|
||||
float lastVal = 0;
|
||||
float.TryParse(item.Value.value, out lastVal);
|
||||
if (lastVal == 0)
|
||||
{
|
||||
lastVal = item.Value.maxVal - item.Value.factor;
|
||||
}
|
||||
// decremento casuale...
|
||||
float newVal = lastVal - ((float)item.Value.factor * rnd.Next(80, 120) / 100);
|
||||
// se inferiore a minimo --> massimo!
|
||||
if (newVal < item.Value.minVal)
|
||||
{
|
||||
newVal = item.Value.maxVal;
|
||||
}
|
||||
// salvo il suo VALUE...
|
||||
item.Value.value = $"{newVal}";
|
||||
outVal.Add(item.Key, $"{newVal}");
|
||||
}
|
||||
// altrimenti siulazione random walk...
|
||||
else
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -678,8 +725,8 @@ namespace IOB_WIN_NEXT
|
||||
/// <returns></returns>
|
||||
public override string getPrgName()
|
||||
{
|
||||
// valore non presente in vers default... se gestito fare override
|
||||
string prgName = string.Format("DEMO_{0:00}", DateTime.Now.Minute);
|
||||
// NOME DEL SIM!
|
||||
string prgName = $"PROG_{cIobConf.codIOB}";
|
||||
return prgName;
|
||||
}
|
||||
|
||||
@@ -724,10 +771,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