aggiunta altre variabili

This commit is contained in:
Samuele E. Locatelli
2016-04-05 10:31:02 +02:00
parent a697b86c07
commit 74972506a6
7 changed files with 363 additions and 113 deletions
Binary file not shown.
+16 -12
View File
@@ -27,11 +27,13 @@ namespace MTC_Sim
mProgRowNum.Value = parentForm.datiProd.ProgrRow;
mPartId.Value = parentForm.datiProd.PartId;
//mPz_Tot.Value = parentForm.datiProd.pzTot;
//mPz_Ok.Value = parentForm.datiProd.pzOk;
//mPz_Ko.Value = parentForm.datiProd.pzKo;
mOperator.Value = parentForm.datiProd.Operator;
// recupero SEMPRE dati ulteriori: status ON/OFF, clock, ...
mStatus.Value = parentForm.datiProd.Status;
mAccTime.Value = parentForm.datiProd.AccTime;
mClock.Value = DateTime.Now.ToFileTimeUtc();
mPower.Value = parentForm.datiProd.Power;
}
public override void getCurrMode()
@@ -64,14 +66,7 @@ namespace MTC_Sim
mMessage.Value = parentForm.datiProd.MessageText;
}
}
public override void getOtherData()
{
base.getOtherData();
mCommonVariable.Value = parentForm.datiProd.otherData;
}
public override void getAlarms()
{
base.getAlarms();
@@ -123,6 +118,15 @@ namespace MTC_Sim
}
}
public override position PosAct
{
get
{
position answ = parentForm.datiProd.PosAct;
return answ;
}
}
/// <summary>
/// Recupero dati da form...
/// </summary>
+74 -12
View File
@@ -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
/// <summary>
/// XX.XX.STOP - stop per pressione emergenze
/// </summary>
public Event mEStop = new Event("estop");
public Event mEStop = new Event("PROTECTION_STATUS");
/// <summary>
/// STATUS macchina (ON/OFF)
/// </summary>
public Event mStatus = new Event("STATUS");
/// <summary>
/// Minuti funzionamento globale macchina
/// </summary>
public Event mAccTime= new Event("ACC_TIME");
/// <summary>
/// Orologio
/// </summary>
public Event mClock = new Event("CLOCK_TIME");
/// <summary>
/// Consumo elettrico globale
/// </summary>
public Event mPower = new Event("POWER");
/// <summary>
/// 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...
}
/// <summary>
/// carico ulteriori altri dati
/// </summary>
public virtual void getOtherData()
{
// da gestire su ogni adapter...
}
/// <summary>
/// controllo codici MST
/// </summary>
@@ -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;
}
}
/// <summary>
@@ -418,6 +468,18 @@ namespace MTC_Sim
}
}
/// <summary>
/// recupera Vettore completo PosAct (fare override!)
/// </summary>
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))
+141 -63
View File
@@ -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;
}
}
+96 -15
View File
@@ -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);
}
/// <summary>
@@ -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<string,string>)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);
+6 -9
View File
@@ -117,28 +117,25 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="cv24.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="gather.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="cv21.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="X.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cv22.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="Y.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cv23.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="Z.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cv21.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="I.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cv22.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="J.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cv23.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="K.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+30 -2
View File
@@ -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;
}
/// <summary>
/// Vettore completo posizione (X-Y-Z con versori i-j-k)
/// </summary>
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;
}
}
/// <summary>
@@ -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,