diff --git a/MTC_Sim/.vs/MTC_Sim/v14/.suo b/MTC_Sim/.vs/MTC_Sim/v14/.suo index dc8ead1..ab00d2d 100644 Binary files a/MTC_Sim/.vs/MTC_Sim/v14/.suo and b/MTC_Sim/.vs/MTC_Sim/v14/.suo differ diff --git a/MTC_Sim/MTC_Sim/AdapterConf.cs b/MTC_Sim/MTC_Sim/AdapterConf.cs index 2f64f94..063e0d5 100644 --- a/MTC_Sim/MTC_Sim/AdapterConf.cs +++ b/MTC_Sim/MTC_Sim/AdapterConf.cs @@ -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 { + /// + /// id univoci x classe di elemento + /// public string idx; + /// + /// alias x poterlo riconoscere/riferire in agent + /// public string alias; + /// + /// fonte dati + /// + public fonteDati fonte; + /// + /// riferimento dati x recupero (es posizioni memoria separate da #) + /// + public string dataRef; + /// + /// init empty + /// public element() { idx = ""; alias = ""; + fonte = fonteDati.NoData; + dataRef = ""; } - public element(int Idx, string Alias) + /// + /// init element con dati + /// + /// + /// + /// + /// + public element(int Idx, string Alias, fonteDati FonteD, string DataR) { idx = Idx.ToString(); alias = Alias; + fonte = FonteD; + dataRef = DataR; } } diff --git a/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs b/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs index 76592b1..a54f78b 100644 --- a/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs +++ b/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs @@ -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; } } diff --git a/MTC_Sim/MTC_Sim/CMS_MachineSim.cs b/MTC_Sim/MTC_Sim/CMS_MachineSim.cs index f766f7c..53e69d0 100644 --- a/MTC_Sim/MTC_Sim/CMS_MachineSim.cs +++ b/MTC_Sim/MTC_Sim/CMS_MachineSim.cs @@ -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); diff --git a/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs b/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs index 630ad57..245322d 100644 --- a/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs +++ b/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/MTC_Sim/MTC_Sim/SetupAdapter.cs b/MTC_Sim/MTC_Sim/SetupAdapter.cs index 44a2a95..e4bb1e9 100644 --- a/MTC_Sim/MTC_Sim/SetupAdapter.cs +++ b/MTC_Sim/MTC_Sim/SetupAdapter.cs @@ -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; diff --git a/MTC_Sim/MTC_Sim/utils.cs b/MTC_Sim/MTC_Sim/utils.cs index 9a797be..5345a6e 100644 --- a/MTC_Sim/MTC_Sim/utils.cs +++ b/MTC_Sim/MTC_Sim/utils.cs @@ -122,6 +122,26 @@ namespace MTC_Sim HMI } + public enum fonteDati + { + /// + /// dati recuperati da metodi/calssi con HMI + /// + HMI, + /// + /// dati recuperati da recupero memorie PLC/CNC + /// + MemLoad, + /// + /// in questo caso dato fittizio/senza dati (x init) + /// + NoData, + /// + /// Dati generati random + /// + Random + } + /// /// informazioni di produzione ///