aggiunti parametri x conf adapter

This commit is contained in:
Samuele E. Locatelli
2016-04-22 08:07:17 +02:00
parent 03358f0200
commit 0cfcf9233f
7 changed files with 114 additions and 17 deletions
Binary file not shown.
+36 -1
View File
@@ -18,6 +18,7 @@ namespace MTC_Sim
{
string sNomeAdapt;
int nVers;
public tipoAdapter etipoAdapt;
element[] _VacuumPump;
element[] _VacuumAct;
@@ -33,6 +34,7 @@ namespace MTC_Sim
public AdapterConf()
{
sNomeAdapt = "";
etipoAdapt = tipoAdapter.Demo;
nLubro = 0;
nCooler = 0;
@@ -69,6 +71,11 @@ namespace MTC_Sim
get { return sNomeAdapt; }
set { sNomeAdapt = value; }
}
public tipoAdapter TipoAdapt
{
get { return etipoAdapt; }
set { etipoAdapt = value; }
}
public element[] VacuumPump
{
get { return _VacuumPump; }
@@ -86,18 +93,46 @@ namespace MTC_Sim
public class element
{
/// <summary>
/// id univoci x classe di elemento
/// </summary>
public string idx;
/// <summary>
/// alias x poterlo riconoscere/riferire in agent
/// </summary>
public string alias;
/// <summary>
/// fonte dati
/// </summary>
public fonteDati fonte;
/// <summary>
/// riferimento dati x recupero (es posizioni memoria separate da #)
/// </summary>
public string dataRef;
/// <summary>
/// init empty
/// </summary>
public element()
{
idx = "";
alias = "";
fonte = fonteDati.NoData;
dataRef = "";
}
public element(int Idx, string Alias)
/// <summary>
/// init element con dati
/// </summary>
/// <param name="Idx"></param>
/// <param name="Alias"></param>
/// <param name="FonteD"></param>
/// <param name="DataR"></param>
public element(int Idx, string Alias, fonteDati FonteD, string DataR)
{
idx = Idx.ToString();
alias = Alias;
fonte = FonteD;
dataRef = DataR;
}
}
+10 -8
View File
@@ -150,7 +150,7 @@
this.fILEToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.lOADADAPTERCONFToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.sETUPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mANAGEADAPTERCONFIGURATIONToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mConfGen = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox4.SuspendLayout();
this.groupBox5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PosAct)).BeginInit();
@@ -1314,17 +1314,19 @@
// sETUPToolStripMenuItem
//
this.sETUPToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mANAGEADAPTERCONFIGURATIONToolStripMenuItem});
this.mConfGen});
this.sETUPToolStripMenuItem.Name = "sETUPToolStripMenuItem";
this.sETUPToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.S)));
this.sETUPToolStripMenuItem.Size = new System.Drawing.Size(53, 20);
this.sETUPToolStripMenuItem.Text = "SETUP";
//
// mANAGEADAPTERCONFIGURATIONToolStripMenuItem
// mConfGen
//
this.mANAGEADAPTERCONFIGURATIONToolStripMenuItem.Name = "mANAGEADAPTERCONFIGURATIONToolStripMenuItem";
this.mANAGEADAPTERCONFIGURATIONToolStripMenuItem.Size = new System.Drawing.Size(274, 22);
this.mANAGEADAPTERCONFIGURATIONToolStripMenuItem.Text = "MANAGE ADAPTER CONFIGURATION";
this.mANAGEADAPTERCONFIGURATIONToolStripMenuItem.Click += new System.EventHandler(this.mANAGEADAPTERCONFIGURATIONToolStripMenuItem_Click);
this.mConfGen.Name = "mConfGen";
this.mConfGen.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.T)));
this.mConfGen.Size = new System.Drawing.Size(271, 22);
this.mConfGen.Text = "TEMPLATE CONF GENERATOR";
this.mConfGen.Click += new System.EventHandler(this.mConfGen_Click);
//
// CMS_MachineSim
//
@@ -1513,7 +1515,7 @@
private System.Windows.Forms.ToolStripMenuItem fILEToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem lOADADAPTERCONFToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem sETUPToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mANAGEADAPTERCONFIGURATIONToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mConfGen;
}
}
+2 -2
View File
@@ -637,8 +637,8 @@ namespace MTC_Sim
txtPathSpeedOver.Text = hsPathSpeedOver.Value.ToString();
raiseFlag_FEED_SPEED();
}
private void mANAGEADAPTERCONFIGURATIONToolStripMenuItem_Click(object sender, EventArgs e)
private void mConfGen_Click(object sender, EventArgs e)
{
SetupAdapter setupWIndow = new SetupAdapter();
setupWIndow.Show(this);
+31 -4
View File
@@ -38,13 +38,15 @@
this.nVacPump = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.nVacAct = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.cbTipoAdapt = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// txtAdapter
//
this.txtAdapter.Location = new System.Drawing.Point(91, 10);
this.txtAdapter.Name = "txtAdapter";
this.txtAdapter.Size = new System.Drawing.Size(252, 20);
this.txtAdapter.Size = new System.Drawing.Size(214, 20);
this.txtAdapter.TabIndex = 0;
this.txtAdapter.Text = "CMS_ADAPTER_00";
//
@@ -60,7 +62,7 @@
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(359, 13);
this.label2.Location = new System.Drawing.Point(311, 13);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(63, 13);
this.label2.TabIndex = 3;
@@ -68,9 +70,9 @@
//
// txtFileName
//
this.txtFileName.Location = new System.Drawing.Point(428, 10);
this.txtFileName.Location = new System.Drawing.Point(380, 10);
this.txtFileName.Name = "txtFileName";
this.txtFileName.Size = new System.Drawing.Size(252, 20);
this.txtFileName.Size = new System.Drawing.Size(122, 20);
this.txtFileName.TabIndex = 2;
this.txtFileName.Text = "Demo.xml";
//
@@ -128,11 +130,34 @@
this.nVacAct.TabIndex = 8;
this.nVacAct.Text = "0";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(517, 13);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(32, 13);
this.label5.TabIndex = 10;
this.label5.Text = "TIPO";
//
// cbTipoAdapt
//
this.cbTipoAdapt.FormattingEnabled = true;
this.cbTipoAdapt.Items.AddRange(new object[] {
"DEMO",
"FANUC",
"HMI"});
this.cbTipoAdapt.Location = new System.Drawing.Point(555, 10);
this.cbTipoAdapt.Name = "cbTipoAdapt";
this.cbTipoAdapt.Size = new System.Drawing.Size(121, 21);
this.cbTipoAdapt.TabIndex = 11;
//
// SetupAdapter
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(692, 517);
this.Controls.Add(this.cbTipoAdapt);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.nVacAct);
this.Controls.Add(this.label3);
@@ -162,5 +187,7 @@
private System.Windows.Forms.TextBox nVacPump;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox nVacAct;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ComboBox cbTipoAdapt;
}
}
+15 -2
View File
@@ -62,13 +62,26 @@ namespace MTC_Sim
AdapterConf c = new AdapterConf();
c.NomeAdapt = txtAdapter.Text;
c.Version = 1;
switch (cbTipoAdapt.SelectedText)
{
case "FANUC":
c.TipoAdapt = tipoAdapter.Fanuc;
break;
case "HMI":
c.TipoAdapt = tipoAdapter.HMI;
break;
case "DEMO":
default:
c.TipoAdapt = tipoAdapter.Demo;
break;
}
// inizializzo tamte pompe quanto richieste...
if (numVacPump > 0)
{
element[] VacuumPump = new element[numVacPump];
for (int i = 0; i < numVacPump; i++)
{
VacuumPump[i] = new element(i + 1, string.Format("Pompa {0}", i + 1));
VacuumPump[i] = new element(i + 1, string.Format("Pompa {0}", i + 1), fonteDati.Random,"0#8");
}
// salvo oggetto
c.VacuumPump = VacuumPump;
@@ -79,7 +92,7 @@ namespace MTC_Sim
element[] VacuumAct = new element[numVacAct];
for (int i = 0; i < numVacAct; i++)
{
VacuumAct[i] = new element(i + 1, string.Format("Attuatore vuoto {0}", i + 1));
VacuumAct[i] = new element(i + 1, string.Format("Attuatore vuoto {0}", i + 1), fonteDati.Random, "0#8");
}
// salvo oggetto
c.VacuumAct = VacuumAct;
+20
View File
@@ -122,6 +122,26 @@ namespace MTC_Sim
HMI
}
public enum fonteDati
{
/// <summary>
/// dati recuperati da metodi/calssi con HMI
/// </summary>
HMI,
/// <summary>
/// dati recuperati da recupero memorie PLC/CNC
/// </summary>
MemLoad,
/// <summary>
/// in questo caso dato fittizio/senza dati (x init)
/// </summary>
NoData,
/// <summary>
/// Dati generati random
/// </summary>
Random
}
/// <summary>
/// informazioni di produzione
/// </summary>