CombinedWithDetectionSeq, ProcessTabPageCtrl and SeqBase.ReadRegistersTempPressAmbient() changes, ver. 3.6.2030
This commit is contained in:
@@ -985,14 +985,13 @@ namespace TBF.Rig.Sequences
|
||||
.AddOperation(realTest ? queryEnd1 : null)
|
||||
.AddOperation(realTest ? processDataLoggingOp : null)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
/// Invoke Run() of all operatios once
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
if (e.Contains(Event.TestCompleted) || e.Contains(Event.Next)) return Event.TestCompleted;
|
||||
}
|
||||
while (!e.Contains(Event.ReadAllRegistersDone));
|
||||
|
||||
return Event.Done;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.UiBridge;
|
||||
|
||||
namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
{
|
||||
@@ -76,6 +74,9 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
return Simulate(test, repetitionNr, isLastRepetition, testParams);
|
||||
}
|
||||
|
||||
ControlBoard.Uni.UniCB cBrd = StateMachine.ControlBoard as ControlBoard.Uni.UniCB;
|
||||
IScale scale = cBrd.Devices.Scale as IScale;
|
||||
|
||||
if ((outPath.FlowMeter is IFlowMeterSingle) &&
|
||||
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
|
||||
{
|
||||
@@ -83,13 +84,6 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
|
||||
}
|
||||
|
||||
IScale scale = outPath.Scale as IScale;
|
||||
if (scale == null)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_scale);
|
||||
return new List<Event> { Event.ConfigurationError };
|
||||
}
|
||||
|
||||
if (test.Part < 0 || test.Part > TBF.Data.CompoundWMsCount)
|
||||
{
|
||||
UiBridge.Bridge.OnError(this, string.Format("Test 'Part' should be '-' or 1 .. {0}", TBF.Data.CompoundWMsCount));
|
||||
@@ -98,28 +92,26 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
|
||||
IList<Event> e; /// Events from currently running operations
|
||||
TBF.Rig.ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
|
||||
Event retVal = Event.Done;
|
||||
int tMass1 = 0;
|
||||
int tMass2 = 0;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
/// Since CheckDeviceCaps() passed cBrd is ControlBoard.Uni.UniCB
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
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));
|
||||
@@ -152,8 +144,8 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.Busy));
|
||||
|
||||
@@ -166,24 +158,17 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
Qrise = 0;
|
||||
Qfall = 0;
|
||||
|
||||
if (!test.DoDraining) /// Do not skip emptying if test.Emptying==true
|
||||
double estimatedEndMass = scale.Mass + test.Volume;
|
||||
if (test.DoDraining || estimatedEndMass >= scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
double estimatedEndMass = scale.Mass + test.Volume;
|
||||
if (estimatedEndMass < scale.Capacity * Constants.TankFullFactor)
|
||||
/// Empty the water tank
|
||||
switch (DrainTheTank(scale, readTempPressOps))
|
||||
{
|
||||
goto switching_flow_detection; /// Enough room in the tank -> skip emptying
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
}
|
||||
|
||||
/// Empty the water tank
|
||||
switch (DrainTheTank(scale, readTempPressOps))
|
||||
{
|
||||
case Event.Error: goto error;
|
||||
case Event.UiCmdStop: goto stopTest;
|
||||
}
|
||||
|
||||
switching_flow_detection:
|
||||
|
||||
int flowDetectTime0 = StateMachine.Time;
|
||||
|
||||
///
|
||||
@@ -191,18 +176,15 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
///
|
||||
|
||||
/// Find ROI-s
|
||||
IList<GenericDevices.IRegReaderLiveCamera> rois = new List<GenericDevices.IRegReaderLiveCamera>();
|
||||
IList<IRegReaderLiveCamera> rois = new List<IRegReaderLiveCamera>();
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IRegReaderLiveCamera cameraRoI = rr as GenericDevices.IRegReaderLiveCamera;
|
||||
if ((cameraRoI != null) && cameraRoI.Detected)
|
||||
{
|
||||
rois.Add(cameraRoI);
|
||||
}
|
||||
var cameraRoI = rr as IRegReaderLiveCamera;
|
||||
if (cameraRoI != null && cameraRoI.Detected) rois.Add(cameraRoI);
|
||||
}
|
||||
|
||||
/// Find cameras
|
||||
IList<GenericDevices.ICamera> cameras = new List<GenericDevices.ICamera>();
|
||||
var cameras = new List<GenericDevices.ICamera>();
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
if (roi.Camera != null && !cameras.Contains(roi.Camera))
|
||||
@@ -216,10 +198,9 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
foreach (var roi in rois) roi.RegisterRoiToCamera();
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
var measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp());
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Switching_flow_detection);
|
||||
//------------------------------------------------
|
||||
@@ -262,8 +243,8 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
switch (ReadRegistersTempPressAmbient(measureOperations, false))
|
||||
{
|
||||
case Event.Error: goto error;
|
||||
case Event.UiCmdStop: goto stopTest;
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
|
||||
|
||||
@@ -306,7 +287,8 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.SwitchingFlowDetection));
|
||||
|
||||
if (TestAndLogUiCmdStop(test, e)) goto stopTest;
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.PositionReached));
|
||||
|
||||
@@ -327,8 +309,8 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
switch (ReadRegistersTempPressAmbient(measureOperations, false))
|
||||
{
|
||||
case Event.Error: goto error;
|
||||
case Event.UiCmdStop: goto stopTest;
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
|
||||
flowsForDetection[0] = cBrd.RefFrequency * outPath.FlowMeter.NominalFlow / outPath.FlowMeter.NominalFreq;
|
||||
@@ -386,16 +368,15 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
aveFreqBefore /= (double)DetectionKernelSize;
|
||||
aveFreqAfter /= (double)DetectionKernelSize;
|
||||
|
||||
//UiBridge.Bridge.OnEvent(this, string.Format("time={0}, flow{1}, aveFlowB={2}, aveFlowA={3}, pulseFreq={4}, aveFreqB={5}, aveFreqA={6}\r\n",
|
||||
// StateMachine.Time - startTime,
|
||||
// flowsForDetection[0].ToString("F2"),
|
||||
// aveFlowBefore.ToString("F2"),
|
||||
// aveFlowAfter.ToString("F2"),
|
||||
// pulseFreqsForDetection[0].ToString("F2"),
|
||||
// aveFreqBefore.ToString("F2"),
|
||||
// aveFreqAfter.ToString("F2")));
|
||||
UiBridge.Bridge.OnCompoundDetection(this, string.Format("time={0}, flow{1}, aveFlowB={2}, aveFlowA={3}, pulseFreq={4}, aveFreqB={5}, aveFreqA={6}",
|
||||
StateMachine.Time - startTime,
|
||||
flowsForDetection[0].ToString("F2"),
|
||||
aveFlowBefore.ToString("F2"),
|
||||
aveFlowAfter.ToString("F2"),
|
||||
pulseFreqsForDetection[0].ToString("F2"),
|
||||
aveFreqBefore.ToString("F2"),
|
||||
aveFreqAfter.ToString("F2")));
|
||||
|
||||
//detectedFlow = (aveFlowBefore + aveFlowAfter) / 2;
|
||||
detectedFlow = aveFlowBefore;
|
||||
|
||||
if (rvPulse > 0)
|
||||
@@ -424,7 +405,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
Qfall = detectedFlow;
|
||||
}
|
||||
|
||||
//UiBridge.Bridge.OnEvent(this, string.Format("detected flow={0}\r\n", detectedFlow.ToString("F2")));
|
||||
UiBridge.Bridge.OnCompoundDetection(this, string.Format("detected flow={0}", detectedFlow.ToString("F2")));
|
||||
|
||||
double qfrom_detected = detectedFlow + testParams.RelativeQfrom;
|
||||
double qto_detected = detectedFlow + testParams.RelativeQto;
|
||||
@@ -484,22 +465,30 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
//start_measurement:
|
||||
|
||||
//------------------------------------------------
|
||||
//----------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
||||
//------------------------------------------------
|
||||
//----------------------------------------------------
|
||||
|
||||
LogProcessDataTestInfo(processDataLogger, test.Procedure.Name, test.Name);
|
||||
|
||||
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "Start mass");
|
||||
else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass");
|
||||
|
||||
State.Create(Strings.Measure_the_mass)
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.TimeFlow2Mass, test.MassMethod, test.MassRepeats, test.MassSpread))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.ScaleTimeout))
|
||||
{
|
||||
Bridge.OnError(this, Strings.Mass_measurement_timeout);
|
||||
retVal = Event.RecoverableError;
|
||||
goto stopTest;
|
||||
}
|
||||
}
|
||||
@@ -510,75 +499,66 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
//------------------------------------------------
|
||||
|
||||
/// Measurement loop preparation
|
||||
int estimtdEndTime = StateMachine.Time + Convert.ToInt32(testTimeFromDetectedFlow);
|
||||
int remainingTime;
|
||||
StartNewStatistics(outPath.FlowMeter, BatchRslts.Batch.BatchNr, test, repetitionNr, 0);
|
||||
DiverterStart.Start(BatchRslts.Batch.BatchNr, test.Name, repetitionNr);
|
||||
DiverterEnd.Start(BatchRslts.Batch.BatchNr, test.Name, repetitionNr);
|
||||
|
||||
State.Create(Strings.Start_the_test)
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
//.AddOperation(cBrd.StartTestOp(test, true, true, false, qfrom_detected, qto_detected, totalPulses, 0))
|
||||
.EnterState();
|
||||
.AddOperation(cBrd.FlyingStartStopTestOp(test, qfrom_detected, qto_detected, totalPulses, true, false, 0, true, DiverterStart, DiverterEnd))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
|
||||
}
|
||||
while (!e.Contains(Event.TestInProgress));
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
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; }
|
||||
|
||||
///
|
||||
/// Measurement loop - preparation
|
||||
///
|
||||
queryEnd1 = cBrd.QueryMeasurementEndOp();
|
||||
/// 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));
|
||||
|
||||
StartNewStatistics(outPath.FlowMeter, BatchRslts.Batch.BatchNr, test, repetitionNr, 0);
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
/// Update statistics
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = outPath.FlowMeter.ReadFlow();
|
||||
UpdateAllStatistics();
|
||||
|
||||
/// Read the diverter switch time
|
||||
if (StateMachine.ControlBoard is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
ControlBoard.Uni.UniCB eldeCB = StateMachine.ControlBoard as ControlBoard.Uni.UniCB;
|
||||
//switchTimeStart = 0.001f * (float)eldeCB.DivTime(0);
|
||||
//log.WarnFormat("Diverter switch time on test start = {0} ms", eldeCB.DivTime(0));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.Test));
|
||||
}
|
||||
while (!e.Contains(Event.TestCompleted) && !e.Contains(Event.Next));
|
||||
|
||||
/// Measurement loop - begin
|
||||
while (true)
|
||||
{
|
||||
//--------------------------------
|
||||
switch (ReadRegistersTempPressAmbient(measureOperations, true))
|
||||
{
|
||||
case Event.Error: goto error;
|
||||
case Event.UiCmdStop: goto stopTest;
|
||||
case Event.TestCompleted: goto measurement_completed;
|
||||
}
|
||||
/// Measurement loop end
|
||||
StopRecordingStatistics();
|
||||
|
||||
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));
|
||||
}
|
||||
///
|
||||
/// (Berlin:) Water is stopped immediately after the test and before the 2nd mass measurement in case:
|
||||
/// - no 'transition sequence after test' is used
|
||||
/// - this is the last (or the only) test repetition or test is a part of an 'outer loop'
|
||||
///
|
||||
if (isLastRepetition && transitionAfter == null)
|
||||
{
|
||||
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOff();
|
||||
|
||||
UpdateAllStatistics();
|
||||
|
||||
/// TODO: Reimplement
|
||||
//for (int i = 0; i < TBF.Data.CompoundWMsCount; i++)
|
||||
//{
|
||||
// data.TestResult.CombinedMeters[i].VolumeMeter = data.TestResult.Meters[2 * i].VolumeMeter
|
||||
// + data.TestResult.Meters[2 * i + 1].VolumeMeter;
|
||||
// if (data.Volume.Valid)
|
||||
// {
|
||||
// data.TestResult.CombinedMeters[i].VolumeErrorPct =
|
||||
// Formulas.ErrorFromVolumes(data.TestResult.CombinedMeters[i].VolumeMeter, data.Volume.Val);
|
||||
// }
|
||||
//}
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.Test));
|
||||
}
|
||||
/// Measurement loop - end
|
||||
|
||||
|
||||
measurement_completed:
|
||||
State.Create("SequenceBase : Transition : TestEnd - Default action")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
|
||||
.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.ValvesSet));
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
||||
@@ -590,17 +570,19 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.ScaleTimeout))
|
||||
{
|
||||
Bridge.OnError(this, Strings.Mass_measurement_timeout);
|
||||
retVal = Event.RecoverableError;
|
||||
goto stopTest;
|
||||
}
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone) && !e.Contains(Event.Next));
|
||||
///
|
||||
tMass2 = StateMachine.Time;
|
||||
log.WarnFormat("End mass = {0}kg", EndMass);
|
||||
TestEndTime = DateTime.Now;
|
||||
|
||||
if (test.DoDrainingAfter)
|
||||
@@ -610,10 +592,10 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
|
||||
.AddOperations(readTempPressOps)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { goto error; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
}
|
||||
@@ -637,8 +619,9 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
|
||||
}
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
cBrd.StopAll(false);
|
||||
@@ -811,44 +794,33 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet) || ((inPath.Pump is GenericDevices.IPumpFM) && !e.Contains(Event.TurnPumpOnOffDone)));
|
||||
}
|
||||
|
||||
return stopCycle ? new List<Event> { Event.ErrorFlagsStop } : new List<Event> { Event.Done };
|
||||
if (stopCycle) retVal = Event.ErrorFlagsStop;
|
||||
|
||||
//====================================
|
||||
stopTest:
|
||||
|
||||
State.Create(string.Format("{0}({1}) : User selected STOP -> Closing the valves", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
|
||||
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
StopRecordingStatistics(); /// Make sure graph files are closed
|
||||
|
||||
return new List<Event> { Event.UiCmdStop };
|
||||
///
|
||||
/// Quit this sequence
|
||||
///
|
||||
if (isLastRepetition || retVal == Event.UiCmdStop
|
||||
|| retVal == Event.OpArgumentError
|
||||
|| retVal == Event.RecoverableError
|
||||
|| retVal == Event.ErrorFlagsStop
|
||||
|| retVal == Event.Error
|
||||
|| retVal == Event.ConfigurationError)
|
||||
{
|
||||
cBrd.StopAll(false);
|
||||
}
|
||||
|
||||
//====================================
|
||||
error:
|
||||
State.Create("close_before_error")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
|
||||
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) break;
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
return new List<Event> { Event.Error };
|
||||
}
|
||||
return new List<Event> { retVal };
|
||||
}
|
||||
|
||||
|
||||
IList<Event> Simulate(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
|
||||
|
||||
@@ -113,22 +113,20 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
/// Since CheckDeviceCaps() passed cBrd is ControlBoard.Uni.UniCB
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
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));
|
||||
@@ -166,16 +164,9 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Checking_tank_capacity);
|
||||
//------------------------------------------------
|
||||
bool drainTheTank = test.DoDraining;
|
||||
|
||||
if (!drainTheTank) /// If condition met => skip measuring and force emptying
|
||||
{
|
||||
double estimatedEndMass = scale.Mass + test.Volume;
|
||||
if (estimatedEndMass >= scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
drainTheTank = true;
|
||||
}
|
||||
}
|
||||
double estEndMass = scale.Mass + test.Volume;
|
||||
bool drainTheTank =
|
||||
test.DoDraining || (estEndMass >= scale.Capacity * Constants.TankFullFactor);
|
||||
///
|
||||
if (drainTheTank)
|
||||
{
|
||||
@@ -484,9 +475,9 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
//----------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
||||
//------------------------------------------------
|
||||
//----------------------------------------------------
|
||||
|
||||
LogProcessDataTestInfo(processDataLogger, test.Procedure.Name, test.Name);
|
||||
|
||||
@@ -527,7 +518,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
//------------------------------------------------
|
||||
|
||||
/// Measurement loop preparation
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
int estimtdEndTime = StateMachine.Time + Convert.ToInt32(test.TestTime);
|
||||
int remainingTime;
|
||||
StartNewStatistics(outPath.FlowMeter, BatchRslts.Batch.BatchNr, test, repetitionNr, 0);
|
||||
DiverterStart.Start(BatchRslts.Batch.BatchNr, test.Name, repetitionNr);
|
||||
|
||||
Reference in New Issue
Block a user