Agganciati allarmi!!!

This commit is contained in:
Samuele E. Locatelli
2016-04-28 09:04:11 +02:00
parent 3ce6388b0b
commit 4b5f609407
5 changed files with 57 additions and 26 deletions
Binary file not shown.
+48 -14
View File
@@ -33,6 +33,7 @@ namespace MTC_Sim
base.startAdapter(port);
// aggiungo altre condizioni specifiche...
mTemp.Normal();
mFillLevel.Normal();
}
@@ -86,24 +87,57 @@ namespace MTC_Sim
mMessage.Value = parentForm.datiProd.MessageText;
}
}
protected void addSystemAlarm(int numAllarme)
{
mAlarmSystem.Add(Condition.Level.FAULT, string.Format("ERR_{0:###}: Errore", numAllarme), string.Format("ERR_{0:###}", numAllarme));
}
protected void addPlcAlarm(int numAllarme)
{
mAlarmPLC.Add(Condition.Level.FAULT, string.Format("ERR_{0:###}: Errore", numAllarme), string.Format("ERR_{0:###}", numAllarme));
}
protected void addCncAlarm(int numAllarme)
{
mAlarmCNC.Add(Condition.Level.FAULT, string.Format("ERR_{0:###}: Errore", numAllarme), string.Format("ERR_{0:###}", numAllarme));
}
protected void addGenericAlarm(DataRefItem<int, string> allarme)
{
mAlarmGeneral.Add(Condition.Level.FAULT, string.Format("ERR_{0:###}: Errore {1}", allarme.Key, allarme.Value), string.Format("ERR_{0:###}_{1}", allarme.Key, allarme.Value));
}
public override void getAlarms()
{
base.getAlarms();
if (parentForm.datiProd.err_01)
mAlarmSystem.Add(Condition.Level.FAULT, "ERR_01: Yur Flaz Bat is flapping", "FLAZBAT");
if (parentForm.datiProd.err_02)
mAlarmSystem.Add(Condition.Level.WARNING, "ERR_02: Something went wrong", "AKAK");
if (parentForm.datiProd.err_03)
mAlarmSystem.Add(Condition.Level.FAULT, "ERR_03: No program loaded", "PROG");
if (parentForm.datiProd.err_04)
mTemp.Add(Condition.Level.WARNING, "ERR_04: Temperature is too high", "OT");
if (parentForm.datiProd.err_05)
mAlarmCNC.Add(Condition.Level.FAULT, "ERR_05: Axis overload", "OL");
if (parentForm.datiProd.err_06)
mAlarmPLC.Add(Condition.Level.FAULT, "ERR_06: Travel outside boundaries", "OP");
if (parentForm.systemAlarm.Count > 0)
{
foreach (Int32 alarm in parentForm.systemAlarm)
{
addSystemAlarm(alarm);
}
}
if (parentForm.plcAlarm.Count > 0)
{
foreach (Int32 alarm in parentForm.plcAlarm)
{
addPlcAlarm(alarm);
}
}
if (parentForm.cncAlarm.Count > 0)
{
foreach (Int32 alarm in parentForm.cncAlarm)
{
addCncAlarm(alarm);
}
}
if (parentForm.genericAlarm.Count > 0)
{
foreach (DataRefItem<int, string> alarm in parentForm.genericAlarm)
{
addGenericAlarm(alarm);
}
}
}
public override void getPath()
+5 -2
View File
@@ -566,10 +566,11 @@ namespace MTC_Sim
#region Conditions
// vettori vari: allarmi sistema, PLC, CNC ed allarmi HMI
public Condition mAlarmSystem = new Condition("system");
public Condition mAlarmSystem = new Condition("System");
public Condition mAlarmCNC = new Condition("CNC");
public Condition mAlarmPLC = new Condition("PLC");
public Condition mAlarmHMI = new Condition("HMI");
public Condition mAlarmGeneral = new Condition("General");
#endregion
@@ -756,6 +757,7 @@ namespace MTC_Sim
mAdapter.AddDataItem(mAlarmCNC);
mAdapter.AddDataItem(mAlarmPLC);
mAdapter.AddDataItem(mAlarmHMI);
mAdapter.AddDataItem(mAlarmGeneral);
}
@@ -775,7 +777,8 @@ namespace MTC_Sim
mAlarmSystem.Normal();
mAlarmCNC.Normal();
mAlarmPLC.Normal();
mAlarmHMI.Normal();
mAlarmCNC.Normal();
mAlarmGeneral.Normal();
}
/// <summary>
+4 -2
View File
@@ -595,13 +595,15 @@ namespace MTC_Sim
answ.pzTot = pzOk + pzKo;
#if false
// allarmi...
answ.err_01 = SysErr_01.Checked;
answ.err_02 = SysErr_02.Checked;
answ.err_03 = SysErr_03.Checked;
answ.err_04 = PlcErr_01.Checked;
answ.err_05 = PlcErr_02.Checked;
answ.err_06 = PlcErr_03.Checked;
answ.err_06 = PlcErr_03.Checked;
#endif
// ritorno oggetto!
@@ -943,7 +945,7 @@ namespace MTC_Sim
}
}
public List<DataRefItem<int, string>> otherAlarm
public List<DataRefItem<int, string>> genericAlarm
{
get
{
-8
View File
@@ -147,14 +147,6 @@ namespace MTC_Sim
public int pzTot;
public int pzOk;
public int pzKo;
public bool err_01;
public bool err_02;
public bool err_03;
public bool err_04;
public bool err_05;
public bool err_06;
}
public struct PathData