ControlBoards, IControlBoard iface, Devices, test methods.
This commit is contained in:
@@ -17,6 +17,40 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(AdjustmentSeq));
|
||||
|
||||
/// <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.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;
|
||||
}
|
||||
|
||||
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
///
|
||||
delegate void ErrorsFormDlgt(AdjustmentSeq myRef, IList<GenericDevices.IWaterMeter> waterMeters);
|
||||
@@ -85,7 +119,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
|
||||
IList<Event> e; /// Events from currently running operations
|
||||
Event retVal = Event.Done;
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
TBF.BenchControl.ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
@@ -102,7 +136,10 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
@@ -117,11 +154,10 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
int flowSetTime = 0;
|
||||
|
||||
/// 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);
|
||||
|
||||
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
|
||||
@@ -223,7 +259,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
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();
|
||||
@@ -342,7 +378,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses))
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -369,8 +405,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
case Event.MeasurementCompleted: goto one_test_completed;
|
||||
}
|
||||
|
||||
RefFreq.Val = cBrd.ReferenceFreq;
|
||||
RefFlow.Val = cBrd.ReferenceFlow;
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = cBrd.RefFlow;
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
@@ -404,8 +440,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
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;
|
||||
@@ -449,7 +485,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
meterRslt.VolumeEnd = 0; /// liter
|
||||
meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter
|
||||
meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter
|
||||
meterRslt.TestTime = cBrd.ImpulseTime(i + 1);
|
||||
meterRslt.TestTime = cBrd.PulsesWM(i + 1);
|
||||
meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
|
||||
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.VolumeCTV, tstRslt.TestTime) + test.Uncertainty)
|
||||
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.VolumeCTV, tstRslt.TestTime) - test.Uncertainty);
|
||||
|
||||
Reference in New Issue
Block a user