- FixedStartMassCollection method ready to be tested
- FlyingStart method (without mass collection) flow corrections fixed - DataEntry/WMStates data entry forms added (used by FixedStartMassCollection method) - minor changes
This commit is contained in:
@@ -27,6 +27,19 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
string protocolTitle;
|
||||
|
||||
|
||||
/// <summary> Not supported in Munich </summary>
|
||||
public string SerialNr(int wmNr)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary> Not supported in Munich </summary>
|
||||
public float WMState(int wmNr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
|
||||
bool resultSaved;
|
||||
@@ -50,7 +63,7 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowFormAtCycleBeginningOp(IList<GenericDevices.IWaterMeter> waterMeters)
|
||||
public IOperation ShowCycleBeginFormOp(IList<GenericDevices.IWaterMeter> waterMeters)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
@@ -59,7 +72,7 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowFormAtCycleEndOp(IList<GenericDevices.IWaterMeter> waterMeters)
|
||||
public IOperation ShowCycleEndFormOp(IList<GenericDevices.IWaterMeter> waterMeters)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
@@ -67,6 +80,18 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowWMSNsAndStatesFormOp()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowWMStatesFormOp()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
delegate void EntryFormDlgt(EntryForm myRef);
|
||||
///
|
||||
void OpenBeginningDlg(EntryForm myRef)
|
||||
|
||||
@@ -21,6 +21,19 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
string protocolTitle;
|
||||
|
||||
|
||||
/// <summary> Not supported in Munich </summary>
|
||||
public string SerialNr(int wmNr)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary> Not supported in Munich </summary>
|
||||
public float WMState(int wmNr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
|
||||
bool resultSaved;
|
||||
@@ -44,7 +57,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowFormAtCycleBeginningOp(IList<GenericDevices.IWaterMeter> waterMeters)
|
||||
public IOperation ShowCycleBeginFormOp(IList<GenericDevices.IWaterMeter> waterMeters)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
@@ -53,7 +66,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowFormAtCycleEndOp(IList<GenericDevices.IWaterMeter> waterMeters)
|
||||
public IOperation ShowCycleEndFormOp(IList<GenericDevices.IWaterMeter> waterMeters)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
@@ -61,6 +74,18 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowWMSNsAndStatesFormOp()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowWMStatesFormOp()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
delegate void EntryFormDlgt(EntryForm myRef);
|
||||
///
|
||||
void OpenBeginningDlg(EntryForm myRef)
|
||||
@@ -71,7 +96,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
///
|
||||
void OpenEndDlg(EntryForm myRef)
|
||||
{
|
||||
CycleEndForm endForm = new CycleEndForm();
|
||||
CycleEndForm endForm = new CycleEndForm(Program.WMsCount);
|
||||
endForm.ProtocolName1 = entryFormCfg.ProtocolTitle1;
|
||||
endForm.ProtocolName2 = entryFormCfg.ProtocolTitle2;
|
||||
endForm.ProtocolName3 = entryFormCfg.ProtocolTitle3;
|
||||
|
||||
@@ -5,7 +5,7 @@ using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.DataEntry.WMStates
|
||||
{
|
||||
public class EntryForm : Generic.IComponent, IOperation, GenericDevices.IDataEntry, GenericDevices.IHasProtocolTitle
|
||||
public class EntryForm : Generic.IComponent, IOperation, GenericDevices.IDataEntry
|
||||
{
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
public Generic.IComponentCfg Cfg { get { return entryFormCfg; } }
|
||||
@@ -14,24 +14,44 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
|
||||
public string Name { get { return entryFormCfg.Name; } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin and the End form
|
||||
/// Water meter serial numbers set by forms
|
||||
/// </summary>
|
||||
public string ProtocolTitle { get { return protocolTitle; } }
|
||||
string protocolTitle;
|
||||
string[] serialNr;
|
||||
public string SerialNr(int wmNr)
|
||||
{
|
||||
if (serialNr == null || serialNr.Length <= wmNr) return string.Empty;
|
||||
return serialNr[wmNr];
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Water meter states set by forms
|
||||
/// </summary>
|
||||
float[] wmState;
|
||||
public float WMState(int wmNr)
|
||||
{
|
||||
if (wmState == null || wmState.Length <= wmNr) return 0;
|
||||
return wmState[wmNr];
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Not supported </summary>
|
||||
public void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<Entities.TestResult> results)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
|
||||
bool resultSaved;
|
||||
|
||||
IList<GenericDevices.IWaterMeter> waterMeters;
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
None,
|
||||
ShowFormAtCycleBeginning,
|
||||
ShowFormAtCycleEnd,
|
||||
EnterWMSNsAndStates,
|
||||
EnterWMStates,
|
||||
}
|
||||
|
||||
CurrentOp currentOp;
|
||||
@@ -40,24 +60,36 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
{
|
||||
if (cfg == null) throw new ArgumentNullException("cfg");
|
||||
this.entryFormCfg = cfg;
|
||||
serialNr = new string[Program.WMsCount];
|
||||
wmState = new float[Program.WMsCount];
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp(IList<GenericDevices.IWaterMeter> waterMeters)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleEndFormOp(IList<GenericDevices.IWaterMeter> waterMeters)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowFormAtCycleBeginningOp(IList<GenericDevices.IWaterMeter> waterMeters)
|
||||
public IOperation ShowWMSNsAndStatesFormOp()
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
this.waterMeters = waterMeters;
|
||||
currentOp = CurrentOp.EnterWMSNsAndStates;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowFormAtCycleEndOp(IList<GenericDevices.IWaterMeter> waterMeters)
|
||||
public IOperation ShowWMStatesFormOp()
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||
this.waterMeters = waterMeters;
|
||||
currentOp = CurrentOp.EnterWMStates;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -71,8 +103,7 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
///
|
||||
void OpenEndDlg(EntryForm myRef)
|
||||
{
|
||||
WMStatesForm endForm = new WMStatesForm();
|
||||
myRef.modelessDlg = endForm;
|
||||
myRef.modelessDlg = new WMStatesForm(Program.WMsCount);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
|
||||
@@ -82,10 +113,10 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
resultSaved = false;
|
||||
switch (currentOp)
|
||||
{
|
||||
case CurrentOp.ShowFormAtCycleBeginning:
|
||||
case CurrentOp.EnterWMSNsAndStates:
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
|
||||
break;
|
||||
case CurrentOp.ShowFormAtCycleEnd:
|
||||
case CurrentOp.EnterWMStates:
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
|
||||
break;
|
||||
}
|
||||
@@ -106,30 +137,30 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
{
|
||||
WMSNsAndStatesForm dlg = (modelessDlg as WMSNsAndStatesForm);
|
||||
|
||||
//if (dlg.WaterMetersCount > 0 && waterMeters[0] != null) waterMeters[0].EndState = dlg.WMStateText[0];
|
||||
//if (dlg.WaterMetersCount > 1 && waterMeters[1] != null) waterMeters[1].EndState = dlg.WMStateText[1];
|
||||
//if (dlg.WaterMetersCount > 2 && waterMeters[2] != null) waterMeters[2].EndState = dlg.WMStateText[2];
|
||||
//if (dlg.WaterMetersCount > 3 && waterMeters[3] != null) waterMeters[3].EndState = dlg.WMStateText[3];
|
||||
//if (dlg.WaterMetersCount > 4 && waterMeters[4] != null) waterMeters[4].EndState = dlg.WMStateText[4];
|
||||
//if (dlg.WaterMetersCount > 5 && waterMeters[5] != null) waterMeters[5].EndState = dlg.WMStateText[5];
|
||||
if (dlg.WaterMetersCount > 0) wmState[0] = dlg.WMState[0];
|
||||
if (dlg.WaterMetersCount > 1) wmState[1] = dlg.WMState[1];
|
||||
if (dlg.WaterMetersCount > 2) wmState[2] = dlg.WMState[2];
|
||||
if (dlg.WaterMetersCount > 3) wmState[3] = dlg.WMState[3];
|
||||
if (dlg.WaterMetersCount > 4) wmState[4] = dlg.WMState[4];
|
||||
if (dlg.WaterMetersCount > 5) wmState[5] = dlg.WMState[5];
|
||||
|
||||
if (dlg.WaterMetersCount > 0 && waterMeters[0] != null) waterMeters[0].SerialNr = dlg.SNText[0];
|
||||
if (dlg.WaterMetersCount > 1 && waterMeters[1] != null) waterMeters[1].SerialNr = dlg.SNText[1];
|
||||
if (dlg.WaterMetersCount > 2 && waterMeters[2] != null) waterMeters[2].SerialNr = dlg.SNText[2];
|
||||
if (dlg.WaterMetersCount > 3 && waterMeters[3] != null) waterMeters[3].SerialNr = dlg.SNText[3];
|
||||
if (dlg.WaterMetersCount > 4 && waterMeters[4] != null) waterMeters[4].SerialNr = dlg.SNText[4];
|
||||
if (dlg.WaterMetersCount > 5 && waterMeters[5] != null) waterMeters[5].SerialNr = dlg.SNText[5];
|
||||
if (dlg.WaterMetersCount > 0) serialNr[0] = dlg.SNText[0];
|
||||
if (dlg.WaterMetersCount > 1) serialNr[1] = dlg.SNText[1];
|
||||
if (dlg.WaterMetersCount > 2) serialNr[2] = dlg.SNText[2];
|
||||
if (dlg.WaterMetersCount > 3) serialNr[3] = dlg.SNText[3];
|
||||
if (dlg.WaterMetersCount > 4) serialNr[4] = dlg.SNText[4];
|
||||
if (dlg.WaterMetersCount > 5) serialNr[5] = dlg.SNText[5];
|
||||
}
|
||||
else if (modelessDlg is WMStatesForm)
|
||||
{
|
||||
WMStatesForm dlg = (modelessDlg as WMStatesForm);
|
||||
|
||||
if (dlg.WaterMetersCount > 0 && waterMeters[0] != null) waterMeters[0].EndState = dlg.WMStateText[0];
|
||||
if (dlg.WaterMetersCount > 1 && waterMeters[1] != null) waterMeters[1].EndState = dlg.WMStateText[1];
|
||||
if (dlg.WaterMetersCount > 2 && waterMeters[2] != null) waterMeters[2].EndState = dlg.WMStateText[2];
|
||||
if (dlg.WaterMetersCount > 3 && waterMeters[3] != null) waterMeters[3].EndState = dlg.WMStateText[3];
|
||||
if (dlg.WaterMetersCount > 4 && waterMeters[4] != null) waterMeters[4].EndState = dlg.WMStateText[4];
|
||||
if (dlg.WaterMetersCount > 5 && waterMeters[5] != null) waterMeters[5].EndState = dlg.WMStateText[5];
|
||||
if (dlg.WaterMetersCount > 0) wmState[0] = dlg.WMState[0];
|
||||
if (dlg.WaterMetersCount > 1) wmState[1] = dlg.WMState[1];
|
||||
if (dlg.WaterMetersCount > 2) wmState[2] = dlg.WMState[2];
|
||||
if (dlg.WaterMetersCount > 3) wmState[3] = dlg.WMState[3];
|
||||
if (dlg.WaterMetersCount > 4) wmState[4] = dlg.WMState[4];
|
||||
if (dlg.WaterMetersCount > 5) wmState[5] = dlg.WMState[5];
|
||||
}
|
||||
resultSaved = true;
|
||||
}
|
||||
@@ -143,25 +174,5 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
modelessDlg = null;
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates test results with the information collected in watermeters.
|
||||
/// </summary>
|
||||
/// <param name="waterMeters">Watermetes with information entered in the forms</param>
|
||||
/// <param name="results">Test results to be updated with the information</param>
|
||||
public void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<Entities.TestResult> results)
|
||||
{
|
||||
foreach (var test in results)
|
||||
{
|
||||
if (test.MetersKind != Entities.MetersKind.Single) continue;
|
||||
|
||||
int count = Math.Max(waterMeters.Count, test.Meters.Count);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
test.Meters[i].SerialNr = waterMeters[i].SerialNr;
|
||||
test.Meters[i].EndState = waterMeters[i].EndState;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
public string[] SNText;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public string[] WMStateText;
|
||||
public float[] WMState;
|
||||
|
||||
/// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
@@ -28,7 +28,7 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
this.WaterMetersCount = waterMetersCount;
|
||||
InitializeComponent();
|
||||
SNText = new string[WaterMetersCount];
|
||||
WMStateText = new string[WaterMetersCount];
|
||||
WMState = new float[WaterMetersCount];
|
||||
completed = false;
|
||||
|
||||
//Height = 55 + WaterMetersCount * 105;
|
||||
@@ -36,7 +36,7 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
|
||||
/// <summary> Parameterless constructor for 3 watermeters </summary>
|
||||
public WMSNsAndStatesForm()
|
||||
: this(3)
|
||||
: this(Program.WMsCount)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -78,19 +78,26 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WaterMetersCount >= 1) SNText[0] = snTextBox1.Text;
|
||||
if (WaterMetersCount >= 2) SNText[1] = snTextBox2.Text;
|
||||
if (WaterMetersCount >= 3) SNText[2] = snTextBox3.Text;
|
||||
if (WaterMetersCount >= 4) SNText[3] = snTextBox4.Text;
|
||||
if (WaterMetersCount >= 5) SNText[4] = snTextBox5.Text;
|
||||
if (WaterMetersCount >= 6) SNText[5] = snTextBox6.Text;
|
||||
try
|
||||
{
|
||||
if (WaterMetersCount >= 1) SNText[0] = snTextBox1.Text;
|
||||
if (WaterMetersCount >= 2) SNText[1] = snTextBox2.Text;
|
||||
if (WaterMetersCount >= 3) SNText[2] = snTextBox3.Text;
|
||||
if (WaterMetersCount >= 4) SNText[3] = snTextBox4.Text;
|
||||
if (WaterMetersCount >= 5) SNText[4] = snTextBox5.Text;
|
||||
if (WaterMetersCount >= 6) SNText[5] = snTextBox6.Text;
|
||||
|
||||
if (WaterMetersCount >= 1) WMStateText[0] = wmStateTextBox1.Text;
|
||||
if (WaterMetersCount >= 2) WMStateText[1] = wmStateTextBox3.Text;
|
||||
if (WaterMetersCount >= 3) WMStateText[2] = wmStateTextBox4.Text;
|
||||
if (WaterMetersCount >= 4) WMStateText[3] = wmStateTextBox5.Text;
|
||||
if (WaterMetersCount >= 5) WMStateText[4] = wmStateTextBox6.Text;
|
||||
if (WaterMetersCount >= 6) WMStateText[5] = wmStateTextBox6.Text;
|
||||
if (WaterMetersCount >= 1) WMState[0] = Utils.ParseUFloat(wmStateTextBox1.Text);
|
||||
if (WaterMetersCount >= 2) WMState[1] = Utils.ParseUFloat(wmStateTextBox3.Text);
|
||||
if (WaterMetersCount >= 3) WMState[2] = Utils.ParseUFloat(wmStateTextBox4.Text);
|
||||
if (WaterMetersCount >= 4) WMState[3] = Utils.ParseUFloat(wmStateTextBox5.Text);
|
||||
if (WaterMetersCount >= 5) WMState[4] = Utils.ParseUFloat(wmStateTextBox6.Text);
|
||||
if (WaterMetersCount >= 6) WMState[5] = Utils.ParseUFloat(wmStateTextBox6.Text);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
public readonly int WaterMetersCount;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public string[] WMStateText;
|
||||
public float[] WMState;
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
@@ -24,13 +24,13 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
{
|
||||
this.WaterMetersCount = waterMetersCount;
|
||||
InitializeComponent();
|
||||
WMStateText = new string[WaterMetersCount];
|
||||
WMState = new float[WaterMetersCount];
|
||||
completed = false;
|
||||
}
|
||||
|
||||
/// <summary> Parameterless constructor for 3 watermeters </summary>
|
||||
public WMStatesForm()
|
||||
: this(3)
|
||||
: this(Program.WMsCount)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -68,12 +68,19 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WaterMetersCount >= 1) WMStateText[0] = wmStateTextBox1.Text;
|
||||
if (WaterMetersCount >= 2) WMStateText[1] = wmStateTextBox3.Text;
|
||||
if (WaterMetersCount >= 3) WMStateText[2] = wmStateTextBox4.Text;
|
||||
if (WaterMetersCount >= 4) WMStateText[3] = wmStateTextBox5.Text;
|
||||
if (WaterMetersCount >= 5) WMStateText[4] = wmStateTextBox6.Text;
|
||||
if (WaterMetersCount >= 6) WMStateText[5] = wmStateTextBox6.Text;
|
||||
try
|
||||
{
|
||||
if (WaterMetersCount >= 1) WMState[0] = Utils.ParseUFloat(wmStateTextBox1.Text);
|
||||
if (WaterMetersCount >= 2) WMState[1] = Utils.ParseUFloat(wmStateTextBox3.Text);
|
||||
if (WaterMetersCount >= 3) WMState[2] = Utils.ParseUFloat(wmStateTextBox4.Text);
|
||||
if (WaterMetersCount >= 4) WMState[3] = Utils.ParseUFloat(wmStateTextBox5.Text);
|
||||
if (WaterMetersCount >= 5) WMState[4] = Utils.ParseUFloat(wmStateTextBox6.Text);
|
||||
if (WaterMetersCount >= 6) WMState[5] = Utils.ParseUFloat(wmStateTextBox6.Text);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
{
|
||||
public class RRProcedureParams : IParamsProvider, IProcedureParams
|
||||
{
|
||||
public float PulsesPerLtr; /// Target low limit of the flow increase or decrease
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
Strings.PulsesPerLtr,
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return PulsesPerLtr.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor - sets default values of parameters.
|
||||
/// </summary>
|
||||
public RRProcedureParams()
|
||||
{
|
||||
PulsesPerLtr = 1.0f;
|
||||
}
|
||||
|
||||
/// Retrieves parameters from UI controls
|
||||
public void UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: PulsesPerLtr = Utils.ParseUFloat(strValue); return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
/// Verifies whether strings in UI controls represent valid parameters
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
||||
float dummy;
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (Utils.TryParseUFloat(strValue, out dummy)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
#region Boilerplate code
|
||||
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < ParamsCount(); i++)
|
||||
{
|
||||
if (i != 0) sb.Append("; ");
|
||||
sb.Append(ParamName(i));
|
||||
sb.Append("=");
|
||||
sb.Append(ToString(i));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public Entities.ComponentProcedure ProcedureParamsEntity { get { return procedureParamsEntity; } }
|
||||
Entities.ComponentProcedure procedureParamsEntity;
|
||||
|
||||
[XmlIgnore]
|
||||
public string ComponentName { get { return componentName; } }
|
||||
string componentName;
|
||||
|
||||
[XmlIgnore]
|
||||
public Entities.Procedure Procedure { get { return procedure; } }
|
||||
Entities.Procedure procedure;
|
||||
|
||||
public RRProcedureParams(Entities.ComponentProcedure procedureParamsEntity, string componentName, Entities.Procedure procedure)
|
||||
: this()
|
||||
{
|
||||
this.procedureParamsEntity = procedureParamsEntity;
|
||||
this.componentName = componentName;
|
||||
this.procedure = procedure;
|
||||
}
|
||||
|
||||
public TBF.Entities.ComponentProcedure ToDbEntity(IComponent component, Entities.Procedure procedure)
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
/// Serialize this class with parameters
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
|
||||
/// Create and return the ComponentProcedure entity
|
||||
TBF.Entities.ComponentProcedure entity = new TBF.Entities.ComponentProcedure();
|
||||
entity.CmpntName = component.Cfg.Name;
|
||||
entity.Parameters = writer.ToString();
|
||||
entity.Procedure = procedure;
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
/// Serialize this class and update the entity
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
procedureParamsEntity.Parameters = writer.ToString();
|
||||
procedureParamsEntity.CmpntName = componentName;
|
||||
procedureParamsEntity.Procedure = procedure;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static IParamsProvider GetProcedureParams(Entities.ComponentProcedure procedureParamsEntity)
|
||||
{
|
||||
if (procedureParamsEntity == null) return new RRProcedureParams();
|
||||
|
||||
RRProcedureParams procedureParams;
|
||||
try
|
||||
{
|
||||
procedureParams = (RRProcedureParams)(new XmlSerializer(typeof(RRProcedureParams)))
|
||||
.Deserialize(new StringReader(procedureParamsEntity.Parameters));
|
||||
}
|
||||
catch
|
||||
{
|
||||
procedureParams = new RRProcedureParams();
|
||||
}
|
||||
procedureParams.procedureParamsEntity = procedureParamsEntity;
|
||||
procedureParams.componentName = procedureParamsEntity.CmpntName;
|
||||
procedureParams.procedure = procedureParamsEntity.Procedure;
|
||||
return procedureParams;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
{
|
||||
public class ReadReferenceForRegisterOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadReferenceForRegisterOp));
|
||||
public override string ToString() { return string.Format("ReadWaterMeterOp(.,{0},.)", eventDone); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly Event eventDone;
|
||||
IntBox pulses;
|
||||
|
||||
/// <summary>
|
||||
/// Events: or Error
|
||||
/// </summary>
|
||||
/// <param name="register">Flow meter reference</param>
|
||||
/// <param name="flow">Reference to the measured flow variable, value is in bar</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadReferenceForRegisterOp(RegisterReader register, ref IntBox pulses, Event eventDone)
|
||||
{
|
||||
if (register == null) throw new ArgumentNullException("register");
|
||||
this.controlBoard = register.ControlBoard;
|
||||
this.eventDone = eventDone;
|
||||
this.pulses = pulses;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadReferenceForRegisterOp(RegisterReader register, ref IntBox pulses)
|
||||
: this(register, ref pulses, Event.ReadReferenceDone)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.FlowInDone or Event.FlowOutDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
pulses.Val = (int)controlBoard.EtPulses(0);
|
||||
return eventDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
{
|
||||
public class ReadRegisterOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadRegisterOp));
|
||||
public override string ToString() { return string.Format("ReadRegisterOp({0})", reader.Name); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly RegisterReader reader;
|
||||
IntBox pulses;
|
||||
IntBox refPulses;
|
||||
|
||||
/// <summary>
|
||||
/// Events: Event.ReadRegisterDone or Event.Error
|
||||
/// </summary>
|
||||
/// <param name="reader">Register reader reference</param>
|
||||
/// <param name="pulses">Reference to a field with the water meter pulses</param>
|
||||
public ReadRegisterOp(GenericDevices.IRegisterReader reader, ref IntBox pulses)
|
||||
{
|
||||
this.reader = reader as RegisterReader;
|
||||
if (reader == null) throw new ArgumentNullException("reader is null or it is not Elde");
|
||||
|
||||
this.pulses = pulses;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: Event.ReadRegisterDone or Event.Error
|
||||
/// </summary>
|
||||
/// <param name="reader">Register reader reference</param>
|
||||
/// <param name="pulses">Reference to a Box with the water meter pulses</param>
|
||||
/// <param name="refPulses">Reference to a Box with the reference flow meter pulses synchronized with the water meter</param>
|
||||
public ReadRegisterOp(GenericDevices.IRegisterReader reader, ref IntBox pulses, ref IntBox refPulses)
|
||||
: this(reader, ref pulses)
|
||||
{
|
||||
this.refPulses = refPulses;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
private void ReadPulses()
|
||||
{
|
||||
pulses.Val = (int)(reader.EndWMState - reader.BeginWMState); /// TODO: replace 0
|
||||
if (refPulses != null)
|
||||
{
|
||||
refPulses.Val = (int)reader.ControlBoard.EtPulses(0);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
ReadPulses();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>eventDone</returns>
|
||||
public Event Run()
|
||||
{
|
||||
ReadPulses();
|
||||
return Event.ReadRegisterDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
{
|
||||
public class RegisterReader : ComponentBase, GenericDevices.IRegisterReader
|
||||
{
|
||||
/// <summary>
|
||||
/// Info: StartMassMeasurement() and "Balance response = .., Mass = ..."
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(RegisterReader));
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("Register({0})", Name);
|
||||
}
|
||||
|
||||
public float BeginWMState;
|
||||
public float EndWMState;
|
||||
|
||||
public static void ResetStaticProperties() { }
|
||||
|
||||
public float PulsesPerLtr
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ProcedureParams is RRProcedureParams) ? (ProcedureParams as RRProcedureParams).PulsesPerLtr : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
|
||||
public RegisterReader(RegisterReaderCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
if (cfg == null) throw new ArgumentNullException("cfg");
|
||||
|
||||
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
/// Prepare data for SendCalibData() control board component method
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: Event.ReadRegisterDone, Event.Error
|
||||
/// </summary>
|
||||
/// <param name="pulses">Reference to a variable for the water meter pulses</param>
|
||||
/// <returns>ReadWaterMeter instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadRegisterOp(ref IntBox pulses)
|
||||
{
|
||||
return new ReadRegisterOp(this, ref pulses);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: Event.ReadRegisterDone, Event.Error
|
||||
/// </summary>
|
||||
/// <param name="pulses">Reference to a variable for the water meter pulses</param>
|
||||
/// <param name="pulses">Reference to a variable for the related reference flowmeter pulses</param>
|
||||
/// <returns>Reference to operation object instance</returns>
|
||||
public IOperation ReadRegisterOp(ref IntBox pulses, ref IntBox refPulses)
|
||||
{
|
||||
return new ReadRegisterOp(this, ref pulses, ref refPulses);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: ReadReferenceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="pulses">Reference to a variable for the water meter pulses</param>
|
||||
/// <returns>Reference to operation object instance</returns>
|
||||
public IOperation ReadReferenceForRegisterOp(ref IntBox pulses, ref IntBox refPulses)
|
||||
{
|
||||
return new ReadReferenceForRegisterOp(this, ref pulses);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
{
|
||||
public class RegisterReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
||||
{
|
||||
/// Parameterless constructor
|
||||
public RegisterReaderCfg()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Regulation valve configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="name">Regulation valve name</param>
|
||||
/// <param name="position">Position on the control board 1 .. nrWaterMeters</param>
|
||||
public RegisterReaderCfg(IComponentFactory factory, string name, string parentName)
|
||||
: base(factory, name, parentName)
|
||||
{
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new RegisterReaderCfg(Factory, Name, ParentName);
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return "<nothing to configure>";
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
RegisterReaderCfg config = (RegisterReaderCfg)(new XmlSerializer(typeof(RegisterReaderCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+107
@@ -0,0 +1,107 @@
|
||||
namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
{
|
||||
partial class RegisterReaderCfgCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.parentNameLabel = new System.Windows.Forms.Label();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.componentNameLabel = new System.Windows.Forms.Label();
|
||||
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// parentNameLabel
|
||||
//
|
||||
this.parentNameLabel.AutoSize = true;
|
||||
this.parentNameLabel.Location = new System.Drawing.Point(26, 96);
|
||||
this.parentNameLabel.Name = "parentNameLabel";
|
||||
this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
|
||||
this.parentNameLabel.TabIndex = 3;
|
||||
this.parentNameLabel.Text = "Parent Name";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(136, 67);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(26, 70);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// componentNameLabel
|
||||
//
|
||||
this.componentNameLabel.AutoSize = true;
|
||||
this.componentNameLabel.Location = new System.Drawing.Point(133, 43);
|
||||
this.componentNameLabel.Name = "componentNameLabel";
|
||||
this.componentNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.componentNameLabel.TabIndex = 0;
|
||||
this.componentNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// parentNameComboBox
|
||||
//
|
||||
this.parentNameComboBox.Enabled = false;
|
||||
this.parentNameComboBox.FormattingEnabled = true;
|
||||
this.parentNameComboBox.Location = new System.Drawing.Point(136, 93);
|
||||
this.parentNameComboBox.Name = "parentNameComboBox";
|
||||
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parentNameComboBox.TabIndex = 4;
|
||||
//
|
||||
// RegisterReaderCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.parentNameComboBox);
|
||||
this.Controls.Add(this.parentNameLabel);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.componentNameLabel);
|
||||
this.Name = "RegisterReaderCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.RegisterReaderCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label parentNameLabel;
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label componentNameLabel;
|
||||
private System.Windows.Forms.ComboBox parentNameComboBox;
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
{
|
||||
public partial class RegisterReaderCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(RegisterReaderCfgCtrl));
|
||||
|
||||
ComponentParametersDlg parent;
|
||||
RegisterReaderCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as RegisterReaderCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public RegisterReaderCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void RegisterReaderCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
parent = ParentForm as ComponentParametersDlg;
|
||||
if (parent == null) return;
|
||||
|
||||
if (parent.TbfComponents != null)
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
|
||||
componentNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
parentNameComboBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgVerifyFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgVerifyFlags flags = CfgVerifyFlags.None;
|
||||
|
||||
int dummy;
|
||||
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Parent Name'";
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
public void UpdateCfg()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
{
|
||||
public class RegisterReaderFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "Fixed-Start-Register-Reader"; } }
|
||||
|
||||
/// <summary>Max. number of components of this class in the system</summary>
|
||||
public int MaxCount { get { return Program.WMsCount; } }
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new RegisterReaderCfg(this, "Dummy", "CB");
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
{
|
||||
return new RegisterReaderCfgCtrl();
|
||||
}
|
||||
|
||||
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
|
||||
{
|
||||
return new RegisterReader((RegisterReaderCfg)config, components);
|
||||
}
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return RegisterReaderCfg.CreateFromDbEntity(component, this);
|
||||
}
|
||||
|
||||
public bool HasProcedureParams { get { return true; } }
|
||||
///
|
||||
public IParamsProvider GetProcedureParams(Entities.ComponentProcedure procedureParams)
|
||||
{
|
||||
return RRProcedureParams.GetProcedureParams(procedureParams);
|
||||
}
|
||||
|
||||
public bool HasTestParams { get { return false; } }
|
||||
///
|
||||
public IParamsProvider GetTestParams(Entities.ComponentTest testParams) { return null; }
|
||||
|
||||
public void ResetStaticProperties() { RegisterReader.ResetStaticProperties(); }
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
/// <param name="register">Flow meter reference</param>
|
||||
/// <param name="flow">Reference to the measured flow variable, value is in bar</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadReferenceForRegisterOp(Elde.RegisterReader.RegisterReader register, ref IntBox pulses, Event eventDone)
|
||||
public ReadReferenceForRegisterOp(RegisterReader register, ref IntBox pulses, Event eventDone)
|
||||
{
|
||||
if (register == null) throw new ArgumentNullException("register");
|
||||
this.controlBoard = register.ControlBoard;
|
||||
@@ -31,7 +31,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadReferenceForRegisterOp(Elde.RegisterReader.RegisterReader register, ref IntBox pulses)
|
||||
public ReadReferenceForRegisterOp(RegisterReader register, ref IntBox pulses)
|
||||
: this(register, ref pulses, Event.ReadReferenceDone)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -5,19 +5,45 @@ namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IDataEntry : IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Water meter serial numbers set by forms
|
||||
/// </summary>
|
||||
string SerialNr(int wmNr);
|
||||
|
||||
/// <summary>
|
||||
/// Water meter states set by forms
|
||||
/// </summary>
|
||||
float WMState(int wmNr);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Displays form at the beginning of the cycle (usually to enter S/N).
|
||||
/// </summary>
|
||||
/// <param name="waterMeters">Watermetes to be updated by the operation</param>
|
||||
/// <returns>Operation to be used in the sequence</returns>
|
||||
IOperation ShowFormAtCycleBeginningOp(IList<IWaterMeter> waterMeters);
|
||||
IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters);
|
||||
|
||||
/// <summary>
|
||||
/// Displays form at the end of the cycle (usually to enter the end state).
|
||||
/// </summary>
|
||||
/// <param name="waterMeters">Watermetes to be updated by the operation</param>
|
||||
/// <returns>Operation to be used in the sequence</returns>
|
||||
IOperation ShowFormAtCycleEndOp(IList<IWaterMeter> waterMeters);
|
||||
IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters);
|
||||
|
||||
/// <summary>
|
||||
/// Displays form at the beginning of the cycle (usually to enter S/N).
|
||||
/// </summary>
|
||||
/// <param name="waterMeters">Watermetes to be updated by the operation</param>
|
||||
/// <returns>Operation to be used in the sequence</returns>
|
||||
IOperation ShowWMSNsAndStatesFormOp();
|
||||
|
||||
/// <summary>
|
||||
/// Displays form at the beginning of the cycle (usually to enter S/N).
|
||||
/// </summary>
|
||||
/// <param name="waterMeters">Watermetes to be updated by the operation</param>
|
||||
/// <returns>Operation to be used in the sequence</returns>
|
||||
IOperation ShowWMStatesFormOp();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates test results with the information collected in watermeters.
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace TBF.BenchControl.Sequences
|
||||
{
|
||||
Bridge.OnActivity(this, "Enter the water meter data");
|
||||
State.Create("MainSeq : Enter begin data")
|
||||
.AddPermanentOperation(dataEntryCmpnt.ShowFormAtCycleBeginningOp(WaterMeters))
|
||||
.AddPermanentOperation(dataEntryCmpnt.ShowCycleBeginFormOp(WaterMeters))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -297,7 +297,7 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
/// Open the modeless form for the end of the cycle
|
||||
State.Create("MainSeq : Enter end data")
|
||||
.AddOperation((dataEntryCmpnt as GenericDevices.IDataEntry).ShowFormAtCycleEndOp(WaterMeters))
|
||||
.AddOperation((dataEntryCmpnt as GenericDevices.IDataEntry).ShowCycleEndFormOp(WaterMeters))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
do
|
||||
|
||||
@@ -611,7 +611,7 @@ namespace TBF.BenchControl.Sequences
|
||||
data.TestResult = tstRslt;
|
||||
|
||||
//float ltrPerRefPulse = outPath.FlowMeter.NominalFlow / 7200.0f; /// [ltr/pulse]
|
||||
float refPulsesPerLtr = 1.0f / outPath.FlowMeter.LtrPerPulse; /// [pulse/ltr]
|
||||
float refPulsesPerLtr = 1.0f / outPath.FlowMeter.LtrPerPulseCorrected(refFlow.Val); /// [pulse/ltr]
|
||||
|
||||
data.RefPulses = cBrd.EtPulses(0);
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace TBF.BenchControl
|
||||
Factories.Add(new DataEntry.WMStates.EntryFormFactory());
|
||||
Factories.Add(new Elde.ControlBoardFactory());
|
||||
Factories.Add(new Elde.Diverter.DiverterFactory());
|
||||
Factories.Add(new Elde.FlowMeter.FlowMeterFactory());
|
||||
Factories.Add(new Elde.FixedStartRegisterReader.RegisterReaderFactory());
|
||||
Factories.Add(new Elde.FlowMeter.FlowMeterFactory());
|
||||
Factories.Add(new Elde.FlowMeterTwins.FlowMeterFactory());
|
||||
Factories.Add(new Elde.PressureMeter.PressureMeterFactory());
|
||||
Factories.Add(new Elde.Pump.PumpFactory());
|
||||
|
||||
+59
-2
@@ -42,6 +42,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
int totalPulses = (int)(test.Volume / ltrPerRefPulse);
|
||||
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this);
|
||||
|
||||
float[] wmBeginStates = new float[Program.WMsCount];
|
||||
float[] wmEndStates = new float[Program.WMsCount];
|
||||
|
||||
int repetitionNr = 1; /// First test: repetitionNr=1
|
||||
|
||||
@@ -171,8 +174,36 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
|
||||
|
||||
///
|
||||
/// Enter the watermeter states here
|
||||
/// Enter watermeter begin states here
|
||||
///
|
||||
GenericDevices.IDataEntry dataEntryCmpnt =
|
||||
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
|
||||
if (dataEntryCmpnt != null)
|
||||
{
|
||||
IOperation showFormOp = dataEntryCmpnt.ShowWMStatesFormOp();
|
||||
if (showFormOp != null)
|
||||
{
|
||||
Bridge.OnActivity(this, "Enter the water meter data");
|
||||
State.Create("FixedStartMassCollection : Enter begin-state")
|
||||
.AddOperation(showFormOp)
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ModelessFormClosed));
|
||||
|
||||
for (int i = 0; i < Program.WMsCount; i++)
|
||||
{
|
||||
BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader =
|
||||
sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader;
|
||||
registerReader.BeginWMState = dataEntryCmpnt.WMState(i);
|
||||
registerReader.EndWMState = dataEntryCmpnt.WMState(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
@@ -337,8 +368,34 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
|
||||
|
||||
///
|
||||
/// Enter the watermeter states here
|
||||
/// Enter watermeter end states here
|
||||
///
|
||||
if (dataEntryCmpnt != null)
|
||||
{
|
||||
IOperation showFormOp = dataEntryCmpnt.ShowWMStatesFormOp();
|
||||
if (showFormOp != null)
|
||||
{
|
||||
Bridge.OnActivity(this, "Enter the water meter data");
|
||||
State.Create("FixedStartMassCollection : Enter end-state")
|
||||
.AddOperation(showFormOp)
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ModelessFormClosed));
|
||||
|
||||
|
||||
for (int i = 0; i < Program.WMsCount; i++)
|
||||
{
|
||||
BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader =
|
||||
sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader;
|
||||
registerReader.EndWMState = dataEntryCmpnt.WMState(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
@@ -249,10 +249,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
tstRslt.FlowMass = 0; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h]
|
||||
tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total)
|
||||
/// TODO: tuto pokracovat
|
||||
tstRslt.VolumeMaster = ltrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
|
||||
tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume);
|
||||
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume / 1000.0f); /// Convert the flow to [m3/h]
|
||||
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
/// Corrected master pulses per liter
|
||||
if (tstRslt.VolumeCTV <= float.Epsilon)
|
||||
{
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace TBF.Forms
|
||||
/// Results items to be selected in the configuration
|
||||
public enum ResultsItem
|
||||
{
|
||||
Hovno,
|
||||
Makove,
|
||||
Abc,
|
||||
Def,
|
||||
Count
|
||||
}
|
||||
//
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace TBF.Screens
|
||||
{
|
||||
foreach (var testRslt in testResults)
|
||||
{
|
||||
if (testRslt.TestId.Equals(test.Id) && (testRslt.RepetitionNr == rpt) && !testRslt.DoNotPublish)
|
||||
if ((testRslt.TestId == test.Id) && (testRslt.RepetitionNr == rpt) && !testRslt.DoNotPublish)
|
||||
{
|
||||
rslts.Add(testRslt);
|
||||
added = true;
|
||||
@@ -407,7 +407,8 @@ namespace TBF.Screens
|
||||
try
|
||||
{
|
||||
Entities.TestResult tr = testResults
|
||||
.First<Entities.TestResult>(x => x.Name.Equals(args.TestResult.Name));
|
||||
.First<Entities.TestResult>(x => (x.TestId == args.TestResult.TestId) &&
|
||||
(x.RepetitionNr == args.TestResult.RepetitionNr));
|
||||
testResults.Remove(tr);
|
||||
}
|
||||
catch { };
|
||||
|
||||
@@ -224,6 +224,18 @@
|
||||
<DependentUpon>EntryFormCfgCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\DataEntry\WMStates\EntryFormFactory.cs" />
|
||||
<Compile Include="BenchControl\Elde\FixedStartRegisterReader\ReadReferenceForRegisterOp.cs" />
|
||||
<Compile Include="BenchControl\Elde\FixedStartRegisterReader\ReadRegisterOp.cs" />
|
||||
<Compile Include="BenchControl\Elde\FixedStartRegisterReader\RegisterReader.cs" />
|
||||
<Compile Include="BenchControl\Elde\FixedStartRegisterReader\RegisterReaderCfg.cs" />
|
||||
<Compile Include="BenchControl\Elde\FixedStartRegisterReader\RegisterReaderCfgCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\Elde\FixedStartRegisterReader\RegisterReaderCfgCtrl.designer.cs">
|
||||
<DependentUpon>RegisterReaderCfgCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\Elde\FixedStartRegisterReader\RegisterReaderFactory.cs" />
|
||||
<Compile Include="BenchControl\Elde\FixedStartRegisterReader\RRProcedureParams.cs" />
|
||||
<Compile Include="BenchControl\Elde\FlowMeterTwins\FlowMeter.cs" />
|
||||
<Compile Include="BenchControl\Elde\FlowMeterTwins\FlowMeterCfg.cs" />
|
||||
<Compile Include="BenchControl\Elde\FlowMeterTwins\FlowMeterCfgCtrl.cs">
|
||||
@@ -955,6 +967,9 @@
|
||||
<EmbeddedResource Include="BenchControl\Elde\Diverter\DiverterCfgCtrl.resx">
|
||||
<DependentUpon>DiverterCfgCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="BenchControl\Elde\FixedStartRegisterReader\RegisterReaderCfgCtrl.resx">
|
||||
<DependentUpon>RegisterReaderCfgCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="BenchControl\Elde\FlowMeterTwins\FlowMeterCfgCtrl.resx">
|
||||
<DependentUpon>FlowMeterCfgCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Reference in New Issue
Block a user