From 74972506a681fda072cb8b5d28c9b53a4f2b4b56 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 5 Apr 2016 10:31:02 +0200 Subject: [PATCH] aggiunta altre variabili --- MTC_Sim/.vs/MTC_Sim/v14/.suo | Bin 107520 -> 116224 bytes MTC_Sim/MTC_Sim/AdapterDemo.cs | 28 +-- MTC_Sim/MTC_Sim/AdapterGeneric.cs | 86 +++++++-- MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs | 204 ++++++++++++++------- MTC_Sim/MTC_Sim/CMS_MachineSim.cs | 111 +++++++++-- MTC_Sim/MTC_Sim/CMS_MachineSim.resx | 15 +- MTC_Sim/MTC_Sim/utils.cs | 32 +++- 7 files changed, 363 insertions(+), 113 deletions(-) diff --git a/MTC_Sim/.vs/MTC_Sim/v14/.suo b/MTC_Sim/.vs/MTC_Sim/v14/.suo index 5fb2d12a475378fbf0f59c5f899b055cde53ea83..a3884d26e834fc85822d09a892067b841f1530d1 100644 GIT binary patch delta 2816 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 /// Recupero dati da form... /// diff --git a/MTC_Sim/MTC_Sim/AdapterGeneric.cs b/MTC_Sim/MTC_Sim/AdapterGeneric.cs index 3d791e8..3d150ca 100644 --- a/MTC_Sim/MTC_Sim/AdapterGeneric.cs +++ b/MTC_Sim/MTC_Sim/AdapterGeneric.cs @@ -34,7 +34,11 @@ namespace MTC_Sim // item disponibilità mAdapter.AddDataItem(mAvail); mAvail.Value = "AVAILABLE"; - // emergency stop + // status, clock, emergency stop + mAdapter.AddDataItem(mStatus); + mAdapter.AddDataItem(mAccTime); + mAdapter.AddDataItem(mClock); + mAdapter.AddDataItem(mPower); mAdapter.AddDataItem(mEStop); // nome ed ID/UUID - e li imposto... @@ -69,6 +73,14 @@ namespace MTC_Sim mAdapter.AddDataItem(mPathFeedOver); mAdapter.AddDataItem(mPathSpeedOver); + mAdapter.AddDataItem(mPathPosActX); + mAdapter.AddDataItem(mPathPosActY); + mAdapter.AddDataItem(mPathPosActZ); + mAdapter.AddDataItem(mPathPosActI); + mAdapter.AddDataItem(mPathPosActJ); + mAdapter.AddDataItem(mPathPosActK); + + mAdapter.AddDataItem(mPosition); mAdapter.AddDataItem(mxLoad); @@ -109,7 +121,23 @@ namespace MTC_Sim /// /// XX.XX.STOP - stop per pressione emergenze /// - public Event mEStop = new Event("estop"); + public Event mEStop = new Event("PROTECTION_STATUS"); + /// + /// STATUS macchina (ON/OFF) + /// + public Event mStatus = new Event("STATUS"); + /// + /// Minuti funzionamento globale macchina + /// + public Event mAccTime= new Event("ACC_TIME"); + /// + /// Orologio + /// + public Event mClock = new Event("CLOCK_TIME"); + /// + /// Consumo elettrico globale + /// + public Event mPower = new Event("POWER"); /// /// D.D1.NAME @@ -221,6 +249,14 @@ namespace MTC_Sim public Sample mPathFeedOver = new Sample("PATH_FEEDRATE_OVER"); public Sample mPathSpeedOver = new Sample("PATH_SPEEDRATE_OVER"); + + public Sample mPathPosActX = new Sample("PATH_POS_ACT_X"); + public Sample mPathPosActY = new Sample("PATH_POS_ACT_Y"); + public Sample mPathPosActZ = new Sample("PATH_POS_ACT_Z"); + public Sample mPathPosActI = new Sample("PATH_POS_ACT_I"); + public Sample mPathPosActJ = new Sample("PATH_POS_ACT_J"); + public Sample mPathPosActK = new Sample("PATH_POS_ACT_K"); + public Sample mPosition = new Sample("xPosition"); public Sample mxLoad = new Sample("xLoad"); @@ -276,7 +312,7 @@ namespace MTC_Sim // leggo parametri da config file getConfigParam(); - ///acquisisco dati su programma in esecuzione + ///acquisisco dati su programma in esecuzione e dati generali (stato, orologio, power...) getCurrProgramData(); // fix codici M/S/T @@ -290,8 +326,7 @@ namespace MTC_Sim getPath(); getAlarms(); - - getOtherData(); + // INVIO dati variati! mAdapter.SendChanged(); @@ -318,13 +353,7 @@ namespace MTC_Sim { // da gestire su ogni adapter... } - /// - /// carico ulteriori altri dati - /// - public virtual void getOtherData() - { - // da gestire su ogni adapter... - } + /// /// controllo codici MST /// @@ -366,6 +395,7 @@ namespace MTC_Sim public void checkPath() { + // controllo feed e velocità if (utils.IsSetAny(STROBE_PLC, Strobe.FEED_SPEED)) { // leggo i valori feed/speed @@ -382,6 +412,26 @@ namespace MTC_Sim // resetto eventuali flag di lettura... if (utils.IsSetAll(STROBE_ADP, Strobe.FEED_SPEED)) STROBE_ADP -= Strobe.FEED_SPEED; } + + // controllo posizione... + if (utils.IsSetAny(STROBE_PLC, Strobe.POS_ACT)) + { + // leggo i valori posizione attuale + mPathPosActX.Value = PosAct.x; + mPathPosActY.Value = PosAct.y; + mPathPosActZ.Value = PosAct.z; + mPathPosActI.Value = PosAct.i; + mPathPosActJ.Value = PosAct.j; + mPathPosActK.Value = PosAct.k; + + // alzo flag lettura... + if (utils.IsSetAll(STROBE_PLC, Strobe.POS_ACT)) STROBE_ADP = STROBE_ADP | Strobe.POS_ACT; + } + else + { + // resetto eventuali flag di lettura... + if (utils.IsSetAll(STROBE_ADP, Strobe.POS_ACT)) STROBE_ADP -= Strobe.POS_ACT; + } } /// @@ -418,6 +468,18 @@ namespace MTC_Sim } } + /// + /// recupera Vettore completo PosAct (fare override!) + /// + public virtual position PosAct + { + get + { + position answ = new position(); + return answ; + } + } + public void checkProd() { if (utils.IsSetAny(STROBE_PLC, Strobe.PZ_OK | Strobe.PZ_KO)) diff --git a/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs b/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs index 0711d78..8c8bc89 100644 --- a/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs +++ b/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs @@ -30,7 +30,6 @@ { this.components = new System.ComponentModel.Container(); 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(); this.label8 = new System.Windows.Forms.Label(); @@ -51,10 +50,7 @@ this.label13 = new System.Windows.Forms.Label(); this.functionalMode = new System.Windows.Forms.ComboBox(); this.label12 = new System.Windows.Forms.Label(); - this.commonVariables = new System.Windows.Forms.DataGridView(); - this.cv21 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.cv22 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.cv23 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.PosAct = new System.Windows.Forms.DataGridView(); this.ERR_06 = new System.Windows.Forms.CheckBox(); this.groupBox6 = new System.Windows.Forms.GroupBox(); this.ERR_04 = new System.Windows.Forms.CheckBox(); @@ -139,10 +135,20 @@ this.txtPathSpeedOver = new System.Windows.Forms.TextBox(); this.label28 = new System.Windows.Forms.Label(); this.hsPathSpeedOver = new System.Windows.Forms.HScrollBar(); + this.X = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Y = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Z = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.I = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.J = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.K = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.label29 = new System.Windows.Forms.Label(); + this.label30 = new System.Windows.Forms.Label(); + this.txtPower = new System.Windows.Forms.TextBox(); + this.lblAT = new System.Windows.Forms.Label(); + this.txtAccTime = new System.Windows.Forms.TextBox(); this.groupBox4.SuspendLayout(); this.groupBox5.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.commonVariables)).BeginInit(); - this.groupBox6.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.PosAct)).BeginInit(); this.groupBox1.SuspendLayout(); this.mode.SuspendLayout(); this.Execution.SuspendLayout(); @@ -168,12 +174,6 @@ this.ERR_05.Text = "ERR_05"; this.ERR_05.UseVisualStyleBackColor = true; // - // cv24 - // - this.cv24.HeaderText = "24"; - this.cv24.Name = "cv24"; - this.cv24.Width = 75; - // // gather // this.gather.Tick += new System.EventHandler(this.gather_Tick); @@ -234,7 +234,7 @@ // // cuttingToolButton // - this.cuttingToolButton.Location = new System.Drawing.Point(237, 575); + this.cuttingToolButton.Location = new System.Drawing.Point(21, 85); this.cuttingToolButton.Name = "cuttingToolButton"; this.cuttingToolButton.Size = new System.Drawing.Size(75, 23); this.cuttingToolButton.TabIndex = 42; @@ -251,7 +251,7 @@ this.groupBox5.Controls.Add(this.label10); this.groupBox5.Controls.Add(this.label11); this.groupBox5.Controls.Add(this.cLoad); - this.groupBox5.Location = new System.Drawing.Point(410, 416); + this.groupBox5.Location = new System.Drawing.Point(405, 536); this.groupBox5.Name = "groupBox5"; this.groupBox5.Size = new System.Drawing.Size(375, 70); this.groupBox5.TabIndex = 45; @@ -347,41 +347,25 @@ this.label12.TabIndex = 46; this.label12.Text = "Halt Type"; // - // commonVariables + // PosAct // - this.commonVariables.AllowUserToAddRows = false; - this.commonVariables.AllowUserToDeleteRows = false; - this.commonVariables.AllowUserToResizeColumns = false; - this.commonVariables.AllowUserToResizeRows = false; - this.commonVariables.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.commonVariables.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.cv21, - this.cv22, - this.cv23, - this.cv24}); - this.commonVariables.Location = new System.Drawing.Point(9, 17); - this.commonVariables.Name = "commonVariables"; - this.commonVariables.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.commonVariables.Size = new System.Drawing.Size(344, 48); - this.commonVariables.TabIndex = 32; - // - // cv21 - // - this.cv21.HeaderText = "21"; - this.cv21.Name = "cv21"; - this.cv21.Width = 75; - // - // cv22 - // - this.cv22.HeaderText = "22"; - this.cv22.Name = "cv22"; - this.cv22.Width = 75; - // - // cv23 - // - this.cv23.HeaderText = "23"; - this.cv23.Name = "cv23"; - this.cv23.Width = 75; + this.PosAct.AllowUserToAddRows = false; + this.PosAct.AllowUserToDeleteRows = false; + this.PosAct.AllowUserToResizeColumns = false; + this.PosAct.AllowUserToResizeRows = false; + this.PosAct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.PosAct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.X, + this.Y, + this.Z, + this.I, + this.J, + this.K}); + this.PosAct.Location = new System.Drawing.Point(85, 99); + this.PosAct.Name = "PosAct"; + this.PosAct.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.PosAct.Size = new System.Drawing.Size(287, 41); + this.PosAct.TabIndex = 32; // // ERR_06 // @@ -395,8 +379,7 @@ // // groupBox6 // - this.groupBox6.Controls.Add(this.commonVariables); - this.groupBox6.Location = new System.Drawing.Point(11, 416); + this.groupBox6.Location = new System.Drawing.Point(404, 456); this.groupBox6.Name = "groupBox6"; this.groupBox6.Size = new System.Drawing.Size(380, 74); this.groupBox6.TabIndex = 50; @@ -594,7 +577,8 @@ 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.Controls.Add(this.cuttingToolButton); + this.groupBox3.Location = new System.Drawing.Point(12, 492); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(375, 114); this.groupBox3.TabIndex = 41; @@ -651,7 +635,7 @@ this.groupBox2.Controls.Add(this.label4); this.groupBox2.Controls.Add(this.label3); this.groupBox2.Controls.Add(this.xLoad); - this.groupBox2.Location = new System.Drawing.Point(410, 340); + this.groupBox2.Location = new System.Drawing.Point(404, 367); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(375, 70); this.groupBox2.TabIndex = 40; @@ -732,6 +716,10 @@ // // groupBox7 // + this.groupBox7.Controls.Add(this.lblAT); + this.groupBox7.Controls.Add(this.txtAccTime); + this.groupBox7.Controls.Add(this.label30); + this.groupBox7.Controls.Add(this.txtPower); this.groupBox7.Controls.Add(this.label16); this.groupBox7.Controls.Add(this.D1_UUID); this.groupBox7.Controls.Add(this.label15); @@ -790,7 +778,7 @@ // this.D1_NAME.Location = new System.Drawing.Point(51, 17); this.D1_NAME.Name = "D1_NAME"; - this.D1_NAME.Size = new System.Drawing.Size(174, 20); + this.D1_NAME.Size = new System.Drawing.Size(124, 20); this.D1_NAME.TabIndex = 53; // // estop @@ -1062,6 +1050,8 @@ // // groupBox13 // + this.groupBox13.Controls.Add(this.label29); + this.groupBox13.Controls.Add(this.PosAct); this.groupBox13.Controls.Add(this.txtPathSpeedOver); this.groupBox13.Controls.Add(this.label28); this.groupBox13.Controls.Add(this.hsPathSpeedOver); @@ -1073,7 +1063,7 @@ this.groupBox13.Controls.Add(this.hsPathFeed); this.groupBox13.Location = new System.Drawing.Point(12, 311); this.groupBox13.Name = "groupBox13"; - this.groupBox13.Size = new System.Drawing.Size(379, 99); + this.groupBox13.Size = new System.Drawing.Size(379, 148); this.groupBox13.TabIndex = 60; this.groupBox13.TabStop = false; this.groupBox13.Text = "PATH"; @@ -1207,6 +1197,89 @@ this.hsPathSpeedOver.TabIndex = 30; this.hsPathSpeedOver.ValueChanged += new System.EventHandler(this.hsPathSpeedOver_ValueChanged); // + // X + // + this.X.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.X.HeaderText = "X"; + this.X.Name = "X"; + this.X.Width = 39; + // + // Y + // + this.Y.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.Y.HeaderText = "Y"; + this.Y.Name = "Y"; + this.Y.Width = 39; + // + // Z + // + this.Z.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.Z.HeaderText = "Z"; + this.Z.Name = "Z"; + this.Z.Width = 39; + // + // I + // + this.I.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.I.HeaderText = "I"; + this.I.Name = "I"; + this.I.Width = 35; + // + // J + // + this.J.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.J.HeaderText = "J"; + this.J.Name = "J"; + this.J.Width = 37; + // + // K + // + this.K.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.K.HeaderText = "K"; + this.K.Name = "K"; + this.K.Width = 39; + // + // label29 + // + this.label29.AutoSize = true; + this.label29.Location = new System.Drawing.Point(12, 113); + this.label29.Name = "label29"; + this.label29.Size = new System.Drawing.Size(51, 13); + this.label29.TabIndex = 33; + this.label29.Text = "Posiz Act"; + // + // label30 + // + this.label30.AutoSize = true; + this.label30.Location = new System.Drawing.Point(288, 20); + this.label30.Name = "label30"; + this.label30.Size = new System.Drawing.Size(36, 13); + this.label30.TabIndex = 61; + this.label30.Text = "power"; + // + // txtPower + // + this.txtPower.Location = new System.Drawing.Point(325, 17); + this.txtPower.Name = "txtPower"; + this.txtPower.Size = new System.Drawing.Size(49, 20); + this.txtPower.TabIndex = 60; + // + // lblAT + // + this.lblAT.AutoSize = true; + this.lblAT.Location = new System.Drawing.Point(189, 20); + this.lblAT.Name = "lblAT"; + this.lblAT.Size = new System.Drawing.Size(43, 13); + this.lblAT.TabIndex = 63; + this.lblAT.Text = "AccMin"; + // + // txtAccTime + // + this.txtAccTime.Location = new System.Drawing.Point(234, 17); + this.txtAccTime.Name = "txtAccTime"; + this.txtAccTime.Size = new System.Drawing.Size(53, 20); + this.txtAccTime.TabIndex = 62; + // // CMS_MachineSim // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1222,7 +1295,6 @@ this.Controls.Add(this.groupBox7); this.Controls.Add(this.groupBox4); this.Controls.Add(this.label6); - this.Controls.Add(this.cuttingToolButton); this.Controls.Add(this.groupBox5); this.Controls.Add(this.groupBox6); this.Controls.Add(this.groupBox1); @@ -1236,8 +1308,7 @@ this.groupBox4.PerformLayout(); this.groupBox5.ResumeLayout(false); this.groupBox5.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.commonVariables)).EndInit(); - this.groupBox6.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.PosAct)).EndInit(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.mode.ResumeLayout(false); @@ -1272,7 +1343,6 @@ #endregion 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; private System.Windows.Forms.Label label8; @@ -1293,10 +1363,7 @@ private System.Windows.Forms.Label label13; private System.Windows.Forms.ComboBox functionalMode; private System.Windows.Forms.Label label12; - private System.Windows.Forms.DataGridView commonVariables; - private System.Windows.Forms.DataGridViewTextBoxColumn cv21; - private System.Windows.Forms.DataGridViewTextBoxColumn cv22; - private System.Windows.Forms.DataGridViewTextBoxColumn cv23; + private System.Windows.Forms.DataGridView PosAct; private System.Windows.Forms.CheckBox ERR_06; private System.Windows.Forms.GroupBox groupBox6; private System.Windows.Forms.CheckBox ERR_04; @@ -1381,6 +1448,17 @@ private System.Windows.Forms.TextBox txtPathFeed; private System.Windows.Forms.Label label26; private System.Windows.Forms.HScrollBar hsPathFeed; + private System.Windows.Forms.DataGridViewTextBoxColumn X; + private System.Windows.Forms.DataGridViewTextBoxColumn Y; + private System.Windows.Forms.DataGridViewTextBoxColumn Z; + private System.Windows.Forms.DataGridViewTextBoxColumn I; + private System.Windows.Forms.DataGridViewTextBoxColumn J; + private System.Windows.Forms.DataGridViewTextBoxColumn K; + private System.Windows.Forms.Label label29; + private System.Windows.Forms.Label lblAT; + private System.Windows.Forms.TextBox txtAccTime; + private System.Windows.Forms.Label label30; + private System.Windows.Forms.TextBox txtPower; } } diff --git a/MTC_Sim/MTC_Sim/CMS_MachineSim.cs b/MTC_Sim/MTC_Sim/CMS_MachineSim.cs index b39ee00..bbbe79b 100644 --- a/MTC_Sim/MTC_Sim/CMS_MachineSim.cs +++ b/MTC_Sim/MTC_Sim/CMS_MachineSim.cs @@ -73,9 +73,10 @@ namespace MTC_Sim PROG_ROW_NUM.Text = "0"; partID.Text = utils.CRS("PartID"); - txtPzTot.Text = "0"; - txtPzOk.Text = "0"; - txtPzKo.Text = "0"; + pzOk = 0; + pzKo = 0; + Power = 1000; + AccTime = 1440 * 365; OPERATOR_ID.Text = "M9999"; @@ -110,8 +111,8 @@ namespace MTC_Sim functionalMode.ValueMember = "Key"; - string[] row = { "1", "2", "3", "4" }; - commonVariables.Rows.Add(row); + string[] row = { "0", "0", "0", "0", "0", "0"}; + PosAct.Rows.Add(row); } /// @@ -186,6 +187,9 @@ namespace MTC_Sim answ.Operator = OPERATOR_ID.Text; // variabili lette da + controlli + answ.Status = stop.Enabled; + answ.Power = Power; + answ.AccTime = AccTime; answ.EmrStop = estop.Checked; if (automatic.Checked) answ.RunMode = "AUTOMATIC"; else if (mdi.Checked) answ.RunMode = "MANUAL_DATA_INPUT"; @@ -197,6 +201,7 @@ namespace MTC_Sim else if (stopped.Checked) answ.ExeMode = "STOPPED"; else if (ready.Checked) answ.ExeMode = "READY"; + answ.FuncMode = ((KeyValuePair)functionalMode.SelectedItem).Key; answ.MessageCode = messageCode.Text; @@ -212,6 +217,17 @@ namespace MTC_Sim answ.PathFeedrateOver= hsPathFeedOver.Value; answ.PathSpeedrateOver= hsPathSpeedOver.Value; + // posizione attuale + position posAct = new position(); + DataGridViewCellCollection cells = PosAct.Rows[0].Cells; + float.TryParse(cells[0].Value.ToString(), out posAct.x); + float.TryParse(cells[1].Value.ToString(), out posAct.y); + float.TryParse(cells[2].Value.ToString(), out posAct.z); + float.TryParse(cells[3].Value.ToString(), out posAct.i); + float.TryParse(cells[4].Value.ToString(), out posAct.j); + float.TryParse(cells[5].Value.ToString(), out posAct.k); + answ.PosAct = posAct; + // load... answ.xLoad = xLoad.Value; answ.cLoad = cLoad.Value; @@ -224,15 +240,6 @@ namespace MTC_Sim 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; @@ -293,6 +300,42 @@ namespace MTC_Sim txtPzTot.Text = pzTot.ToString(); } + protected int Power + { + get + { + int answ = 0; + try + { + answ = Convert.ToInt32(txtPower.Text.Trim()); + } + catch + { } + return answ; + } + set + { + txtPower.Text = value.ToString(); + } + } + protected int AccTime + { + get + { + int answ = 0; + try + { + answ = Convert.ToInt32(txtAccTime.Text.Trim()); + } + catch + { } + return answ; + } + set + { + txtAccTime.Text = value.ToString(); + } + } protected int pzOk { get @@ -325,6 +368,11 @@ namespace MTC_Sim { } return answ; } + set + { + txtPzKo.Text = value.ToString(); + txtPzTot.Text = pzTot.ToString(); + } } protected int pzTot { @@ -377,6 +425,34 @@ namespace MTC_Sim agObj.STROBE_PLC = agObj.STROBE_PLC | Strobe.PZ_OK; } + // cambio posizioni XYZ/ijk nel 20% dei casi x ogni terna... + if (rnd.Next(0, 100) > 80) + { + PosAct.Rows[0].Cells[0].Value = rnd.Next(0, 100); + PosAct.Rows[0].Cells[1].Value = rnd.Next(0, 100); + PosAct.Rows[0].Cells[2].Value = rnd.Next(0, 100); + agObj.STROBE_PLC = agObj.STROBE_PLC | Strobe.POS_ACT; + } + if (rnd.Next(0, 100) > 80) + { + PosAct.Rows[0].Cells[3].Value = rnd.Next(0, 100); + PosAct.Rows[0].Cells[4].Value = rnd.Next(0, 100); + PosAct.Rows[0].Cells[5].Value = rnd.Next(0, 100); + agObj.STROBE_PLC = agObj.STROBE_PLC | Strobe.POS_ACT; + } + + + // cambio power nel 50% dei casi... + if (rnd.Next(0, 100) > 50) + { + Power += rnd.Next(-10, 10); + } + // aggiungo 1 min AccTime nel 1.6% dei casi + if (rnd.Next(0, 1000) > 984) + { + AccTime++; + } + // controllo se ci sia il flag di lettura di un evento M/S/T nel qual caso lo abbasso... if (utils.IsSetAll(agObj.STROBE_ADP, Strobe.M_CODE)) { @@ -401,12 +477,17 @@ namespace MTC_Sim if (utils.IsSetAll(agObj.STROBE_PLC, Strobe.PZ_KO)) agObj.STROBE_PLC -= Strobe.PZ_KO; } - // controllo se ci sia il flag di lettura di un evento FEED/SPEED nel qual caso lo abbasso... + // controllo se ci sia il flag di lettura di un evento FEED_SPEED nel qual caso lo abbasso... if (utils.IsSetAll(agObj.STROBE_ADP, Strobe.FEED_SPEED)) { if (utils.IsSetAll(agObj.STROBE_PLC, Strobe.FEED_SPEED)) agObj.STROBE_PLC -= Strobe.FEED_SPEED; } + // controllo se ci sia il flag di lettura di un evento POS_ACT nel qual caso lo abbasso... + if (utils.IsSetAll(agObj.STROBE_ADP, Strobe.POS_ACT)) + { + if (utils.IsSetAll(agObj.STROBE_PLC, Strobe.POS_ACT)) agObj.STROBE_PLC -= Strobe.POS_ACT; + } // aggiorno visualizzazione strobe! STATUS_PLC_ADP.Text = utils.binaryForm((int)agObj.STROBE_PLC); diff --git a/MTC_Sim/MTC_Sim/CMS_MachineSim.resx b/MTC_Sim/MTC_Sim/CMS_MachineSim.resx index d0af042..c9e8fbb 100644 --- a/MTC_Sim/MTC_Sim/CMS_MachineSim.resx +++ b/MTC_Sim/MTC_Sim/CMS_MachineSim.resx @@ -117,28 +117,25 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - 17, 17 - + True - + True - + True - + True - + True - + True diff --git a/MTC_Sim/MTC_Sim/utils.cs b/MTC_Sim/MTC_Sim/utils.cs index ae457a2..9a797be 100644 --- a/MTC_Sim/MTC_Sim/utils.cs +++ b/MTC_Sim/MTC_Sim/utils.cs @@ -131,13 +131,16 @@ namespace MTC_Sim public string ProgrRow; public string PartId; public string Operator; + + public bool Status; + public int AccTime; + public int Power; public bool EmrStop; public string RunMode; public string ExeMode; public string FuncMode; public string MessageCode; public string MessageText; - public string otherData; public int pzTot; public int pzOk; @@ -147,6 +150,8 @@ namespace MTC_Sim public int PathFeedrateOver; public int PathSpeedrateOver; + public position PosAct; + public int xLoad; public int yLoad; public int zLoad; @@ -159,6 +164,28 @@ namespace MTC_Sim public bool err_05; public bool err_06; } + + /// + /// Vettore completo posizione (X-Y-Z con versori i-j-k) + /// + public class position + { + public float x; + public float y; + public float z; + public float i; + public float j; + public float k; + public position() + { + x = 0; + y = 0; + z = 0; + i = 0; + j = 0; + k = 0; + } + } /// @@ -176,7 +203,8 @@ namespace MTC_Sim PZ_OK = 1 << 3, PZ_KO = 1 << 4, FEED_SPEED = 1 << 5, - SP07 = 1 << 6, + POS_ACT = 1 << 6, + SP07 = 1 << 7, SP08 = 1 << 8, SP09 = 1 << 9, SP10 = 1 << 10,