diff --git a/MTC_Sim/.vs/MTC_Sim/v14/.suo b/MTC_Sim/.vs/MTC_Sim/v14/.suo index 98549bb..77196ea 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 b86bea1..b167494 100644 --- a/MTC_Sim/MTC_Sim/AdapterConf.cs +++ b/MTC_Sim/MTC_Sim/AdapterConf.cs @@ -26,8 +26,8 @@ namespace MTC_Sim element[] _VacuumPump; element[] _VacuumAct; element[] _Lubro; + element[] _Cooler; - int nCooler; int nPress; int nTemper; int nAxis; @@ -42,7 +42,6 @@ namespace MTC_Sim sNomeAdapt = ""; etipoAdapt = tipoAdapter.Demo; - nCooler = 0; nPress = 0; nTemper = 0; nAxis = 0; @@ -106,6 +105,11 @@ namespace MTC_Sim get { return _Lubro; } set { _Lubro = value; } } + public element[] Cooler + { + get { return _Cooler; } + set { _Cooler = value; } + } diff --git a/MTC_Sim/MTC_Sim/AdapterGeneric.cs b/MTC_Sim/MTC_Sim/AdapterGeneric.cs index e16fd6a..72169d1 100644 --- a/MTC_Sim/MTC_Sim/AdapterGeneric.cs +++ b/MTC_Sim/MTC_Sim/AdapterGeneric.cs @@ -86,7 +86,6 @@ namespace MTC_Sim /// public class Lubro: element { - /// /// Alias /// @@ -118,21 +117,8 @@ namespace MTC_Sim /// /// Singolo refrigeratore, 0..n /// - public class Cooler + public class Cooler : element { - /// - /// Id univoco - /// - protected string idx; - /// - /// Descrizione/Alias - /// - protected string descr; - - /// - /// ID - /// - public Event mCoolId; /// /// Alias /// @@ -145,16 +131,19 @@ namespace MTC_Sim /// /// Classe refrigeratore con Idx e descrizione /// - /// Identificativo misura, salvato in event Cool_{0}_Id dove {0}=ident - /// Alias misura, salvato in event Cool_{0}_alias dove {0}=ident - public Cooler(string ident, string alias) + /// Identificativo univoco + /// Alias/descrizione + /// Tipo fonte dati + /// Parametri x recupero dati in forma dictionary + public Cooler(string Idx, string Alias, fonteDati FonteD, List> DataRefList) { - idx = ident; - descr = alias; + ident = Idx; + alias = Alias; + fonte = FonteD; + dataRefList = DataRefList; - mCoolId = new Event(string.Format("Cool_{0}_Id", idx)); - mCoolAlias = new Event(string.Format("Cool_{0}_Alias", idx)); - mCoolStatus = new Event(string.Format("Cool_{0}_Status", idx)); + mCoolAlias = new Event(string.Format("Cool_{0}_Alias", Idx)); + mCoolStatus = new Event(string.Format("Cool_{0}_Status", Idx)); } } /// diff --git a/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs b/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs index 2c1eb04..6818a2a 100644 --- a/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs +++ b/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs @@ -42,6 +42,8 @@ this.cbTipoAdapt = new System.Windows.Forms.ComboBox(); this.label6 = new System.Windows.Forms.Label(); this.nLubro = new System.Windows.Forms.TextBox(); + this.label7 = new System.Windows.Forms.Label(); + this.nCooler = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // txtAdapter @@ -111,14 +113,14 @@ // this.nVacPump.Location = new System.Drawing.Point(91, 36); this.nVacPump.Name = "nVacPump"; - this.nVacPump.Size = new System.Drawing.Size(57, 20); + this.nVacPump.Size = new System.Drawing.Size(33, 20); this.nVacPump.TabIndex = 6; this.nVacPump.Text = "1"; // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(182, 39); + this.label4.Location = new System.Drawing.Point(135, 39); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(60, 13); this.label4.TabIndex = 9; @@ -126,9 +128,9 @@ // // nVacAct // - this.nVacAct.Location = new System.Drawing.Point(248, 36); + this.nVacAct.Location = new System.Drawing.Point(201, 36); this.nVacAct.Name = "nVacAct"; - this.nVacAct.Size = new System.Drawing.Size(57, 20); + this.nVacAct.Size = new System.Drawing.Size(33, 20); this.nVacAct.TabIndex = 8; this.nVacAct.Text = "2"; // @@ -157,7 +159,7 @@ // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(315, 39); + this.label6.Location = new System.Drawing.Point(248, 39); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(57, 13); this.label6.TabIndex = 13; @@ -165,17 +167,36 @@ // // nLubro // - this.nLubro.Location = new System.Drawing.Point(381, 36); + this.nLubro.Location = new System.Drawing.Point(314, 36); this.nLubro.Name = "nLubro"; - this.nLubro.Size = new System.Drawing.Size(57, 20); + this.nLubro.Size = new System.Drawing.Size(33, 20); this.nLubro.TabIndex = 12; this.nLubro.Text = "1"; // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(356, 39); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(64, 13); + this.label7.TabIndex = 15; + this.label7.Text = "n° COOLER"; + // + // nCooler + // + this.nCooler.Location = new System.Drawing.Point(422, 36); + this.nCooler.Name = "nCooler"; + this.nCooler.Size = new System.Drawing.Size(33, 20); + this.nCooler.TabIndex = 14; + this.nCooler.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.label7); + this.Controls.Add(this.nCooler); this.Controls.Add(this.label6); this.Controls.Add(this.nLubro); this.Controls.Add(this.cbTipoAdapt); @@ -213,5 +234,7 @@ private System.Windows.Forms.ComboBox cbTipoAdapt; private System.Windows.Forms.Label label6; private System.Windows.Forms.TextBox nLubro; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.TextBox nCooler; } } \ No newline at end of file diff --git a/MTC_Sim/MTC_Sim/SetupAdapter.cs b/MTC_Sim/MTC_Sim/SetupAdapter.cs index f8c7c92..cbaaaba 100644 --- a/MTC_Sim/MTC_Sim/SetupAdapter.cs +++ b/MTC_Sim/MTC_Sim/SetupAdapter.cs @@ -69,6 +69,20 @@ namespace MTC_Sim return answ; } } + int numCooler + { + get + { + int answ = 0; + try + { + answ = Convert.ToInt32(nCooler.Text); + } + catch + { } + return answ; + } + } private void btnCreateFile_Click(object sender, EventArgs e) { @@ -106,7 +120,7 @@ namespace MTC_Sim // ciclo x istanziare! for (int i = 0; i < numVacPump; i++) { - VacuumPump[i] = new element(string.Format("VacPump_{0:##}", i + 1), string.Format("Pompa {0}", i + 1), fonteDati.Random,listaDR); + VacuumPump[i] = new element(string.Format("VacPump_{0:00}", i + 1), string.Format("Pompa {0}", i + 1), fonteDati.Random,listaDR); } // salvo oggetto c.VacuumPump = VacuumPump; @@ -123,7 +137,7 @@ namespace MTC_Sim // ciclo x istanziare! for (int i = 0; i < numVacAct; i++) { - VacuumAct[i] = new element(string.Format("VacAct_{0:##}", i + 1), string.Format("Attuatore vuoto {0}", i + 1), fonteDati.Random, listaDR); + VacuumAct[i] = new element(string.Format("VacAct_{0:00}", i + 1), string.Format("Attuatore vuoto {0}", i + 1), fonteDati.Random, listaDR); } // salvo oggetto c.VacuumAct = VacuumAct; @@ -140,11 +154,28 @@ namespace MTC_Sim // ciclo x istanziare! for (int i = 0; i < numLubro; i++) { - Lubro[i] = new element(string.Format("Lubro_{0:##}", i + 1), string.Format("Lubrorefrigerante {0}", i + 1), fonteDati.Random, listaDR); + Lubro[i] = new element(string.Format("Lubro_{0:00}", i + 1), string.Format("Lubrorefrigerante {0}", i + 1), fonteDati.Random, listaDR); } // salvo oggetto c.Lubro = Lubro; } + + // COOLER + if (numCooler > 0) + { + // creo elementi richiesti + element[] Cooler = new element[numCooler]; + // inizializzo list x parametri + listaDR = new List>(); + listaDR.Add(new DataRefItem("Status", "0#4")); + // ciclo x istanziare! + for (int i = 0; i < numCooler; i++) + { + Cooler[i] = new element(string.Format("Cooler_{0:00}", i + 1), string.Format("Cooler {0}", i + 1), fonteDati.Random, listaDR); + } + // salvo oggetto + c.Cooler = Cooler; + } // Serializzzo oggetto conf su file AdapterConf.Serialize(filePath, c);