ControlBoards, IControlBoard iface, Devices, test methods.
This commit is contained in:
@@ -17,6 +17,60 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(DiverterTestSeq));
|
||||
|
||||
/// <summary>
|
||||
/// Check capabilities of devces in the output path required for this test method
|
||||
/// </summary>
|
||||
/// <param name="devices">Devices</param>
|
||||
/// <returns>true when capabilities of devices are OK</returns>
|
||||
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
|
||||
{
|
||||
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.ControlBoardDev) &&
|
||||
!(StateMachine.ControlBoard is ControlBoard.New.CBoard))
|
||||
{
|
||||
/// Control board does not support this method
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.Scale is IScale))
|
||||
{
|
||||
/// Scale is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_scale);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (test.Volume > devices.Scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
/// Scale capacity is not sufficient
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Test_volume_exceeds_the_scale_capacity);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.Diverter is IDiverter))
|
||||
{
|
||||
/// Scale is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_diverter);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.FlowMeter is IFlowMeter))
|
||||
{
|
||||
/// Flow meter is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_flow_meter);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
return false;
|
||||
}
|
||||
|
||||
message = string.Empty;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flying start mass collection method sequence
|
||||
/// </summary>
|
||||
@@ -29,12 +83,8 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
/// </returns>
|
||||
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition, TestParams testParams)
|
||||
{
|
||||
IScale scale = outPath.Scale as IScale;
|
||||
if (scale == null)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_scale);
|
||||
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
|
||||
}
|
||||
TBF.BenchControl.ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
|
||||
IScale scale = cBrd.Devices.Scale as IScale;
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
@@ -57,16 +107,9 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
}
|
||||
}
|
||||
|
||||
if (test.Volume > scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
|
||||
return new List<Event> { Event.ConfigurationError };
|
||||
}
|
||||
|
||||
|
||||
IList<Event> e; /// Events from currently running operations
|
||||
Event retVal = Event.Done;
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
int tMass1 = 0;
|
||||
int tMass2 = 0;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
@@ -86,7 +129,10 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
}
|
||||
}
|
||||
|
||||
cBrd.SetFiltersPidShortPulses(filters, outPath.PidCoef, (test.TolerRed == 0) ? 0 : 1);
|
||||
if (cBrd is ControlBoard.Legacy.ControlBoardDev)
|
||||
{
|
||||
(cBrd as ControlBoard.Legacy.ControlBoardDev).SetFiltersPidShortPulses(filters, outPath.PidCoef, (test.TolerRed == 0) ? 0 : 1);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if(benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
@@ -114,7 +160,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
while (e.Contains(Event.Busy));
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, null, totalPulses));
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, null));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
@@ -259,7 +305,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec))
|
||||
.AddOperation(cBrd.SetFlowOp(test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec))
|
||||
.AddOperations(readTempPressOps)
|
||||
.EnterState();
|
||||
do {
|
||||
@@ -457,7 +503,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses/ testParams.DivRepetitions))
|
||||
.AddOperation(cBrd.StartTestOp(test, testParams.DivRepetitions))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -512,8 +558,8 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
}
|
||||
//------------------------------------------------
|
||||
|
||||
RefFreq.Val = cBrd.ReferenceFreq;
|
||||
RefFlow.Val = cBrd.ReferenceFlow;
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = cBrd.RefFlow;
|
||||
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
@@ -546,13 +592,13 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
|
||||
/// Accumulate partial pulses
|
||||
cumulativeEtPulses[0] += cBrd.EtPulses(0);
|
||||
cumulativeTestTime[0] += cBrd.TTime;
|
||||
cumulativeEtPulses[0] += cBrd.RefPulses;
|
||||
cumulativeTestTime[0] += cBrd.TestTime;
|
||||
for (int i = 1; i <= Config.Data.WMsCount; i++)
|
||||
{
|
||||
cumulativeEtPulses[i] += cBrd.EtPulses(i);
|
||||
cumulativeWMPulses[i] += cBrd.WMeterPulses(i);
|
||||
cumulativeTestTime[i] += cBrd.ImpulseTime(i);
|
||||
cumulativeEtPulses[i] += cBrd.RefPulsesWM(i);
|
||||
cumulativeWMPulses[i] += cBrd.PulsesWM(i);
|
||||
cumulativeTestTime[i] += cBrd.TestTimeWM(i);
|
||||
}
|
||||
}
|
||||
} /// end for ... diverter test loop
|
||||
@@ -566,7 +612,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
State.Create(string.Format("{0}({1}) : Stopping flow regulation", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.StopFlowRegulationOp(outPath))
|
||||
.AddOperation(cBrd.StopFlowRegulationOp())
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -607,7 +653,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -667,13 +713,13 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
///
|
||||
/// Accumulate partial pulses from the last diverter repetition
|
||||
///
|
||||
cumulativeEtPulses[0] += cBrd.EtPulses(0);
|
||||
cumulativeTestTime[0] += cBrd.TTime;
|
||||
cumulativeEtPulses[0] += cBrd.RefPulses;
|
||||
cumulativeTestTime[0] += cBrd.TestTime;
|
||||
for (int i = 1; i <= Config.Data.WMsCount; i++)
|
||||
{
|
||||
cumulativeEtPulses[i] += cBrd.EtPulses(i);
|
||||
cumulativeWMPulses[i] += cBrd.WMeterPulses(i);
|
||||
cumulativeTestTime[i] += cBrd.ImpulseTime(i);
|
||||
cumulativeEtPulses[i] += cBrd.RefPulsesWM(i);
|
||||
cumulativeWMPulses[i] += cBrd.PulsesWM(i);
|
||||
cumulativeTestTime[i] += cBrd.TestTimeWM(i);
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user