From 86a2977eb859b385f07ba62da124d7ecec6ccdb6 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 4 Apr 2016 15:40:09 +0200 Subject: [PATCH] Completato porting componenti!!! --- MTC_Sim/.vs/MTC_Sim/v14/.suo | Bin 118784 -> 118784 bytes MTC_Sim/MTC_Sim/AdapterDemo.cs | 45 +++++- MTC_Sim/MTC_Sim/AdapterGeneric.cs | 115 +++++++------ MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs | 166 +++++++++---------- MTC_Sim/MTC_Sim/CMS_MachineSim.cs | 179 ++++++--------------- MTC_Sim/MTC_Sim/MainForm.Designer.cs | 38 ----- MTC_Sim/MTC_Sim/MainForm.cs | 20 --- MTC_Sim/MTC_Sim/utils.cs | 16 ++ 8 files changed, 242 insertions(+), 337 deletions(-) delete mode 100644 MTC_Sim/MTC_Sim/MainForm.Designer.cs delete mode 100644 MTC_Sim/MTC_Sim/MainForm.cs diff --git a/MTC_Sim/.vs/MTC_Sim/v14/.suo b/MTC_Sim/.vs/MTC_Sim/v14/.suo index 30231beae39076f532ee5bffcb6056c0c4dcf814..666177c05255ae45d011e71bdfef2d2177ca74da 100644 GIT binary patch delta 2257 zcmb`HdrZ?;6vuzxU!O>U0_9mi9+ih<3~?c7Kv60oiWwE-mS~2!hq`FS4Bc>3`kQXZ z)J@v!dL2`TovWH9OXSCFwwSFdBl`oHx>uGlCy6H8k{LE3Mh&oYyNblU7jN?UoqNtb z_nvd^X|K{{P`V5q>uG>EZe9f`na1Ha!tR+zy@)_KP7INr;$Yhy;a94BIloGLz(E>_u$@yOeE$!|iyO z*>!f4*!DOrJwdR&x(yzaF>5=`Um{*6+K3%QJMju3{HgBg>5P=U#Os7Nys(et8$>5_ zM?URtD(sFl;vSwB)eO`zXY_XYJxRS8t%oPgZW2EbQLh-H`K-B2!7?_Q=7NJc(|38| znz5BR%`R+Vqx5}&Ib(NulI^NJ@gzK!8deisIOSA}9^I)U(6`dDeKNZl^ZcLg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wjiii+H(y9mGm#qgL3|EdYGpn%rj5K^dlFs_MPFLuY%C#2v;5*Hi?>oJjXP=e(+;7 z%?!a4$8<{TX&ZRXYCH?X{<#Nzoaw6Q^_;d1Hm z;`i@mOe=P%2QJ?q1vcv(n$CsCGMQun5oqe_XceO^lgKogN+pj_T<#0=eO1Lgp z#y~4vk$>F_d*rfh5G)rZK)U>6C0v#>;-MLux`(6@km}W0;V3{$w`I>Rx=DQ^XuU3) zAx8b;--;k4`jR*@)bgM3_10HItVVA3K&UpA#?0PpHP9Jk&QLx1lI)vG*FoN&_reve z>KL(%4E!I0{|oRto}0IMAH+ai2AGadgWJ80e6PnjU==NtCmKCl{~uZX;D?ldS2oLC z0OiljUYWC3-cSIey`#s04`jE6QhHoCd=7O>AwoX24sv970i{xLKDePy0?qLWpcB2i z&Cmg|brAWiks!)DWIa@aY52jTH&ZSYL`K6}VRe&lfZV(l&i&_$U{Vm*^59e|#^Lnt zN#mRrif2tO%qwy%SQ8BkCo%^s;Q^E*HJ}99X~;*_Kdh&AoU-d&Qo5e;CtimJPDZ! 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