diff --git a/IOB-WIN/DATA/CONF/VL24.ini b/IOB-WIN/DATA/CONF/VL24.ini index e93fc977..a2697d0d 100644 --- a/IOB-WIN/DATA/CONF/VL24.ini +++ b/IOB-WIN/DATA/CONF/VL24.ini @@ -9,7 +9,7 @@ VENDOR=SAET MODEL=Preriscaldo_105B08 [CNC] -IP=192.168.214.24 +IP=192.168.220.24 CPUTYPE=S71500 RACK=0 SLOT=0 @@ -57,22 +57,25 @@ PZCOUNT_MODE=STD.DB1275.DBDW4 DISABLE_PZCOUNT=TRUE ENABLE_DYN_DATA=TRUE FORCE_DYN_DATA=TRUE -TSVC_Power_01=MAX:5 -TSVC_Power_02=MAX:5 -TSVC_Power_03=MAX:5 -TSVC_Power_04=MAX:5 -TSVC_TempPirom_01=MAX:5 -TSVC_TempPirom_02=MAX:5 -TSVC_TempPirom_03=MAX:5 -TSVC_TempPirom_04=MAX:5 -TSVC_TempCool_01=MAX:5 -TSVC_TempCool_02=MAX:5 -TSVC_TempCool_03=MAX:5 -TSVC_TempCool_04=MAX:5 -TSVC_PartStatus_01=MAX:5 -TSVC_PartStatus_02=MAX:5 -TSVC_PartStatus_03=MAX:5 -TSVC_PartStatus_04=MAX:5 +NEW_DYN_DATA=TRUE +; conf parametri memoria READ/WRITE +PARAM_CONF=VL24.json +;TSVC_Power_01=MAX:5 +;TSVC_Power_02=MAX:5 +;TSVC_Power_03=MAX:5 +;TSVC_Power_04=MAX:5 +;TSVC_TempPirom_01=MAX:5 +;TSVC_TempPirom_02=MAX:5 +;TSVC_TempPirom_03=MAX:5 +;TSVC_TempPirom_04=MAX:5 +;TSVC_TempCool_01=MAX:5 +;TSVC_TempCool_02=MAX:5 +;TSVC_TempCool_03=MAX:5 +;TSVC_TempCool_04=MAX:5 +;TSVC_PartStatus_01=MAX:5 +;TSVC_PartStatus_02=MAX:5 +;TSVC_PartStatus_03=MAX:5 +;TSVC_PartStatus_04=MAX:5 [BRANCH] NAME=master \ No newline at end of file diff --git a/IOB-WIN/DATA/CONF/VL24.json b/IOB-WIN/DATA/CONF/VL24.json index 9a87d274..d862941c 100644 --- a/IOB-WIN/DATA/CONF/VL24.json +++ b/IOB-WIN/DATA/CONF/VL24.json @@ -1,46 +1,22 @@ { "mMapWrite": { - "kgParz": { - "name": "kgParz", - "tipoMem": "Int", - "index": 66, - "size": 2 + "setArt": { + "name": "setArt", + "tipoMem": "String", + "index": 4, + "size": 32 }, - "set_th": { - "name": "set_th", - "tipoMem": "Int", - "index": 72, - "size": 2 + "setComm": { + "name": "setComm", + "tipoMem": "String", + "index": 38, + "size": 12 }, - "set_c": { - "name": "set_c", - "tipoMem": "Real", - "index": 74, + "setPzComm": { + "name": "setPzComm", + "tipoMem": "Int", + "index": 52, "size": 4 - }, - "aria_1": { - "name": "aria_1", - "tipoMem": "Int", - "index": 78, - "size": 2 - }, - "aria_2": { - "name": "aria_2", - "tipoMem": "Int", - "index": 80, - "size": 2 - }, - "setMmH20": { - "name": "setMmH20", - "tipoMem": "Real", - "index": 82, - "size": 4 - }, - "rpmci": { - "name": "rpmci", - "tipoMem": "Int", - "index": 86, - "size": 2 } }, "mMapRead": { diff --git a/IOB-WIN/IOB-WIN.csproj b/IOB-WIN/IOB-WIN.csproj index b8f74fc8..a2ee1ec0 100644 --- a/IOB-WIN/IOB-WIN.csproj +++ b/IOB-WIN/IOB-WIN.csproj @@ -234,6 +234,9 @@ Always + + Always + Always diff --git a/IOB-WIN/IobSiemens.cs b/IOB-WIN/IobSiemens.cs index 66c70bdf..7356e80d 100644 --- a/IOB-WIN/IobSiemens.cs +++ b/IOB-WIN/IobSiemens.cs @@ -76,7 +76,7 @@ namespace IOB_WIN if (writePre) { // MAX LUN - stringPar[1] = 20; + stringPar[1] = (byte)totLen; // LUNGH STRING stringPar[0] = (byte)byteLen; Buffer.BlockCopy(stringPar, 0, MemBlock, startPos, shiftStrByte); @@ -110,19 +110,19 @@ namespace IOB_WIN } } /// - /// Salvo in memblock il valore stringa indicato con formattazione siemens + /// Salvo in memblock il valore Int indicato con formattazione siemens /// /// Blocco memoria come byte[] dove scrivere - /// Valore scrivere + /// Valore da scrivere /// Posizione inizio scrittura - public void saveIntOnMemBlock(ref byte[] MemBlock, string stringValue, int startPos) + public void saveIntOnMemBlock(ref byte[] MemBlock, string currValue, int startPos) { - if (currProdData.ContainsKey(stringValue)) + if (currProdData.ContainsKey(currValue)) { try { byte[] stringPar = new byte[2]; - string valore = currProdData[stringValue]; + string valore = currProdData[currValue]; short valInt = 0; short.TryParse(valore, out valInt); byte[] strByte = S7.Net.Types.Int.ToByteArray(valInt); @@ -132,7 +132,34 @@ namespace IOB_WIN } catch (Exception exc) { - lgError($"Errore in gestione scrittura {stringValue}{Environment.NewLine}{exc}"); + lgError($"Errore in gestione scrittura {currValue}{Environment.NewLine}{exc}"); + } + } + } + /// + /// Salvo in memblock il valore DInt indicato con formattazione siemens + /// + /// Blocco memoria come byte[] dove scrivere + /// Valore da scrivere + /// Posizione inizio scrittura + public void saveDIntOnMemBlock(ref byte[] MemBlock, string currValue, int startPos) + { + if (currProdData.ContainsKey(currValue)) + { + try + { + byte[] stringPar = new byte[4]; + string valore = currProdData[currValue]; + int valInt = 0; + int.TryParse(valore, out valInt); + byte[] strByte = S7.Net.Types.DInt.ToByteArray(valInt); + int byteLen = 4; + Buffer.BlockCopy(strByte, 0, MemBlock, startPos, byteLen); + var verifica = S7.Net.Types.String.FromByteArray(MemBlock); + } + catch (Exception exc) + { + lgError($"Errore in gestione scrittura {currValue}{Environment.NewLine}{exc}"); } } } diff --git a/IOB-WIN/IobSiemensAt2001.cs b/IOB-WIN/IobSiemensAt2001.cs index 653c7613..6f2f3b52 100644 --- a/IOB-WIN/IobSiemensAt2001.cs +++ b/IOB-WIN/IobSiemensAt2001.cs @@ -97,8 +97,7 @@ namespace IOB_WIN case taskType.setParameter: // deserializzo il valore del parametro in primis var paramData = JsonConvert.DeserializeObject(item.Value); - - + // !!!FIXME!!! fare!!! break; case taskType.sendWatchDogMes2Plc: //// compogo in byte... primo bit è setup/run, ultimo è watchdog diff --git a/IOB-WIN/IobSiemensSaet.cs b/IOB-WIN/IobSiemensSaet.cs index f84eb911..b33f2e12 100644 --- a/IOB-WIN/IobSiemensSaet.cs +++ b/IOB-WIN/IobSiemensSaet.cs @@ -1,4 +1,5 @@ using IOB_UT; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; @@ -146,8 +147,8 @@ namespace IOB_WIN Dictionary taskDone = new Dictionary(); bool taskOk = false; string taskVal = ""; - // inizio con 1 byte VUOTO - byte[] MemBlock = new byte[2]; + // inizio VUOTO + byte[] MemBlock = new byte[parametri.memSizeWrite]; // cerco task specifici: se ho startSetup --> imposto bit DBB701.DBB0.4 foreach (var item in task2exe) @@ -164,13 +165,22 @@ namespace IOB_WIN case taskType.fixStopSetup: case taskType.forceResetPzCount: case taskType.forceSetPzCount: - case taskType.setArt: - case taskType.setComm: case taskType.setProg: case taskType.startSetup: case taskType.stopSetup: taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC"; break; + case taskType.setArt: + case taskType.setComm: + case taskType.setPzComm: + // imposto i valori... + taskVal = item.Value; + break; + case taskType.setParameter: + // deserializzo il valore del parametro in primis + var paramData = JsonConvert.DeserializeObject(item.Value); + // !!!FIXME!!! fare!!! + break; case taskType.sendWatchDogMes2Plc: MemBlock[1] = (byte)counterMes2Plc; MemBlock[0] = (byte)(counterMes2Plc >> 8); @@ -183,6 +193,13 @@ namespace IOB_WIN // aggiungo task! taskDone.Add(item.Key, taskVal); } + + + // controllo SE HO da scrivere articolo/commessa/programma + saveStringOnMemBlock(ref MemBlock, "setArt", 4, 32, true); + saveStringOnMemBlock(ref MemBlock, "setComm", 38, 12, true); + saveDIntOnMemBlock(ref MemBlock, "setPzComm", 52); + // scrivo comunque! taskOk = S7WriteBB(ref MemBlock); diff --git a/Jenkinsfile b/Jenkinsfile index 2b35bf6c..6acdcd60 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=492']) { + withEnv(['NEXT_BUILD_NUMBER=493']) { // env.versionNumber = VersionNumber(versionNumberString : '2.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '2.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN'