diff --git a/MTC_Sim/.vs/MTC_Sim/v14/.suo b/MTC_Sim/.vs/MTC_Sim/v14/.suo index 6d68a41..a82688d 100644 Binary files a/MTC_Sim/.vs/MTC_Sim/v14/.suo and b/MTC_Sim/.vs/MTC_Sim/v14/.suo differ diff --git a/MTC_Sim/MTC_Sim/AdapterDemo.cs b/MTC_Sim/MTC_Sim/AdapterDemo.cs index 940aceb..a5d5600 100644 --- a/MTC_Sim/MTC_Sim/AdapterDemo.cs +++ b/MTC_Sim/MTC_Sim/AdapterDemo.cs @@ -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 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 alarm in parentForm.genericAlarm) + { + addGenericAlarm(alarm); + } + } } public override void getPath() diff --git a/MTC_Sim/MTC_Sim/AdapterGeneric.cs b/MTC_Sim/MTC_Sim/AdapterGeneric.cs index cf315bc..b31d25f 100644 --- a/MTC_Sim/MTC_Sim/AdapterGeneric.cs +++ b/MTC_Sim/MTC_Sim/AdapterGeneric.cs @@ -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(); } /// diff --git a/MTC_Sim/MTC_Sim/CMS_MachineSim.cs b/MTC_Sim/MTC_Sim/CMS_MachineSim.cs index 1f66c20..fdafd4b 100644 --- a/MTC_Sim/MTC_Sim/CMS_MachineSim.cs +++ b/MTC_Sim/MTC_Sim/CMS_MachineSim.cs @@ -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> otherAlarm + public List> genericAlarm { get { diff --git a/MTC_Sim/MTC_Sim/utils.cs b/MTC_Sim/MTC_Sim/utils.cs index cfc3eca..816e2c5 100644 --- a/MTC_Sim/MTC_Sim/utils.cs +++ b/MTC_Sim/MTC_Sim/utils.cs @@ -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