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
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/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/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..9c8ad538 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...
@@ -512,9 +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), 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());
+ outVal.Add("RPM_02", valDW.ToString());
return outVal;
}
@@ -530,14 +538,85 @@ 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 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)
+ {
+
+ }
+ }
+
///
/// Effettua decodifica aree memoria alla bitmap usata x MAPO
///
- private void decodeToBitmap()
+ private void decodeToBaseBitmap()
{
// init a zero...
B_input = 0;
@@ -552,7 +631,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 +682,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
diff --git a/Jenkinsfile b/Jenkinsfile
index 383624a0..0bede904 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=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'