ControlBoards, IControlBoard iface, Devices, test methods.

This commit is contained in:
Milan Hanajik
2020-05-21 15:55:02 +02:00
parent 6df9261697
commit 7b321abb30
222 changed files with 3995 additions and 1284 deletions
@@ -16,6 +16,38 @@ namespace TBF.BenchControl.TestMethods.Endurance
{
private static readonly ILog log = LogManager.GetLogger(typeof(EnduranceSeq));
/// <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))
{
/// 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.FlowMeter is GenericDevices.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>
/// Endurance test sequence
/// </summary>
@@ -30,6 +62,9 @@ namespace TBF.BenchControl.TestMethods.Endurance
string enduranceCycleStr,
Config.Entities.DebugMode debugLevel)
{
ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
ControlBoard.Legacy.ControlBoardDev eldeCB = cBrd as ControlBoard.Legacy.ControlBoardDev;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
{
@@ -54,7 +89,6 @@ namespace TBF.BenchControl.TestMethods.Endurance
IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
@@ -72,7 +106,10 @@ namespace TBF.BenchControl.TestMethods.Endurance
}
}
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));
@@ -121,7 +158,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
while (e.Contains(Event.Busy));
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now;
@@ -155,7 +192,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec))
.AddOperation(cBrd.SetFlowOp(test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
@@ -259,7 +296,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(enduranceDataLoggingOp)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses))
.AddOperation(cBrd.StartTestOp(test))
.AddOperation(processDataLoggingOp)
.EnterState();
do {
@@ -317,8 +354,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
}
//------------------------------------------------
RefFreq.Val = cBrd.ReferenceFreq;
RefFlow.Val = cBrd.ReferenceFlow;
RefFrequency.Val = cBrd.RefFrequency;
RefFlow.Val = cBrd.RefFlow;
UpdateAllStatistics(StateMachine.Time);
@@ -360,8 +397,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
tstRslt.StartTime = TestStartTime;
tstRslt.EndTime = TestEndTime;
tstRslt.FlowSetTime = flowSetTime;
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
tstRslt.TestTime = cBrd.TestTime; /// [s] measurement time
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.RefPulses); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = 0;
tstRslt.MassEndRaw = 0;
@@ -534,12 +571,13 @@ namespace TBF.BenchControl.TestMethods.Endurance
cyclePar[2 * stepsCount + 2] = 0;
cyclePar[0] = duration / 10;
///
cBrd.CyclePar = cyclePar;
eldeCB.CyclePar = cyclePar;
///
State.Create(string.Format("{0}({1}) : Uploading cycle parameters", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.ExecuteCommandOp(Elde.Command.EnduranceCycleParamsUpload, Elde.Command.None, 0))
.AddOperation(eldeCB.ExecuteCommandOp(ControlBoard.Legacy.Command.EnduranceCycleParamsUpload, ControlBoard.Legacy.Command.None, 0))
.AddOperation(processDataLoggingOp)
.AddOperation(enduranceDataLoggingOp)
.EnterState();
@@ -548,8 +586,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
RefFreq.Val = cBrd.ReferenceFreq;
RefFlow.Val = cBrd.ReferenceFlow;
RefFrequency.Val = cBrd.RefFrequency;
RefFlow.Val = cBrd.RefFlow;
UpdateAllStatistics(StateMachine.Time);
}
@@ -562,7 +600,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp((int)test.TstTime, Event.TimerExpired))
.AddOperation(cBrd.ExecuteCommandOp(Elde.Command.EnduranceCycleStart, Elde.Command.EnduranceCycleStop, 0))
.AddOperation(eldeCB.ExecuteCommandOp(ControlBoard.Legacy.Command.EnduranceCycleStart, ControlBoard.Legacy.Command.EnduranceCycleStop, 0))
.AddOperation(processDataLoggingOp)
.AddOperation(enduranceDataLoggingOp)
.EnterState();
@@ -587,8 +625,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
}
//------------------------------------------------
RefFreq.Val = cBrd.ReferenceFreq;
RefFlow.Val = cBrd.ReferenceFlow;
RefFrequency.Val = cBrd.RefFrequency;
RefFlow.Val = cBrd.RefFlow;
UpdateAllStatistics(StateMachine.Time);
@@ -616,8 +654,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
stopInProgress = true;
}
RefFreq.Val = cBrd.ReferenceFreq;
RefFlow.Val = cBrd.ReferenceFlow;
RefFrequency.Val = cBrd.RefFrequency;
RefFlow.Val = cBrd.RefFlow;
UpdateAllStatistics(StateMachine.Time);