From 4c23130d19da0f7002f7f2d4969f0b1a0e9efc48 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 25 Jul 2018 15:56:40 +0200 Subject: [PATCH 1/7] Aggiunta conf x ghiringhelli M200 (nuova torri) --- IOB-WIN/DATA/CONF/3013.ini | 62 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 IOB-WIN/DATA/CONF/3013.ini diff --git a/IOB-WIN/DATA/CONF/3013.ini b/IOB-WIN/DATA/CONF/3013.ini new file mode 100644 index 00000000..9ff24b00 --- /dev/null +++ b/IOB-WIN/DATA/CONF/3013.ini @@ -0,0 +1,62 @@ +;Configurazione IOB-WIN +[IOB] +CNCTYPE=SIEMENS_TORRI + +[MACHINE] +VENDOR=TORRI +MODEL=GHIRINGHELLI M200 + +[CNC] +; Siemens Torri (GHIRINGHELLI M200) +IP=192.168.0.55 +CPUTYPE=S7300 +RACK=0 +SLOT=2 + +[SERVER] +MPIP=http://192.168.1.7 +MPURL=/MP/IO +CMDBASE=/IOB/input/ +CMDFLOG=/IOB/flog/ +CMDALIVE=/IOB +CMDENABLED=/IOB/enabled/ +CMDADV1=?valore= +CMDREBO=/sendReboot.aspx?idxMacchina= + +[MEMORY] +ADDR_READ=DB700.DBB0 +ADDR_WRITE=DB701.DBB0 +SIZE_READ=52 +SIZE_WRITE=138 +;BIT0=CONN +BIT1=DB700.DBB1 +;BIT2=PZCOUNT.STD.DB700.DBW22 +BIT3=DB700.DBB3 +BIT4=DB700.DBB4 + + +[BLINK] +;MAX_COUNTER_BLINK = 30 +MAX_COUNTER_BLINK = 15 +;bit0 = 0 +;bit1 = 0 +;bit2 = 1 +;bit3 = 1 +;bit4 = 1 +;bit5 = 0 +;bit6 = 0 +;bit7 = 0 +BLINK_FILT=0 +;BLINK_FILT=28 + +[OPTPAR] +;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice +; attenzione memoria sempre base BYTE (1604 DW --> 6416...) +PZCOUNT_MODE=STD.DB700.DBW22 +;PZ_CAD_MADDR=1602 +;PZ_REQ_MADDR=1603 +;PZ_DONE_MADDR=1604 +;PZ_GTOT_MADDR=1605 + +[BRANCH] +NAME=develop \ No newline at end of file From 65f67c9a52c6b5fb1fdf75b57fd56a5d1cc99714 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 25 Jul 2018 15:57:04 +0200 Subject: [PATCH 2/7] modifiche x gestione mancanza risposta a chiamata URL x ODL --- IOB-WIN/DATA/CONF/MAIN.ini | 2 +- IOB-WIN/IOB-WIN.csproj | 3 +++ IOB-WIN/IobFanuc.cs | 24 +++++++++++++++---- IOB-WIN/IobGeneric.cs | 4 ++++ IOB-WIN/IobSiemensTorri.cs | 49 +++++++++++++++++++++++++++++++------- 5 files changed, 69 insertions(+), 13 deletions(-) diff --git a/IOB-WIN/DATA/CONF/MAIN.ini b/IOB-WIN/DATA/CONF/MAIN.ini index 47e52239..e4e85e83 100644 --- a/IOB-WIN/DATA/CONF/MAIN.ini +++ b/IOB-WIN/DATA/CONF/MAIN.ini @@ -11,6 +11,6 @@ CMDREBO=/IOB/sendRebootGateway?GWIP= CMDIOB2CALL=/IOB/getIob2call?GWIP= [IOB] -STARTLIST=3011 +STARTLIST=3013 MAXCNC=4 ;STARTLIST=3001,3002,3003,3004,3005 \ No newline at end of file diff --git a/IOB-WIN/IOB-WIN.csproj b/IOB-WIN/IOB-WIN.csproj index bebb8b7e..d64b9276 100644 --- a/IOB-WIN/IOB-WIN.csproj +++ b/IOB-WIN/IOB-WIN.csproj @@ -188,6 +188,9 @@ Always + + Always + Always diff --git a/IOB-WIN/IobFanuc.cs b/IOB-WIN/IobFanuc.cs index daa7bea9..10909574 100644 --- a/IOB-WIN/IobFanuc.cs +++ b/IOB-WIN/IobFanuc.cs @@ -121,6 +121,7 @@ namespace IOB_WIN // gestione invio ritardato contapezzi pzCountDelay = utils.CRI("pzCountDelay"); lastPzCountSend = DateTime.Now; + lastWarnODL = DateTime.Now; // inizializzo correttamente aree memoria secondo CONF - iniFileName IniFile fIni = new IniFile(IOBConf.iniFileName); @@ -443,7 +444,19 @@ namespace IOB_WIN // se l'area è PZCOUNT... processo PUNTUALMENTE il CONTAPEZZI... if (bVal.StartsWith("PZCOUNT")) { - string currODL = utils.callUrl(urlGetCurrODL); + string currODL = ""; + try + { + currODL = utils.callUrl(urlGetCurrODL); + } + catch (Exception exc) + { + if (DateTime.Now.Subtract(lastWarnODL).TotalSeconds > 15) + { + lgError(exc, "Errore in fase di chiamata URL x ODL corrente | URL chiamato: {0}", urlGetCurrODL); + lastWarnODL = DateTime.Now; + } + } if (currODL != null && currODL != "") { // controllo se è passato intervallo minimo tra 2 controlli/elaborazioni x distanziare invio e ridurre letture @@ -481,9 +494,12 @@ namespace IOB_WIN } else { - lgInfo(string.Format("Attenzione: mancanza ODL non procedo con gestione contapezzi. Contapezzi FANUC: {0} | Contapezzi interno {1}", lastCountCNC, contapezzi)); - // resetto timer... - lastPzCountSend = DateTime.Now; + if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay)) + { + lgInfo(string.Format("Attenzione: mancanza ODL non procedo con gestione contapezzi. Contapezzi FANUC: {0} | Contapezzi interno {1}", lastCountCNC, contapezzi)); + // resetto timer... + lastPzCountSend = DateTime.Now; + } } } else // area "normale" byte.bit diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs index b088d9d2..df3ba9ab 100644 --- a/IOB-WIN/IobGeneric.cs +++ b/IOB-WIN/IobGeneric.cs @@ -31,6 +31,10 @@ namespace IOB_WIN /// protected DateTime lastPzCountSend; /// + /// Ultima registrazione warning x ODL mancante (x scrivere solo ogni 15 secondi) + /// + protected DateTime lastWarnODL; + /// /// Ritardo minimo x invio contapezzi /// protected int pzCountDelay; diff --git a/IOB-WIN/IobSiemensTorri.cs b/IOB-WIN/IobSiemensTorri.cs index 87a1e2c3..c7271b95 100644 --- a/IOB-WIN/IobSiemensTorri.cs +++ b/IOB-WIN/IobSiemensTorri.cs @@ -85,7 +85,7 @@ namespace IOB_WIN } string titolo = string.Format("READ BLOCK MEM BYTE: {0} --> {1} byte", parametri.memAddrRead, numByte); if (verboseLog) lgInfo(titolo); - string contenuto = ""; + string contenuto = string.Format("Contenuto area memoria aquisita{0}", Environment.NewLine); string byteVal = ""; for (int i = 0; i < memByteRead.Length; i++) { @@ -162,6 +162,7 @@ namespace IOB_WIN // gestione invio ritardato contapezzi pzCountDelay = utils.CRI("pzCountDelay"); lastPzCountSend = DateTime.Now; + lastWarnODL = DateTime.Now; // init conf _IOBConf = IOBConf; // inizializzo parametri... @@ -530,14 +531,31 @@ namespace IOB_WIN byte[] MemBlock = new byte[parametri.memSizeRead]; bool fatto = S7ReadBB(ref MemBlock); Buffer.BlockCopy(MemBlock, 0, RawInput, 0, parametri.memSizeRead); - if (verboseLog) lgInfo(string.Format("RawInput: {0}", utils.binaryForm((int)RawInput[0]))); + if (verboseLog) lgInfo(string.Format("RawInput[0]: {0}", utils.binaryForm((int)RawInput[0]))); // salvo il solo BYTE dell'input decifrando il semaforo... - decodeToBitmap(); + decodeToBaseBitmap(); + decodeOtherData(); } + /// + /// Decodifica il resto dell'area TORRI x i dati accessori (allarmi, ...) + /// + private void decodeOtherData() + { + //if (verboseLog) + //{ + // int i = 0; + // foreach (var item in RawInput) + // { + // lgInfo(string.Format("Byte[{0:00}]: {1}", i, utils.binaryForm((int)item))); + // i++; + // } + //} + } + /// /// Effettua decodifica aree memoria alla bitmap usata x MAPO /// - private void decodeToBitmap() + private void decodeToBaseBitmap() { // init a zero... B_input = 0; @@ -552,7 +570,19 @@ namespace IOB_WIN B_input = byteSem; - string currODL = utils.callUrl(urlGetCurrODL); + string currODL = ""; + try + { + currODL = utils.callUrl(urlGetCurrODL); + } + catch (Exception exc) + { + if (DateTime.Now.Subtract(lastWarnODL).TotalSeconds > 15) + { + lgError(exc, "Errore in fase di chiamata URL x ODL corrente | URL chiamato: {0}", urlGetCurrODL); + lastWarnODL = DateTime.Now; + } + } if (currODL != null && currODL != "") { // ora processo il contapezzi... @@ -591,9 +621,12 @@ namespace IOB_WIN } else { - lgInfo(string.Format("Attenzione: mancanza ODL non procedo con gestione contapezzi. Contapezzi SIEMENST-TORRI: {0} | Contapezzi interno {1}", lastCountCNC, contapezzi)); - // resetto timer... - lastPzCountSend = DateTime.Now; + if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay)) + { + lgInfo(string.Format("Attenzione: mancanza ODL non procedo con gestione contapezzi. Contapezzi SIEMENST-TORRI: {0} | Contapezzi interno {1}", lastCountCNC, contapezzi)); + // resetto timer... + lastPzCountSend = DateTime.Now; + } } #if false From 277b6cd5c426040d85369f00564cd986082f1052 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 25 Jul 2018 15:58:43 +0200 Subject: [PATCH 3/7] update versione --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 383624a0..ce1f987c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=275']) { + withEnv(['NEXT_BUILD_NUMBER=278']) { // env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN' From 803c7829ccdd045922f4fbf863316e5cb32fef0d Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 25 Jul 2018 17:37:54 +0200 Subject: [PATCH 4/7] aggiunta note decodifica modi siemens/torri + decodifica in sw x modo corrente --- IOB-WIN/DATA/CONF/MMapR.map | 9 +++++ IOB-WIN/IobSiemensTorri.cs | 73 ++++++++++++++++++++++++++++++++----- Jenkinsfile | 2 +- 3 files changed, 74 insertions(+), 10 deletions(-) diff --git a/IOB-WIN/DATA/CONF/MMapR.map b/IOB-WIN/DATA/CONF/MMapR.map index 369dc4db..b2e299d2 100644 --- a/IOB-WIN/DATA/CONF/MMapR.map +++ b/IOB-WIN/DATA/CONF/MMapR.map @@ -23,6 +23,15 @@ 018|AUTO_POWER_OFF |BYTE 019|OVR_FEED |BYTE 020|OVR_SPEED |BYTE +# CURR MODE diviso in BIT: +# B0 (01) = AUTO +# B1 (02) = MDI +# B2 (04) = JOG +# B3 (08) = TeachIN (associato a MDI --> 10) +# B4 (16) = Repos (associato a JOG --> 20) +# B5 (32) = RefPoint (associato a Jog --> 36) +# B6 (64) = Incr1 (associato a Jog --> 68) +# B7 (128) = Incr10 (associato a Jog --> -124 / 132 se UInt) 021|CURR_MODE |BYTE # valori word come UINT 16bit/Word 32bit/DWord 022|COUNT_TOT |WORD diff --git a/IOB-WIN/IobSiemensTorri.cs b/IOB-WIN/IobSiemensTorri.cs index c7271b95..90353bdd 100644 --- a/IOB-WIN/IobSiemensTorri.cs +++ b/IOB-WIN/IobSiemensTorri.cs @@ -516,6 +516,7 @@ namespace IOB_WIN // !!!FARE!!! recuperare da conf memoria, ora HARD CODED outVal.Add("FEED_OVER", RawInput[19].ToString()); outVal.Add("RAPID_OVER", RawInput[20].ToString()); + outVal.Add("CURR_MODE", decodeCurrMode(RawInput[21])); return outVal; } @@ -536,20 +537,74 @@ namespace IOB_WIN decodeToBaseBitmap(); decodeOtherData(); } + + /// + /// decodifica da bitmap il CURRENT MODE del controllo + /// + /// + /// + protected string decodeCurrMode(byte currModeBitmap) + { + string answ = ""; + if (verboseLog) lgInfo(string.Format("CURR_MODE raw data: {0}", utils.binaryForm((int)currModeBitmap))); + // decodifica del MODO... B21 + /* + * CURR MODE diviso in BIT: + * B0 (01) = AUTO + * B1 (02) = MDI + * B2 (04) = JOG + * B3 (08) = TeachIN (associato a MDI --> 10) + * B4 (16) = Repos (associato a JOG --> 20) + * B5 (32) = RefPoint (associato a Jog --> 36) + * B6 (64) = Incr1 (associato a Jog --> 68) + * B7 (128) = Incr10 (associato a Jog --> -124 / 132 se UInt) + * */ + + // modi principali + if (currModeBitmap.SelectBit(0)) + { + answ = "AUTO"; + } + else if (currModeBitmap.SelectBit(1)) + { + answ = "MDI"; + } + else if (currModeBitmap.SelectBit(2)) + { + answ = "JOG"; + } + // modi accessori + if (currModeBitmap.SelectBit(3)) + { + answ += " | TEACH-IN"; + } + if (currModeBitmap.SelectBit(4)) + { + answ += " | REPOS"; + } + if (currModeBitmap.SelectBit(5)) + { + answ += " | REF-POINT"; + } + if (currModeBitmap.SelectBit(6)) + { + answ += " | INCR-1"; + } + if (currModeBitmap.SelectBit(7)) + { + answ += " | INCR-10"; + } + return answ; + } /// /// Decodifica il resto dell'area TORRI x i dati accessori (allarmi, ...) /// private void decodeOtherData() { - //if (verboseLog) - //{ - // int i = 0; - // foreach (var item in RawInput) - // { - // lgInfo(string.Format("Byte[{0:00}]: {1}", i, utils.binaryForm((int)item))); - // i++; - // } - //} + if (verboseLog) + { + + } } /// diff --git a/Jenkinsfile b/Jenkinsfile index ce1f987c..63915b17 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=278']) { + withEnv(['NEXT_BUILD_NUMBER=280']) { // env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN' From 682e5e21ad6ffc3226c1c2865ebd556e80f307e1 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 25 Jul 2018 18:28:14 +0200 Subject: [PATCH 5/7] aggiornamento versione x decodifica siemens e modi --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 63915b17..1fd57c08 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=280']) { + withEnv(['NEXT_BUILD_NUMBER=282']) { // env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN' From 1bbd226873021933ff7c549a38310f15225602ec Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 25 Jul 2018 18:43:27 +0200 Subject: [PATCH 6/7] aggiunta rilevazione giri mola (RPM) x 3013 in OTHER DATA --- IOB-WIN/IobSiemensTorri.cs | 6 ++++++ Jenkinsfile | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/IOB-WIN/IobSiemensTorri.cs b/IOB-WIN/IobSiemensTorri.cs index 90353bdd..038262f7 100644 --- a/IOB-WIN/IobSiemensTorri.cs +++ b/IOB-WIN/IobSiemensTorri.cs @@ -513,10 +513,16 @@ namespace IOB_WIN public override Dictionary getOverrides() { Dictionary outVal = new Dictionary(); + uint valDW = 0; // !!!FARE!!! recuperare da conf memoria, ora HARD CODED outVal.Add("FEED_OVER", RawInput[19].ToString()); outVal.Add("RAPID_OVER", RawInput[20].ToString()); outVal.Add("CURR_MODE", decodeCurrMode(RawInput[21])); + // recupero RPM pezzo/mola !!!FARE!!! cambio nome da config, qui sono 01:conduttrice e 02:operatrice (3013) + valDW = S7.Net.Types.DWord.FromByteArray(RawInput.Skip(24).Take(4).ToArray()); + outVal.Add("RPM_01", valDW.ToString()); + valDW = S7.Net.Types.DWord.FromByteArray(RawInput.Skip(28).Take(4).ToArray()); + outVal.Add("RPM_02", valDW.ToString()); return outVal; } diff --git a/Jenkinsfile b/Jenkinsfile index 1fd57c08..0bede904 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=282']) { + withEnv(['NEXT_BUILD_NUMBER=284']) { // env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN' From b227d1d12b5c97f0dbf831476054adc8e5f56e7a Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 25 Jul 2018 20:10:39 +0200 Subject: [PATCH 7/7] fix typo? --- IOB-WIN/IobSiemensTorri.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IOB-WIN/IobSiemensTorri.cs b/IOB-WIN/IobSiemensTorri.cs index 038262f7..9c8ad538 100644 --- a/IOB-WIN/IobSiemensTorri.cs +++ b/IOB-WIN/IobSiemensTorri.cs @@ -518,7 +518,7 @@ namespace IOB_WIN outVal.Add("FEED_OVER", RawInput[19].ToString()); outVal.Add("RAPID_OVER", RawInput[20].ToString()); outVal.Add("CURR_MODE", decodeCurrMode(RawInput[21])); - // recupero RPM pezzo/mola !!!FARE!!! cambio nome da config, qui sono 01:conduttrice e 02:operatrice (3013) + // recupero RPM pezzo/mola !!!FARE!!! cambio nome da config, qui sono 01:conduttrice e 02:operatrice (3013), mentre sono pezzo/mola nella V100 valDW = S7.Net.Types.DWord.FromByteArray(RawInput.Skip(24).Take(4).ToArray()); outVal.Add("RPM_01", valDW.ToString()); valDW = S7.Net.Types.DWord.FromByteArray(RawInput.Skip(28).Take(4).ToArray());