diff --git a/MTC_Sim/.vs/MTC_Sim/v14/.suo b/MTC_Sim/.vs/MTC_Sim/v14/.suo
index 30231be..666177c 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 18f55c0..8def6e2 100644
--- a/MTC_Sim/MTC_Sim/AdapterDemo.cs
+++ b/MTC_Sim/MTC_Sim/AdapterDemo.cs
@@ -1,4 +1,5 @@
-using System;
+using MTConnect;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -48,7 +49,49 @@ namespace MTC_Sim
// imposto EXE mode
mExec.Value = parentForm.datiProd.ExeMode;
+ // imposto func mode...
+ mFunctionalMode.Value = parentForm.datiProd.FuncMode;
+
+ // se ho un messaggio...
+ if(parentForm.datiProd.MessageText.Length>0)
+ {
+ mMessage.Code = parentForm.datiProd.MessageCode;
+ mMessage.Value = parentForm.datiProd.MessageText;
+ }
}
+ public override void getOtherData()
+ {
+ base.getOtherData();
+
+ mCommonVariable.Value = parentForm.datiProd.otherData;
+ }
+
+ public override void getAlarms()
+ {
+ base.getAlarms();
+
+ if (parentForm.datiProd.err_01)
+ mSystem.Add(Condition.Level.FAULT, "ERR_01: Yur Flaz Bat is flapping", "FLAZBAT");
+ if (parentForm.datiProd.err_02)
+ mSystem.Add(Condition.Level.WARNING, "ERR_02: Something went wrong", "AKAK");
+ if (parentForm.datiProd.err_03)
+ mSystem.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)
+ mOverload.Add(Condition.Level.FAULT, "ERR_05: Axis overload", "OL");
+ if (parentForm.datiProd.err_06)
+ mTravel.Add(Condition.Level.FAULT, "ERR_06: Travel outside boundaries", "OP");
+ }
+
+ public override void getAxes()
+ {
+ base.getAxes();
+
+ mxLoad.Value = parentForm.datiProd.xLoad;
+ mcLoad.Value = parentForm.datiProd.cLoad;
+ }
}
}
diff --git a/MTC_Sim/MTC_Sim/AdapterGeneric.cs b/MTC_Sim/MTC_Sim/AdapterGeneric.cs
index f4073f4..2259504 100644
--- a/MTC_Sim/MTC_Sim/AdapterGeneric.cs
+++ b/MTC_Sim/MTC_Sim/AdapterGeneric.cs
@@ -18,7 +18,7 @@ namespace MTC_Sim
///
/// adapter globale
///
- Adapter mAdapter = new Adapter();
+ public Adapter mAdapter = new Adapter();
protected CMS_MachineSim parentForm;
@@ -53,25 +53,29 @@ namespace MTC_Sim
mAdapter.AddDataItem(mCod_S);
mAdapter.AddDataItem(mCod_T);
-
+ // modalità esecutiva e funzionale
mAdapter.AddDataItem(mMode);
mAdapter.AddDataItem(mExec);
-
mAdapter.AddDataItem(mFunctionalMode);
+
+ // messaggi ulteriori
mAdapter.AddDataItem(mMessage);
+ // TimeSeries (es assi)
mAdapter.AddDataItem(mPosition);
mAdapter.AddDataItem(mxLoad);
mAdapter.AddDataItem(mSpeed);
mAdapter.AddDataItem(mcLoad);
+ // allarmi
mAdapter.AddDataItem(mSystem);
mAdapter.AddDataItem(mTemp);
mAdapter.AddDataItem(mOverload);
mAdapter.AddDataItem(mTravel);
mAdapter.AddDataItem(mFillLevel);
+ // altre variabili
mAdapter.AddDataItem(mCommonVariable);
}
@@ -158,9 +162,9 @@ namespace MTC_Sim
///
public Event mCod_T = new Event("Cod_T");
-
-
-
+ ///
+ /// modalità funzionale
+ ///
public Event mFunctionalMode = new Event("func");
@@ -171,11 +175,11 @@ namespace MTC_Sim
#region Conditions
- Condition mSystem = new Condition("system");
- Condition mTemp = new Condition("temp");
- Condition mOverload = new Condition("overload");
- Condition mTravel = new Condition("travel");
- Condition mFillLevel = new Condition("cool_low", true);
+ public Condition mSystem = new Condition("system");
+ public Condition mTemp = new Condition("temp");
+ public Condition mOverload = new Condition("overload");
+ public Condition mTravel = new Condition("travel");
+ public Condition mFillLevel = new Condition("cool_low", true);
#endregion
@@ -183,7 +187,7 @@ namespace MTC_Sim
#region Messages
- Message mMessage = new Message("message");
+ public Message mMessage = new Message("message");
#endregion
@@ -193,11 +197,11 @@ namespace MTC_Sim
- Sample mPosition = new Sample("xPosition");
- Sample mxLoad = new Sample("xLoad");
+ public Sample mPosition = new Sample("xPosition");
+ public Sample mxLoad = new Sample("xLoad");
- Sample mSpeed = new Sample("sSpeed");
- Sample mcLoad = new Sample("sLoad");
+ public Sample mSpeed = new Sample("sSpeed");
+ public Sample mcLoad = new Sample("sLoad");
#endregion
@@ -254,55 +258,40 @@ namespace MTC_Sim
// fix codici M/S/T
getCodMST();
-
- // fix dati x allarmi e modalità RUN/EXEC
+ // fix dati x ulteriori (allarmi, modalità RUN/EXEC, ...)
getCurrMode();
-#if false
-
+ getAxes();
- mFunctionalMode.Value = functionalMode.Text;
+ getAlarms();
- if (messageCode.Text.Length > 0)
- {
- mMessage.Code = messageCode.Text;
- mMessage.Value = messageText.Text;
- }
-
- mxLoad.Value = xLoad.Value;
- mcLoad.Value = cLoad.Value;
-
- if (flazBat.Checked)
- mSystem.Add(Condition.Level.FAULT, "Yur Flaz Bat is flapping", "FLAZBAT");
- if (something.Checked)
- mSystem.Add(Condition.Level.WARNING, "Something went wrong", "AKAK");
- if (noProgram.Checked)
- mSystem.Add(Condition.Level.FAULT, "No program loaded", "PROG");
-
- if (overtemp.Checked)
- mTemp.Add(Condition.Level.WARNING, "Temperature is too high", "OT");
- if (overload.Checked)
- mOverload.Add(Condition.Level.FAULT, "Axis overload", "OL");
- if (travel.Checked)
- mTravel.Add(Condition.Level.FAULT, "Travel outside boundaries", "OP");
-
- DataGridViewColumnCollection headers = commonVariables.Columns;
- DataGridViewCellCollection cells = commonVariables.Rows[0].Cells;
- string result = "";
-
- for (int i = 0; i < cells.Count; i++)
- {
- result += headers[i].HeaderText + ":" + cells[i].Value + " ";
- }
-
- mCommonVariable.Value = result;
-#endif
+ getOtherData();
+ // INVIO dati variati!
mAdapter.SendChanged();
-
}
-
+ ///
+ /// recupero dati ASSI
+ ///
+ public virtual void getAxes()
+ {
+ // da gestire su ogni adapter...
+ }
+ ///
+ /// recupero allarmi
+ ///
+ public virtual void getAlarms()
+ {
+ // da gestire su ogni adapter...
+ }
+ ///
+ /// carico ulteriori altri dati
+ ///
+ public virtual void getOtherData()
+ {
+ // da gestire su ogni adapter...
+ }
///
/// controllo codici MST
///
@@ -323,17 +312,21 @@ namespace MTC_Sim
mID.Value = utils.CRS("D1_ID");
mUUID.Value = utils.CRS("D1_UUID");
}
-
+ ///
+ /// dati relativi al programma
+ ///
public virtual void getCurrProgramData()
{
// da gestire su ogni adapter...
}
+ ///
+ /// dati relativi al RUN mode
+ ///
public virtual void getCurrMode()
{
// da gestire su ogni adapter...
}
-
-
+
#endregion
#region area metodi comunicazione con PLC/CNC
@@ -345,7 +338,7 @@ namespace MTC_Sim
mCod_M.Value = getNextMCode;
// se il valore è "" allora alzo flag lettura...
if (mCod_M.Value.ToString() == "") STROBE_ADP = STROBE_ADP | Strobe.M_CODE;
-
+
}
else
{
diff --git a/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs b/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs
index 4fa6fae..c49b406 100644
--- a/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs
+++ b/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs
@@ -29,7 +29,7 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
- this.flazBat = new System.Windows.Forms.CheckBox();
+ this.ERR_05 = new System.Windows.Forms.CheckBox();
this.cv24 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.gather = new System.Windows.Forms.Timer(this.components);
this.groupBox4 = new System.Windows.Forms.GroupBox();
@@ -55,9 +55,9 @@
this.cv21 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.cv22 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.cv23 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.travel = new System.Windows.Forms.CheckBox();
+ this.ERR_06 = new System.Windows.Forms.CheckBox();
this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.something = new System.Windows.Forms.CheckBox();
+ this.ERR_04 = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.dump = new System.Windows.Forms.Button();
this.stop = new System.Windows.Forms.Button();
@@ -75,10 +75,10 @@
this.stopped = new System.Windows.Forms.RadioButton();
this.running = new System.Windows.Forms.RadioButton();
this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.overtemp = new System.Windows.Forms.CheckBox();
- this.coolant = new System.Windows.Forms.CheckBox();
- this.noProgram = new System.Windows.Forms.CheckBox();
- this.overload = new System.Windows.Forms.CheckBox();
+ this.ERR_03 = new System.Windows.Forms.CheckBox();
+ this.ERR_00 = new System.Windows.Forms.CheckBox();
+ this.ERR_02 = new System.Windows.Forms.CheckBox();
+ this.ERR_01 = new System.Windows.Forms.CheckBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.xPositionValue = new System.Windows.Forms.TextBox();
this.xLoadValue = new System.Windows.Forms.TextBox();
@@ -141,15 +141,15 @@
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
- // flazBat
+ // ERR_05
//
- this.flazBat.AutoSize = true;
- this.flazBat.Location = new System.Drawing.Point(151, 43);
- this.flazBat.Name = "flazBat";
- this.flazBat.Size = new System.Drawing.Size(76, 17);
- this.flazBat.TabIndex = 6;
- this.flazBat.Text = "FLAZ BAT";
- this.flazBat.UseVisualStyleBackColor = true;
+ this.ERR_05.AutoSize = true;
+ this.ERR_05.Location = new System.Drawing.Point(151, 43);
+ this.ERR_05.Name = "ERR_05";
+ this.ERR_05.Size = new System.Drawing.Size(67, 17);
+ this.ERR_05.TabIndex = 6;
+ this.ERR_05.Text = "ERR_05";
+ this.ERR_05.UseVisualStyleBackColor = true;
//
// cv24
//
@@ -167,9 +167,9 @@
this.groupBox4.Controls.Add(this.label7);
this.groupBox4.Controls.Add(this.messageText);
this.groupBox4.Controls.Add(this.messageCode);
- this.groupBox4.Location = new System.Drawing.Point(11, 330);
+ this.groupBox4.Location = new System.Drawing.Point(12, 253);
this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(375, 52);
+ this.groupBox4.Size = new System.Drawing.Size(379, 52);
this.groupBox4.TabIndex = 44;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Message";
@@ -373,35 +373,35 @@
this.cv23.Name = "cv23";
this.cv23.Width = 75;
//
- // travel
+ // ERR_06
//
- this.travel.AutoSize = true;
- this.travel.Location = new System.Drawing.Point(151, 89);
- this.travel.Name = "travel";
- this.travel.Size = new System.Drawing.Size(155, 17);
- this.travel.TabIndex = 5;
- this.travel.Text = "FM_1_Achse_Positionierun";
- this.travel.UseVisualStyleBackColor = true;
+ this.ERR_06.AutoSize = true;
+ this.ERR_06.Location = new System.Drawing.Point(151, 66);
+ this.ERR_06.Name = "ERR_06";
+ this.ERR_06.Size = new System.Drawing.Size(67, 17);
+ this.ERR_06.TabIndex = 5;
+ this.ERR_06.Text = "ERR_06";
+ this.ERR_06.UseVisualStyleBackColor = true;
//
// groupBox6
//
this.groupBox6.Controls.Add(this.commonVariables);
- this.groupBox6.Location = new System.Drawing.Point(12, 388);
+ this.groupBox6.Location = new System.Drawing.Point(11, 416);
this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(374, 74);
+ this.groupBox6.Size = new System.Drawing.Size(380, 74);
this.groupBox6.TabIndex = 50;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "Common Variables (EXT)";
//
- // something
+ // ERR_04
//
- this.something.AutoSize = true;
- this.something.Location = new System.Drawing.Point(151, 20);
- this.something.Name = "something";
- this.something.Size = new System.Drawing.Size(89, 17);
- this.something.TabIndex = 4;
- this.something.Text = "ALR DK TLD";
- this.something.UseVisualStyleBackColor = true;
+ this.ERR_04.AutoSize = true;
+ this.ERR_04.Location = new System.Drawing.Point(151, 20);
+ this.ERR_04.Name = "ERR_04";
+ this.ERR_04.Size = new System.Drawing.Size(67, 17);
+ this.ERR_04.TabIndex = 4;
+ this.ERR_04.Text = "ERR_04";
+ this.ERR_04.UseVisualStyleBackColor = true;
//
// groupBox1
//
@@ -577,13 +577,13 @@
//
// groupBox3
//
- this.groupBox3.Controls.Add(this.flazBat);
- this.groupBox3.Controls.Add(this.travel);
- this.groupBox3.Controls.Add(this.something);
- this.groupBox3.Controls.Add(this.overtemp);
- this.groupBox3.Controls.Add(this.coolant);
- this.groupBox3.Controls.Add(this.noProgram);
- this.groupBox3.Controls.Add(this.overload);
+ this.groupBox3.Controls.Add(this.ERR_05);
+ this.groupBox3.Controls.Add(this.ERR_06);
+ this.groupBox3.Controls.Add(this.ERR_04);
+ this.groupBox3.Controls.Add(this.ERR_03);
+ this.groupBox3.Controls.Add(this.ERR_00);
+ this.groupBox3.Controls.Add(this.ERR_02);
+ this.groupBox3.Controls.Add(this.ERR_01);
this.groupBox3.Location = new System.Drawing.Point(410, 492);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(375, 114);
@@ -591,46 +591,46 @@
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Alarms";
//
- // overtemp
+ // ERR_03
//
- this.overtemp.AutoSize = true;
- this.overtemp.Location = new System.Drawing.Point(7, 89);
- this.overtemp.Name = "overtemp";
- this.overtemp.Size = new System.Drawing.Size(72, 17);
- this.overtemp.TabIndex = 3;
- this.overtemp.Text = "Overtemp";
- this.overtemp.UseVisualStyleBackColor = true;
+ this.ERR_03.AutoSize = true;
+ this.ERR_03.Location = new System.Drawing.Point(7, 66);
+ this.ERR_03.Name = "ERR_03";
+ this.ERR_03.Size = new System.Drawing.Size(67, 17);
+ this.ERR_03.TabIndex = 3;
+ this.ERR_03.Text = "ERR_03";
+ this.ERR_03.UseVisualStyleBackColor = true;
//
- // coolant
+ // ERR_00
//
- this.coolant.AutoSize = true;
- this.coolant.Location = new System.Drawing.Point(7, 66);
- this.coolant.Name = "coolant";
- this.coolant.Size = new System.Drawing.Size(85, 17);
- this.coolant.TabIndex = 2;
- this.coolant.Text = "Coolant Low";
- this.coolant.UseVisualStyleBackColor = true;
- this.coolant.CheckedChanged += new System.EventHandler(this.coolant_CheckedChanged);
+ this.ERR_00.AutoSize = true;
+ this.ERR_00.Location = new System.Drawing.Point(151, 89);
+ this.ERR_00.Name = "ERR_00";
+ this.ERR_00.Size = new System.Drawing.Size(112, 17);
+ this.ERR_00.TabIndex = 2;
+ this.ERR_00.Text = "ERR_00 (realtime)";
+ this.ERR_00.UseVisualStyleBackColor = true;
+ this.ERR_00.CheckedChanged += new System.EventHandler(this.ERR_00_CheckedChanged);
//
- // noProgram
+ // ERR_02
//
- this.noProgram.AutoSize = true;
- this.noProgram.Location = new System.Drawing.Point(7, 43);
- this.noProgram.Name = "noProgram";
- this.noProgram.Size = new System.Drawing.Size(82, 17);
- this.noProgram.TabIndex = 1;
- this.noProgram.Text = "No Program";
- this.noProgram.UseVisualStyleBackColor = true;
+ this.ERR_02.AutoSize = true;
+ this.ERR_02.Location = new System.Drawing.Point(7, 43);
+ this.ERR_02.Name = "ERR_02";
+ this.ERR_02.Size = new System.Drawing.Size(67, 17);
+ this.ERR_02.TabIndex = 1;
+ this.ERR_02.Text = "ERR_02";
+ this.ERR_02.UseVisualStyleBackColor = true;
//
- // overload
+ // ERR_01
//
- this.overload.AutoSize = true;
- this.overload.Location = new System.Drawing.Point(7, 20);
- this.overload.Name = "overload";
- this.overload.Size = new System.Drawing.Size(91, 17);
- this.overload.TabIndex = 0;
- this.overload.Text = "Axis Overload";
- this.overload.UseVisualStyleBackColor = true;
+ this.ERR_01.AutoSize = true;
+ this.ERR_01.Location = new System.Drawing.Point(7, 20);
+ this.ERR_01.Name = "ERR_01";
+ this.ERR_01.Size = new System.Drawing.Size(67, 17);
+ this.ERR_01.TabIndex = 0;
+ this.ERR_01.Text = "ERR_01";
+ this.ERR_01.UseVisualStyleBackColor = true;
//
// groupBox2
//
@@ -936,7 +936,7 @@
this.groupBox12.Controls.Add(this.label20);
this.groupBox12.Location = new System.Drawing.Point(405, 147);
this.groupBox12.Name = "groupBox12";
- this.groupBox12.Size = new System.Drawing.Size(379, 100);
+ this.groupBox12.Size = new System.Drawing.Size(380, 100);
this.groupBox12.TabIndex = 58;
this.groupBox12.TabStop = false;
this.groupBox12.Text = "Codici M/S/T";
@@ -1105,7 +1105,7 @@
#endregion
- private System.Windows.Forms.CheckBox flazBat;
+ private System.Windows.Forms.CheckBox ERR_05;
private System.Windows.Forms.DataGridViewTextBoxColumn cv24;
private System.Windows.Forms.Timer gather;
private System.Windows.Forms.GroupBox groupBox4;
@@ -1131,9 +1131,9 @@
private System.Windows.Forms.DataGridViewTextBoxColumn cv21;
private System.Windows.Forms.DataGridViewTextBoxColumn cv22;
private System.Windows.Forms.DataGridViewTextBoxColumn cv23;
- private System.Windows.Forms.CheckBox travel;
+ private System.Windows.Forms.CheckBox ERR_06;
private System.Windows.Forms.GroupBox groupBox6;
- private System.Windows.Forms.CheckBox something;
+ private System.Windows.Forms.CheckBox ERR_04;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button stop;
private System.Windows.Forms.Button start;
@@ -1150,10 +1150,10 @@
private System.Windows.Forms.RadioButton stopped;
private System.Windows.Forms.RadioButton running;
private System.Windows.Forms.GroupBox groupBox3;
- private System.Windows.Forms.CheckBox overtemp;
- private System.Windows.Forms.CheckBox coolant;
- private System.Windows.Forms.CheckBox noProgram;
- private System.Windows.Forms.CheckBox overload;
+ private System.Windows.Forms.CheckBox ERR_03;
+ private System.Windows.Forms.CheckBox ERR_00;
+ private System.Windows.Forms.CheckBox ERR_02;
+ private System.Windows.Forms.CheckBox ERR_01;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox xPositionValue;
private System.Windows.Forms.TextBox xLoadValue;
diff --git a/MTC_Sim/MTC_Sim/CMS_MachineSim.cs b/MTC_Sim/MTC_Sim/CMS_MachineSim.cs
index 84ac084..6489a09 100644
--- a/MTC_Sim/MTC_Sim/CMS_MachineSim.cs
+++ b/MTC_Sim/MTC_Sim/CMS_MachineSim.cs
@@ -134,90 +134,6 @@ namespace MTC_Sim
// refresh stringhe code M/S/T
refreshCodeMST();
MainProgrBar.PerformStep();
-#if false
- mAdapter.Begin();
- // nome
- mName.Value = D1_NAME.Text;
- mID.Value = D1_ID.Text;
- mUUID.Value = D1_UUID.Text;
-
- // programma
- mProgram.Value = program.Text;
- mProgRowNum.Value = PROG_ROW_NUM.Text;
- mPartId.Value = partID.Text;
- mOperator.Value = OPERATOR_ID.Text;
-
- // SE presente recupero Cod_M/S/T
- checkCodM();
- checkCodS();
- checkCodT();
-
-
-
- if (estop.Checked)
- mEStop.Value = "TRIGGERED";
- else
- mEStop.Value = "ARMED";
-
- if (automatic.Checked)
- mMode.Value = "AUTOMATIC";
- else if (mdi.Checked)
- mMode.Value = "MANUAL_DATA_INPUT";
- else if (edit.Checked)
- mMode.Value = "EDIT";
- else
- mMode.Value = "MANUAL";
-
- if (running.Checked)
- mExec.Value = "ACTIVE";
- else if (feedhold.Checked)
- mExec.Value = "FEED_HOLD";
- else if (stopped.Checked)
- mExec.Value = "STOPPED";
- else if (ready.Checked)
- mExec.Value = "READY";
-
- mFunctionalMode.Value = functionalMode.Text;
-
- if (messageCode.Text.Length > 0)
- {
- mMessage.Code = messageCode.Text;
- mMessage.Value = messageText.Text;
- }
-
- mxLoad.Value = xLoad.Value;
- mcLoad.Value = cLoad.Value;
-
- if (flazBat.Checked)
- mSystem.Add(Condition.Level.FAULT, "Yur Flaz Bat is flapping", "FLAZBAT");
- if (something.Checked)
- mSystem.Add(Condition.Level.WARNING, "Something went wrong", "AKAK");
- if (noProgram.Checked)
- mSystem.Add(Condition.Level.FAULT, "No program loaded", "PROG");
-
- if (overtemp.Checked)
- mTemp.Add(Condition.Level.WARNING, "Temperature is too high", "OT");
- if (overload.Checked)
- mOverload.Add(Condition.Level.FAULT, "Axis overload", "OL");
- if (travel.Checked)
- mTravel.Add(Condition.Level.FAULT, "Travel outside boundaries", "OP");
-
- DataGridViewColumnCollection headers = commonVariables.Columns;
- DataGridViewCellCollection cells = commonVariables.Rows[0].Cells;
- string result = "";
-
- for (int i = 0; i < cells.Count; i++)
- {
- result += headers[i].HeaderText + ":" + cells[i].Value + " ";
- }
-
- mCommonVariable.Value = result;
-
- mAdapter.SendChanged();
-#endif
-
- // chiudo update...
- MainProgrBar.PerformStep();
// se è arrivato a 100 resetto...
if (MainProgrBar.Value >= MainProgrBar.Maximum) MainProgrBar.Value = 0;
@@ -252,6 +168,33 @@ namespace MTC_Sim
else if (stopped.Checked) answ.ExeMode = "STOPPED";
else if (ready.Checked) answ.ExeMode = "READY";
+ answ.FuncMode = functionalMode.Text;
+
+ answ.MessageCode = messageCode.Text;
+ answ.MessageText = messageText.Text;
+
+ // load...
+ answ.xLoad = xLoad.Value;
+ answ.cLoad = cLoad.Value;
+
+ // allarmi...
+ answ.err_01 = ERR_01.Checked;
+ answ.err_02 = ERR_02.Checked;
+ answ.err_03 = ERR_03.Checked;
+ answ.err_04 = ERR_04.Checked;
+ answ.err_05 = ERR_05.Checked;
+ answ.err_06 = ERR_06.Checked;
+
+ // altri dati
+ DataGridViewColumnCollection headers = commonVariables.Columns;
+ DataGridViewCellCollection cells = commonVariables.Rows[0].Cells;
+ string result = "";
+ for (int i = 0; i < cells.Count; i++)
+ {
+ result += headers[i].HeaderText + ":" + cells[i].Value + " ";
+ }
+ answ.otherData = result;
+
// ritorno oggetto!
return answ;
}
@@ -264,11 +207,10 @@ namespace MTC_Sim
private void message_Leave(object sender, EventArgs e)
{
-#if false
- mMessage.Value = messageText.Text;
- mMessage.ForceChanged();
- mAdapter.SendChanged();
-#endif
+ agObj.mMessage.Code = messageCode.Text;
+ agObj.mMessage.Value = messageText.Text;
+ agObj.mMessage.ForceChanged();
+ agObj.mAdapter.SendChanged();
}
private void xLoad_Scroll(object sender, ScrollEventArgs e)
@@ -278,12 +220,10 @@ namespace MTC_Sim
private void xPosition_Scroll(object sender, ScrollEventArgs e)
{
-#if false
- mPosition.Value = xPosition.Value;
- mAdapter.SendChanged();
+ agObj.mPosition.Value = xPosition.Value;
+ agObj.mAdapter.SendChanged();
- xPositionValue.Text = xPosition.Value.ToString();
-#endif
+ xPositionValue.Text = xPosition.Value.ToString();
}
private void cLoad_Scroll(object sender, ScrollEventArgs e)
@@ -293,23 +233,19 @@ namespace MTC_Sim
private void cSpeed_Scroll(object sender, ScrollEventArgs e)
{
-#if false
- mSpeed.Value = cSpeed.Value * 100.0;
- mAdapter.SendChanged();
+ agObj.mSpeed.Value = cSpeed.Value * 100.0;
+ agObj.mAdapter.SendChanged();
- cSpeedValue.Text = mSpeed.Value.ToString();
-#endif
+ cSpeedValue.Text = agObj.mSpeed.Value.ToString();
}
- private void coolant_CheckedChanged(object sender, EventArgs e)
+ private void ERR_00_CheckedChanged(object sender, EventArgs e)
{
-#if false
- if (coolant.Checked)
- mFillLevel.Add(Condition.Level.WARNING, "Coolant Low", "COOL", "LOW");
+ if (ERR_00.Checked)
+ agObj.mFillLevel.Add(Condition.Level.WARNING, "ERR_00 Coolant Low", "COOL", "LOW");
else
- mFillLevel.Clear("COOL");
- mAdapter.SendChanged();
-#endif
+ agObj.mFillLevel.Clear("COOL");
+ agObj.mAdapter.SendChanged();
}
@@ -335,11 +271,11 @@ namespace MTC_Sim
#region classi x simulazione valori vari
///
- /// simula alcuni dati generando ad esempio numeri casuali... SE abilitato
+ /// simula alcuni dati generando ad esempio numeri casuali... SE abilitato e SE adapter è DEMO
///
private void simulateData()
{
- if (enableDataSim.Checked)
+ if (enableDataSim.Checked && tipoScelto == tipoAdapter.Demo)
{
DateTime adesso = DateTime.Now;
Random rnd = new Random();
@@ -355,32 +291,6 @@ namespace MTC_Sim
// aggiorno visualizzazione strobe!
STATUS_PLC_ADP.Text = utils.binaryForm((int)agObj.STROBE_PLC);
STATUS_ADP_PLC.Text = utils.binaryForm((int)agObj.STROBE_ADP);
-
-#if false
- // verifica se ci sia un evento strobe da recepire...
- if (STATUS_PLC_ADP.Text.IndexOf("1") >= 0)
- {
- // verifica SE sia stato recepito da adapter...
- if (STATUS_ADP_PLC.Text == STATUS_PLC_ADP.Text)
- {
- // in questo caso ripulisco da PLC...
- STATUS_PLC_ADP.Text = binaryForm(0);
- }
- }
- else
- {
- // se era ancora sollevato strobe lettura lo abbasso...
- if (STATUS_ADP_PLC.Text.IndexOf("1") >= 0)
- {
- STATUS_ADP_PLC.Text = binaryForm(0);
- }
- else
- {
- // se il numero è < 1000 (10%) imposto strobe...
- STATUS_PLC_ADP.Text = binaryForm(rnd.Next(1, 10000000));
- }
- }
-#endif
}
}
@@ -480,5 +390,6 @@ namespace MTC_Sim
#endregion
+
}
}
diff --git a/MTC_Sim/MTC_Sim/MainForm.Designer.cs b/MTC_Sim/MTC_Sim/MainForm.Designer.cs
deleted file mode 100644
index 080a1c6..0000000
--- a/MTC_Sim/MTC_Sim/MainForm.Designer.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-namespace MTC_Sim
-{
- partial class MainForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Text = "MainForm";
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/MTC_Sim/MTC_Sim/MainForm.cs b/MTC_Sim/MTC_Sim/MainForm.cs
deleted file mode 100644
index 6872cd5..0000000
--- a/MTC_Sim/MTC_Sim/MainForm.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace MTC_Sim
-{
- public partial class MainForm : Form
- {
- public MainForm()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/MTC_Sim/MTC_Sim/utils.cs b/MTC_Sim/MTC_Sim/utils.cs
index 3bde8bd..60480da 100644
--- a/MTC_Sim/MTC_Sim/utils.cs
+++ b/MTC_Sim/MTC_Sim/utils.cs
@@ -109,6 +109,22 @@ namespace MTC_Sim
public bool EmrStop;
public string RunMode;
public string ExeMode;
+ public string FuncMode;
+ public string MessageCode;
+ public string MessageText;
+ public string otherData;
+
+ public int xLoad;
+ public int yLoad;
+ public int zLoad;
+ public int cLoad;
+
+ 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 runningData