From 467a0601a66b1e6908130c61ffc853aadd376328 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 22 Apr 2016 10:27:40 +0200 Subject: [PATCH] Aggiunto Path a conf adapter XML --- MTC_Sim/.vs/MTC_Sim/v14/.suo | Bin 126976 -> 126976 bytes MTC_Sim/MTC_Sim/AdapterConf.cs | 14 +- MTC_Sim/MTC_Sim/AdapterGeneric.cs | 303 +++++++++++------------ MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs | 23 ++ MTC_Sim/MTC_Sim/SetupAdapter.cs | 51 +++- 5 files changed, 222 insertions(+), 169 deletions(-) diff --git a/MTC_Sim/.vs/MTC_Sim/v14/.suo b/MTC_Sim/.vs/MTC_Sim/v14/.suo index 5115ab0959891877c29293b33b37eebbf104af08..c6083eda0851f5d2cedebd5ca4e10f1e9407e4bd 100644 GIT binary patch delta 1810 zcmchXe{54#6vyB9?X_#Wt+ZWN$~Hzf%jkZf z;u}B}gH#Zo^%&!*Kuyhu1xdwH}L5&RRz)E-ZeIYa06N3(28%D&H? zNn!7p<{PMLAwL>?tt^L>mxyPH4a9RqI&u!_L1Ghel$0hX|@RGg9;@QBP)>NW9J z_>7rttBUR!?Zkl`39*V$cn zgTyOI=9$-}Y!lUdtH_S84rsN7aj2e%i0`z{k}%}JFxuqnU2xc|3nFH1`1WM9uQA#b z=szq(gT>~p!g`@m*dYwDZ%Te<-G0g5KHv!dxngqBndY+(&NUBoQdsVcFt}DLMUuK~ z0=U3#J+{Nd=lvEhX4`V_!o{S#Pn;t9h!}C2_<;DG_>dTg2E)wvxRwf7w{%G>i%uh$!)W+)$vO1)Ky*TyUmS)j?uiVl9Momc$eN%TPp$Ftb0!F;{V zfiA=xaKy49#_Ax&tZ>KH!e;5Ddz?$jGX=Rggp2y+7f=j&bQiYBTY3?YCtL87+}%rq zcp6qq$3LTSQI7WFR5FrIUcw;XI4R#e1e08I6h57fo)G8I8v{|e=U+0^e5Iv!#wkep z?GUO(*9g^+6mL9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8J z59z|d4w#bQUv*hv<+0vo)Twai`xB<%pC*iYHfCB0X4>4rOsn$kLo<9mzga!pOp!>9 zF&VQT7YMe#ID&ruDCU&a52t0QvdEXCbo9Z1`;+#8VaWaZ4j4z*$&&cUH2R64pK2m~ z+vKI%;#Dd~QCI_1jIYfRb2h;VDRb7^Mf)eP ZSt&@qhC9q%(<-)hL!(TTU4YxFKLB57uEqcW 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);