Uni.XyzStartStopTest[WithDiv]Op, etc., AdjustmentSeq and all FlyingStartXyzSeq completed, ver. 3.1.1630
This commit is contained in:
@@ -98,22 +98,22 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
//cBrd.SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
@@ -148,6 +148,17 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test
|
||||
///
|
||||
@@ -342,7 +353,6 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
|
||||
temperature_set:
|
||||
|
||||
|
||||
///
|
||||
/// Prepare cameras, ROI-s and measurementOperations
|
||||
///
|
||||
@@ -373,82 +383,49 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
foreach (var roi in rois) roi.RegisterRoiToCamera();
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp());
|
||||
|
||||
IList<IOperation> cameraMeasurementOps = new List<IOperation>();
|
||||
foreach (var camera in cameras) cameraMeasurementOps.Add(camera.MeasurementOp());
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
|
||||
/// Measurement loop preparation
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
int remainingTime;
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
|
||||
/// Measurement loop
|
||||
State.Create(string.Format("{0}({1}) : FlyingStartStopTestOp is running", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.AddOperations(cameraMeasurementOps)
|
||||
.AddOperation(cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, totalPulses))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
/// Show remaining time
|
||||
if ((remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0)) > 60)
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
else
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Measurement loop - preparation
|
||||
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
|
||||
queryEnd1 = cBrd.QueryMeasurementEndOp();
|
||||
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
|
||||
/// Measurement loop - begin
|
||||
State.Create(string.Format("{0}({1}) : Read water meters", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(queryEnd1)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.MeasurementCompleted)) goto test_completed;
|
||||
|
||||
//------------------------------------------------
|
||||
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
||||
if (remainingTime > 60)
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
}
|
||||
else
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
}
|
||||
//------------------------------------------------
|
||||
|
||||
/// Update statistics
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = outPath.FlowMeter.ReadFlow();
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
#region Heat meters
|
||||
|
||||
if (heatMetersTestParams != null)
|
||||
{
|
||||
/// Update heatmeter volume and energy values
|
||||
if (lastEnergyUpdateTime == 0)
|
||||
{
|
||||
lastEnergyUpdateTime = StateMachine.Time;
|
||||
@@ -456,8 +433,8 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
else
|
||||
{
|
||||
//double deltaTime = (double)(StateMachine.Time - lastEnergyUpdateTime);
|
||||
double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C]
|
||||
double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C]
|
||||
double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C]
|
||||
double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C]
|
||||
double deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l]
|
||||
double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Config.Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)]
|
||||
Energy.Update(deltaEnergy);
|
||||
@@ -466,15 +443,15 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
}
|
||||
}
|
||||
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (true);
|
||||
/// Measurement loop - end
|
||||
#endregion
|
||||
|
||||
test_completed:
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (!e.Contains(Event.TestCompleted) && !e.Contains(Event.Next)); /// 'Next' button is enabled in Debug version only
|
||||
|
||||
StopRecordingStatistics();
|
||||
/// Measurement loop end
|
||||
StopRecordingStatistics();
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_completed);
|
||||
|
||||
Reference in New Issue
Block a user