diff --git a/MTC_Sim/.vs/MTC_Sim/v14/.suo b/MTC_Sim/.vs/MTC_Sim/v14/.suo index c6083ed..126808b 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 87f1212..f7d1be3 100644 --- a/MTC_Sim/MTC_Sim/AdapterConf.cs +++ b/MTC_Sim/MTC_Sim/AdapterConf.cs @@ -30,9 +30,8 @@ namespace MTC_Sim element[] _Press; element[] _Temp; element[] _Path; + element[] _UnOp; - int nPath; - int nUnOp; int nAxis; /// @@ -43,7 +42,6 @@ namespace MTC_Sim sNomeAdapt = ""; etipoAdapt = tipoAdapter.Demo; - nUnOp = 0; nAxis = 0; } /// @@ -122,6 +120,11 @@ namespace MTC_Sim get { return _Path; } set { _Path = value; } } + public element[] UnOp + { + get { return _UnOp; } + set { _UnOp = value; } + } } diff --git a/MTC_Sim/MTC_Sim/AdapterGeneric.cs b/MTC_Sim/MTC_Sim/AdapterGeneric.cs index f58888e..51ffde3 100644 --- a/MTC_Sim/MTC_Sim/AdapterGeneric.cs +++ b/MTC_Sim/MTC_Sim/AdapterGeneric.cs @@ -285,21 +285,8 @@ namespace MTC_Sim /// /// Singolo mandrino, 1..n /// - public class UnOp + public class UnOp : element { - /// - /// Id univoco - /// - protected string idx; - /// - /// Descrizione/Alias - /// - protected string descr; - - /// - /// ID - /// - public Event mUnOpId; /// /// Alias /// @@ -335,22 +322,25 @@ namespace MTC_Sim /// /// Classe Unita Operatrice (Mandrino) con Idx e descrizione /// - /// Identificativo misura, salvato in event UnOp_{0}_Id dove {0}=ident - /// Alias misura, salvato in event UnOp_{0}_alias dove {0}=ident - public UnOp(string ident, string alias) + /// Identificativo univoco + /// Alias/descrizione + /// Tipo fonte dati + /// Parametri x recupero dati in forma dictionary + public UnOp(string Idx, string Alias, fonteDati FonteD, List> DataRefList) { - idx = ident; - descr = alias; + ident = Idx; + alias = Alias; + fonte = FonteD; + dataRefList = DataRefList; - mUnOpId = new Event(string.Format("UnOp_{0}_Id", idx)); - mUnOpAlias = new Event(string.Format("UnOp_{0}_Alias", idx)); - mUnOpToolId = new Event(string.Format("UnOp_{0}_ToolId", idx)); - mUnOpNumCU = new Event(string.Format("UnOp_{0}_NumCU", idx)); - mUnOpStatus = new Event(string.Format("UnOp_{0}_Status", idx)); - mUnOpVitaRes = new Event(string.Format("UnOp_{0}_VitaRes", idx)); - mUnOpSpeed = new Sample(string.Format("UnOp_{0}_Speed", idx)); - mUnOpLoad = new Sample(string.Format("UnOp_{0}_Load", idx)); - mUnOpAccTime = new Sample(string.Format("UnOp_{0}_AccTime", idx)); + mUnOpAlias = new Event(string.Format("{0}_Alias", Idx)); + mUnOpToolId = new Event(string.Format("{0}_ToolId", Idx)); + mUnOpNumCU = new Event(string.Format("{0}_NumCU", Idx)); + mUnOpStatus = new Event(string.Format("{0}_Status", Idx)); + mUnOpVitaRes = new Event(string.Format("{0}_VitaRes", Idx)); + mUnOpSpeed = new Sample(string.Format("{0}_Speed", Idx)); + mUnOpLoad = new Sample(string.Format("{0}_Load", Idx)); + mUnOpAccTime = new Sample(string.Format("{0}_AccTime", Idx)); } } /// diff --git a/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs b/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs index 8b1632a..8a036ed 100644 --- a/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs +++ b/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs @@ -50,6 +50,8 @@ this.nTempe = new System.Windows.Forms.TextBox(); this.label10 = new System.Windows.Forms.Label(); this.nPath = new System.Windows.Forms.TextBox(); + this.label11 = new System.Windows.Forms.Label(); + this.nUnOp = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // txtAdapter @@ -247,11 +249,30 @@ this.nPath.TabIndex = 20; this.nPath.Text = "1"; // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(473, 65); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(52, 13); + this.label11.TabIndex = 23; + this.label11.Text = "n° Un OP"; + // + // nUnOp + // + this.nUnOp.Location = new System.Drawing.Point(539, 62); + this.nUnOp.Name = "nUnOp"; + this.nUnOp.Size = new System.Drawing.Size(33, 20); + this.nUnOp.TabIndex = 22; + this.nUnOp.Text = "1"; + // // 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.label11); + this.Controls.Add(this.nUnOp); this.Controls.Add(this.label10); this.Controls.Add(this.nPath); this.Controls.Add(this.label9); @@ -305,5 +326,7 @@ private System.Windows.Forms.TextBox nTempe; private System.Windows.Forms.Label label10; private System.Windows.Forms.TextBox nPath; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.TextBox nUnOp; } } \ No newline at end of file diff --git a/MTC_Sim/MTC_Sim/SetupAdapter.cs b/MTC_Sim/MTC_Sim/SetupAdapter.cs index 68417ca..29b6d54 100644 --- a/MTC_Sim/MTC_Sim/SetupAdapter.cs +++ b/MTC_Sim/MTC_Sim/SetupAdapter.cs @@ -125,6 +125,20 @@ namespace MTC_Sim return answ; } } + int numUnOp + { + get + { + int answ = 0; + try + { + answ = Convert.ToInt32(nUnOp.Text); + } + catch + { } + return answ; + } + } private void btnCreateFile_Click(object sender, EventArgs e) { @@ -278,6 +292,29 @@ namespace MTC_Sim c.Path = Path; } + // UNITA OPERATRICI + if (numUnOp > 0) + { + // creo elementi richiesti + element[] UnOp = new element[numUnOp]; + // inizializzo list x parametri + listaDR = new List>(); + listaDR.Add(new DataRefItem("ToolId", "0#7")); + listaDR.Add(new DataRefItem("NumCU", "8#15")); + listaDR.Add(new DataRefItem("Status", "16#23")); + listaDR.Add(new DataRefItem("VitaRes", "24#31")); + listaDR.Add(new DataRefItem("Speed", "32#39")); + listaDR.Add(new DataRefItem("Load", "40#47")); + listaDR.Add(new DataRefItem("AccTime", "48#55")); + // ciclo x istanziare! + for (int i = 0; i < numUnOp; i++) + { + UnOp[i] = new element(string.Format("UnOp_{0:00}", i + 1), string.Format("Unita Op num {0}", i + 1), fonteDati.Random, listaDR); + } + // salvo oggetto + c.UnOp = UnOp; + } + // Serializzo oggetto conf su file AdapterConf.Serialize(filePath, c);