From cd28df8a1dcf88c7b04500eaaa33f8136aafb298 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 11 Nov 2022 19:13:44 +0100 Subject: [PATCH] Zetapack: - aggiunto metodo test INT - conf aggiornata --- IOB-UT-NEXT/BitConditionCheck.cs | 2 +- IOB-UT-NEXT/IOB-UT-NEXT.csproj | 1 + IOB-UT-NEXT/IntConditionCheck.cs | 89 +++++++++++++++ IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_1.ini | 2 +- IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_1.json | 111 +++++-------------- IOB-WIN-NEXT/DATA/CONF/MAIN.ini | 3 +- IOB-WIN-NEXT/IOB-WIN-NEXT.csproj | 12 ++ IOB-WIN-NEXT/IobGeneric.cs | 61 ++++++++--- IOB-WIN-NEXT/IobModbusTCP.cs | 127 ++++++++++++++++------ IOB-WIN-NEXT/IobModbusTCPImaxAeromec.cs | 8 +- IOB-WIN-NEXT/IobModbusTCPZetapack.cs | 100 +++++++---------- IOB-WIN-NEXT/RemoteDebugInfo.txt | 6 +- IOB-WIN-NEXT/postBuildTgt.bat | 4 +- 13 files changed, 323 insertions(+), 203 deletions(-) create mode 100644 IOB-UT-NEXT/IntConditionCheck.cs diff --git a/IOB-UT-NEXT/BitConditionCheck.cs b/IOB-UT-NEXT/BitConditionCheck.cs index 94899773..07224b3f 100644 --- a/IOB-UT-NEXT/BitConditionCheck.cs +++ b/IOB-UT-NEXT/BitConditionCheck.cs @@ -8,7 +8,7 @@ /// Inizializza un oggetto da usare per testing bit condition /// /// Nome della chiave registrata - /// Configuraizone nel formato BaseAddr.BitNum=ValOk + /// Configurazione nel formato BaseAddr.BitNum=ValOk public BitConditionCheck(string keyName, string rawConf) { Logging.Instance.Info($"Init BitConditionCheck | {keyName} | {rawConf}"); diff --git a/IOB-UT-NEXT/IOB-UT-NEXT.csproj b/IOB-UT-NEXT/IOB-UT-NEXT.csproj index e74a2d2f..d4d5f883 100644 --- a/IOB-UT-NEXT/IOB-UT-NEXT.csproj +++ b/IOB-UT-NEXT/IOB-UT-NEXT.csproj @@ -141,6 +141,7 @@ + diff --git a/IOB-UT-NEXT/IntConditionCheck.cs b/IOB-UT-NEXT/IntConditionCheck.cs new file mode 100644 index 00000000..8f1c0e86 --- /dev/null +++ b/IOB-UT-NEXT/IntConditionCheck.cs @@ -0,0 +1,89 @@ +namespace IOB_UT_NEXT +{ + public class IntConditionCheck + { + #region Public Constructors + + /// + /// Inizializza un oggetto da usare per testing INT condition + /// + /// Nome della chiave registrata + /// Configurazione nel formato BaseAddr|IntIndex=ValOk + public IntConditionCheck(string keyName, string rawConf) + { + Logging.Instance.Info($"Init IntConditionCheck | {keyName} | {rawConf}"); + KeyName = keyName; + RawVal = rawConf; + string sVal = ""; + int valDecoded = 0; + // check preliminare + if (rawConf.Contains(".") && rawConf.Contains("=")) + { + // splitto per "="... + var splitCond = rawConf.Split('='); + sVal = splitCond[1]; + int.TryParse(sVal, out valDecoded); + ValOk = valDecoded; + // il restante splitto per "." + var splitMem = splitCond[0].Split('|'); + // BaseAddr + sVal = splitMem[0]; + int.TryParse(sVal, out valDecoded); + BaseAddr = valDecoded; + // BitNum + sVal = splitMem[1]; + int.TryParse(sVal, out valDecoded); + IntIndex = valDecoded; + } + } + + /// + /// Inizializza un oggetto fake/empty + /// + public IntConditionCheck() + { + Logging.Instance.Info("Init empty IntConditionCheck"); + } + + /// + /// Inizializza un oggetto solo per key + /// + /// Nome della chiave registrata + public IntConditionCheck(string keyName) + { + Logging.Instance.Info($"Init IntConditionCheck | {keyName}"); + KeyName = keyName; + } + + #endregion Public Constructors + + #region Public Properties + + /// + /// Indirizzo base x memoria da testare come iny condition + /// + public int BaseAddr { get; set; } = 0; + + /// + /// Indirizzo base x memoria da testare come int condition (0/1) dell'int[], 2=DWord + /// + public int IntIndex { get; set; } = 0; + + /// + /// Valore chiave + /// + public string KeyName { get; set; } = ""; + + /// + /// Valore raw decodificato + /// + public string RawVal { get; set; } = ""; + + /// + /// Valore target che porta a condizione OK = true + /// + public int ValOk { get; set; } = 0; + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_1.ini b/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_1.ini index 09d2eaaf..ad8739db 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_1.ini +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_1.ini @@ -11,7 +11,7 @@ MODEL=Linea imballo [CNC] IP=192.168.16.11 -PORT=502 +PORT=8000 [SERVER] MPIP=http://192.168.1.7 diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_1.json b/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_1.json index 2ecd5729..c2b97033 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_1.json +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_1.json @@ -3,108 +3,53 @@ }, "mMapRead": { - //"StatusWord": { - // "name": "StatusWord", - // "description": "Word di Status", - // "memAddr": "40002", - // "tipoMem": "Int", - // "index": 2, - // "size": 1, - // "func": "POINT", - // "period": 90, - // "factor": 1, - // "minVal": 0, - // "maxVal": 65536, - // "unit": "BMap" - //}, - //"StatusDetWord": { - // "name": "StatusDetWord", - // "description": "Word di Status", - // "memAddr": "40005", - // "tipoMem": "Int", - // "index": 5, - // "size": 1, - // "func": "POINT", - // "period": 90, - // "factor": 1, - // "minVal": 0, - // "maxVal": 65536, - // "unit": "BMap" - //}, - "FreqInverter": { - "name": "FreqInverter", - "description": "Frequenza Inverter", - "memAddr": "40011", - "tipoMem": "Real", - "index": 11, - "size": 2, - "func": "MEDIAN", - "period": 90, - "factor": 1, - "minVal": 0, - "maxVal": 999999999, - "unit": "Hz" - }, - "CDOreManuten": { - "name": "CDOreManuten", - "description": "Residuo ore a prossimo service", - "memAddr": "40013", + "AmpMot1": { + "name": "AmpMot1", + "description": "Assorbimento motore 1 - calibratrice", + "memAddr": "40001", "tipoMem": "Int", - "index": 13, + "index": 1, "size": 1, "func": "MEDIAN", "period": 90, - "factor": 1, + "factor": 100, "minVal": 0, - "maxVal": 999999999, - "unit": "h" + "maxVal": 999, + "unit": "%" }, - "COreTAsp1": { - "name": "COreTAsp1", - "description": "Totale ore funzionamento impianto", - "memAddr": "40014", + "AmpMot2": { + "name": "AmpMot2", + "description": "Assorbimento Motore 2 - nastro dosi", + "memAddr": "40002", "tipoMem": "Int", - "index": 14, + "index": 2, "size": 1, "func": "MEDIAN", "period": 90, - "factor": 1, + "factor": 100, "minVal": 0, - "maxVal": 999999999, - "unit": "h" + "maxVal": 999, + "unit": "%" }, - "COrePAsp1": { - "name": "COrePAsp1", - "description": "Parziale ore funzionamento impianto da ultimo service", - "memAddr": "40015", + "AmpMot3": { + "name": "AmpMot3", + "description": "Assorbimento motore 3 - curva ingresso", + "memAddr": "40003", "tipoMem": "Int", - "index": 15, + "index": 3, "size": 1, "func": "MEDIAN", "period": 90, - "factor": 1, + "factor": 100, "minVal": 0, - "maxVal": 999999999, - "unit": "h" - }, - "AmpereReale": { - "name": "AmpereReale", - "description": "Assorbimento aspiratore 1", - "memAddr": "40016", - "tipoMem": "Real", - "index": 16, - "size": 2, - "func": "MEDIAN", - "period": 90, - "factor": 1, - "minVal": 0, - "maxVal": 999999999, - "unit": "A" + "maxVal": 999, + "unit": "%" } }, "optMemPar": { - "AutoBitCond": "40002.14=1", - "EStopBitCond": "40002.9=0", - "WorkBitCond": "40002.0=1" + "AlarmIntCond": "40000|0=0", + "ManualIntCond": "40000|0=1", + "EStopBitCond": "40001.0=1", + "WorkIntCond": "40000|0=2" } } \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/MAIN.ini b/IOB-WIN-NEXT/DATA/CONF/MAIN.ini index b06d4194..a98260e6 100644 --- a/IOB-WIN-NEXT/DATA/CONF/MAIN.ini +++ b/IOB-WIN-NEXT/DATA/CONF/MAIN.ini @@ -43,6 +43,7 @@ CLI_INST=SteamWareSim ;STARTLIST=FINASSI_HELPI_01 ;STARTLIST=FINASSI_OMP_01 ;STARTLIST=BAGLIETTO_CIMOLAI_01 -STARTLIST=SIMUL_01 +;STARTLIST=SIMUL_01 +STARTLIST=GIACO_ZPACK_1 MAXCNC=10 \ No newline at end of file diff --git a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj index b9b14eab..9e5a77c2 100644 --- a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj +++ b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj @@ -360,6 +360,18 @@ + + Always + + + Always + + + Always + + + Always + diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index 23d6cb38..e4111d81 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -4301,10 +4301,13 @@ namespace IOB_WIN_NEXT protected int numSim { get; set; } /// - /// Dizionario condizioni di check (opzionali) da usare x valori controllo bitmap (es ModBUs - /// TCP Imax) + /// Dizionario condizioni di check BIT da usare x valori controllo (es ModBus TCP Imax) /// - protected Dictionary OptCheckConditions { get; set; } = new Dictionary(); + protected Dictionary OptCheckCondBit { get; set; } = new Dictionary(); + /// + /// Dizionario condizioni di check INT da usare x valori controllo bitmap (es ModBus TCP Zetapack) + /// + protected Dictionary OptCheckCondInt { get; set; } = new Dictionary(); /// /// Indica se sia stato resettato un contapezzi @@ -5600,20 +5603,32 @@ namespace IOB_WIN_NEXT lgInfo($"setupMemMap | salvata conf memoria R/W"); } } - + /// + /// Setup aprametri memoria opzionali + /// es: BitCond e IntCond x ricerca valori target + /// protected virtual void setupOptMemPar() { - // verifica se siano necessari configuraizoni speciali dalla optMemPar (es per ricerca - // condizioni status bolleane come ModbusTCP...) + // verifica se siano necessari configuraizoni speciali dalla optMemPar: + // es: per ricerca condizioni status bolleane come ModbusTCP... if (memMap.optMemPar != null && memMap.optMemPar.Count > 0) { - // cerco condizioni speciali x Auto, Estop, Work.. devono essere *BitCond + // cerco condizioni BIT speciali x Auto, Estop, Work.. devono essere *BitCond var listPar2add = memMap.optMemPar.Where(x => x.Key.EndsWith("BitCond")).ToList(); if (listPar2add != null && listPar2add.Count > 0) { foreach (var item in listPar2add) { - addCheckCondition(item.Key, item.Value); + addCheckConditionBit(item.Key, item.Value); + } + } + // cerco condizioni INT speciali x Auto, Estop, Work.. devono essere *IntCond + var listParInt2add = memMap.optMemPar.Where(x => x.Key.EndsWith("IntCond")).ToList(); + if (listParInt2add != null && listParInt2add.Count > 0) + { + foreach (var item in listParInt2add) + { + addCheckConditionInt(item.Key, item.Value); } } } @@ -5859,21 +5874,39 @@ namespace IOB_WIN_NEXT #region Private Methods /// - /// Aggiunge in setup memoria la checkCondition ricevuta già "decodificata" + /// Aggiunge in setup memoria la checkCondition BIT "decodificata" /// /// Chiave da aggiungere /// Valore da decodificare e poi aggiungere - private void addCheckCondition(string ompKey, string ompVal) + private void addCheckConditionBit(string ompKey, string ompVal) { - var newCond = new BitConditionCheck(ompVal); + var newCond = new BitConditionCheck(ompKey, ompVal); // cerco x aggiornare o aggiungere... - if (OptCheckConditions.ContainsKey(ompKey)) + if (OptCheckCondBit.ContainsKey(ompKey)) { - OptCheckConditions[ompKey] = newCond; + OptCheckCondBit[ompKey] = newCond; } else { - OptCheckConditions.Add(ompKey, newCond); + OptCheckCondBit.Add(ompKey, newCond); + } + } + /// + /// Aggiunge in setup memoria la checkCondition INT "decodificata" + /// + /// Chiave da aggiungere + /// Valore da decodificare e poi aggiungere + private void addCheckConditionInt(string ompKey, string ompVal) + { + var newCond = new IntConditionCheck(ompKey, ompVal); + // cerco x aggiornare o aggiungere... + if (OptCheckCondInt.ContainsKey(ompKey)) + { + OptCheckCondInt[ompKey] = newCond; + } + else + { + OptCheckCondInt.Add(ompKey, newCond); } } diff --git a/IOB-WIN-NEXT/IobModbusTCP.cs b/IOB-WIN-NEXT/IobModbusTCP.cs index 1bedd686..246786d5 100644 --- a/IOB-WIN-NEXT/IobModbusTCP.cs +++ b/IOB-WIN-NEXT/IobModbusTCP.cs @@ -401,7 +401,7 @@ namespace IOB_WIN_NEXT { lgInfo("ModBus TCP: tryConnect step 02"); - // reimporto parametri PLC se necessario... + // reimposto parametri PLC se necessario... setParamPlc(); } lgInfo("ModBus TCP: tryConnect step 03"); @@ -912,48 +912,50 @@ namespace IOB_WIN_NEXT lgError(exc, "Errore in contapezzi ModBusTCP"); } } - - // ora tento avvio PLC... SE PING OK... - lastPING = adesso; - IPStatus esitoPing = testPingMachine; - if (esitoPing == IPStatus.Success) + // verifico se sia connessa... + if (!connectionOk) { - needRefresh = false; - try + // ora tento avvio PLC... SE PING OK... + lastPING = adesso; + IPStatus esitoPing = testPingMachine; + if (esitoPing == IPStatus.Success) { - //Ip-Address and Port of Modbus-TCP-Server - currPLC = new ModbusClient(parametri.ipAdrr, parametri.port); - currPLC.ConnectionTimeout = 3000; - - currPLC.ConnectedChanged += CurrPLC_ConnectedChanged; - - // disconnetto e connetto... - if (isVerboseLog) - { - lgInfoStartup("ModBus TCP: tryDisconnect"); - } - tryDisconnect(); - - // lo ripeto x evitare che ci sia un loop... e tryConnect richiami la - // procedura corrente... needRefresh = false; - lgInfoStartup("ModBus TCP: tryConnect"); - tryConnect(); - lgInfoStartup("End init Adapter ModBusTCP"); - if (isVerboseLog) + try { - lgInfo("ModBus TCP CONNESSIONE AVVENUTA"); + //Ip-Address and Port of Modbus-TCP-Server + currPLC = new ModbusClient(parametri.ipAdrr, parametri.port); + currPLC.ConnectionTimeout = 5000; + + currPLC.ConnectedChanged += CurrPLC_ConnectedChanged; + + // disconnetto e connetto... + if (isVerboseLog) + { + lgInfoStartup("ModBus TCP: tryDisconnect"); + } + tryDisconnect(); + + // tolgo needRefresh x evitare un loop... (tryConnect richiama setParamPlc) + needRefresh = false; + lgInfoStartup("ModBus TCP: tryConnect"); + tryConnect(); + lgInfoStartup("End init Adapter ModBusTCP"); + if (isVerboseLog) + { + lgInfo("ModBus TCP CONNESSIONE AVVENUTA"); + } + } + catch (Exception exc) + { + lgError(exc, "Errore in INIT ModBusTCP"); } } - catch (Exception exc) + else { - lgError(exc, "Errore in INIT ModBusTCP"); + lgError($"ModBusTCP IOB | Errore in ping: esito {esitoPing}"); } } - else - { - lgError($"ModBusTCP IOB | Errore in ping: esito {esitoPing}"); - } parentForm.commPlcActive = false; } else @@ -963,6 +965,63 @@ namespace IOB_WIN_NEXT } } + /// + /// Testa la condition modbus da LUT + configurazione, valori tipo BIT + /// + /// + /// + protected bool testBitCondition(string cKey) + { + bool answ = false; + if (OptCheckCondBit.ContainsKey(cKey)) + { + int currStatus = 0; + int[] listInt = new int[2]; + listInt = HoldingRegisterLUT[OptCheckCondBit[cKey].BaseAddr]; + currStatus = ModbusClient.ConvertRegistersToInt(listInt); + // controllo valore del bit richiesto + answ = ((currStatus & (1 << OptCheckCondBit[cKey].BitNum)) == OptCheckCondBit[cKey].ValOk); + lgTrace($"testBitCondition for {cKey} | BaseAddr: {OptCheckCondBit[cKey].BaseAddr} | BitNum: {OptCheckCondBit[cKey].BitNum} | ValOk: {OptCheckCondBit[cKey].ValOk}"); + } + else + { + lgTrace($"testBitCondition error: {cKey} not found"); + } + return answ; + } + /// + /// Testa la condition modbus da LUT + configurazione, valori tipo INT + /// + /// + /// + protected bool testIntCondition(string cKey) + { + bool answ = false; + if (OptCheckCondInt.ContainsKey(cKey)) + { + int currStatus = 0; + int[] listInt = new int[2]; + listInt = HoldingRegisterLUT[OptCheckCondInt[cKey].BaseAddr]; + // leggo da conf OptCheckCondInt[cKey].IntIndex + if (OptCheckCondInt[cKey].IntIndex < 2) + { + currStatus = listInt[OptCheckCondInt[cKey].IntIndex]; + } + else + { + currStatus = ModbusClient.ConvertRegistersToInt(listInt); + } + // controllo se il valore sia quello configurato... + answ = (currStatus == OptCheckCondInt[cKey].ValOk); + lgTrace($"testIntCondition for {cKey} | BaseAddr: {OptCheckCondInt[cKey].BaseAddr} | ValOk: {OptCheckCondInt[cKey].ValOk}"); + } + else + { + lgTrace($"testIntCondition error: {cKey} not found"); + } + return answ; + } + /// /// effettua il setup dei memblock da gestire (NON leggo intera memoria ma tanti blocchi...) /// diff --git a/IOB-WIN-NEXT/IobModbusTCPImaxAeromec.cs b/IOB-WIN-NEXT/IobModbusTCPImaxAeromec.cs index 5dce5300..59efae29 100644 --- a/IOB-WIN-NEXT/IobModbusTCPImaxAeromec.cs +++ b/IOB-WIN-NEXT/IobModbusTCPImaxAeromec.cs @@ -203,15 +203,15 @@ namespace IOB_WIN_NEXT private bool testCondition(string cKey) { bool answ = false; - if (OptCheckConditions.ContainsKey(cKey)) + if (OptCheckCondBit.ContainsKey(cKey)) { int currStatus = 0; int[] listInt = new int[2]; - listInt = HoldingRegisterLUT[OptCheckConditions[cKey].BaseAddr]; + listInt = HoldingRegisterLUT[OptCheckCondBit[cKey].BaseAddr]; currStatus = ModbusClient.ConvertRegistersToInt(listInt); // hard coded il 9° bit a zero - answ = ((currStatus & (1 << OptCheckConditions[cKey].BitNum)) == OptCheckConditions[cKey].ValOk); - lgTrace($"testCondition for {cKey} | BaseAddr: {OptCheckConditions[cKey].BaseAddr} | BitNum: {OptCheckConditions[cKey].BitNum} | ValOk: {OptCheckConditions[cKey].ValOk}"); + answ = ((currStatus & (1 << OptCheckCondBit[cKey].BitNum)) == OptCheckCondBit[cKey].ValOk); + lgTrace($"testCondition for {cKey} | BaseAddr: {OptCheckCondBit[cKey].BaseAddr} | BitNum: {OptCheckCondBit[cKey].BitNum} | ValOk: {OptCheckCondBit[cKey].ValOk}"); } else { diff --git a/IOB-WIN-NEXT/IobModbusTCPZetapack.cs b/IOB-WIN-NEXT/IobModbusTCPZetapack.cs index 6bd369b7..4dfb581f 100644 --- a/IOB-WIN-NEXT/IobModbusTCPZetapack.cs +++ b/IOB-WIN-NEXT/IobModbusTCPZetapack.cs @@ -46,25 +46,23 @@ namespace IOB_WIN_NEXT #region Protected Properties /// - /// Restituisce status di AUTOmatico, hard coded + /// Restituisce status di WORK (auto + lavora), hard coded /// - protected bool Auto + protected bool WorkState { get { - return testCondition("WorkBitCond"); -#if false - bool answ = false; - int currStatus = 0; - // hard coded - int statusReg = 40002; - int[] listInt = new int[2]; - listInt = HoldingRegisterLUT[statusReg]; - currStatus = ModbusClient.ConvertRegistersToInt(listInt); - // hard coded il 5° bit - answ = ((currStatus & (1 << 14)) > 0); - return answ; -#endif + return testIntCondition("WorkIntCond"); + } + } + /// + /// Restituisce status di Manuale, hard coded + /// + protected bool ManualState + { + get + { + return testIntCondition("ManualIntCond"); } } @@ -75,10 +73,20 @@ namespace IOB_WIN_NEXT { get { - return testCondition("EStopBitCond"); + return testBitCondition("EStopBitCond"); } } + /// + /// Restituisce controllo IN ALLARME + /// + protected bool AlarmState + { + get + { + return testIntCondition("AlarmIntCond"); + } + } /// /// Restituisce status di LAVORA, hard coded /// @@ -86,20 +94,7 @@ namespace IOB_WIN_NEXT { get { - return testCondition("WorkBitCond"); -#if false - - bool answ = false; - int currStatus = 0; - // hard coded - int statusReg = 40002; - int[] listInt = new int[2]; - listInt = HoldingRegisterLUT[statusReg]; - currStatus = ModbusClient.ConvertRegistersToInt(listInt); - // hard coded il 5° bit - answ = ((currStatus & (1 << 0)) > 0); - return answ; -#endif + return testIntCondition("WorkIntCond"); } } @@ -136,27 +131,29 @@ namespace IOB_WIN_NEXT { byteSignals += (1 << 0); } + // se ho qualcosa nella holding register... if (HoldingRegisterLUT != null && HoldingRegisterLUT.Count > 0) { - // se emergenza NON premuta (triggered) indico OK (armata...) - if (!EStopTriggered) + // se emergenza NON premuta (triggered) indico OK (armata...) FARE !!! togliere true + //if (!EStopTriggered) + if (true) { byteSignals += (1 << 7); } - // processo dagli stati + gravi... - if (hasAlarms()) + // impiego controlli da setup IntConditions... processo dagli stati + gravi... + if (AlarmState || hasAlarms()) { byteSignals += (1 << 3); } - if (Work) - { - byteSignals += (1 << 1); - } - if (!Auto) + else if (ManualState) { byteSignals += (1 << 4); } + else if (WorkState) + { + byteSignals += (1 << 1); + } } else { @@ -195,30 +192,7 @@ namespace IOB_WIN_NEXT lgTrace("-------------------- Completato test lettura {baseAddr} --------------------"); } - /// - /// Testa la condition modbus da LUT + configurazione - /// - /// - /// - private bool testCondition(string cKey) - { - bool answ = false; - if (OptCheckConditions.ContainsKey(cKey)) - { - int currStatus = 0; - int[] listInt = new int[2]; - listInt = HoldingRegisterLUT[OptCheckConditions[cKey].BaseAddr]; - currStatus = ModbusClient.ConvertRegistersToInt(listInt); - // hard coded il 9° bit a zero - answ = ((currStatus & (1 << OptCheckConditions[cKey].BitNum)) == OptCheckConditions[cKey].ValOk); - lgTrace($"testCondition for {cKey} | BaseAddr: {OptCheckConditions[cKey].BaseAddr} | BitNum: {OptCheckConditions[cKey].BitNum} | ValOk: {OptCheckConditions[cKey].ValOk}"); - } - else - { - lgTrace($"testCondition error: {cKey} not found"); - } - return answ; - } + private void testRead() { diff --git a/IOB-WIN-NEXT/RemoteDebugInfo.txt b/IOB-WIN-NEXT/RemoteDebugInfo.txt index 427f0406..276df6ab 100644 --- a/IOB-WIN-NEXT/RemoteDebugInfo.txt +++ b/IOB-WIN-NEXT/RemoteDebugInfo.txt @@ -4,7 +4,7 @@ 2) verificare sia avviato e configurato 3) verificare esistenza cartella C:\Steamware\IOB-WIN-NEXT-DEB\ 4) impostare path di avvio come C:\Steamware\IOB-WIN-NEXT-DEB\IOB-WIN-NEXT.exe -5) impostare la remote machine con ip: porta, ad esempio sotto si trovano i aprametri x i vari clienti +5) impostare la remote machine con ip: porta, ad esempio sotto si trovano i parametri x i vari clienti 6) modificare il path dello script di replica post build 7) impostare nel file di avvio la machcina corretta: DATA/CONF/MAIN.ini (in fondo, sezione [IOB] ad esempio STARTLIST=FINASSI_OMP_01) @@ -16,3 +16,7 @@ Remote Machine conf: Cereria Finassi: - 10.150.0.1:4026 + + + Giacovelli: + - 192.168.1.93:4026 diff --git a/IOB-WIN-NEXT/postBuildTgt.bat b/IOB-WIN-NEXT/postBuildTgt.bat index b6a0a32e..64a89fd7 100644 --- a/IOB-WIN-NEXT/postBuildTgt.bat +++ b/IOB-WIN-NEXT/postBuildTgt.bat @@ -60,9 +60,11 @@ REM FINASSI REM ROBOCOPY . \\10.150.0.1\Steamware\IOB-WIN-NEXT-DEB /MIR REM Baglietto REM ROBOCOPY . \\192.168.60.15\Steamware\IOB-WIN-NEXT-DEB /MIR +REM GIACOVELLI LOCOROTONDO +ROBOCOPY . \\192.168.1.93\Steamware\IOB-WIN-NEXT-DEB /MIR REM IOB-WIN-SIM -ROBOCOPY . \\IOB-WIN-SIMULA\Steamware\IOB-WIN-NEXT-DEB /MIR +REM ROBOCOPY . \\IOB-WIN-SIMULA\Steamware\IOB-WIN-NEXT-DEB /MIR goto END