Aggiunta conf mandrino / Unità Operatrice

This commit is contained in:
Samuele E. Locatelli
2016-04-22 10:35:57 +02:00
parent 467a0601a6
commit a9ecaee9ff
5 changed files with 84 additions and 31 deletions
Binary file not shown.
+6 -3
View File
@@ -30,9 +30,8 @@ namespace MTC_Sim
element[] _Press;
element[] _Temp;
element[] _Path;
element[] _UnOp;
int nPath;
int nUnOp;
int nAxis;
/// <summary>
@@ -43,7 +42,6 @@ namespace MTC_Sim
sNomeAdapt = "";
etipoAdapt = tipoAdapter.Demo;
nUnOp = 0;
nAxis = 0;
}
/// <summary>
@@ -122,6 +120,11 @@ namespace MTC_Sim
get { return _Path; }
set { _Path = value; }
}
public element[] UnOp
{
get { return _UnOp; }
set { _UnOp = value; }
}
}
+18 -28
View File
@@ -285,21 +285,8 @@ namespace MTC_Sim
/// <summary>
/// Singolo mandrino, 1..n
/// </summary>
public class UnOp
public class UnOp : element
{
/// <summary>
/// Id univoco
/// </summary>
protected string idx;
/// <summary>
/// Descrizione/Alias
/// </summary>
protected string descr;
/// <summary>
/// ID
/// </summary>
public Event mUnOpId;
/// <summary>
/// Alias
/// </summary>
@@ -335,22 +322,25 @@ namespace MTC_Sim
/// <summary>
/// Classe Unita Operatrice (Mandrino) con Idx e descrizione
/// </summary>
/// <param name="ident">Identificativo misura, salvato in event UnOp_{0}_Id dove {0}=ident</param>
/// <param name="alias">Alias misura, salvato in event UnOp_{0}_alias dove {0}=ident</param>
public UnOp(string ident, string alias)
/// <param name="Idx">Identificativo univoco</param>
/// <param name="Alias">Alias/descrizione</param>
/// <param name="FonteD">Tipo fonte dati</param>
/// <param name="DataRefList">Parametri x recupero dati in forma dictionary</param>
public UnOp(string Idx, string Alias, fonteDati FonteD, List<DataRefItem<string, string>> 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));
}
}
/// <summary>
+23
View File
@@ -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;
}
}
+37
View File
@@ -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<DataRefItem<string, string>>();
listaDR.Add(new DataRefItem<string, string>("ToolId", "0#7"));
listaDR.Add(new DataRefItem<string, string>("NumCU", "8#15"));
listaDR.Add(new DataRefItem<string, string>("Status", "16#23"));
listaDR.Add(new DataRefItem<string, string>("VitaRes", "24#31"));
listaDR.Add(new DataRefItem<string, string>("Speed", "32#39"));
listaDR.Add(new DataRefItem<string, string>("Load", "40#47"));
listaDR.Add(new DataRefItem<string, string>("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);