diff --git a/MTC_Sim/MTC_Sim/AdapterConf.cs b/MTC_Sim/MTC_Sim/AdapterConf.cs index ce1a80b..e5423a2 100644 --- a/MTC_Sim/MTC_Sim/AdapterConf.cs +++ b/MTC_Sim/MTC_Sim/AdapterConf.cs @@ -20,6 +20,10 @@ namespace MTC_Adapter { string sNomeAdapt; int nVers; + TimeSpan tContOreMaccOn; + TimeSpan tContOreMaccLav; + int[] _ContGiriElettrom; + float[] _ContKmMovAssi; tipoAdapter etipoAdapt; element[] _VacuumPump; @@ -234,6 +238,26 @@ namespace MTC_Adapter get { return etipoAdapt; } set { etipoAdapt = value; } } + public TimeSpan ContOreMaccOn + { + get { return tContOreMaccOn; } + set { tContOreMaccOn = value; } + } + public TimeSpan ContOreMaccLav + { + get { return tContOreMaccLav; } + set { tContOreMaccLav = value; } + } + public int[] ContGiriElettrom + { + get { return _ContGiriElettrom; } + set { _ContGiriElettrom = value; } + } + public float[] ContKmMovAssi + { + get { return _ContKmMovAssi; } + set { _ContKmMovAssi = value; } + } public element[] VacuumPump { get { return _VacuumPump; } diff --git a/MTC_Sim/MTC_Sim/AdapterConf/SCM_ESA.xml b/MTC_Sim/MTC_Sim/AdapterConf/SCM_ESA.xml index 88b4878..c0e6913 100644 --- a/MTC_Sim/MTC_Sim/AdapterConf/SCM_ESA.xml +++ b/MTC_Sim/MTC_Sim/AdapterConf/SCM_ESA.xml @@ -3,6 +3,8 @@ 1 SCM_ADAPTER_ESA HMI_ESA + + VacPump_01 diff --git a/MTC_Sim/MTC_Sim/AdapterESA.cs b/MTC_Sim/MTC_Sim/AdapterESA.cs index 37f3cf4..c21472f 100644 --- a/MTC_Sim/MTC_Sim/AdapterESA.cs +++ b/MTC_Sim/MTC_Sim/AdapterESA.cs @@ -131,7 +131,7 @@ namespace MTC_Adapter } // dati override feed/speed... - Byte v82 = ncDevice.PLC_MemoryAreaV[14]; + Byte v82 = ncDevice.PLC_MemoryAreaV[14]; Byte v83 = ncDevice.PLC_MemoryAreaV[15]; // 2 byte x speed da copiare... byte[] tmpByte = new byte[2]; @@ -166,6 +166,31 @@ namespace MTC_Adapter sb.AppendLine(string.Format("SpeedRate: {0} rpm", SpeedRate)); // ------------------------------------------- + // ------------------------------------------- + // recupero dati dai contatori EOK + int MinMaccOn = ncDevice.PLC_MemoryAreaETK[0]; + int OreMaccOn = ncDevice.PLC_MemoryAreaETK[1]; + TimeSpan CurrMaccOn = new TimeSpan(OreMaccOn, MinMaccOn, 0); + // controllo valore riferimento... + if (CurrMaccOn > contOreMaccOn) + { + TimeSpan deltaTime = CurrMaccOn.Subtract(CurrMaccOn); + currAdpConf.ContOreMaccOn = currAdpConf.ContOreMaccOn.Add(deltaTime); + } + else + { + // ...se il contatore si รจ resettato aggiorno valore riferimento... + contOreMaccOn = CurrMaccOn; + } + // passo valore in ORE (float) all'adapter + mAccTime.Value = currAdpConf.ContOreMaccOn.TotalHours; + + + + // ------------------------------------------- + + + // copio allarmi in vettore generale AlarFlags (dove lo gestisce)... Buffer.BlockCopy(ncDevice.PLC_MemAreaAlarm_tmp, 0, AlarmFlags, 0, ncDevice.PLC_MemAreaAlarm_tmp.Length); diff --git a/MTC_Sim/MTC_Sim/AdapterFanuc.cs b/MTC_Sim/MTC_Sim/AdapterFanuc.cs index 8f90f38..44c26fb 100644 --- a/MTC_Sim/MTC_Sim/AdapterFanuc.cs +++ b/MTC_Sim/MTC_Sim/AdapterFanuc.cs @@ -628,6 +628,7 @@ namespace MTC_Adapter mOperator.Value = "NA"; mStatus.Value = "NA"; mAccTime.Value = "NA"; + mAccTimeWork.Value = "NA"; } diff --git a/MTC_Sim/MTC_Sim/AdapterGeneric.cs b/MTC_Sim/MTC_Sim/AdapterGeneric.cs index d9ac2ef..b267994 100644 --- a/MTC_Sim/MTC_Sim/AdapterGeneric.cs +++ b/MTC_Sim/MTC_Sim/AdapterGeneric.cs @@ -546,6 +546,22 @@ namespace MTC_Adapter /// vettore gestione cronometraggi /// public DateTime inizio; + /// + /// Conteggio ATTUALE ore macchina ON + /// + public TimeSpan contOreMaccOn; + /// + /// Conteggio ATTUALE ore macchina IN LAVORO + /// + public TimeSpan contOreMaccLav; + /// + /// Vettore dei contatori giri cumulati elettromandrino (migliaia) + /// + public int[] contGiriElettrom; + /// + /// Vettore dei contatori del movimento degli assi + /// + public float[] contKmMovAssi; /// /// posizione precedente assi per calcolo distanze... @@ -713,10 +729,14 @@ namespace MTC_Adapter /// public Event mStatus = new Event("STATUS"); /// - /// Minuti funzionamento globale macchina + /// Minuti accensione globale macchina /// public Sample mAccTime = new Sample("ACC_TIME"); /// + /// Minuti funzionamento globale macchina (IN LAVORO) + /// + public Sample mAccTimeWork = new Sample("ACC_TIME_WORK"); + /// /// Orologio /// public Sample mClock = new Sample("CLOCK"); @@ -809,6 +829,7 @@ namespace MTC_Adapter // status, clock, emergency stop mAdapter.AddDataItem(mStatus); mAdapter.AddDataItem(mAccTime); + mAdapter.AddDataItem(mAccTimeWork); mAdapter.AddDataItem(mClock); mAdapter.AddDataItem(mPower); mAdapter.AddDataItem(mEStop); @@ -1064,6 +1085,20 @@ namespace MTC_Adapter // resetto running flag... adpRunning = false; + // carico valori a zero x i conteggi + contOreMaccOn = new TimeSpan(0); + contOreMaccLav = new TimeSpan(0); + contGiriElettrom = new int[currAdpConf.nUnOp]; + for (int i = 0; i < currAdpConf.nUnOp; i++) + { + contGiriElettrom[i] = 0; + } + contKmMovAssi = new float[currAdpConf.nAxis]; + for (int i = 0; i < currAdpConf.nAxis; i++) + { + contKmMovAssi[i] = 0; + } + mAlarmSystem.Normal(); mAlarmCNC.Normal(); mAlarmPLC.Normal(); diff --git a/MTC_Sim/MTC_Sim/Resources/SCM/VariabiliContatori.txt b/MTC_Sim/MTC_Sim/Resources/SCM/VariabiliContatori.txt index 4fd1d66..11270e4 100644 --- a/MTC_Sim/MTC_Sim/Resources/SCM/VariabiliContatori.txt +++ b/MTC_Sim/MTC_Sim/Resources/SCM/VariabiliContatori.txt @@ -21,7 +21,7 @@ C_KM_ASSEZ1 AT %EOK73; * Metri mov. asse X km SNO RIFERITI AD UnOp, macchina tutta e totale movimenti degli assi... -eok60/61 e eok62/63 servono x avere ore mmcchina on e ore macchina lavoro +eok60/61 e eok62/63 servono x avere ore macchina on e ore macchina lavoro eok64 ่ monotono crescente giri totali elettromandrino... diff --git a/MTC_Sim/SCMCncLib/thdNcEsaGvKvara.cs b/MTC_Sim/SCMCncLib/thdNcEsaGvKvara.cs index ec9a412..9b31701 100644 --- a/MTC_Sim/SCMCncLib/thdNcEsaGvKvara.cs +++ b/MTC_Sim/SCMCncLib/thdNcEsaGvKvara.cs @@ -349,7 +349,7 @@ namespace SCMCncLib iError = read_regbuffer(ref VAreaAddress, 68, VAreaByteSize, PLC_MemAreaV_tmp); // leggo da posizione memorie ETK TS_REG - iError = read_regbuffer(ref ETKAreaAddress, 68, ETKAreaByteSize, PLC_MemAreaETK_tmp); + iError = read_regbuffer(ref ETKAreaAddress, 60, ETKAreaByteSize, PLC_MemAreaETK_tmp); // leggo da posizione memorie Vcome TS_REG