inserito e modificato codice x gestione contatori manutenzione EOK x ESA

This commit is contained in:
Samuele E. Locatelli
2016-06-13 12:34:26 +02:00
parent 1a50893725
commit 59e870d2d7
7 changed files with 91 additions and 4 deletions
+24
View File
@@ -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; }
+2
View File
@@ -3,6 +3,8 @@
<Version>1</Version>
<NomeAdapt>SCM_ADAPTER_ESA</NomeAdapt>
<TipoAdapt>HMI_ESA</TipoAdapt>
<ContOreMaccOn />
<ContOreMaccLav />
<VacuumPump>
<element>
<ident>VacPump_01</ident>
+26 -1
View File
@@ -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);
+1
View File
@@ -628,6 +628,7 @@ namespace MTC_Adapter
mOperator.Value = "NA";
mStatus.Value = "NA";
mAccTime.Value = "NA";
mAccTimeWork.Value = "NA";
}
+36 -1
View File
@@ -546,6 +546,22 @@ namespace MTC_Adapter
/// vettore gestione cronometraggi
/// </summary>
public DateTime inizio;
/// <summary>
/// Conteggio ATTUALE ore macchina ON
/// </summary>
public TimeSpan contOreMaccOn;
/// <summary>
/// Conteggio ATTUALE ore macchina IN LAVORO
/// </summary>
public TimeSpan contOreMaccLav;
/// <summary>
/// Vettore dei contatori giri cumulati elettromandrino (migliaia)
/// </summary>
public int[] contGiriElettrom;
/// <summary>
/// Vettore dei contatori del movimento degli assi
/// </summary>
public float[] contKmMovAssi;
/// <summary>
/// posizione precedente assi per calcolo distanze...
@@ -713,10 +729,14 @@ namespace MTC_Adapter
/// </summary>
public Event mStatus = new Event("STATUS");
/// <summary>
/// Minuti funzionamento globale macchina
/// Minuti accensione globale macchina
/// </summary>
public Sample mAccTime = new Sample("ACC_TIME");
/// <summary>
/// Minuti funzionamento globale macchina (IN LAVORO)
/// </summary>
public Sample mAccTimeWork = new Sample("ACC_TIME_WORK");
/// <summary>
/// Orologio
/// </summary>
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();
@@ -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...
+1 -1
View File
@@ -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