diff --git a/AgentBin/simulator/CMS_DEMO.xml b/AgentBin/simulator/CMS_DEMO.xml index 9852ad1..cbfeb13 100644 --- a/AgentBin/simulator/CMS_DEMO.xml +++ b/AgentBin/simulator/CMS_DEMO.xml @@ -10,7 +10,7 @@ - + diff --git a/AgentBin/simulator/SCM_DEMO.xml b/AgentBin/simulator/SCM_DEMO.xml index 3dc2e03..1f5b44d 100644 --- a/AgentBin/simulator/SCM_DEMO.xml +++ b/AgentBin/simulator/SCM_DEMO.xml @@ -10,7 +10,7 @@ - + diff --git a/MTC_Sim/MTC_Sim/AdapterESA.cs b/MTC_Sim/MTC_Sim/AdapterESA.cs index 4255b81..d5ef4d9 100644 --- a/MTC_Sim/MTC_Sim/AdapterESA.cs +++ b/MTC_Sim/MTC_Sim/AdapterESA.cs @@ -165,6 +165,7 @@ namespace MTC_Adapter istGiriElettrom[i] = (uint)ncDevice.PLC_MemoryAreaEOK[4 + i]; } needSave = procGiriTotUnOp(needSave); + needSave = procNumCU(needSave); // spostamento totale assi! for (int i = 0; i < 3; i++) diff --git a/MTC_Sim/MTC_Sim/AdapterFanuc.cs b/MTC_Sim/MTC_Sim/AdapterFanuc.cs index 4273e06..d89d1dd 100644 --- a/MTC_Sim/MTC_Sim/AdapterFanuc.cs +++ b/MTC_Sim/MTC_Sim/AdapterFanuc.cs @@ -813,6 +813,19 @@ namespace MTC_Adapter istGiriElettrom[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i); } } + else if (maintData[i].varName.EndsWith("_NumCambiUT")) + { + try + { + numero = Convert.ToInt32(maintData[i].varName.Replace("UnOp_", "").Replace("_NumCambiUT", "")); + } + catch + { } + if (numero > 0) + { + istNumCambiUt[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i); + } + } } else if (maintData[i].varName.StartsWith("VacPump_")) { @@ -870,6 +883,7 @@ namespace MTC_Adapter needSave = procPartId(needSave); needSave = procPzProd(needSave); needSave = procGiriTotUnOp(needSave); + needSave = procNumCU(needSave); needSave = procMovTotAssi(needSave); needSave = procNumInvAssi(needSave); needSave = procVacPump(needSave); @@ -1267,7 +1281,7 @@ namespace MTC_Adapter vettPath[i].mPathPosActI.Value = ((decimal)vettTTCoord.c1) / utils.CRI("fattdecimale"); vettPath[i].mPathPosActJ.Value = ((decimal)vettTTCoord.c2) / utils.CRI("fattdecimale"); vettPath[i].mPathPosActK.Value = "0"; // è 5 assi...nullo... - + //vettPath[i].mPathCurrProg.Value = string.Format("{0}-{1}-{2}", allDynData.prgmnum, allDynData.prgnum, allDynData.seqnum); //vettPath[i].mPathCurrProgRowNum.Value = PtData.ProgrRow; //vettPath[i].mPathActiveAxes.Value = PtData.ActiveAxes; diff --git a/MTC_Sim/MTC_Sim/AdapterGeneric.cs b/MTC_Sim/MTC_Sim/AdapterGeneric.cs index e0b838d..8f4acfc 100644 --- a/MTC_Sim/MTC_Sim/AdapterGeneric.cs +++ b/MTC_Sim/MTC_Sim/AdapterGeneric.cs @@ -614,6 +614,10 @@ namespace MTC_Adapter /// Vettore ATTUALE dei contatori del tempo cumulato lavoro degli assi (h) /// public double[] contAxisAccumTime; + /// + /// Vettore ATTUALE dei contatori del numero cambi utensili x UnOp + /// + public uint[] currNumCambiUt; /// @@ -660,6 +664,12 @@ namespace MTC_Adapter /// Vettore ISTANTANEO dei contatori del tempo cumulato lavoro degli assi (h) /// public double[] istAxisAccumTime; + /// + /// Vettore ISTANTANEO dei contatori del numero cambi utensili x UnOp + /// + public uint[] istNumCambiUt; + + /// /// data-ora ultimo controllo movimento assi /// @@ -1241,16 +1251,22 @@ namespace MTC_Adapter contOreMaccLav = currAdpConf.ContOreMaccLav; contGiriElettrom = new uint[currAdpConf.nUnOp]; istGiriElettrom = new uint[currAdpConf.nUnOp]; + currNumCambiUt= new uint[currAdpConf.nUnOp]; + istNumCambiUt= new uint[currAdpConf.nUnOp]; for (int i = 0; i < currAdpConf.nUnOp; i++) { // leggo tutti i dati... List> listaDR = currAdpConf.UnOp[i].dataRefList; // punto all'item DataRefItem riContRpm = listaDR.Find(x => x.Key == string.Format("UnOp_{0:00}_AccTime", i + 1)); + DataRefItem riContNumCU = listaDR.Find(x => x.Key == string.Format("UnOp_{0:00}_NumCU", i + 1)); // recupero valore giri... UInt32 contTotGiri = Convert.ToUInt32(riContRpm.Value); + // recupero valore num cambi ut... + UInt32 contNumCU = Convert.ToUInt32(riContNumCU.Value); // salvo valore letto contGiriElettrom[i] = contTotGiri; + currNumCambiUt[i] = contNumCU; } // imposto num assi... contDistMovAssi = new uint[currAdpConf.nAxis]; @@ -2222,6 +2238,33 @@ namespace MTC_Adapter return needSave; } /// + /// Processing delle variabili sul numero cambi utensile (totali) + /// + /// + /// + public bool procNumCU(bool needSave) + { + for (int i = 0; i < currAdpConf.nUnOp; i++) + { + // controllo valore riferimento... + if (istNumCambiUt[i] > currNumCambiUt[i]) + { + uint delta = istNumCambiUt[i] - currNumCambiUt[i]; + uint contatore = updateUnOpRefListByIncr(i, delta, "UnOp_{0:00}_NumCU"); + + // passo valore num CU all'adapter + vettUnOp[i].mUnOpNumCU.Value = contatore; + + // segnalo necessità salvataggio! + needSave = true; + } + // ...aggiorno valore riferimento... + currNumCambiUt[i] = istNumCambiUt[i]; + } + + return needSave; + } + /// /// Processing delle variabili sul totale m percorsi dagli assi /// /// diff --git a/MTC_Sim/MTC_Sim/App.config b/MTC_Sim/MTC_Sim/App.config index ed4bed2..bb1e8fb 100644 --- a/MTC_Sim/MTC_Sim/App.config +++ b/MTC_Sim/MTC_Sim/App.config @@ -48,18 +48,18 @@ - + - + - + - + diff --git a/MTC_Sim/MTC_Sim/CmsMaintDataConf.txt b/MTC_Sim/MTC_Sim/CmsMaintDataConf.txt index ddd6bb1..23af28b 100644 --- a/MTC_Sim/MTC_Sim/CmsMaintDataConf.txt +++ b/MTC_Sim/MTC_Sim/CmsMaintDataConf.txt @@ -23,4 +23,4 @@ 022|SlittaTastatore_Count |COUNT 023|SlittaMagazzino_01_Count |COUNT 024|ProtMagazzino_01_Count |COUNT -025|CambiUT_Count |COUNT \ No newline at end of file +025|UnOp_01_NumCambiUT |COUNT \ No newline at end of file