Portata gestione path in vettoriale

This commit is contained in:
Samuele E. Locatelli
2016-04-27 16:28:36 +02:00
parent 740c3b5c55
commit 77015cd250
6 changed files with 357 additions and 362 deletions
Binary file not shown.
+35 -24
View File
@@ -110,40 +110,50 @@ namespace MTC_Sim
{
base.getPath();
#if false
mxLoad.Value = parentForm.datiProd.xLoad;
mcLoad.Value = parentForm.datiProd.cLoad;
#endif
PathData PtData = parentForm.CurrPath;
if(PtData.PathSel>=0)
{
vettPath[PtData.PathSel].mPathFeed.Value = PtData.PathFeedrate;
vettPath[PtData.PathSel].mPathFeedOver.Value = PtData.PathFeedrateOver;
vettPath[PtData.PathSel].mPathSpeedOver.Value = PtData.PathSpeedrateOver;
vettPath[PtData.PathSel].mPathPosActX.Value = PtData.PathPosAct.x;
vettPath[PtData.PathSel].mPathPosActY.Value = PtData.PathPosAct.y;
vettPath[PtData.PathSel].mPathPosActZ.Value = PtData.PathPosAct.z;
vettPath[PtData.PathSel].mPathPosActI.Value = PtData.PathPosAct.i;
vettPath[PtData.PathSel].mPathPosActJ.Value = PtData.PathPosAct.j;
vettPath[PtData.PathSel].mPathPosActK.Value = PtData.PathPosAct.k;
}
}
public override void getAxis()
{
base.getAxis();
if (parentForm.AxisSel >= 0)
AxisData AxData = parentForm.CurrAxis;
if (AxData.AxisSel >= 0)
{
// USO asse selezionato + dati visualizzati e di conseguenza aggiorno...
vettAxis[parentForm.AxisSel].mAxMainProc.Value = parentForm.AxisMainProc;
vettAxis[parentForm.AxisSel].mAxIsMaster.Value = parentForm.AxisIsMaster;
vettAxis[parentForm.AxisSel].mAxMastId.Value = parentForm.AxisMastId;
vettAxis[parentForm.AxisSel].mAxType.Value = parentForm.AxisType;
vettAxis[parentForm.AxisSel].mAxDir.Value = parentForm.AxisDir;
vettAxis[parentForm.AxisSel].mAxLoad.Value = parentForm.AxisLoad;
vettAxis[parentForm.AxisSel].mAxPosAct.Value = parentForm.AxisPosAct;
vettAxis[parentForm.AxisSel].mAxPosTgt.Value = parentForm.AxisPosTgt;
vettAxis[parentForm.AxisSel].mAxFeedAct.Value = parentForm.AxisFeedAct;
vettAxis[parentForm.AxisSel].mAxFeedOver.Value = parentForm.AxisFeedOver;
vettAxis[parentForm.AxisSel].mAxAccelAct.Value = parentForm.AxisAccel;
vettAxis[parentForm.AxisSel].mAxAccTime.Value = parentForm.AxisAccTime;
vettAxis[parentForm.AxisSel].mAxBattery.Value = parentForm.AxisBattery;
vettAxis[AxData.AxisSel].mAxMainProc.Value = AxData.AxisMainProc;
vettAxis[AxData.AxisSel].mAxIsMaster.Value = AxData.AxisIsMaster;
vettAxis[AxData.AxisSel].mAxMastId.Value = AxData.AxisMastId;
vettAxis[AxData.AxisSel].mAxType.Value = AxData.AxisType;
vettAxis[AxData.AxisSel].mAxDir.Value = AxData.AxisDir;
vettAxis[AxData.AxisSel].mAxLoad.Value = AxData.AxisLoad;
vettAxis[AxData.AxisSel].mAxPosAct.Value = AxData.AxisPosAct;
vettAxis[AxData.AxisSel].mAxPosTgt.Value = AxData.AxisPosTgt;
vettAxis[AxData.AxisSel].mAxFeedAct.Value = AxData.AxisFeedAct;
vettAxis[AxData.AxisSel].mAxFeedOver.Value = AxData.AxisFeedOver;
vettAxis[AxData.AxisSel].mAxAccelAct.Value = AxData.AxisAccel;
vettAxis[AxData.AxisSel].mAxAccTime.Value = AxData.AxisAccTime;
vettAxis[AxData.AxisSel].mAxBattery.Value = AxData.AxisBattery;
}
}
#if false
public override int FeedRate
{
get
{
return parentForm.datiProd.PathFeedrate;
return parentForm.CurrPath.PathFeedrate;
}
}
@@ -151,7 +161,7 @@ namespace MTC_Sim
{
get
{
return parentForm.datiProd.PathFeedrateOver;
return parentForm.CurrPath.PathFeedrateOver;
}
}
@@ -159,7 +169,7 @@ namespace MTC_Sim
{
get
{
return parentForm.datiProd.PathSpeedrateOver;
return parentForm.CurrPath.PathSpeedrateOver;
}
}
@@ -167,10 +177,11 @@ namespace MTC_Sim
{
get
{
position answ = parentForm.datiProd.PosAct;
position answ = parentForm.CurrPath.PathPosAct;
return answ;
}
}
}
#endif
/// <summary>
/// Recupero dati da form...
+49 -24
View File
@@ -170,6 +170,8 @@
this.label36 = new System.Windows.Forms.Label();
this.AxAccelAct = new System.Windows.Forms.TextBox();
this.label37 = new System.Windows.Forms.Label();
this.cbPathSel = new System.Windows.Forms.ComboBox();
this.label38 = new System.Windows.Forms.Label();
this.groupBox4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PosAct)).BeginInit();
this.groupBox3.SuspendLayout();
@@ -212,7 +214,7 @@
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(386, 243);
this.groupBox4.Location = new System.Drawing.Point(4, 418);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(379, 52);
this.groupBox4.TabIndex = 44;
@@ -356,10 +358,10 @@
this.I,
this.J,
this.K});
this.PosAct.Location = new System.Drawing.Point(85, 99);
this.PosAct.Location = new System.Drawing.Point(80, 115);
this.PosAct.Name = "PosAct";
this.PosAct.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.PosAct.Size = new System.Drawing.Size(287, 41);
this.PosAct.Size = new System.Drawing.Size(292, 41);
this.PosAct.TabIndex = 32;
//
// X
@@ -433,7 +435,7 @@
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(3, 412);
this.groupBox3.Location = new System.Drawing.Point(3, 504);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(375, 114);
this.groupBox3.TabIndex = 41;
@@ -513,7 +515,7 @@
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.AxLoad);
this.groupBox2.Location = new System.Drawing.Point(385, 301);
this.groupBox2.Location = new System.Drawing.Point(385, 418);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(375, 225);
this.groupBox2.TabIndex = 40;
@@ -610,7 +612,7 @@
this.groupBox9.Controls.Add(this.label13);
this.groupBox9.Controls.Add(this.functionalMode);
this.groupBox9.Controls.Add(this.label12);
this.groupBox9.Location = new System.Drawing.Point(3, 94);
this.groupBox9.Location = new System.Drawing.Point(3, 148);
this.groupBox9.Name = "groupBox9";
this.groupBox9.Size = new System.Drawing.Size(379, 158);
this.groupBox9.TabIndex = 55;
@@ -752,7 +754,7 @@
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1,
this.MainProgrBar});
this.statusStrip1.Location = new System.Drawing.Point(0, 618);
this.statusStrip1.Location = new System.Drawing.Point(0, 725);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(794, 22);
this.statusStrip1.TabIndex = 59;
@@ -771,6 +773,8 @@
//
// groupBox13
//
this.groupBox13.Controls.Add(this.cbPathSel);
this.groupBox13.Controls.Add(this.label38);
this.groupBox13.Controls.Add(this.label29);
this.groupBox13.Controls.Add(this.PosAct);
this.groupBox13.Controls.Add(this.txtPathSpeedOver);
@@ -782,9 +786,9 @@
this.groupBox13.Controls.Add(this.txtPathFeed);
this.groupBox13.Controls.Add(this.label26);
this.groupBox13.Controls.Add(this.hsPathFeed);
this.groupBox13.Location = new System.Drawing.Point(3, 258);
this.groupBox13.Location = new System.Drawing.Point(385, 84);
this.groupBox13.Name = "groupBox13";
this.groupBox13.Size = new System.Drawing.Size(379, 148);
this.groupBox13.Size = new System.Drawing.Size(379, 167);
this.groupBox13.TabIndex = 60;
this.groupBox13.TabStop = false;
this.groupBox13.Text = "PATH";
@@ -792,7 +796,7 @@
// label29
//
this.label29.AutoSize = true;
this.label29.Location = new System.Drawing.Point(12, 113);
this.label29.Location = new System.Drawing.Point(12, 133);
this.label29.Name = "label29";
this.label29.Size = new System.Drawing.Size(51, 13);
this.label29.TabIndex = 33;
@@ -800,7 +804,7 @@
//
// txtPathSpeedOver
//
this.txtPathSpeedOver.Location = new System.Drawing.Point(298, 68);
this.txtPathSpeedOver.Location = new System.Drawing.Point(298, 88);
this.txtPathSpeedOver.Name = "txtPathSpeedOver";
this.txtPathSpeedOver.Size = new System.Drawing.Size(74, 20);
this.txtPathSpeedOver.TabIndex = 32;
@@ -809,7 +813,7 @@
// label28
//
this.label28.AutoSize = true;
this.label28.Location = new System.Drawing.Point(10, 71);
this.label28.Location = new System.Drawing.Point(10, 91);
this.label28.Name = "label28";
this.label28.Size = new System.Drawing.Size(67, 13);
this.label28.TabIndex = 31;
@@ -817,7 +821,7 @@
//
// hsPathSpeedOver
//
this.hsPathSpeedOver.Location = new System.Drawing.Point(80, 71);
this.hsPathSpeedOver.Location = new System.Drawing.Point(80, 91);
this.hsPathSpeedOver.Maximum = 150;
this.hsPathSpeedOver.Name = "hsPathSpeedOver";
this.hsPathSpeedOver.Size = new System.Drawing.Size(213, 18);
@@ -826,7 +830,7 @@
//
// txtPathFeedOver
//
this.txtPathFeedOver.Location = new System.Drawing.Point(298, 43);
this.txtPathFeedOver.Location = new System.Drawing.Point(298, 63);
this.txtPathFeedOver.Name = "txtPathFeedOver";
this.txtPathFeedOver.Size = new System.Drawing.Size(74, 20);
this.txtPathFeedOver.TabIndex = 29;
@@ -835,7 +839,7 @@
// label27
//
this.label27.AutoSize = true;
this.label27.Location = new System.Drawing.Point(10, 46);
this.label27.Location = new System.Drawing.Point(10, 66);
this.label27.Name = "label27";
this.label27.Size = new System.Drawing.Size(60, 13);
this.label27.TabIndex = 28;
@@ -843,7 +847,7 @@
//
// hsPathFeedOver
//
this.hsPathFeedOver.Location = new System.Drawing.Point(80, 46);
this.hsPathFeedOver.Location = new System.Drawing.Point(80, 66);
this.hsPathFeedOver.Maximum = 150;
this.hsPathFeedOver.Name = "hsPathFeedOver";
this.hsPathFeedOver.Size = new System.Drawing.Size(213, 18);
@@ -852,7 +856,7 @@
//
// txtPathFeed
//
this.txtPathFeed.Location = new System.Drawing.Point(298, 17);
this.txtPathFeed.Location = new System.Drawing.Point(298, 37);
this.txtPathFeed.Name = "txtPathFeed";
this.txtPathFeed.Size = new System.Drawing.Size(74, 20);
this.txtPathFeed.TabIndex = 26;
@@ -861,7 +865,7 @@
// label26
//
this.label26.AutoSize = true;
this.label26.Location = new System.Drawing.Point(10, 20);
this.label26.Location = new System.Drawing.Point(10, 40);
this.label26.Name = "label26";
this.label26.Size = new System.Drawing.Size(49, 13);
this.label26.TabIndex = 24;
@@ -869,7 +873,7 @@
//
// hsPathFeed
//
this.hsPathFeed.Location = new System.Drawing.Point(80, 20);
this.hsPathFeed.Location = new System.Drawing.Point(80, 40);
this.hsPathFeed.Maximum = 150;
this.hsPathFeed.Name = "hsPathFeed";
this.hsPathFeed.Size = new System.Drawing.Size(213, 18);
@@ -939,7 +943,7 @@
this.tabCtrlMain.Location = new System.Drawing.Point(0, 50);
this.tabCtrlMain.Name = "tabCtrlMain";
this.tabCtrlMain.SelectedIndex = 0;
this.tabCtrlMain.Size = new System.Drawing.Size(794, 568);
this.tabCtrlMain.Size = new System.Drawing.Size(794, 675);
this.tabCtrlMain.TabIndex = 65;
//
// tpStatus
@@ -1043,7 +1047,7 @@
this.tpSIM.Controls.Add(this.groupBox12);
this.tpSIM.Location = new System.Drawing.Point(4, 22);
this.tpSIM.Name = "tpSIM";
this.tpSIM.Size = new System.Drawing.Size(786, 542);
this.tpSIM.Size = new System.Drawing.Size(786, 649);
this.tpSIM.TabIndex = 2;
this.tpSIM.Text = "SIMULATION";
//
@@ -1053,7 +1057,7 @@
this.Execution.Controls.Add(this.feedhold);
this.Execution.Controls.Add(this.stopped);
this.Execution.Controls.Add(this.running);
this.Execution.Location = new System.Drawing.Point(386, 84);
this.Execution.Location = new System.Drawing.Point(3, 94);
this.Execution.Name = "Execution";
this.Execution.Size = new System.Drawing.Size(380, 48);
this.Execution.TabIndex = 61;
@@ -1399,7 +1403,7 @@
this.groupBox12.Controls.Add(this.lblCodaM);
this.groupBox12.Controls.Add(this.addCodM);
this.groupBox12.Controls.Add(this.label20);
this.groupBox12.Location = new System.Drawing.Point(386, 138);
this.groupBox12.Location = new System.Drawing.Point(3, 312);
this.groupBox12.Name = "groupBox12";
this.groupBox12.Size = new System.Drawing.Size(380, 100);
this.groupBox12.TabIndex = 58;
@@ -1553,11 +1557,30 @@
this.label37.TabIndex = 42;
this.label37.Text = "Accel Act";
//
// cbPathSel
//
this.cbPathSel.DisplayMember = "Name";
this.cbPathSel.FormattingEnabled = true;
this.cbPathSel.Location = new System.Drawing.Point(80, 16);
this.cbPathSel.Name = "cbPathSel";
this.cbPathSel.Size = new System.Drawing.Size(121, 21);
this.cbPathSel.TabIndex = 63;
this.cbPathSel.ValueMember = "Value";
//
// label38
//
this.label38.AutoSize = true;
this.label38.Location = new System.Drawing.Point(11, 20);
this.label38.Name = "label38";
this.label38.Size = new System.Drawing.Size(54, 13);
this.label38.TabIndex = 62;
this.label38.Text = "Path Num";
//
// CMS_MachineSim
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(794, 640);
this.ClientSize = new System.Drawing.Size(794, 747);
this.Controls.Add(this.tabCtrlMain);
this.Controls.Add(this.lblCurrAdapt);
this.Controls.Add(this.statusStrip1);
@@ -1749,6 +1772,8 @@
private System.Windows.Forms.Label label35;
private System.Windows.Forms.Label label34;
private System.Windows.Forms.ComboBox cbAxType;
private System.Windows.Forms.ComboBox cbPathSel;
private System.Windows.Forms.Label label38;
}
}
+239 -263
View File
@@ -37,6 +37,8 @@ namespace MTC_Sim
/// </summary>
protected tipoAdapter tipoScelto = tipoAdapter.Demo;
#region utils ed helpers
public static void EnableTab(TabPage page, bool enable)
{
EnableControls(page.Controls, enable);
@@ -49,6 +51,17 @@ namespace MTC_Sim
EnableControls(ctl.Controls, enable);
}
}
private class Item
{
public string Name;
public int Value;
public Item(string name, int value)
{
Name = name; Value = value;
}
}
#endregion
public CMS_MachineSim()
{
@@ -151,7 +164,19 @@ namespace MTC_Sim
string[] row = { "0", "0", "0", "0", "0", "0" };
PosAct.Rows.Add(row);
// fix componenti vettoriali...
// fix componenti vettoriali PATH, UNOP, ASSI...
for (int i = 0; i < adpConf.nPath; i++)
{
cbPathSel.Items.Insert(i, adpConf.Path[i].alias);
}
if (adpConf.nPath > 0) cbPathSel.SelectedIndex = 0;
for (int i = 0; i < adpConf.nUnOp; i++)
{
//cbAxNum.Items.Insert(i, adpConf.Axis[i].alias);
}
//if (adpConf.nUnOp > 0) cbAxNum.SelectedIndex = 0;
for (int i = 0; i < adpConf.nAxis; i++)
{
cbAxNum.Items.Insert(i, adpConf.Axis[i].alias);
@@ -160,15 +185,7 @@ namespace MTC_Sim
}
private class Item
{
public string Name;
public int Value;
public Item(string name, int value)
{
Name = name; Value = value;
}
}
/// <summary>
/// Avvio dell'adapter
/// </summary>
@@ -224,85 +241,7 @@ namespace MTC_Sim
}
#region accesso dati FROM/TO maschera
/// <summary>
/// Dati di produzione (su form)
/// </summary>
public prodData datiProd
{
get
{
prodData answ = new prodData();
// carico da form
answ.ProgramName = program.Text;
answ.ProgrRow = PROG_ROW_NUM.Text;
answ.PartId = partID.Text;
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";
else if (edit.Checked) answ.RunMode = "EDIT";
else answ.RunMode = "MANUAL";
if (running.Checked) answ.ExeMode = "ACTIVE";
else if (feedhold.Checked) answ.ExeMode = "FEED_HOLD";
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;
answ.MessageText = messageText.Text;
// pezzi
answ.pzOk = pzOk;
answ.pzKo = pzKo;
answ.pzTot = pzOk + pzKo;
// FEED/SPEED
answ.PathFeedrate = hsPathFeed.Value;
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 = AxLoad.Value;
answ.cLoad = AxFeedAct.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;
// ritorno oggetto!
return answ;
}
}
#endregion
private void message_Leave(object sender, EventArgs e)
@@ -324,93 +263,6 @@ namespace MTC_Sim
agObj.mAdapter.SendChanged();
}
private void pzKo_TextChanged(object sender, EventArgs e)
{
agObj.STROBE_PLC = agObj.STROBE_PLC | Strobe.PZ_KO;
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
{
int answ = 0;
try
{
answ = Convert.ToInt32(txtPzOk.Text.Trim());
}
catch
{ }
return answ;
}
set
{
txtPzOk.Text = value.ToString();
txtPzTot.Text = pzTot.ToString();
}
}
protected int pzKo
{
get
{
int answ = 0;
try
{
answ = Convert.ToInt32(txtPzKo.Text.Trim());
}
catch
{ }
return answ;
}
set
{
txtPzKo.Text = value.ToString();
txtPzTot.Text = pzTot.ToString();
}
}
protected int pzTot
{
get
{
return pzOk + pzKo;
}
}
// apro eseguibile dump
private void dump_Click(object sender, EventArgs e)
@@ -708,6 +560,193 @@ namespace MTC_Sim
}
}
#endregion
#region accesso dati produzione FROM/TO maschera
/// <summary>
/// Dati di produzione (su form)
/// </summary>
public prodData datiProd
{
get
{
prodData answ = new prodData();
// carico da form
answ.ProgramName = program.Text;
answ.ProgrRow = PROG_ROW_NUM.Text;
answ.PartId = partID.Text;
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";
else if (edit.Checked) answ.RunMode = "EDIT";
else answ.RunMode = "MANUAL";
if (running.Checked) answ.ExeMode = "ACTIVE";
else if (feedhold.Checked) answ.ExeMode = "FEED_HOLD";
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;
answ.MessageText = messageText.Text;
// pezzi
answ.pzOk = pzOk;
answ.pzKo = pzKo;
answ.pzTot = pzOk + pzKo;
// 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;
// ritorno oggetto!
return answ;
}
}
private void pzKo_TextChanged(object sender, EventArgs e)
{
agObj.STROBE_PLC = agObj.STROBE_PLC | Strobe.PZ_KO;
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
{
int answ = 0;
try
{
answ = Convert.ToInt32(txtPzOk.Text.Trim());
}
catch
{ }
return answ;
}
set
{
txtPzOk.Text = value.ToString();
txtPzTot.Text = pzTot.ToString();
}
}
protected int pzKo
{
get
{
int answ = 0;
try
{
answ = Convert.ToInt32(txtPzKo.Text.Trim());
}
catch
{ }
return answ;
}
set
{
txtPzKo.Text = value.ToString();
txtPzTot.Text = pzTot.ToString();
}
}
protected int pzTot
{
get
{
return pzOk + pzKo;
}
}
#endregion
#region gestione Path
/// <summary>
/// Dati PATH
/// </summary>
public PathData CurrPath
{
get
{
PathData answ = new PathData();
answ.PathSel = cbPathSel.SelectedIndex;
// FEED/SPEED
answ.PathFeedrate = hsPathFeed.Value;
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.PathPosAct = posAct;
// ritorno oggetto!
return answ;
}
}
#endregion
#region gestione UnOp
#endregion
#region gestione assi
@@ -729,35 +768,36 @@ namespace MTC_Sim
AxBatt.Text = "100";
}
public int AxisSel
/// <summary>
/// Dati di produzione (su form)
/// </summary>
public AxisData CurrAxis
{
get
{
return cbAxNum.SelectedIndex;
Random rnd = new Random();
AxisData answ = new AxisData();
answ.AxisSel= cbAxNum.SelectedIndex;
answ.AxisMainProc = AxMainProc.Text;
answ.AxisIsMaster = AxIsMaster.Checked;
answ.AxisMastId = AxMastId.Text;
answ.AxisType = AxisType;
answ.AxisDir = AxDir.Text;
answ.AxisLoad = AxLoad.Value;
answ.AxisPosAct = AxPosition.Value + rnd.Next(-2, 2);
answ.AxisPosTgt = AxPosition.Value;
answ.AxisFeedAct = AxFeedAct.Value;
answ.AxisFeedOver = AxFeedOver.Value;
answ.AxisAccel = AxAccelAct.Text;
answ.AxisAccTime = AxAccTime.Text;
answ.AxisBattery = AxBatt.Text;
// restituisco oggetto
return answ;
}
}
public string AxisMainProc
{
get
{
return AxMainProc.Text;
}
}
public bool AxisIsMaster
{
get
{
return AxIsMaster.Checked;
}
}
public string AxisMastId
{
get
{
return AxMastId.Text;
}
}
public string AxisType
protected string AxisType
{
get
{
@@ -771,70 +811,6 @@ namespace MTC_Sim
return answ;
}
}
public string AxisDir
{
get
{
return AxDir.Text;
}
}
public int AxisLoad
{
get
{
return AxLoad.Value;
}
}
public int AxisPosAct
{
get
{
Random rnd = new Random();
return AxPosition.Value + rnd.Next(-2, 2);
}
}
public int AxisPosTgt
{
get
{
return AxPosition.Value;
}
}
public int AxisFeedAct
{
get
{
return AxFeedAct.Value;
}
}
public int AxisFeedOver
{
get
{
return AxFeedOver.Value;
}
}
public string AxisAccel
{
get
{
return AxAccelAct.Text;
}
}
public string AxisAccTime
{
get
{
return AxAccTime.Text;
}
}
public string AxisBattery
{
get
{
return AxBatt.Text;
}
}
private void xLoad_Scroll(object sender, ScrollEventArgs e)
{
-18
View File
@@ -138,24 +138,6 @@
<metadata name="K.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="X.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Y.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Z.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="I.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="J.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<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">
<value>104, 17</value>
</metadata>
+34 -33
View File
@@ -80,28 +80,6 @@ namespace MTC_Sim
return answ;
}
#if false
public DataSet DS_lists
{
get
{
DataTable tbl = new DataTable("HaltType");
tbl.Columns.Add("label");
tbl.Columns.Add("value");
tbl.Rows.Add("COD001", 001);
tbl.Rows.Add("COD002", 002);
tbl.Rows.Add("COD003", 003);
// Create a DataSet.
DataSet set = new DataSet("MTC-ADAPT");
set.Tables.Add(tbl);
set.Namespace = "adapt";
set.Prefix = "mtc";
return set;
}
}
#endif
}
@@ -169,17 +147,7 @@ namespace MTC_Sim
public int pzTot;
public int pzOk;
public int pzKo;
public int PathFeedrate;
public int PathFeedrateOver;
public int PathSpeedrateOver;
public position PosAct;
public int xLoad;
public int yLoad;
public int zLoad;
public int cLoad;
public bool err_01;
public bool err_02;
@@ -189,6 +157,39 @@ namespace MTC_Sim
public bool err_06;
}
public struct PathData
{
public int PathSel;
public int PathFeedrate;
public int PathFeedrateOver;
public int PathSpeedrateOver;
public position PathPosAct;
}
public struct UnOpData
{
}
public struct AxisData
{
public int AxisSel;
public string AxisMainProc;
public bool AxisIsMaster;
public string AxisMastId;
public string AxisType;
public string AxisDir;
public int AxisLoad;
public int AxisPosAct;
public int AxisPosTgt;
public int AxisFeedAct;
public int AxisFeedOver;
public string AxisAccel;
public string AxisAccTime;
public string AxisBattery;
}
/// <summary>
/// Vettore completo posizione (X-Y-Z con versori i-j-k)
/// </summary>