diff --git a/MTC_Sim/.vs/MTC_Sim/v14/.suo b/MTC_Sim/.vs/MTC_Sim/v14/.suo index 5115ab0..c6083ed 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 fa0d521..87f1212 100644 --- a/MTC_Sim/MTC_Sim/AdapterConf.cs +++ b/MTC_Sim/MTC_Sim/AdapterConf.cs @@ -29,10 +29,11 @@ namespace MTC_Sim element[] _Cooler; element[] _Press; element[] _Temp; - - int nAxis; + element[] _Path; + int nPath; int nUnOp; + int nAxis; /// /// init conf adapter @@ -42,10 +43,8 @@ namespace MTC_Sim sNomeAdapt = ""; etipoAdapt = tipoAdapter.Demo; - nAxis = 0; - nPath = 0; nUnOp = 0; - + nAxis = 0; } /// /// Serializzazione XML dell'oggetto conf dell'adapter @@ -118,6 +117,11 @@ namespace MTC_Sim get { return _Temp; } set { _Temp = value; } } + public element[] Path + { + get { return _Path; } + set { _Path = value; } + } } diff --git a/MTC_Sim/MTC_Sim/AdapterGeneric.cs b/MTC_Sim/MTC_Sim/AdapterGeneric.cs index c9bc7f6..f58888e 100644 --- a/MTC_Sim/MTC_Sim/AdapterGeneric.cs +++ b/MTC_Sim/MTC_Sim/AdapterGeneric.cs @@ -208,6 +208,151 @@ namespace MTC_Sim mTempValIst = new Sample(string.Format("{0}_ValIst", Idx)); } } + + /// + /// Singolo path, da 1..20 + /// + public class Path : element + { + /// + /// Alias + /// + public Event mPathAlias; + /// + /// Feedrate + /// + public Sample mPathFeed; + /// + /// Override feed + /// + public Sample mPathFeedOver; + /// + /// Override speed + /// + public Sample mPathSpeedOver; + /// + /// Posizione X + /// + public Sample mPathPosActX; + /// + /// Posizione Y + /// + public Sample mPathPosActY; + /// + /// Posizione Z + /// + public Sample mPathPosActZ; + /// + /// Angolo I + /// + public Sample mPathPosActI; + /// + /// Angolo J + /// + public Sample mPathPosActJ; + /// + /// Angolo K + /// + public Sample mPathPosActK; + + /// + /// Classe Path con Idx e descrizione + /// + /// Identificativo univoco + /// Alias/descrizione + /// Tipo fonte dati + /// Parametri x recupero dati in forma dictionary + public Path(string Idx, string Alias, fonteDati FonteD, List> DataRefList) + { + ident = Idx; + alias = Alias; + fonte = FonteD; + dataRefList = DataRefList; + + mPathAlias = new Event(string.Format("{0}_Alias", Idx)); + mPathFeed = new Sample(string.Format("{0}_Feed", Idx)); + mPathFeedOver = new Sample(string.Format("{0}_Feed_Over", Idx)); + mPathSpeedOver = new Sample(string.Format("{0}_Speed_Over", Idx)); + mPathPosActX = new Sample(string.Format("{0}_PosAct_X", Idx)); + mPathPosActY = new Sample(string.Format("{0}_PosAct_Y", Idx)); + mPathPosActZ = new Sample(string.Format("{0}_PosAct_Z", Idx)); + mPathPosActI = new Sample(string.Format("{0}_PosAct_I", Idx)); + mPathPosActJ = new Sample(string.Format("{0}_PosAct_J", Idx)); + mPathPosActK = new Sample(string.Format("{0}_PosAct_K", Idx)); + } + } + + /// + /// Singolo mandrino, 1..n + /// + public class UnOp + { + /// + /// Id univoco + /// + protected string idx; + /// + /// Descrizione/Alias + /// + protected string descr; + + /// + /// ID + /// + public Event mUnOpId; + /// + /// Alias + /// + public Event mUnOpAlias; + /// + /// Alias + /// + public Event mUnOpToolId; + /// + /// valore numero Cambi Utensili effettuato + /// + public Event mUnOpNumCU; + /// + /// status utensil + /// + public Event mUnOpStatus; + /// + /// valore vita residua utensile + /// + public Event mUnOpVitaRes; + /// + /// valore speed + /// + public Sample mUnOpSpeed; + /// + /// valore load + /// + public Sample mUnOpLoad; + /// + /// valore tempo cumulato di impiego + /// + public Sample mUnOpAccTime; + /// + /// 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) + { + idx = ident; + descr = alias; + + 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)); + } + } /// /// Asse singolo, 1..n /// @@ -316,164 +461,6 @@ namespace MTC_Sim } - /// - /// Singolo path, da 1..20 - /// - public class Path - {/// - /// Id univoco - /// - protected string idx; - /// - /// Descrizione/Alias - /// - protected string descr; - - /// - /// ID - /// - public Event mPathId; - /// - /// Alias - /// - public Event mPathAlias; - - - /// - /// Feedrate - /// - public Sample mPathFeed; - /// - /// Override feed - /// - public Sample mPathFeedOver; - /// - /// Override speed - /// - public Sample mPathSpeedOver; - /// - /// Posizione X - /// - public Sample mPathPosActX; - /// - /// Posizione Y - /// - public Sample mPathPosActY; - /// - /// Posizione Z - /// - public Sample mPathPosActZ; - /// - /// Angolo I - /// - public Sample mPathPosActI; - /// - /// Angolo J - /// - public Sample mPathPosActJ; - /// - /// Angolo K - /// - public Sample mPathPosActK; - - - - /// - /// Classe Path con Idx e descrizione - /// - /// Identificativo misura, salvato in event Path_{0}_Id dove {0}=ident - /// Alias misura, salvato in event Path_{0}_alias dove {0}=ident - public Path(string ident, string alias) - { - idx = ident; - descr = alias; - - mPathId = new Event(string.Format("Path_{0}_Id", idx)); - mPathAlias = new Event(string.Format("Path_{0}_Alias", idx)); - - mPathFeed = new Sample(string.Format("Path_{0}_Feed", idx)); - mPathFeedOver = new Sample(string.Format("Path_{0}_Feed_Over", idx)); - mPathSpeedOver = new Sample(string.Format("Path_{0}_Speed_Over", idx)); - mPathPosActX = new Sample(string.Format("Path_{0}_PosAct_X", idx)); - mPathPosActY = new Sample(string.Format("Path_{0}_PosAct_Y", idx)); - mPathPosActZ = new Sample(string.Format("Path_{0}_PosAct_Z", idx)); - mPathPosActI = new Sample(string.Format("Path_{0}_PosAct_I", idx)); - mPathPosActJ = new Sample(string.Format("Path_{0}_PosAct_J", idx)); - mPathPosActK = new Sample(string.Format("Path_{0}_PosAct_K", idx)); - } - } - - /// - /// Singolo mandrino, 1..n - /// - public class UnOp - { - /// - /// Id univoco - /// - protected string idx; - /// - /// Descrizione/Alias - /// - protected string descr; - - /// - /// ID - /// - public Event mUnOpId; - /// - /// Alias - /// - public Event mUnOpAlias; - /// - /// Alias - /// - public Event mUnOpToolId; - /// - /// valore numero Cambi Utensili effettuato - /// - public Event mUnOpNumCU; - /// - /// status utensil - /// - public Event mUnOpStatus; - /// - /// valore vita residua utensile - /// - public Event mUnOpVitaRes; - /// - /// valore speed - /// - public Sample mUnOpSpeed; - /// - /// valore load - /// - public Sample mUnOpLoad; - /// - /// valore tempo cumulato di impiego - /// - public Sample mUnOpAccTime; - /// - /// 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) - { - idx = ident; - descr = alias; - - 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)); - } - } #endregion diff --git a/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs b/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs index 98a152e..8b1632a 100644 --- a/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs +++ b/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs @@ -48,6 +48,8 @@ this.nPress = new System.Windows.Forms.TextBox(); this.label9 = new System.Windows.Forms.Label(); this.nTempe = new System.Windows.Forms.TextBox(); + this.label10 = new System.Windows.Forms.Label(); + this.nPath = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // txtAdapter @@ -228,11 +230,30 @@ this.nTempe.TabIndex = 18; this.nTempe.Text = "1"; // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(314, 65); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(49, 13); + this.label10.TabIndex = 21; + this.label10.Text = "n° PATH"; + // + // nPath + // + this.nPath.Location = new System.Drawing.Point(380, 62); + this.nPath.Name = "nPath"; + this.nPath.Size = new System.Drawing.Size(33, 20); + this.nPath.TabIndex = 20; + this.nPath.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.label10); + this.Controls.Add(this.nPath); this.Controls.Add(this.label9); this.Controls.Add(this.nTempe); this.Controls.Add(this.label8); @@ -282,5 +303,7 @@ private System.Windows.Forms.TextBox nPress; private System.Windows.Forms.Label label9; private System.Windows.Forms.TextBox nTempe; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.TextBox nPath; } } \ No newline at end of file diff --git a/MTC_Sim/MTC_Sim/SetupAdapter.cs b/MTC_Sim/MTC_Sim/SetupAdapter.cs index dc46a3c..68417ca 100644 --- a/MTC_Sim/MTC_Sim/SetupAdapter.cs +++ b/MTC_Sim/MTC_Sim/SetupAdapter.cs @@ -111,6 +111,20 @@ namespace MTC_Sim return answ; } } + int numPath + { + get + { + int answ = 0; + try + { + answ = Convert.ToInt32(nPath.Text); + } + catch + { } + return answ; + } + } private void btnCreateFile_Click(object sender, EventArgs e) { @@ -144,7 +158,7 @@ namespace MTC_Sim element[] VacuumPump = new element[numVacPump]; // inizializzo list x parametri listaDR =new List>(); - listaDR.Add(new DataRefItem("Status","0#8")); + listaDR.Add(new DataRefItem("Status","0#7")); // ciclo x istanziare! for (int i = 0; i < numVacPump; i++) { @@ -161,7 +175,7 @@ namespace MTC_Sim element[] VacuumAct = new element[numVacAct]; // inizializzo list x parametri listaDR = new List>(); - listaDR.Add(new DataRefItem("Count", "0#16")); + listaDR.Add(new DataRefItem("Count", "0#15")); // ciclo x istanziare! for (int i = 0; i < numVacAct; i++) { @@ -178,7 +192,7 @@ namespace MTC_Sim element[] Lubro = new element[numLubro]; // inizializzo list x parametri listaDR = new List>(); - listaDR.Add(new DataRefItem("Num", "0#16")); + listaDR.Add(new DataRefItem("Num", "0#15")); // ciclo x istanziare! for (int i = 0; i < numLubro; i++) { @@ -195,7 +209,7 @@ namespace MTC_Sim element[] Cooler = new element[numCooler]; // inizializzo list x parametri listaDR = new List>(); - listaDR.Add(new DataRefItem("Status", "0#4")); + listaDR.Add(new DataRefItem("Status", "0#3")); // ciclo x istanziare! for (int i = 0; i < numCooler; i++) { @@ -212,7 +226,7 @@ namespace MTC_Sim element[] Press = new element[numPress]; // inizializzo list x parametri listaDR = new List>(); - listaDR.Add(new DataRefItem("Value", "0#8")); + listaDR.Add(new DataRefItem("Value", "0#7")); // ciclo x istanziare! for (int i = 0; i < numPress; i++) { @@ -229,7 +243,7 @@ namespace MTC_Sim element[] Temp = new element[numTemp]; // inizializzo list x parametri listaDR = new List>(); - listaDR.Add(new DataRefItem("Value", "0#8")); + listaDR.Add(new DataRefItem("Value", "0#7")); // ciclo x istanziare! for (int i = 0; i < numTemp; i++) { @@ -238,6 +252,31 @@ namespace MTC_Sim // salvo oggetto c.Temp = Temp; } + + // PATH + if (numPath > 0) + { + // creo elementi richiesti + element[] Path = new element[numPath]; + // inizializzo list x parametri + listaDR = new List>(); + listaDR.Add(new DataRefItem("FeedRate", "0#15")); + listaDR.Add(new DataRefItem("FeedOverr", "16#31")); + listaDR.Add(new DataRefItem("SpeedOverr", "32#47")); + listaDR.Add(new DataRefItem("PosActX", "48#63")); + listaDR.Add(new DataRefItem("PosActY", "64#79")); + listaDR.Add(new DataRefItem("PosActZ", "80#95")); + listaDR.Add(new DataRefItem("PosActI", "96#111")); + listaDR.Add(new DataRefItem("PosActJ", "112#127")); + listaDR.Add(new DataRefItem("PosActK", "128#143")); + // ciclo x istanziare! + for (int i = 0; i < numPath; i++) + { + Path[i] = new element(string.Format("Path_{0:00}", i + 1), string.Format("Path num {0}", i + 1), fonteDati.Random, listaDR); + } + // salvo oggetto + c.Path = Path; + } // Serializzo oggetto conf su file AdapterConf.Serialize(filePath, c);