As sent to ST for the last test on Fuzhou300 system

- new component with VZ15 and modified position of VZ13
- fixed start method evaluation OK
- handling of entry forms cleaned-up
This commit is contained in:
Milan Hanajik
2014-09-23 13:16:59 +02:00
parent c3bfe5223b
commit 2f6f24e281
12 changed files with 302 additions and 130 deletions
@@ -5,7 +5,7 @@ using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Munich
{
public class EntryForm : Generic.IComponent, IOperation, GenericDevices.IDataEntry, GenericDevices.IHasProtocolTitle
public class EntryForm : Generic.IComponent, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasProtocolTitle
{
readonly EntryFormCfg entryFormCfg;
public Generic.IComponentCfg Cfg { get { return entryFormCfg; } }
@@ -44,7 +44,7 @@ namespace TBF.BenchControl.DataEntry.Munich
bool resultSaved;
IList<GenericDevices.IWaterMeter> waterMeters;
IList<IWaterMeter> waterMeters;
public enum CurrentOp
{
@@ -63,7 +63,7 @@ namespace TBF.BenchControl.DataEntry.Munich
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp(IList<GenericDevices.IWaterMeter> waterMeters)
public IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
@@ -72,7 +72,7 @@ namespace TBF.BenchControl.DataEntry.Munich
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp(IList<GenericDevices.IWaterMeter> waterMeters)
public IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd;
@@ -129,7 +129,7 @@ namespace TBF.BenchControl.DataEntry.Munich
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if (!(modelessDlg as GenericDevices.IHasCompleted).Completed)
if (!(modelessDlg as IHasCompleted).Completed)
{
return Event.None; /// Return 'None' when form was not closed yet
}
@@ -5,7 +5,7 @@ using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Munich3
{
public class EntryForm : Generic.IComponent, IOperation, GenericDevices.IDataEntry, GenericDevices.IHasProtocolTitle
public class EntryForm : Generic.IComponent, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasProtocolTitle
{
readonly EntryFormCfg entryFormCfg;
public Generic.IComponentCfg Cfg { get { return entryFormCfg; } }
@@ -38,7 +38,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
bool resultSaved;
IList<GenericDevices.IWaterMeter> waterMeters;
IList<IWaterMeter> waterMeters;
public enum CurrentOp
{
@@ -57,7 +57,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp(IList<GenericDevices.IWaterMeter> waterMeters)
public IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
@@ -66,7 +66,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp(IList<GenericDevices.IWaterMeter> waterMeters)
public IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd;
@@ -123,7 +123,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if (!(modelessDlg as GenericDevices.IHasCompleted).Completed)
if (!(modelessDlg as IHasCompleted).Completed)
{
return Event.None; /// Return 'None' when form was not closed yet
}
@@ -5,7 +5,7 @@ using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.WMStates
{
public class EntryForm : Generic.IComponent, IOperation, GenericDevices.IDataEntry
public class EntryForm : Generic.IComponent, IOperation, IDataEntry, IHasWMStatesForm
{
readonly EntryFormCfg entryFormCfg;
public Generic.IComponentCfg Cfg { get { return entryFormCfg; } }
@@ -66,13 +66,13 @@ namespace TBF.BenchControl.DataEntry.WMStates
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp(IList<GenericDevices.IWaterMeter> waterMeters)
public IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters)
{
return null;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp(IList<GenericDevices.IWaterMeter> waterMeters)
public IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters)
{
return null;
}
@@ -126,7 +126,7 @@ namespace TBF.BenchControl.DataEntry.WMStates
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if (!(modelessDlg as GenericDevices.IHasCompleted).Completed)
if (!(modelessDlg as IHasCompleted).Completed)
{
return Event.None; /// Return 'None' when form was not closed yet
}
@@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IHasCycleBeginForm
{
/// <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 ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters);
}
}
@@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IHasCycleEndForm
{
/// <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 ShowCycleEndFormOp(IList<IWaterMeter> waterMeters);
}
}
@@ -0,0 +1,13 @@
namespace TBF.BenchControl.GenericDevices
{
public interface IHasWMStatesForm
{
/// <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();
}
}
@@ -139,11 +139,11 @@ namespace TBF.BenchControl.Sequences
//--------------------------------
GenericDevices.IDataEntry dataEntryCmpnt =
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
if (dataEntryCmpnt != null)
if (dataEntryCmpnt is IHasCycleBeginForm)
{
Bridge.OnActivity(this, "Enter the water meter data");
State.Create("MainSeq : Enter begin data")
.AddPermanentOperation(dataEntryCmpnt.ShowCycleBeginFormOp(WaterMeters))
.AddPermanentOperation((dataEntryCmpnt as IHasCycleBeginForm).ShowCycleBeginFormOp(WaterMeters))
.AddOperation(checkUiOp)
.EnterState();
e = StateMachine.WaitRunDevsRunOps();
@@ -272,6 +272,8 @@ namespace TBF.BenchControl.Sequences
{
Bridge.OnActivity(this, "Enter the protocol data");
if (dataEntryCmpnt is IHasCycleBeginForm)
{
if (!State.LastEvents.Contains(Event.ModelessFormClosed))
{
/// Wait until modeless dialg is closed
@@ -294,10 +296,13 @@ namespace TBF.BenchControl.Sequences
.EnterState();
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) goto stop;
}
if (dataEntryCmpnt is IHasCycleEndForm)
{
/// Open the modeless form for the end of the cycle
State.Create("MainSeq : Enter end data")
.AddOperation((dataEntryCmpnt as GenericDevices.IDataEntry).ShowCycleEndFormOp(WaterMeters))
.AddOperation((dataEntryCmpnt as GenericDevices.IHasCycleEndForm).ShowCycleEndFormOp(WaterMeters))
.AddOperation(checkUiOp)
.EnterState();
do
@@ -306,6 +311,7 @@ namespace TBF.BenchControl.Sequences
if (e.Contains(Event.UiCmdStop)) goto stop;
}
while (!e.Contains(Event.ModelessFormClosed));
}
if (dataEntryCmpnt is IHasProtocolTitle)
{
@@ -178,20 +178,17 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
///
GenericDevices.IDataEntry dataEntryCmpnt =
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
if (dataEntryCmpnt != null)
{
IOperation showFormOp = dataEntryCmpnt.ShowWMStatesFormOp();
if (showFormOp != null)
if (dataEntryCmpnt is GenericDevices.IHasWMStatesForm)
{
Bridge.OnActivity(this, "Enter the water meter data");
State.Create("FixedStartMassCollection : Enter begin-state")
.AddOperation(showFormOp)
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowWMStatesFormOp())
.AddOperation(checkUiOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) { retVal = Event.Error; goto stopTest; }
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.ModelessFormClosed));
@@ -201,7 +198,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader;
registerReader.BeginWMState = dataEntryCmpnt.WMState(i);
registerReader.EndWMState = dataEntryCmpnt.WMState(i);
}
tstRslt.Meters[i].VolumeStart = dataEntryCmpnt.WMState(i) / registerReader.PulsesPerLtr; /// liter
}
}
@@ -241,7 +238,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
State.Create("FixedStartMassCollection : Starting the test")
.AddOperation(checkUiOp)
.AddOperations(measureOperations)
.AddOperation(cBrd.StartMeasurementOp(outPath.FlowMeter, totalPulses, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, (float)test.TolerRed))
.AddOperation(cBrd.StartMeasurementOp(outPath.FlowMeter, 2 * totalPulses, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, (float)test.TolerRed))
.EnterState();
do
{
@@ -275,7 +272,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
ResetAveragedData();
/// Measurement loop - begin
while (true)
do
{
//--------------------------------
switch (ReadRegistersTempPressAmbient(measureOperations, true))
@@ -322,13 +319,14 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, cBrd.TTime, progress));
}
while (cBrd.EtPulses(0) < totalPulses);
/// Measurement loop - end
test_completed:
State.Create("FixedStartMassCollection : Closing the start/stop valve at the end of the fixed start test")
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(outPath.StartValve, null))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState();
do
@@ -339,6 +337,18 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
while (!e.Contains(Event.ValvesSet));
State.Create("FixedStartMassCollection : Stopping diverter, gate, etc.")
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.PreviousStopped));
//------------------------------------------------
Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------
@@ -370,20 +380,17 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
///
/// Enter watermeter end states here
///
if (dataEntryCmpnt != null)
{
IOperation showFormOp = dataEntryCmpnt.ShowWMStatesFormOp();
if (showFormOp != null)
if (dataEntryCmpnt is GenericDevices.IHasWMStatesForm)
{
Bridge.OnActivity(this, "Enter the water meter data");
State.Create("FixedStartMassCollection : Enter end-state")
.AddOperation(showFormOp)
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowWMStatesFormOp())
.AddOperation(checkUiOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) { retVal = Event.Error; goto stopTest; }
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.ModelessFormClosed));
@@ -393,7 +400,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader =
sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader;
registerReader.EndWMState = dataEntryCmpnt.WMState(i);
}
tstRslt.Meters[i].VolumeEnd = dataEntryCmpnt.WMState(i) / registerReader.PulsesPerLtr; /// liter
}
}
@@ -442,17 +449,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
tstRslt.TimeDivEnd4 = 0;
tstRslt.TimeDivEnd5 = 0;
for (int i = 0; i < Program.WMsCount; i++)
{
if (sensPath.RegisterReaders[i] != null)
{
tstRslt.Meters[i].SerialNr = "wm" + (i + 1).ToString();
tstRslt.Meters[i].VolumeStart = 0; /// liter
tstRslt.Meters[i].VolumeEnd = 0; /// liter
if (sensPath.RegisterReaders[i].PulsesPerLtr <= float.Epsilon) tstRslt.Meters[i].VolumeMeter = 0;
else tstRslt.Meters[i].VolumeMeter = Convert.ToSingle(WMPulses[i]) / sensPath.RegisterReaders[i].PulsesPerLtr;
tstRslt.Meters[i].VolumeRef = tstRslt.ConstMaster * WMRefPulses[i]; /// liter
tstRslt.Meters[i].PulsesMeter = WMPulses[i];
tstRslt.Meters[i].PulsesMaster = WMRefPulses[i];
tstRslt.Meters[i].VolumeMeter = tstRslt.Meters[i].VolumeEnd - tstRslt.Meters[i].VolumeStart;
tstRslt.Meters[i].VolumeRef = tstRslt.VolumeCTV; /// liter
tstRslt.Meters[i].PulsesMeter = 0;
tstRslt.Meters[i].PulsesMaster = tstRslt.PulsesMaster;
tstRslt.Meters[i].Time = cBrd.TTime;
if (WMPulses[i] > 0 && tstRslt.Meters[i].VolumeRef > 0)
{
@@ -466,7 +468,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
}
tstRslt.Meters[i].Passed = (tstRslt.ErrLimLo <= tstRslt.Meters[i].VolumeErrorPct) && (tstRslt.Meters[i].VolumeErrorPct <= tstRslt.ErrLimHi);
}
}
/// Add data - end
AddOrOverwriteResult(tstRslt);
+119
View File
@@ -0,0 +1,119 @@
namespace TBF.Boxes
{
public class DoubleBox
{
/// Box value
private double val;
public double Val
{
get { return (valid ? val : 0); }
set { val = value; valid = true; }
}
/// Box name
string name;
public string Name
{
get { return name; }
set { name = value; }
}
/// Validity flag: true = the box value is valid
private bool valid = false;
public bool Valid
{
get { return valid; }
}
/// <summary> Parameterless constructor </summary>
public DoubleBox()
{
}
/// <summary> Constructor that initializes the value </summary>
public DoubleBox(double val)
{
this.Val = val;
}
/// <summary>
/// Clear the box value and the valid flag
/// </summary>
public void Clear()
{
val = 0;
valid = false;
}
///
/// Specifies a conversion to a string.
/// In the most complex case the conversion is:
/// string.Format(FormatEx, val.ToString(Format))
/// If the value is invalid, the conversion result is 'FormatInvalid'.
///
public string Format = null;
public string FormatEx = "{0}";
public string FormatInvalid = "---";
public double Factor = 1.0;
public double LimitLo = double.MinValue;
public double LimitHi = double.MaxValue;
/// <summary>
/// Converts the box value to a string representation
/// </summary>
public override string ToString()
{
if (!valid)
{
return FormatInvalid;
}
else if (Format == null)
{
return string.Format(FormatEx, Val * Factor);
}
else
{
return string.Format(FormatEx, (Val * Factor).ToString(Format));
}
}
/// <summary>
/// Validate the string representation of the box value
/// </summary>
/// <param name="strVal">String representation of the parameter</param>
/// <returns>true = string is OK, false = string is wrong (see 'message')</returns>
public bool ValidateParam(string strVal)
{
float dummy;
return Utils.TryParseSFloat(strVal, out dummy) &&
((dummy / Factor) >= LimitLo) &&
((dummy / Factor) <= LimitHi);
}
/// <summary>
/// Update the parameter from a string
/// </summary>
/// <param name="strVal">String representation of the box value</param>
public void UpdateParam(string strVal)
{
try
{
Val = (double)Utils.ParseSFloat(strVal) / Factor;
}
catch { };
}
public DoubleBox Clone()
{
DoubleBox newDoubleBox = new DoubleBox();
newDoubleBox.name = name;
newDoubleBox.val = val;
newDoubleBox.valid = valid;
newDoubleBox.Format = Format;
newDoubleBox.FormatInvalid = FormatInvalid;
newDoubleBox.FormatEx = FormatEx;
newDoubleBox.Factor = Factor;
return newDoubleBox;
}
}
}
@@ -14,6 +14,7 @@ namespace TBF.Mappings
Map(x => x.Qto);
Map(x => x.RegulValve);
Map(x => x.FlowMeter);
Map(x => x.StartValve);
Map(x => x.Diverter);
Map(x => x.TempDiv);
Map(x => x.Balance);
+4
View File
@@ -323,7 +323,10 @@
<Compile Include="BenchControl\GenericDevices\ICameraRoi.cs" />
<Compile Include="BenchControl\GenericDevices\IDataEntry.cs" />
<Compile Include="BenchControl\GenericDevices\IHasCompleted.cs" />
<Compile Include="BenchControl\GenericDevices\IHasCycleBeginForm.cs" />
<Compile Include="BenchControl\GenericDevices\IHasCycleEndForm.cs" />
<Compile Include="BenchControl\GenericDevices\IHasProtocolTitle.cs" />
<Compile Include="BenchControl\GenericDevices\IHasWMStatesForm.cs" />
<Compile Include="BenchControl\GenericDevices\IPumpFM.cs" />
<Compile Include="BenchControl\GenericDevices\IResultsPrinter.cs" />
<Compile Include="BenchControl\GenericDevices\IPump.cs" />
@@ -492,6 +495,7 @@
<DependentUpon>WaterMeterCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\WaterMeter\WaterMeterFactory.cs" />
<Compile Include="Boxes\DoubleBox.cs" />
<Compile Include="Boxes\FloatBox.cs" />
<Compile Include="Boxes\IBox.cs" />
<Compile Include="Boxes\IntBox.cs" />