diff --git a/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml b/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml
index 3dae1b3..f461ae6 100644
--- a/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml
+++ b/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml
@@ -225,11 +225,11 @@
Path_01_RUN_MODE
- FLAG#R10528.1:R10528.7
+ 0
Path_01_EXE_MODE
- FLAG#R10528.8:R10528.11
+ 0
Path_01_CurrProg
diff --git a/MTC_Sim/MTC_Sim/AdapterConf/Demo.xml b/MTC_Sim/MTC_Sim/AdapterConf/Demo.xml
index 1e6f3e3..3a20b49 100644
--- a/MTC_Sim/MTC_Sim/AdapterConf/Demo.xml
+++ b/MTC_Sim/MTC_Sim/AdapterConf/Demo.xml
@@ -215,11 +215,11 @@
Path_01_RUN_MODE
- FLAG#R10528.1:R10528.7
+ 0
Path_01_EXE_MODE
- FLAG#R10528.8:R10528.11
+ 0
Path_01_CurrProg
diff --git a/MTC_Sim/MTC_Sim/AdapterConf/SCM_ESA.xml b/MTC_Sim/MTC_Sim/AdapterConf/SCM_ESA.xml
index d62573e..87273e3 100644
--- a/MTC_Sim/MTC_Sim/AdapterConf/SCM_ESA.xml
+++ b/MTC_Sim/MTC_Sim/AdapterConf/SCM_ESA.xml
@@ -225,11 +225,11 @@
Path_01_RUN_MODE
- FLAG#R10528.1:R10528.7
+ 0
Path_01_EXE_MODE
- FLAG#R10528.8:R10528.11
+ 0
Path_01_CurrProg
diff --git a/MTC_Sim/MTC_Sim/AdapterESA.cs b/MTC_Sim/MTC_Sim/AdapterESA.cs
index 138c54e..f91bbf7 100644
--- a/MTC_Sim/MTC_Sim/AdapterESA.cs
+++ b/MTC_Sim/MTC_Sim/AdapterESA.cs
@@ -197,6 +197,15 @@ namespace MTC_Adapter
}
needSave = procMovTotAssi(needSave);
+ needSave = procPartId(needSave);
+ needSave = procPzProd(needSave);
+ needSave = procNumInvAssi(needSave);
+ needSave = procVacPump(needSave);
+ needSave = procVacAct(needSave);
+ needSave = procLubro(needSave);
+
+
+
// salvo se necessario!
if (needSave) parentForm.persistXmlData();
// -------------------------------------------
@@ -232,19 +241,41 @@ namespace MTC_Adapter
mPower.Value = "OFF";
}
- // switch su run mode...
+ // switch su EXE mode...
/*
- * MODO_X V[74].W --> byte (6)
- * 0 = Modo NESSUNO
- * 1 = Modo MANUALE
- * 2 = Modo AUTOMATICO
- * 3 = Modo POM
- * 4 = Modo MDI
- * 5 = Modo SEMIAUTOMATICO
- * 6 = Modo RAP
- * 7 = Modo TES
+ * MODO_X V[70/71] --> byte (2-3)
+ * V70.2 = Modo RUN
+ * V70.3 = Modo FeedHold
+ * V71.5 = Ready
* */
- uint V74 = ncDevice.PLC_MemoryAreaV[6];
+ Byte V70 = ncDevice.PLC_MemoryAreaV[2];
+ Byte V71 = ncDevice.PLC_MemoryAreaV[3];
+ if (((StFlag8)V70).HasFlag(StFlag8.B3))
+ {
+ vettPath[idxPath].mPathExeMode.Value = "FEEDHOLD";
+ }
+ else if (((StFlag8)V70).HasFlag(StFlag8.B2))
+ {
+ vettPath[idxPath].mPathExeMode.Value = "RUN";
+ }
+ else if (((StFlag8)V71).HasFlag(StFlag8.B5))
+ {
+ vettPath[idxPath].mPathExeMode.Value = "READY";
+ }
+
+ // switch su run mode...
+ /*
+ * MODO_X V[74].W --> byte (6)
+ * 0 = Modo NESSUNO
+ * 1 = Modo MANUALE
+ * 2 = Modo AUTOMATICO
+ * 3 = Modo POM
+ * 4 = Modo MDI
+ * 5 = Modo SEMIAUTOMATICO
+ * 6 = Modo RAP
+ * 7 = Modo TES
+ * */
+ uint V74 = ncDevice.PLC_MemoryAreaV[6];
switch (V74)
{
case 1:
@@ -313,7 +344,6 @@ namespace MTC_Adapter
{
case 0:
newPos = (double)BitConverter.ToInt32(BitConverter.GetBytes(ncDevice.PLC_MemoryRead[240]), 0);
- //BitConverter.ToUInt16(ncDevice.PLC_MemoryRead, 240);
break;
case 1:
newPos = (double)BitConverter.ToInt32(BitConverter.GetBytes(ncDevice.PLC_MemoryRead[241]), 0);
@@ -350,7 +380,9 @@ namespace MTC_Adapter
// calcolo distanza e salvo valore...
distPerc = newPos - prevPosAxis[i];
- vettAxis[i].mAxDistDone.Value = Math.Abs(distPerc);
+#if false
+ vettAxis[i].mAxDistDone.Value = Math.Abs(distPerc);
+#endif
// sistemo direzione +/- (POS/NEG se lineari, CCW/CW se rotativi)
if (distPerc != 0)
@@ -369,22 +401,7 @@ namespace MTC_Adapter
// salvo "+1" come cambi direzione
istNumInvAssi[i]++;
}
-
- // 2016.06.05 tolto x gestione con procNumInvAssi
-#if false
- // se la direzione è variata salvo il cambio direzione...
- if (newDir != prevDirAxis[i])
- {
- // salvo "+1" come cambi direzione
- vettAxis[i].mAxInvDDone.Value = incrNumInvAssi(i, 1);
- }
- else
- {
- // salvo "0" come aumento...
- vettAxis[i].mAxInvDDone.Value = incrNumInvAssi(i, 0);
- }
-#endif
-
+
// salvo valori vettore prec...
prevPosAxis[i] = newPos;
prevDirAxis[i] = newDir;
diff --git a/MTC_Sim/MTC_Sim/AdapterGeneric.cs b/MTC_Sim/MTC_Sim/AdapterGeneric.cs
index d8b6468..7359708 100644
--- a/MTC_Sim/MTC_Sim/AdapterGeneric.cs
+++ b/MTC_Sim/MTC_Sim/AdapterGeneric.cs
@@ -2147,7 +2147,7 @@ namespace MTC_Adapter
if (istNumInvAssi[i] > contNumInvAssi[i])
{
uint delta = istNumInvAssi[i] - contNumInvAssi[i];
- uint contTot = updateUnOpRefListByIncr(i, delta, "Axis_{0:00}_Invers");
+ uint contTot = updateAxisRefListByIncr(i, delta, "Axis_{0:00}_InvDDone");
// passo valore totale all'adapter
vettAxis[i].mAxInvDDone.Value = contTot.ToString();
// segnalo necessità salvataggio!
diff --git a/MTC_Sim/MTC_Sim/MTC-Adapter.csproj b/MTC_Sim/MTC_Sim/MTC-Adapter.csproj
index cd9c267..10036fd 100644
--- a/MTC_Sim/MTC_Sim/MTC-Adapter.csproj
+++ b/MTC_Sim/MTC_Sim/MTC-Adapter.csproj
@@ -136,6 +136,7 @@
+
@@ -197,6 +198,7 @@
Always
+
diff --git a/MTC_Sim/MTC_Sim/Resources/SCM/DecodFileProd.txt b/MTC_Sim/MTC_Sim/Resources/SCM/DecodFileProd.txt
new file mode 100644
index 0000000..5bdb4a1
--- /dev/null
+++ b/MTC_Sim/MTC_Sim/Resources/SCM/DecodFileProd.txt
@@ -0,0 +1,15 @@
+#--------------------------------
+# dati produzione
+#--------------------------------
+
+Ci sono file in cui si accumulano (per ora a fine "lotto") i dati di produzione SCM; i file in questione sono in "C:\Kvara\Xilog Plus Default\Report"
+
+Questi file saranno copiati (ogni x minuti?) tramite task schedulato in dir IOT, come SCM_prodFile.pro
+
+Il file verrà letto periodicamente, verranno decodificate le linee e veriicate con quelle in memoria
+
+se ci sono novità (+ pezzi x stesso articolo o nuovo articolo) saranno salvati prima PartId poi produzione
+
+E' stato richiesto che
+- sia subito scritta linea x nuovo articolo (pz 0)
+- sia aggiornata riga x tale articolo ogni n minuti (x refresh) - almeno ogni n=10 min
\ No newline at end of file
diff --git a/MTC_Sim/MTC_Sim/Resources/SCM/SCM_prodFile.pro b/MTC_Sim/MTC_Sim/Resources/SCM/SCM_prodFile.pro
new file mode 100644
index 0000000..d8c39b0
--- /dev/null
+++ b/MTC_Sim/MTC_Sim/Resources/SCM/SCM_prodFile.pro
@@ -0,0 +1,6 @@
+09,23,53,00076
+AB,C:\Programme\Scm Group\Xilog Plus\Job\PRGCANTEST.PGM,,1600,600,50,13,14,23,13,18,47,00,03,03,00,04,05,2,00,01,31,50
+AB,C:\Programme\Scm Group\Xilog Plus\Job\PRGCANTEST.PGM,,1600,600,50,13,38,39,13,41,16,00,02,37,00,02,40,1,00,02,37,00
+AB,C:\Programme\Scm Group\Xilog Plus\Job\PRGCANTEST.PGM,,1600,600,50,13,57,11,14,02,53,00,03,50,00,03,53,1,00,03,50,00
+AB,C:\Programme\Scm Group\Xilog Plus\Job\PRGCANTEST.PGM,,1600,600,50,14,32,41,15,07,23,00,34,25,00,34,45,7,00,04,55,00
+AB,C:\Programme\Scm Group\Xilog Plus\Job\PRGCANTEST.PGM,,1600,600,50,15,18,04,00,00,49,08,39,58,08,42,45,65,00,07,59,96
\ No newline at end of file
diff --git a/MTC_Sim/MTC_Sim/SetupAdapter.cs b/MTC_Sim/MTC_Sim/SetupAdapter.cs
index 043ff67..9723cdd 100644
--- a/MTC_Sim/MTC_Sim/SetupAdapter.cs
+++ b/MTC_Sim/MTC_Sim/SetupAdapter.cs
@@ -363,8 +363,8 @@ namespace MTC_Adapter
listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_Cod_M", i + 1), "0"));
listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_Cod_S", i + 1), "0"));
listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_Cod_T", i + 1), "0"));
- listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_RUN_MODE", i + 1), "FLAG#R10528.1:R10528.7"));
- listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_EXE_MODE", i + 1), "FLAG#R10528.8:R10528.11"));
+ listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_RUN_MODE", i + 1), "0"));
+ listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_EXE_MODE", i + 1), "0"));
listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_CurrProg", i + 1), "0"));
listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_CurrProg_RowNum", i + 1), "0"));
listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_ActiveAxes", i + 1), "0"));