As sent to Munich

This commit is contained in:
Milan Hanajik
2014-08-01 08:36:17 +02:00
parent 836daaa5a1
commit fd2db3e229
20 changed files with 254 additions and 131 deletions
@@ -154,7 +154,7 @@ namespace TBF.BenchControl.Elde.RegulValve
opState = OpState.ValveMoveToFlow;
}
expireTime = StateMachine.CurrentTime + timeout;
expireTime = StateMachine.Time + timeout;
if (expireTime < 0) expireTime = int.MaxValue;
TestMethods tm = 0;
@@ -238,7 +238,7 @@ namespace TBF.BenchControl.Elde.RegulValve
opState = OpState.FlowReached;
return Event.FlowReached;
}
else if (StateMachine.CurrentTime > expireTime)
else if (StateMachine.Time > expireTime)
{
return Event.RegulValveTimeOut;
}
@@ -67,7 +67,7 @@ namespace TBF.BenchControl.Elde.RegulValve
{
firstRun = true;
positionReached = false;
expireTime = StateMachine.CurrentTime + timeout;
expireTime = StateMachine.Time + timeout;
log.InfoFormat("Start(): RV#={0}, reqPosLo={1}%, reqPosHi={2}%", regulValveNr, posLoPct.ToString("F1"), posHiPct.ToString("F1"));
}
@@ -106,7 +106,7 @@ namespace TBF.BenchControl.Elde.RegulValve
positionReached = true;
return Event.PositionReached;
}
else if (StateMachine.CurrentTime > expireTime)
else if (StateMachine.Time > expireTime)
{
return Event.RegulValveTimeOut;
}
@@ -167,7 +167,7 @@ namespace TBF.BenchControl.Elde.Valve
public void Start()
{
controlBoard.SetValves(switchPoints[0].MasksOpen, switchPoints[0].MasksClose);
swStartTime = StateMachine.CurrentTime;
swStartTime = StateMachine.Time;
nextIx = 1;
}
@@ -179,7 +179,7 @@ namespace TBF.BenchControl.Elde.Valve
{
if (nextIx >= switchPoints.Count) return Event.ValvesSet;
if (StateMachine.CurrentTime >= swStartTime + switchPoints[nextIx].TimeSec)
if (StateMachine.Time >= swStartTime + switchPoints[nextIx].TimeSec)
{
controlBoard.SetValves(switchPoints[nextIx].MasksOpen, switchPoints[nextIx].MasksClose);
nextIx++;
@@ -64,7 +64,7 @@ namespace TBF.BenchControl.Greco
temperature = 20.0f;
humidity = 40.0f;
pressure = 1.0f;
msrmntTimeStamp = StateMachine.CurrentTime;
msrmntTimeStamp = StateMachine.Time;
msrmntState = BenchControl.MsrmntState.Valid;
return;
}
@@ -82,7 +82,7 @@ namespace TBF.BenchControl.Greco
{
if (ambientCfg.DebugLevel == Entities.DebugMode.Simulate)
{
msrmntTimeStamp = StateMachine.CurrentTime;
msrmntTimeStamp = StateMachine.Time;
return;
}
@@ -124,7 +124,7 @@ namespace TBF.BenchControl.Greco
temperature = t;
humidity = h;
pressure = p;
msrmntTimeStamp = StateMachine.CurrentTime;
msrmntTimeStamp = StateMachine.Time;
msrmntState = MsrmntState.Valid;
log.InfoFormat("Msrmnt OK: time = {0}, temp={1}, humi={2}, pres={3}", msrmntTimeStamp, t, h, p);
@@ -223,7 +223,7 @@ namespace TBF.BenchControl.MettlerToledo
mass = GetSimMass(balanceNr);
Masses[balanceNr] = mass;
msrmntState = MsrmntState.Valid;
msrmntTimeStamp = StateMachine.CurrentTime;
msrmntTimeStamp = StateMachine.Time;
return;
}
@@ -242,7 +242,7 @@ namespace TBF.BenchControl.MettlerToledo
int eolPos = currentBuffer.IndexOf("\r\n");
if (eolPos >= 0)
{
msrmntTimeStamp = StateMachine.CurrentTime;
msrmntTimeStamp = StateMachine.Time;
/// Get part of theh string before EOL
string received = currentBuffer.Substring(0, eolPos);
@@ -68,7 +68,7 @@ namespace TBF.BenchControl.MettlerToledo
Masses[balanceNr] = mass;
serialNumber = "1234567890";
msrmntState = MsrmntState.Valid;
msrmntTimeStamp = StateMachine.CurrentTime;
msrmntTimeStamp = StateMachine.Time;
return;
}
@@ -84,7 +84,7 @@ namespace TBF.BenchControl.MettlerToledo
if (stringBuilder.ToString().EndsWith("\r\n"))
{
msrmntTimeStamp = StateMachine.CurrentTime;
msrmntTimeStamp = StateMachine.Time;
string received = stringBuilder.ToString();
@@ -47,12 +47,12 @@ namespace TBF.BenchControl.Operations
{
timeExpired = false;
timerStarted = true;
expireTime = StateMachine.CurrentTime + timerTime;
expireTime = StateMachine.Time + timerTime;
}
public Event Run()
{
if (timerStarted && !timeExpired && StateMachine.CurrentTime >= expireTime)
if (timerStarted && !timeExpired && StateMachine.Time >= expireTime)
{
timeExpired = true;
return eventExpired;
@@ -98,14 +98,22 @@ namespace TBF.BenchControl.Sequences
static SequenceBase()
{
results = new List<Entities.TestResult>();
}
///------------------------------------------------------------
/// Test related (instance) variables.
/// Created when test sequence is open.
/// They persist during all repetitions of the same test
///------------------------------------------------------------
protected BenchControl.FeedingPath inPath;
WMVolumes = new FloatBox[Program.WMsCount];
WMErrors = new FloatBox[Program.WMsCount];
for (int i = 0; i < Program.WMsCount; i++)
{
WMVolumes[i] = new FloatBox() { Name = string.Format("Volume{0}", i), Format = "F2" };
WMErrors[i] = new FloatBox() { Name = string.Format("Error{0}", i), Format = "F2" };
}
}
///------------------------------------------------------------
/// Test related (instance) variables.
/// Created when test sequence is open.
/// They persist during all repetitions of the same test
///------------------------------------------------------------
protected BenchControl.FeedingPath inPath;
protected BenchControl.BenchPath benchPath;
protected BenchControl.OutputPath outPath;
protected BenchControl.MetersPath sensPath;
@@ -113,18 +121,17 @@ namespace TBF.BenchControl.Sequences
protected Entities.TransitionSequence transitionStart;
protected Entities.TransitionSequence transitionStop;
#region Temperature_Pressure_Humidity
protected FloatBox tempIn = new FloatBox() { Name = "Temperature In", Format = "F1" };
protected FloatBox tempOut = new FloatBox() { Name = "Temperature Out", Format = "F1" };
protected FloatBox tempDiv = new FloatBox() { Name = "Temperature Div", Format = "F1" };
protected FloatBox pressIn = new FloatBox() { Name = "Pressure In", Format = "F1" };
protected FloatBox pressOut = new FloatBox() { Name = "Pressure Out", Format = "F1" };
protected FloatBox airTemperature = new FloatBox() { Name = "Ambient Temperature", Format = "F1" };
protected FloatBox airPressure = new FloatBox() { Name = "Ambient Pressure", Format = "F1" };
protected FloatBox airHumidity = new FloatBox() { Name = "Ambient Humidity", Format = "F1" };
protected static FloatBox tempIn = new FloatBox() { Name = "Temperature In", Format = "F1" };
protected static FloatBox tempOut = new FloatBox() { Name = "Temperature Out", Format = "F1" };
protected static FloatBox tempDiv = new FloatBox() { Name = "Temperature Div", Format = "F1" };
protected static FloatBox pressIn = new FloatBox() { Name = "Pressure In", Format = "F3", Factor = 0.01f };
protected static FloatBox pressOut = new FloatBox() { Name = "Pressure Out", Format = "F3", Factor = 0.01f };
protected static FloatBox airTemperature = new FloatBox() { Name = "Ambient Temperature", Format = "F1" };
protected static FloatBox airPressure = new FloatBox() { Name = "Ambient Pressure", Format = "F1" };
protected static FloatBox airHumidity = new FloatBox() { Name = "Ambient Humidity", Format = "F1" };
///
protected float tempInSum;
protected float tempOutSum;
@@ -183,10 +190,6 @@ namespace TBF.BenchControl.Sequences
#endregion
protected bool ticTac = false;
protected int[] WMPulses = new int[Program.WMsCount];
protected int[] WMRefPulses = new int[Program.WMsCount];
protected IOperation readRegisters1;
protected IOperation readRegisters2;
@@ -195,25 +198,42 @@ namespace TBF.BenchControl.Sequences
protected IOperation checkUiOp;
protected IntBox refCount = new IntBox() { Name = "RefCount" };
protected FloatBox refFreq = new FloatBox() { Name = "RefFreq", Format = "F2" };
protected FloatBox refFlow = new FloatBox() { Name = "RefFlow", Format = "F2" };
protected FloatBox mass = new FloatBox() { Name = "Mass", Format = "F1" };
protected FloatBox startMass = new FloatBox() { Name = "Start Mass", Format = "F1" };
protected FloatBox endMass = new FloatBox() { Name = "End Mass", Format = "F1" };
protected bool ticTac = false;
protected int[] WMPulses = new int[Program.WMsCount];
protected int[] WMRefPulses = new int[Program.WMsCount];
protected static FloatBox[] WMVolumes;
protected static FloatBox[] WMErrors;
protected static IntBox refCount = new IntBox() { Name = "RefCount" };
protected static FloatBox refFreq = new FloatBox() { Name = "RefFreq", Format = "F2" };
protected static FloatBox refFlow = new FloatBox() { Name = "RefFlow", Format = "F2" };
protected static FloatBox mass = new FloatBox() { Name = "Mass", Format = "F1" };
protected static FloatBox startMass = new FloatBox() { Name = "Start Mass", Format = "F1" };
protected static FloatBox endMass = new FloatBox() { Name = "End Mass", Format = "F1" };
/// <summary>
/// To clear process values at the beginning of each test
/// </summary>
protected void ClearProcessValues()
{
//if (WMPulses != null) { for (int i = 0; i < WMPulses.Length; i++) WMPulses[i] = 0; }
//if (WMRefPulses != null) { for (int i = 0; i < WMRefPulses.Length; i++) WMPulses[i] = 0; }
for (int i = 0; i < Program.WMsCount; i++)
{
WMPulses[i] = 0;
WMPulses[i] = 0;
WMVolumes[i].Clear();
WMErrors[i].Clear();
}
refCount.Clear();
refFreq.Clear();
refFlow.Clear();
mass.Clear();
startMass.Clear();
endMass.Clear();
}
/// <summary>
@@ -438,8 +458,7 @@ namespace TBF.BenchControl.Sequences
/// <param name="time">Current test time in [s]</param>
/// <param name="progress">Current progress 0 .. 1.0f</param>
/// <returns>Data for the UI</returns>
protected TestProgressEventArgs GetTestProgressData(Entities.Test test, Entities.TestResult tstRslt,
int currentRefPulses, float time, float progress)
protected TestProgressEventArgs GetTestProgressData(Entities.Test test, Entities.TestResult tstRslt, Elde.ControlBoardDev cBrd, float time, float progress)
{
TestProgressEventArgs data = new TestProgressEventArgs();
@@ -448,25 +467,30 @@ namespace TBF.BenchControl.Sequences
//float ltrPerRefPulse = outPath.FlowMeter.NominalFlow / 7200.0f; /// [ltr/pulse]
float refPulsesPerLtr = 7200.0f / outPath.FlowMeter.NominalFlow; /// [pulse/ltr]
data.RefPulses = currentRefPulses;
data.Flow = refFlow.Val;
data.Volume = Formulas.VolumeFromPulses(currentRefPulses, refPulsesPerLtr);
data.RefPulses = cBrd.EtPulses(0);
refFreq.Val = cBrd.ReferenceFreq;
data.FlowMtrFreq = refFreq;
data.Flow = refFlow;
data.Volume = new FloatBox() { Name = "Volume", Format = "F1", Val = Formulas.VolumeFromPulses(data.RefPulses, refPulsesPerLtr) };
data.Time = time;
data.Mass = mass.Val;
data.StartMass = startMass;
data.Mass = mass;
data.Progress = progress;
float estCurrentTime = TimeEstimateBeginRpts + ((float)(tstRslt.RepetitionNr - 1) + progress) * TimeEstimateOneTest;
data.OveralProgress = estCurrentTime / TimeEstimateTotal;
data.Tin = tempIn.Val;
data.Tout = tempOut.Val;
data.Tdiv = tempDiv.Val;
data.Pin = pressIn.Val;
data.Pout = pressOut.Val;
data.Tin = tempIn;
data.Tout = tempOut;
data.Tdiv = tempDiv;
data.Pin = pressIn;
data.Pout = pressOut;
data.AmbientTemp = airTemperature.Val;
data.AmbientPressure = airPressure.Val;
data.AmbientHumidity = airHumidity.Val;
data.AmbientTemp = airTemperature;
data.AmbientPressure = airPressure;
data.AmbientHumidity = airHumidity;
for (int i = 0; i < Program.WMsCount; i++)
{
@@ -475,7 +499,7 @@ namespace TBF.BenchControl.Sequences
data.WmPulses[i] = WMPulses[i];
data.WmRefPulses[i] = WMRefPulses[i];
data.WmVolume[i] = Formulas.VolumeFromPulses(WMPulses[i], sensPath.RegisterReaders[i].PulsesPerLtr);
data.WmErrPct[i] = Formulas.ErrorFromVolumes(data.WmVolume[i], data.Volume);
if (data.Volume.Valid) { data.WmErrPct[i] = Formulas.ErrorFromVolumes(data.WmVolume[i], data.Volume.Val); }
}
}
@@ -108,7 +108,7 @@ namespace TBF.BenchControl
/// <summary>
/// Current state name
/// </summary>
public static int CurrentTime { get { return currentTimeSec; } }
public static int Time { get { return currentTimeSec; } }
/// <summary>
/// Constructor
@@ -104,7 +104,7 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
while (!e.Contains(Event.FlowReached));
flow_set:
int time = StateMachine.CurrentTime;
int time = StateMachine.Time;
float currentFlow = refFlow.Val;
//------------------------------------------------
@@ -124,6 +124,9 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
set_flow:
int flowSetTime0 = StateMachine.Time;
float estFlowSetTime = 10.0f;
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
@@ -135,6 +138,11 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
do
{
e = StateMachine.WaitRunDevsRunOps();
int flowSetTime = StateMachine.Time - flowSetTime0;
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
if (e.Contains(Event.UiCmdStop)) goto stop;
}
while (!e.Contains(Event.ValvesSet));
@@ -147,12 +155,17 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
do
{
e = StateMachine.WaitRunDevsRunOps();
int flowSetTime = StateMachine.Time - flowSetTime0;
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
if (e.Contains(Event.UiCmdStop)) goto stop;
if (e.Contains(Event.RegulValveTimeOut)) goto error;
}
while (!e.Contains(Event.FlowReached));
int time = StateMachine.CurrentTime;
int time = StateMachine.Time;
float currentFlow = refFlow.Val;
/// Extract cameras from the current sensors path, add operations to the detection state
@@ -238,6 +251,8 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
AccumulateAveragedData();
refFreq.Val = cBrd.ReferenceFreq;
refFlow.Val = cBrd.ReferenceFlow;
string logstr = string.Format("E={0} f={1} q={2}", cBrd.EtPulses(0), cBrd.ReferenceFreq,
cBrd.ReferenceFlow * outPath.FlowMeter.NominalFlow);
@@ -247,11 +262,10 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
}
log.Info(logstr);
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, 10.0f, test.TstTime);
TestProgressEventArgs data = GetTestProgressData(test, tstRslt, cBrd.EtPulses(0), cBrd.TTime, progress);
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
TestProgressEventArgs data = GetTestProgressData(test, tstRslt, cBrd, cBrd.TTime, progress);
data.WmVolume[2] = data.WmVolume[0] + data.WmVolume[1];
data.WmErrPct[2] = Formulas.ErrorFromVolumes(data.WmVolume[2], data.Volume);
if (data.Volume.Valid) { data.WmErrPct[2] = Formulas.ErrorFromVolumes(data.WmVolume[2], data.Volume.Val); }
Bridge.OnTestProgress(this, data);
}
/// Measurement loop - end
@@ -14,6 +14,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
public float RelativeQto; /// Tested flow high range related to the detected flow
public float RateOfChange; /// Each step is calculated as (TargetQfrom - Qfrom) * RateOfChange, text form is displayed in % (*100)
public float DetectionThreshold;/// Drop of frequency for the detection, text form is displayed in % (*100)
public int SupressTrills;
string[] paramNames = new string[]
{
@@ -22,6 +23,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
Strings.RelativeQto,
Strings.RateOfChangePct,
Strings.DetectionThresholdPct,
Strings.SupressWMTrills,
};
public string ParamName(int i) { return paramNames[i]; }
@@ -34,6 +36,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
case 2: return RelativeQto.ToString();
case 3: return (100.0f * RateOfChange).ToString();
case 4: return (100.0f * DetectionThreshold).ToString();
case 5: return SupressTrills.ToString();
default: return string.Empty;
}
}
@@ -47,6 +50,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
case 2: RelativeQto = Utils.ParseSFloat(strValue); return;
case 3: RateOfChange = Utils.ParseUFloat(strValue) / 100.0f; return;
case 4: DetectionThreshold = Utils.ParseUFloat(strValue) / 100.0f; return;
case 5: SupressTrills = int.Parse(strValue); return;
default: return;
}
}
@@ -56,6 +60,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
message = string.Empty;
float dummy;
int idummy;
switch (i)
{
case 0:
@@ -67,6 +72,9 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
case 2:
if (Utils.TryParseSFloat(strValue, out dummy)) return true;
break;
case 5:
if (int.TryParse(strValue, out idummy)) return true;
break;
default:
message = "Invalid index";
return false;
@@ -125,6 +125,9 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
switching_flow_detection:
int flowSetTime0 = StateMachine.Time;
float estFlowSetTime = 100.0f;
/// Extract cameras from the current sensors path, add operations to the detection state
IList<IOperation> measureOperations = new List<IOperation>();
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
@@ -145,6 +148,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
do
{
e = StateMachine.WaitRunDevsRunOps();
int flowSetTime = StateMachine.Time - flowSetTime0;
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
if (e.Contains(Event.UiCmdStop)) goto stop;
}
while (!e.Contains(Event.ValvesSet));
@@ -158,6 +166,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
do
{
e = StateMachine.WaitRunDevsRunOps();
int flowSetTime = StateMachine.Time - flowSetTime0;
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
if (e.Contains(Event.UiCmdStop)) goto stop;
if (e.Contains(Event.RegulValveTimeOut)) goto error;
}
@@ -181,8 +194,8 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
/// Current values
flowsForDetection[0] = refFlow.Val;
pulseFreqsForDetection[0] = 0.0f;
int startTime = StateMachine.CurrentTime;
int lastTime = StateMachine.CurrentTime;
int startTime = StateMachine.Time;
int lastTime = StateMachine.Time;
/// Detection parameters
float rvPulse = (testParams.TargetQ > (test.Qfrom + test.Qto) / 2.0f) ? 0.05f : -0.05f; // rise or fall?
@@ -203,6 +216,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
do
{
e = StateMachine.WaitRunDevsRunOps();
int flowSetTime = StateMachine.Time - flowSetTime0;
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
if (e.Contains(Event.UiCmdStop)) goto stop;
}
while (!e.Contains(Event.PositionReached));
@@ -223,11 +241,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
case Event.UiCmdStop: goto stop;
}
int time = StateMachine.CurrentTime;
int time = StateMachine.Time;
int diff = WMPulses[1] - lastWMPulses[1];
flowsForDetection[0] = cBrd.ReferenceFreq * outPath.FlowMeter.NominalFlow / 2000.0f;
pulseFreqsForDetection[0] = (float)diff / (float)(time - lastTime);
lastTime = StateMachine.CurrentTime;
lastTime = StateMachine.Time;
if ((flowsForDetection[0] > 0) && (flowsForDetection[DetectionBufferSize - 1] > 0))
{
@@ -313,20 +331,31 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
float Qave_lps = (qfrom_test + qto_test) / 7.2f;
tstRslt.TstTime = tstRslt.Volume / Qave_lps;
float relativeQave = (testParams.RelativeQfrom + testParams.RelativeQto) / 2.0f;
bool goBackToInitFlow = ((rvPulse > 0) && (relativeQave < 0)) ||
((rvPulse < 0) && (relativeQave > 0));
//--------------------------------
State.Create("CombinedWithDetection : Switching flow detected, going back")
.AddOperation(checkUiOp)
.AddOperations(measureOperations)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, refFlow, 600)) /// timeout = 10 min.
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) goto stop;
if (e.Contains(Event.RegulValveTimeOut)) goto error;
}
while (!e.Contains(Event.FlowReached));
if (goBackToInitFlow)
{
//--------------------------------
State.Create("CombinedWithDetection : Switching flow detected, going back")
.AddOperation(checkUiOp)
.AddOperations(measureOperations)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, refFlow, 600)) /// timeout = 10 min.
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
int flowSetTime = StateMachine.Time - flowSetTime0;
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
if (e.Contains(Event.UiCmdStop)) goto stop;
if (e.Contains(Event.RegulValveTimeOut)) goto error;
}
while (!e.Contains(Event.FlowReached));
}
//--------------------------------
State.Create("CombinedWithDetection : Going to the test flow")
@@ -339,6 +368,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
do
{
e = StateMachine.WaitRunDevsRunOps();
int flowSetTime = StateMachine.Time - flowSetTime0;
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
if (e.Contains(Event.UiCmdStop)) goto stop;
//if (e.Contains(Event.FlowTimeOut)) goto do_detection;
}
@@ -432,10 +466,10 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
log.Info(logstr);
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, 10.0f, test.TstTime);
TestProgressEventArgs data = GetTestProgressData(test, tstRslt, cBrd.EtPulses(0), cBrd.TTime, progress);
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
TestProgressEventArgs data = GetTestProgressData(test, tstRslt, cBrd, cBrd.TTime, progress);
data.WmVolume[2] = data.WmVolume[0] + data.WmVolume[1];
data.WmErrPct[2] = Formulas.ErrorFromVolumes(data.WmVolume[2], data.Volume);
if (data.Volume.Valid) { data.WmErrPct[2] = Formulas.ErrorFromVolumes(data.WmVolume[2], data.Volume.Val); }
Bridge.OnTestProgress(this, data);
}
/// Measurement loop - end
@@ -490,6 +524,15 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
}
while (!e.Contains(Event.PreviousStopped));
///
/// Optionally supress pulses from the large water meter
///
if (testParams.SupressTrills > 0)
{
WMPulses[0] = 0;
tstRslt.Meters[0].PulsesMeter = 0;
}
///
/// Populate TestRasult data entity with data
///
@@ -115,6 +115,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
set_flow:
int flowSetTime0 = StateMachine.Time;
float estFlowSetTime = 10.0f;
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
@@ -126,6 +129,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
do
{
e = StateMachine.WaitRunDevsRunOps();
int flowSetTime = StateMachine.Time - flowSetTime0;
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
if (e.Contains(Event.UiCmdStop)) goto stop;
}
while (!e.Contains(Event.ValvesSet));
@@ -138,6 +146,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
do
{
e = StateMachine.WaitRunDevsRunOps();
int flowSetTime = StateMachine.Time - flowSetTime0;
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
if (e.Contains(Event.UiCmdStop)) goto stop;
if (e.Contains(Event.RegulValveTimeOut)) goto error;
if (e.Contains(Event.Next)) goto flow_set;
@@ -145,7 +158,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
while (!e.Contains(Event.FlowReached));
flow_set:
int time = StateMachine.CurrentTime;
int time = StateMachine.Time;
float currentFlow = refFlow.Val;
/// Extract cameras from the current sensors path, add operations to the detection state
@@ -245,8 +258,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
log.Info(logstr);
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, 10.0f, test.TstTime);
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd.EtPulses(0), cBrd.TTime, progress));
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, cBrd.TTime, progress));
}
/// Measurement loop - end