Aggiunto cooler

This commit is contained in:
Samuele E. Locatelli
2016-04-22 09:55:53 +02:00
parent f70fa353a7
commit fbcf331edd
5 changed files with 82 additions and 35 deletions
Binary file not shown.
+6 -2
View File
@@ -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; }
}
+12 -23
View File
@@ -86,7 +86,6 @@ namespace MTC_Sim
/// </summary>
public class Lubro: element
{
/// <summary>
/// Alias
/// </summary>
@@ -118,21 +117,8 @@ namespace MTC_Sim
/// <summary>
/// Singolo refrigeratore, 0..n
/// </summary>
public class Cooler
public class Cooler : element
{
/// <summary>
/// Id univoco
/// </summary>
protected string idx;
/// <summary>
/// Descrizione/Alias
/// </summary>
protected string descr;
/// <summary>
/// ID
/// </summary>
public Event mCoolId;
/// <summary>
/// Alias
/// </summary>
@@ -145,16 +131,19 @@ namespace MTC_Sim
/// <summary>
/// Classe refrigeratore con Idx e descrizione
/// </summary>
/// <param name="ident">Identificativo misura, salvato in event Cool_{0}_Id dove {0}=ident</param>
/// <param name="alias">Alias misura, salvato in event Cool_{0}_alias dove {0}=ident</param>
public Cooler(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 Cooler(string Idx, string Alias, fonteDati FonteD, List<DataRefItem<string, string>> 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));
}
}
/// <summary>
+30 -7
View File
@@ -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;
}
}
+34 -3
View File
@@ -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<DataRefItem<string, string>>();
listaDR.Add(new DataRefItem<string, string>("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);