completata modifica adapter generico e fanuc x gestione indicatori manutenzione
This commit is contained in:
@@ -707,7 +707,7 @@ namespace MTC_Adapter
|
||||
base.getSlowChangingData();
|
||||
// dati da PC
|
||||
mClock.Value = DateTime.Now.Date.ToFileTimeUtc();
|
||||
|
||||
|
||||
// reload dati da file...
|
||||
reloadDataFromFile();
|
||||
|
||||
@@ -731,8 +731,10 @@ namespace MTC_Adapter
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-DatiMtz", tabDatiMtz.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
// uno ad uno vado a inserirli nella mappa dei dati dell'adapter...
|
||||
int shift = 0;
|
||||
int numero = 0;
|
||||
for (int i = 0; i < maintData.Length; i++)
|
||||
{
|
||||
numero = 0;
|
||||
shift = Convert.ToInt32(maintData[i].codNum) - 1;
|
||||
|
||||
if (maintData[i].varName == "ACC_TIME")
|
||||
@@ -743,41 +745,116 @@ namespace MTC_Adapter
|
||||
{
|
||||
istOreMaccLav = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
}
|
||||
else if (maintData[i].varName == "Path_01_PZ_TOT")
|
||||
else if (maintData[i].varName.StartsWith("Path_"))
|
||||
{
|
||||
vettPath[0].mPathPartCount.Value = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
if (maintData[i].varName.EndsWith("_PZ_TOT"))
|
||||
{
|
||||
try
|
||||
{
|
||||
numero = Convert.ToInt32(maintData[i].varName.Replace("Path_", "").Replace("_PZ_TOT", ""));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
if (numero > 0)
|
||||
{
|
||||
vettPath[numero - 1].mPathPartCount.Value = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (maintData[i].varName.StartsWith("Axis_"))
|
||||
{
|
||||
int numAx = 0;
|
||||
if (maintData[i].varName.EndsWith("_DistDone"))
|
||||
{
|
||||
try
|
||||
{
|
||||
numAx = Convert.ToInt32(maintData[i].varName.Replace("Axis_", "").Replace("_DistDone", ""));
|
||||
numero = Convert.ToInt32(maintData[i].varName.Replace("Axis_", "").Replace("_DistDone", ""));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (numAx > 0)
|
||||
if (numero > 0)
|
||||
{
|
||||
istDistMovAssi[numAx - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
istDistMovAssi[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (maintData[i].varName.EndsWith("_Invers"))
|
||||
{
|
||||
try
|
||||
{
|
||||
numAx = Convert.ToInt32(maintData[i].varName.Replace("Axis_", "").Replace("_Invers", ""));
|
||||
numero = Convert.ToInt32(maintData[i].varName.Replace("Axis_", "").Replace("_Invers", ""));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (numAx > 0)
|
||||
if (numero > 0)
|
||||
{
|
||||
istNumInvAssi[numAx - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
istNumInvAssi[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (maintData[i].varName.StartsWith("UnOp_"))
|
||||
{
|
||||
if (maintData[i].varName.EndsWith("_AccTime"))
|
||||
{
|
||||
try
|
||||
{
|
||||
numero = Convert.ToInt32(maintData[i].varName.Replace("UnOp_", "").Replace("_AccTime", ""));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (numero > 0)
|
||||
{
|
||||
istGiriElettrom[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (maintData[i].varName.StartsWith("VacPump_"))
|
||||
{
|
||||
if (maintData[i].varName.EndsWith("_WrkTime"))
|
||||
{
|
||||
try
|
||||
{
|
||||
numero = Convert.ToInt32(maintData[i].varName.Replace("VacPump_", "").Replace("_WrkTime", ""));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (numero > 0)
|
||||
{
|
||||
istVacPumpWrkTime[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (maintData[i].varName.StartsWith("VacAct_"))
|
||||
{
|
||||
if (maintData[i].varName.EndsWith("_Count"))
|
||||
{
|
||||
try
|
||||
{
|
||||
numero = Convert.ToInt32(maintData[i].varName.Replace("VacAct_", "").Replace("_Count", ""));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (numero > 0)
|
||||
{
|
||||
istVacActCount[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (maintData[i].varName.StartsWith("Lubro_"))
|
||||
{
|
||||
if (maintData[i].varName.EndsWith("_Count"))
|
||||
{
|
||||
try
|
||||
{
|
||||
numero = Convert.ToInt32(maintData[i].varName.Replace("Lubro_", "").Replace("_Count", ""));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (numero > 0)
|
||||
{
|
||||
istLubroCount[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// verifica se si debba aggiornare XML (e salva in adapter dati vari)
|
||||
@@ -785,8 +862,12 @@ namespace MTC_Adapter
|
||||
needSave = procOreMaccLav(needSave);
|
||||
needSave = procPartId(needSave);
|
||||
needSave = procPzProd(needSave);
|
||||
needSave = procGiriTotUnOp(needSave);
|
||||
needSave = procMovTotAssi(needSave);
|
||||
needSave = procNumInvAssi(needSave);
|
||||
needSave = procVacPump(needSave);
|
||||
needSave = procVacAct(needSave);
|
||||
needSave = procLubro(needSave);
|
||||
|
||||
// salvo se necessario!
|
||||
if (needSave) parentForm.persistXmlData();
|
||||
|
||||
@@ -30,6 +30,10 @@ namespace MTC_Adapter
|
||||
/// </summary>
|
||||
public Event mVacPumpStatus;
|
||||
/// <summary>
|
||||
/// valore work time della pompa vuoto
|
||||
/// </summary>
|
||||
public Event mVacPumpWrkTime;
|
||||
/// <summary>
|
||||
/// Classe Vacuum Pump (pompa)
|
||||
/// </summary>
|
||||
/// <param name="baseElem">element base contenente parametri (da XML)</param>
|
||||
@@ -583,6 +587,18 @@ namespace MTC_Adapter
|
||||
/// Vettore ATTUALE dei contatori del num pezzi fatti x PartId
|
||||
/// </summary>
|
||||
public uint[] currPathPartCount;
|
||||
/// <summary>
|
||||
/// Vettore ATTUALE dei contatori del work time x VacPump
|
||||
/// </summary>
|
||||
public uint[] currVacPumpWrkTime;
|
||||
/// <summary>
|
||||
/// Vettore ATTUALE dei contatori del numero impieghi VacAct
|
||||
/// </summary>
|
||||
public uint[] currVacActCount;
|
||||
/// <summary>
|
||||
/// Vettore ATTUALE dei contatori del Lubro
|
||||
/// </summary>
|
||||
public uint[] currLubroCount;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -613,6 +629,18 @@ namespace MTC_Adapter
|
||||
/// Vettore ISTANTANEO dei contatori del num pezzi fatti x PartId
|
||||
/// </summary>
|
||||
public uint[] istPathPartCount;
|
||||
/// <summary>
|
||||
/// Vettore ISTANTANEO dei contatori del work time x VacPump
|
||||
/// </summary>
|
||||
public uint[] istVacPumpWrkTime;
|
||||
/// <summary>
|
||||
/// Vettore ISTANTANEO dei contatori del numero impieghi VacAct
|
||||
/// </summary>
|
||||
public uint[] istVacActCount;
|
||||
/// <summary>
|
||||
/// Vettore ISTANTANEO dei contatori del Lubro
|
||||
/// </summary>
|
||||
public uint[] istLubroCount;
|
||||
|
||||
/// <summary>
|
||||
/// posizione precedente assi per calcolo distanze...
|
||||
@@ -906,8 +934,8 @@ namespace MTC_Adapter
|
||||
for (int i = 0; i < adpConf.nVacuumPump; i++)
|
||||
{
|
||||
vettVacPump[i] = new VacuumPomp(adpConf.VacuumPump[i]);
|
||||
//mAdapter.AddDataItem(vettVacPump[i].mVacPumpAlias);
|
||||
mAdapter.AddDataItem(vettVacPump[i].mVacPumpStatus);
|
||||
mAdapter.AddDataItem(vettVacPump[i].mVacPumpWrkTime);
|
||||
}
|
||||
// Attuatori vuoto
|
||||
vettVacAct = new VacuumAct[adpConf.nVacuumAct];
|
||||
@@ -1189,8 +1217,6 @@ namespace MTC_Adapter
|
||||
istDistMovAssi = new uint[currAdpConf.nAxis];
|
||||
contNumInvAssi = new uint[currAdpConf.nAxis];
|
||||
istNumInvAssi = new uint[currAdpConf.nAxis];
|
||||
currPathPartId = new string[currAdpConf.nPath];
|
||||
istPathPartId = new string[currAdpConf.nPath];
|
||||
for (int i = 0; i < currAdpConf.nAxis; i++)
|
||||
{
|
||||
// leggo tutti i dati...
|
||||
@@ -1202,6 +1228,8 @@ namespace MTC_Adapter
|
||||
contDistMovAssi[i] = Convert.ToUInt32(riContDist.Value);
|
||||
contNumInvAssi[i] = Convert.ToUInt32(riNumInv.Value);
|
||||
}
|
||||
currPathPartId = new string[currAdpConf.nPath];
|
||||
istPathPartId = new string[currAdpConf.nPath];
|
||||
for (int i = 0; i < currAdpConf.nPath; i++)
|
||||
{
|
||||
// leggo tutti i dati...
|
||||
@@ -1213,6 +1241,39 @@ namespace MTC_Adapter
|
||||
currPathPartId[i] = riPathProgr.Value;
|
||||
currPathPartCount[i] = Convert.ToUInt32(riPathPzTot.Value);
|
||||
}
|
||||
currVacPumpWrkTime = new uint[currAdpConf.nVacuumPump];
|
||||
istVacPumpWrkTime = new uint[currAdpConf.nVacuumPump];
|
||||
for (int i = 0; i < currAdpConf.nVacuumPump; i++)
|
||||
{
|
||||
// leggo tutti i dati...
|
||||
List<DataRefItem<string, string>> listaDR = currAdpConf.VacuumPump[i].dataRefList;
|
||||
// punto all'item
|
||||
DataRefItem<string, string> riVacPumpWrk = listaDR.Find(x => x.Key == string.Format("VacPump_{0:00}_WrkTime", i + 1));
|
||||
// recupero valori...
|
||||
currVacPumpWrkTime[i] = Convert.ToUInt32(riVacPumpWrk.Value);
|
||||
}
|
||||
currVacActCount = new uint[currAdpConf.nVacuumAct];
|
||||
istVacActCount = new uint[currAdpConf.nVacuumAct];
|
||||
for (int i = 0; i < currAdpConf.nVacuumAct; i++)
|
||||
{
|
||||
// leggo tutti i dati...
|
||||
List<DataRefItem<string, string>> listaDR = currAdpConf.VacuumAct[i].dataRefList;
|
||||
// punto all'item
|
||||
DataRefItem<string, string> riVacActCount = listaDR.Find(x => x.Key == string.Format("VacAct_{0:00}_Count", i + 1));
|
||||
// recupero valori...
|
||||
currVacActCount[i] = Convert.ToUInt32(riVacActCount.Value);
|
||||
}
|
||||
currLubroCount = new uint[currAdpConf.nLubro];
|
||||
istLubroCount = new uint[currAdpConf.nLubro];
|
||||
for (int i = 0; i < currAdpConf.nLubro; i++)
|
||||
{
|
||||
// leggo tutti i dati...
|
||||
List<DataRefItem<string, string>> listaDR = currAdpConf.Lubro[i].dataRefList;
|
||||
// punto all'item
|
||||
DataRefItem<string, string> riLubro = listaDR.Find(x => x.Key == string.Format("Lubro_{0:00}_Count", i + 1));
|
||||
// recupero valori...
|
||||
currLubroCount[i] = Convert.ToUInt32(riLubro.Value);
|
||||
}
|
||||
|
||||
mAlarmSystem.Normal();
|
||||
mAlarmCNC.Normal();
|
||||
@@ -1835,6 +1896,58 @@ namespace MTC_Adapter
|
||||
currAdpConf.UnOp[i].dataRefList = listaDR;
|
||||
return contTot;
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiorna un valore RefList del vettore VacPump in INCREMENTO e lo restituisce
|
||||
/// </summary>
|
||||
/// <param name="i"></param>
|
||||
/// <param name="delta"></param>
|
||||
/// <param name="searchString"></param>
|
||||
/// <returns>Nuovo valore incrementato</returns>
|
||||
private uint updateVacPumpRefListByIncr(int i, uint delta, string searchString)
|
||||
{
|
||||
// leggo tutti i dati...
|
||||
List<DataRefItem<string, string>> listaDR = currAdpConf.VacuumPump[i].dataRefList;
|
||||
// recupero valore giri...
|
||||
uint contTot = updateRefListByIncr(i, delta, searchString, ref listaDR);
|
||||
// salvo in adapter!
|
||||
currAdpConf.VacuumPump[i].dataRefList = listaDR;
|
||||
return contTot;
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiorna un valore RefList del vettore VacAct in INCREMENTO e lo restituisce
|
||||
/// </summary>
|
||||
/// <param name="i"></param>
|
||||
/// <param name="delta"></param>
|
||||
/// <param name="searchString"></param>
|
||||
/// <returns>Nuovo valore incrementato</returns>
|
||||
private uint updateVacActRefListByIncr(int i, uint delta, string searchString)
|
||||
{
|
||||
// leggo tutti i dati...
|
||||
List<DataRefItem<string, string>> listaDR = currAdpConf.VacuumAct[i].dataRefList;
|
||||
// recupero valore giri...
|
||||
uint contTot = updateRefListByIncr(i, delta, searchString, ref listaDR);
|
||||
// salvo in adapter!
|
||||
currAdpConf.VacuumAct[i].dataRefList = listaDR;
|
||||
return contTot;
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiorna un valore RefList del vettore Lubro in INCREMENTO e lo restituisce
|
||||
/// </summary>
|
||||
/// <param name="i"></param>
|
||||
/// <param name="delta"></param>
|
||||
/// <param name="searchString"></param>
|
||||
/// <returns>Nuovo valore incrementato</returns>
|
||||
private uint updateLubroRefListByIncr(int i, uint delta, string searchString)
|
||||
{
|
||||
// leggo tutti i dati...
|
||||
List<DataRefItem<string, string>> listaDR = currAdpConf.Lubro[i].dataRefList;
|
||||
// recupero valore giri...
|
||||
uint contTot = updateRefListByIncr(i, delta, searchString, ref listaDR);
|
||||
// salvo in adapter!
|
||||
currAdpConf.Lubro[i].dataRefList = listaDR;
|
||||
return contTot;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processing delle ore macchina ACCESA
|
||||
/// </summary>
|
||||
@@ -1985,7 +2098,6 @@ namespace MTC_Adapter
|
||||
|
||||
return needSave;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processing delle variabili sul totale num inversioni degli assi
|
||||
/// </summary>
|
||||
@@ -2000,10 +2112,8 @@ namespace MTC_Adapter
|
||||
{
|
||||
uint delta = istNumInvAssi[i] - contNumInvAssi[i];
|
||||
uint contTot = updateUnOpRefListByIncr(i, delta, "Axis_{0:00}_Invers");
|
||||
|
||||
// passo valore totale all'adapter
|
||||
vettAxis[i].mAxInvDDone.Value = contTot.ToString();
|
||||
|
||||
// segnalo necessità salvataggio!
|
||||
needSave = true;
|
||||
}
|
||||
@@ -2013,6 +2123,78 @@ namespace MTC_Adapter
|
||||
|
||||
return needSave;
|
||||
}
|
||||
/// <summary>
|
||||
/// Processing delle variabili sulle VacPump
|
||||
/// </summary>
|
||||
/// <param name="needSave"></param>
|
||||
/// <returns></returns>
|
||||
public bool procVacPump(bool needSave)
|
||||
{
|
||||
for (int i = 0; i < currAdpConf.nVacuumPump; i++)
|
||||
{
|
||||
// controllo valore riferimento...
|
||||
if (istVacPumpWrkTime[i] > currVacPumpWrkTime[i])
|
||||
{
|
||||
uint delta = istVacPumpWrkTime[i] - currVacPumpWrkTime[i];
|
||||
uint contTot = updateVacPumpRefListByIncr(i, delta, "VacPump_{0:00}_WrkTime");
|
||||
// passo valore totale all'adapter
|
||||
vettVacPump[i].mVacPumpWrkTime.Value = contTot;
|
||||
// segnalo necessità salvataggio!
|
||||
needSave = true;
|
||||
}
|
||||
// ...aggiorno valore riferimento...
|
||||
currVacPumpWrkTime[i] = istVacPumpWrkTime[i];
|
||||
}
|
||||
return needSave;
|
||||
}
|
||||
/// <summary>
|
||||
/// Processing delle variabili sulle VacAct
|
||||
/// </summary>
|
||||
/// <param name="needSave"></param>
|
||||
/// <returns></returns>
|
||||
public bool procVacAct(bool needSave)
|
||||
{
|
||||
for (int i = 0; i < currAdpConf.nVacuumAct; i++)
|
||||
{
|
||||
// controllo valore riferimento...
|
||||
if (istVacActCount[i] > currVacActCount[i])
|
||||
{
|
||||
uint delta = istVacActCount[i] - currVacActCount[i];
|
||||
uint contTot = updateVacPumpRefListByIncr(i, delta, "VacAct_{0:00}_Count");
|
||||
// passo valore totale all'adapter
|
||||
vettVacAct[i].mVacActCount.Value = contTot;
|
||||
// segnalo necessità salvataggio!
|
||||
needSave = true;
|
||||
}
|
||||
// ...aggiorno valore riferimento...
|
||||
currVacActCount[i] = istVacActCount[i];
|
||||
}
|
||||
return needSave;
|
||||
}
|
||||
/// <summary>
|
||||
/// Processing delle variabili sui componenti Lubro
|
||||
/// </summary>
|
||||
/// <param name="needSave"></param>
|
||||
/// <returns></returns>
|
||||
public bool procLubro(bool needSave)
|
||||
{
|
||||
for (int i = 0; i < currAdpConf.nLubro; i++)
|
||||
{
|
||||
// controllo valore riferimento...
|
||||
if (istLubroCount[i] > currLubroCount[i])
|
||||
{
|
||||
uint delta = istLubroCount[i] - currLubroCount[i];
|
||||
uint contTot = updateVacPumpRefListByIncr(i, delta, "Lubro_{0:00}_Count");
|
||||
// passo valore totale all'adapter
|
||||
vettLubro[i].mLubroNum.Value = contTot;
|
||||
// segnalo necessità salvataggio!
|
||||
needSave = true;
|
||||
}
|
||||
// ...aggiorno valore riferimento...
|
||||
currLubroCount[i] = istLubroCount[i];
|
||||
}
|
||||
return needSave;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user