From 0cfcf9233ff37bac3f9cf0a1adbec3e22e6819a6 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 22 Apr 2016 08:07:17 +0200 Subject: [PATCH] aggiunti parametri x conf adapter --- MTC_Sim/.vs/MTC_Sim/v14/.suo | Bin 126976 -> 130048 bytes MTC_Sim/MTC_Sim/AdapterConf.cs | 37 ++++++++++++++++++++- MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs | 18 +++++----- MTC_Sim/MTC_Sim/CMS_MachineSim.cs | 4 +-- MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs | 35 ++++++++++++++++--- MTC_Sim/MTC_Sim/SetupAdapter.cs | 17 ++++++++-- MTC_Sim/MTC_Sim/utils.cs | 20 +++++++++++ 7 files changed, 114 insertions(+), 17 deletions(-) diff --git a/MTC_Sim/.vs/MTC_Sim/v14/.suo b/MTC_Sim/.vs/MTC_Sim/v14/.suo index dc8ead1a9cfaf06bfc13a643fa8e06d8ff492ca6..ab00d2d77f060052caff8342154d8269d9738d7d 100644 GIT binary patch delta 779 zcmZp8z~1nKeS*RC4-$-=5&{eistgPa%s~9_|Ns9$ih&V`r8fpjGqG*ZvpN+sXLAwL zFJ`s__HHvkY_>K|MyJg``TsM6DB*ft#>1N{9segY?%Z6tbYned3Q#u>5T|T6R%QGy zi_CXs{Kn1LGF{7`@gU=Y>F>N4H}aPeqz!ecB(Ki2!m~%u2{l&b^3%R#--EOXEEwe-`K-=Zu;~b##@Y!rcZ2QoIAZHo6&81 zVJ@Q{3*!}tNI(~(z;@|kMm-KOJ)jv7@MC`*kWmH1E;k^`5^@;Lw;R_min0iLKov1C zs2yknvSqff?O}YtC>8`4S2_UF$_m6T$o4v}XUyl8kN^sULK}p&XIdpG1ZVS2Okbb4 zePYaGyajPT$Qafd zxBQ~q?cYimgV~7ktQRB5Jct{%2i7ruXQasUf$U-_Oh8|Qf%<`ZAe#foc0r1X>A;xK z*k0SoXv{2yE1=dVPHt3I-TrD1qnPn@rb~<-(=r&PwkJJdT*NY6&4p2Ix`7L$41Qwr L116zmuNc_?s)*tA delta 670 zcmZqp!QSwIeS(1^69W_oFffDynan`^@Bjb*AW;xoWMiN-6Wamq+c!SV-dx1=ip8=Lx_N*&e7mtK<9AtPzBA)D zZpIDMwfq?mGQOGq&Wmy5^qqc;I{YaNsSLRc`3!mt6+k*?`kDa7u2I1C-KHy+FkYQ*GKcZjcKbX=Jr>3@ z5V?1aj2zQ>*E4Et&t1T{g>gGjnFhO{2+$-5P&(iYWQcE1T*;`+w7s^L@idc|K1`B9 z + /// 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 ///