Bugfix: Preserve final RefPulses value in StandingStartMassCollection
Description:
During StandingStartMassCollection test evaluation, `tstRslt.PulsesMaster` was assigned directly from `cBrd.RefPulses`. By the time the evaluation was executed, the control board had already reset `RefPulses` to zero, resulting in an incorrect master pulse count being stored.
Solution:
Added `finalPulsesCount` to preserve the last valid `cBrd.RefPulses` value immediately after the measurement completed and before the control board reset the pulse counter.
The test evaluation now uses:
tstRslt.PulsesMaster = Convert.ToDouble(finalPulsesCount);
instead of the live `cBrd.RefPulses` value, ensuring the recorded master pulse count reflects the actual measured value.
This commit is contained in:
parent
a210a0d1f2
commit
a2cee155e4
@ -247,6 +247,7 @@
|
||||
<EmbeddedResource Include="Resources\Strings.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\Strings.ru.resx" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("3.9.3134.107")]
|
||||
[assembly: AssemblyFileVersion("3.9.3134.107")]
|
||||
[assembly: AssemblyVersion("3.9.3134.108")]
|
||||
[assembly: AssemblyFileVersion("3.9.3134.108")]
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
///
|
||||
using log4net;
|
||||
using SharedComponents;
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using System.Text;
|
||||
|
||||
namespace TBF.Rig.ControlBoard.Uni
|
||||
{
|
||||
@ -206,6 +208,8 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
|
||||
log.InfoFormat("Et={0} State={1:X14} Route={2} Freq={3} EtPulses={4} TTime={5} WMPulses[3]={6} WMRefPulses[3]={7}, Time[3]={8}",
|
||||
State & 7, State, Utils.ToBin40(Vystupy >> 8), ReferenceFreq[0], EtPulses[0], Ttime, WMeterPuls[3], EtPulses[3], ImpulseTime[3]);
|
||||
LiveLogCache.Instance.AddLog(String.Format("Et={0} State={1:X14} Route={2} Freq={3} EtPulses={4} TTime={5} WMPulses[3]={6} WMRefPulses[3]={7}, Time[3]={8}",
|
||||
State & 7, State, Utils.ToBin40(Vystupy >> 8), ReferenceFreq[0], EtPulses[0], Ttime, WMeterPuls[3], EtPulses[3], ImpulseTime[3]));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
///
|
||||
using Common;
|
||||
using log4net;
|
||||
using SharedComponents;
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Common;
|
||||
using log4net;
|
||||
using TBF.Rig.GenericDevices;
|
||||
|
||||
namespace TBF.Rig.ControlBoard.Uni
|
||||
@ -24,6 +25,7 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
readonly TBF.Rig.Uni.FlowMetersInParallel.FlowMeter flowMeterInParallel;
|
||||
readonly TBF.Rig.Uni.Diverter.Diverter diverter;
|
||||
readonly int pulsesCount; /// Number of reference pulses for a complete test
|
||||
readonly int massPulsesCount; /// Number of reference pulses for mass collection
|
||||
readonly bool withDiverter; /// Test with diverter (and scale)
|
||||
|
||||
private DateTime startTimeForSimulation;
|
||||
@ -69,16 +71,16 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
{
|
||||
string deviceInfo = GetAllDevicesInfo(devices);
|
||||
string flowMeterStatus = devices.FlowMeter == null
|
||||
? "devices.FlowMeter je NULL"
|
||||
: $"devices.FlowMeter je typu: {devices.FlowMeter.GetType().FullName}";
|
||||
? "devices.FlowMeter is NULL"
|
||||
: $"devices.FlowMeter is type of: {devices.FlowMeter.GetType().FullName}";
|
||||
|
||||
MessageBox.Show(
|
||||
$"Chyba počas zastavenia regulácie prietoku, v ramci StandingStartStopTestOp() pre flowMeter:\n" +
|
||||
$"Error during flow control stop, within StandingStartStopTestOp() for flowMeter:\n" +
|
||||
$"{ex.Message}\n\n" +
|
||||
$"Diagnostika:\n{flowMeterStatus}\n\n" +
|
||||
$"Diagnostic:\n{flowMeterStatus}\n\n" +
|
||||
$"{deviceInfo}\n\n" +
|
||||
$"Stack trace:\n{ex.StackTrace}",
|
||||
"Chyba",
|
||||
"Error",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error
|
||||
);
|
||||
@ -101,9 +103,9 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
string deviceInfo = GetAllDevicesInfo(devices);
|
||||
|
||||
MessageBox.Show(
|
||||
$"Chyba počas zastavenia regulácie prietoku, v ramci StandingStartStopTestOp() pre diverter:\n" +
|
||||
$"Error while stopping the flow control, within StandingStartStopTestOp() for the diverter:\n" +
|
||||
$"{ex.Message}\n\n{deviceInfo}\n\nStack trace:\n{ex.StackTrace}",
|
||||
"Chyba",
|
||||
"Error",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error
|
||||
);
|
||||
@ -117,10 +119,10 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
|
||||
string GetAllDevicesInfo(object obj)
|
||||
{
|
||||
if (obj == null) return "devices objekt je null.";
|
||||
if (obj == null) return "devices object is null.";
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("Zoznam zariadení v devices:");
|
||||
sb.AppendLine("List of devices:");
|
||||
|
||||
var props = obj.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (var prop in props)
|
||||
@ -133,7 +135,7 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
sb.AppendLine($"{prop.Name}: [Chyba pri načítaní - {ex.Message}]");
|
||||
sb.AppendLine($"{prop.Name}: [Loading error - {ex.Message}]");
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,9 +222,11 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
|
||||
if (uniCB.RefPulses < pulsesCount)
|
||||
{
|
||||
LiveLogCache.Instance.AddLog(String.Format("SSSOp: uniCB.RefPulses = {0}/{1}", uniCB.RefPulses, pulsesCount));
|
||||
return Event.TestInProgress; /// Test was not completed yet
|
||||
}
|
||||
opState = OpState.TestCompleted;
|
||||
LiveLogCache.Instance.AddLog(String.Format("SSSOp: TestComplet"));
|
||||
return Event.TestCompleted;
|
||||
|
||||
case OpState.TestCompleted:
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using log4net;
|
||||
using Results.Entities;
|
||||
using SharedComponents;
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
@ -10,7 +12,6 @@ using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Serialization;
|
||||
using Results.Entities;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
using TBF.Rig;
|
||||
@ -761,7 +762,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
tstRslt.FlowSetTime = flowSetTime;
|
||||
tstRslt.TestTime = cBrd.TestTime; /// [s] measurement time
|
||||
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.RefPulses); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.MassStartRaw = StartMass.Val;
|
||||
tstRslt.MassStartRaw = StartMass.Val;
|
||||
tstRslt.MassEndRaw = EndMass.Val;
|
||||
tstRslt.TimeBtwnMassMsrmnts = tMass2 - tMass1;
|
||||
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse;
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
using Config.Entities;
|
||||
using log4net;
|
||||
using NHibernate.Action;
|
||||
using SharedComponents;
|
||||
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
@ -78,21 +80,21 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fixed start mass collection method sequence
|
||||
/// </summary>
|
||||
/// <param name="test">Test entity</param>
|
||||
/// <returns>
|
||||
/// Event.Done . . . . . . . OK
|
||||
/// Event.MakeSecondPass . . OK, 2nd pass (=evaluation) required
|
||||
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
|
||||
/// Event.OpArgumentError . Target flow is out of range
|
||||
/// Event.Error . . . . . . Unspecified error
|
||||
/// </returns>
|
||||
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
|
||||
/// <summary>
|
||||
/// Fixed start mass collection method sequence
|
||||
/// </summary>
|
||||
/// <param name="test">Test entity</param>
|
||||
/// <returns>
|
||||
/// Event.Done . . . . . . . OK
|
||||
/// Event.MakeSecondPass . . OK, 2nd pass (=evaluation) required
|
||||
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
|
||||
/// Event.OpArgumentError . Target flow is out of range
|
||||
/// Event.Error . . . . . . Unspecified error
|
||||
/// </returns>
|
||||
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
|
||||
bool compound,
|
||||
HeatMeters.TestParams heatMetersTestParams,
|
||||
Common.DebugMode debugLevel)
|
||||
HeatMeters.TestParams heatMetersTestParams,
|
||||
Common.DebugMode debugLevel)
|
||||
{
|
||||
ControlBoard.IControlBoard cBrd = StateMachine.ControlBoardMain;
|
||||
IScale scale = cBrd.Devices.Scale as IScale;
|
||||
@ -105,7 +107,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
}
|
||||
|
||||
IList<Event> e; /// Events from currently running operations
|
||||
int waterMetersCount = Math.Min(BenchInfo.WaterMetersCount, sensPath.RegisterReaders.Length);
|
||||
int waterMetersCount = Math.Min(BenchInfo.WaterMetersCount, sensPath.RegisterReaders.Length);
|
||||
DateTimeBox timeStampStart = new DateTimeBox();
|
||||
DateTimeBox timeStampEnd = new DateTimeBox();
|
||||
FloatBox startSwitchTime = new FloatBox();
|
||||
@ -186,53 +188,53 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
IOperation heatMetersPromptOp = null;
|
||||
if (heatMetersTestParams != null && !string.IsNullOrEmpty(heatMetersTestParams.Prompt))
|
||||
{
|
||||
/// Make sure the CycleBeginForm is closed
|
||||
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
|
||||
/// Make sure the CycleBeginForm is closed
|
||||
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
|
||||
|
||||
heatMetersPromptOp = new Operations.MessageBoxOp(heatMetersTestParams.Prompt);
|
||||
heatMetersPromptOp = new Operations.MessageBoxOp(heatMetersTestParams.Prompt);
|
||||
}
|
||||
|
||||
|
||||
if (test.DoDraining || (scale.Mass + test.Volume >= scale.Capacity * Constants.TankFullFactor))
|
||||
{
|
||||
{
|
||||
///
|
||||
/// There is not enough room in the tank OR unconditional draining ... drain the water tank
|
||||
///
|
||||
IList<IOperation> ops = new List<IOperation>(readTempPressOps);
|
||||
ops.Add(heatMetersPromptOp);
|
||||
switch (DrainTheTank(scale, ops))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Make sure the drain valve is closed
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
switch (DrainTheTank(scale, ops))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Make sure the drain valve is closed
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(cBrd.SetValvesOp(null, scale.DrainValve))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.JustStarted));
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(cBrd.SetValvesOp(null, scale.DrainValve))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.JustStarted));
|
||||
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
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.Starting_the_pump);
|
||||
//------------------------------------------------
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
|
||||
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
||||
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
@ -246,9 +248,9 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
|
||||
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy) /* || !e.Contains(Event.AllPositionsReached)*/);
|
||||
while (e.Contains(Event.ValvesBusy) /* || !e.Contains(Event.AllPositionsReached)*/);
|
||||
|
||||
|
||||
if (test.TimePump2StartV > 0)
|
||||
@ -280,7 +282,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
}
|
||||
@ -316,7 +318,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
|
||||
@ -344,13 +346,13 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.SetFlowOp(test.QfromM3ph(), test.QtoM3ph(), RefFlow, FlowSettingTimeoutSec))//...develop: step 1
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.RegulValveTimeOut))
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_adjustment_failed);
|
||||
@ -376,14 +378,14 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
//---------------------------------------------------
|
||||
|
||||
int lastTimeSec = StateMachine.Time;
|
||||
double Tw_last = 0;
|
||||
double Tc_last = 0;
|
||||
double Tw_last = 0;
|
||||
double Tc_last = 0;
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@ -392,56 +394,56 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
break; /// Simulate temperature is within range
|
||||
}
|
||||
|
||||
if (TempRefHi1.Val != 0 && TempRefHi2.Val != 0 && TempRefLo1.Val != 0 && TempRefLo2.Val != 0)
|
||||
{
|
||||
if (StateMachine.Time - lastTimeSec > 10 || StateMachine.Time - lastTimeSec < 0)
|
||||
{
|
||||
double Tw = (TempRefHi1.Val + TempRefHi2.Val) / 2;
|
||||
double Tc = (TempRefLo1.Val + TempRefLo2.Val) / 2;
|
||||
if ((heatMetersTestParams.TempWarmLo <= Tw) && (Tw <= heatMetersTestParams.TempWarmHi) &&
|
||||
(heatMetersTestParams.TempColdLo <= Tc) && (Tc <= heatMetersTestParams.TempColdHi) &&
|
||||
(Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm) &&
|
||||
(Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold) &&
|
||||
(Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm) &&
|
||||
(Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold))
|
||||
{
|
||||
if (TempRefHi1.Val != 0 && TempRefHi2.Val != 0 && TempRefLo1.Val != 0 && TempRefLo2.Val != 0)
|
||||
{
|
||||
if (StateMachine.Time - lastTimeSec > 10 || StateMachine.Time - lastTimeSec < 0)
|
||||
{
|
||||
double Tw = (TempRefHi1.Val + TempRefHi2.Val) / 2;
|
||||
double Tc = (TempRefLo1.Val + TempRefLo2.Val) / 2;
|
||||
if ((heatMetersTestParams.TempWarmLo <= Tw) && (Tw <= heatMetersTestParams.TempWarmHi) &&
|
||||
(heatMetersTestParams.TempColdLo <= Tc) && (Tc <= heatMetersTestParams.TempColdHi) &&
|
||||
(Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm) &&
|
||||
(Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold) &&
|
||||
(Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm) &&
|
||||
(Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold))
|
||||
{
|
||||
break; /// Temperature is withing required range
|
||||
}
|
||||
|
||||
lastTimeSec = StateMachine.Time;
|
||||
Tw_last = Tw;
|
||||
Tc_last = Tc;
|
||||
}
|
||||
}
|
||||
lastTimeSec = StateMachine.Time;
|
||||
Tw_last = Tw;
|
||||
Tc_last = Tc;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(test.TempControl) && benchPath.TempMtrUp != null && benchPath.TempMtrDown != null)
|
||||
{
|
||||
//---------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_temperature);
|
||||
//---------------------------------------------------
|
||||
else if (!string.IsNullOrEmpty(test.TempControl) && benchPath.TempMtrUp != null && benchPath.TempMtrDown != null)
|
||||
{
|
||||
//---------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_temperature);
|
||||
//---------------------------------------------------
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.Next))
|
||||
{
|
||||
break; /// Simulate temperature is within range
|
||||
}
|
||||
|
||||
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
|
||||
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
|
||||
{
|
||||
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
|
||||
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
|
||||
{
|
||||
break; /// Temperature set withing required range
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
|
||||
///
|
||||
/// Temperature is withing required range at this point
|
||||
@ -462,7 +464,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
|
||||
//-----------------------------------------------------------------
|
||||
//-----------------------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Stop flow regulation", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
@ -471,7 +473,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
IOperation testInProgress = cBrd.StandingStartStopTestOp(test, 2 * totalPulses, Devices.Diverter is TBF.Rig.Uni.Diverter.Diverter);
|
||||
IOperation testInProgress = cBrd.StandingStartStopTestOp(test, /*2 * */totalPulses, Devices.Diverter is TBF.Rig.Uni.Diverter.Diverter);
|
||||
IOperation controlFlowOp = cBrd.SetFlowOp(test.QfromM3ph(), test.QtoM3ph(), RefFlow, int.MaxValue, test.TimeBeforeFlow);
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Close the start/stop valve before measuring the start mass", test.Method, test.Name))
|
||||
@ -481,7 +483,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; 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));
|
||||
@ -490,7 +492,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
///-----------------
|
||||
delay = test.TimeFlow2Mass;
|
||||
|
||||
if (delay > 0)
|
||||
if (delay > 0)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Delay for meters stabilization <T flow stab. - start = {2}s> ", test.Method, test.Name, delay))
|
||||
.AddOperation(checkUiOp)
|
||||
@ -512,7 +514,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
State.Create(string.Format("{0}({1}) : Start the standing start/stop test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(testInProgress) //...develop: step 4 --> diverter switch to the mass
|
||||
.AddOperation(cBrd.StandingStartStopTestOp(test, 2 * totalPulses, Devices.Diverter is TBF.Rig.Uni.Diverter.Diverter)) //...develop: step 4 --> diverter switch to the mass
|
||||
.EnterState();
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
@ -534,10 +536,10 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "Start mass");
|
||||
else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass");
|
||||
|
||||
///
|
||||
/// Enter water meter begin states and read the start mass at the same time
|
||||
///
|
||||
GenericDevices.IHasWMStatesForm dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
|
||||
///
|
||||
/// Enter water meter begin states and read the start mass at the same time
|
||||
///
|
||||
GenericDevices.IHasWMStatesForm dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
|
||||
IOperation readStartMassOp = scale.ReadStableMassOp(ref StartMass, test.TimeFlow2Mass, test.MassMethod, test.MassRepeats, test.MassSpread);
|
||||
IOperation readStopMassOp = scale.ReadStableMassOp(ref StartMass, test.TimeStop2Mass, test.MassMethod, test.MassRepeats, test.MassSpread);
|
||||
IOperation readEndMassOp = scale.ReadStableMassOp(ref EndMass, test.TimeStop2Mass, test.MassMethod, test.MassRepeats, test.MassSpread);
|
||||
@ -568,7 +570,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
triggerValve = roi.GetValve();
|
||||
if (triggerValve != null && !triggerSend)
|
||||
{
|
||||
OpenValveGrabImage(cBrd,testInProgress, triggerValve, e,
|
||||
OpenValveGrabImage(cBrd, testInProgress, triggerValve, e,
|
||||
string.Format("{0}({1}) : Grabbing images - valve open", test.Method, test.Name));
|
||||
triggerSend = true;
|
||||
}
|
||||
@ -591,18 +593,18 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.Test));
|
||||
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; break; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; break; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; break; }
|
||||
}
|
||||
while (e.Contains(Event.CameraBusy));
|
||||
|
||||
(dataEntryCmpnt as GenericDevices.IDataEntryForCamera).StartImages = startImages;
|
||||
}
|
||||
|
||||
|
||||
///valve trigger camera close
|
||||
if (triggerValve != null)
|
||||
{
|
||||
CloseValveGrabImage(cBrd,testInProgress,triggerValve, e,
|
||||
CloseValveGrabImage(cBrd, testInProgress, triggerValve, e,
|
||||
string.Format("{0}({1}) : Grabbing images - valve close", test.Method, test.Name));
|
||||
}
|
||||
///////
|
||||
@ -628,7 +630,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
}
|
||||
while (!e.Contains(Event.ModelessFormClosed) || !e.Contains(Event.ScaleDone));
|
||||
long readEndTime = StateMachine.Time;
|
||||
|
||||
|
||||
log.Debug("Read poseidon - took:" + (readEndTime - readStartTime));
|
||||
|
||||
if (heatMetersTestParams != null)
|
||||
@ -670,7 +672,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
{
|
||||
(rr as Rig.Network.Camera.RoiForFixedStartKeyence.Roi).BeginWMState =
|
||||
dataEntryCmpnt.WMStartState(i);
|
||||
log.DebugFormat(" StandingStartMassCollectionSeq.cs - BeginWMState [{0}] -> RoiForFixedStartKeyence.Roi",dataEntryCmpnt.WMStartState(i));
|
||||
log.DebugFormat(" StandingStartMassCollectionSeq.cs - BeginWMState [{0}] -> RoiForFixedStartKeyence.Roi", dataEntryCmpnt.WMStartState(i));
|
||||
}
|
||||
if (rr is Rig.Network.Camera.RoiForFixedStartCJMS11.Roi)
|
||||
(rr as Rig.Network.Camera.RoiForFixedStartCJMS11.Roi).BeginWMState = dataEntryCmpnt.WMStartState(i);
|
||||
@ -696,7 +698,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
string destFName = string.IsNullOrEmpty((dataEntryCmpnt as IDataEntryForCamera).TestStartImgName(i, testName))
|
||||
? fileName : (dataEntryCmpnt as IDataEntryForCamera).TestStartImgName(i, testName);
|
||||
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, destFName), true);
|
||||
log.DebugFormat("Save images sourceFile: {0}, destFile: {1} ",Path.Combine(srcDir, fileName), Path.Combine(destDir, destFName));
|
||||
log.DebugFormat("Save images sourceFile: {0}, destFile: {1} ", Path.Combine(srcDir, fileName), Path.Combine(destDir, destFName));
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
@ -734,7 +736,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(testInProgress)//...nevhodne prepina diverter
|
||||
//.AddOperation(readStartMassOp)
|
||||
//.AddOperation(readStartMassOp)
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.TimeFlow2Mass, test.MassMethod, test.MassRepeats, test.MassSpread))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@ -775,7 +777,9 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
StartNewStatistics(outPath.FlowMeter, BatchRslts.Batch.BatchNr, test, repetitionNr, Math.Max((int)(test.TestTime / 10), 5));
|
||||
|
||||
int initialPulsesCount = RefPulses;
|
||||
int finalPulsesCount = 0;
|
||||
|
||||
LiveLogCache.Instance.AddLog(String.Format("SSMC: Start the test, open the start/stop valve"));
|
||||
State.Create(string.Format("{0}({1}) : Start the test, open the start/stop valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
@ -787,14 +791,17 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
do {
|
||||
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; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
/// Update statistics
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = outPath.FlowMeter.ReadFlow();
|
||||
UpdateAllStatistics();
|
||||
|
||||
LiveLogCache.Instance.AddLog(String.Format("SSMC: finalPulsesCount = {0}", finalPulsesCount));
|
||||
|
||||
|
||||
#region Heat meters
|
||||
|
||||
if (heatMetersTestParams != null)
|
||||
@ -820,9 +827,13 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
#endregion
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.Test));
|
||||
|
||||
|
||||
LiveLogCache.Instance.AddLog(String.Format("SSMC: e.Contains(Event.TestCompleted) = {0}", e.Contains(Event.TestCompleted)));
|
||||
LiveLogCache.Instance.AddLog(String.Format("SSMC: e.Contains(Event.Next) = {0}", e.Contains(Event.Next)));
|
||||
}
|
||||
while ((cBrd.DebugLevel==DebugMode.Simulate && !e.Contains(Event.FlowReached)) ||
|
||||
(cBrd.DebugLevel!=DebugMode.Simulate && cBrd.RefPulses < initialPulsesCount + totalPulses && !e.Contains(Event.TestCompleted) && !e.Contains(Event.Next)));
|
||||
while ((cBrd.DebugLevel == DebugMode.Simulate && !e.Contains(Event.FlowReached)) ||
|
||||
(cBrd.DebugLevel != DebugMode.Simulate && (/*&& cBrd.RefPulses < initialPulsesCount + totalPulses*/ !e.Contains(Event.TestCompleted)) && !e.Contains(Event.Next)));
|
||||
|
||||
/// Measurement loop end
|
||||
log.WarnFormat("Start valve switch time on test start = {0} ms", cBrd.ValveOpenCloseTime);
|
||||
@ -830,6 +841,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
EndTime = (double)StateMachine.Time;
|
||||
TestEndTime = DateTime.Now;
|
||||
|
||||
LiveLogCache.Instance.AddLog(String.Format("SSMC: Closing the start/stop valve at the end of the standing start/stop test"));
|
||||
State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the standing start/stop test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
@ -840,6 +852,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
finalPulsesCount = cBrd.RefPulses;
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
|
||||
@ -1126,12 +1139,14 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
|
||||
/// Raw data
|
||||
UpdateTempPressDensAmb(tstRslt);
|
||||
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
|
||||
tstRslt.StartTime = TestStartTime;
|
||||
tstRslt.EndTime = TestEndTime;
|
||||
tstRslt.FlowSetTime = flowSetTime;
|
||||
tstRslt.TestTime = Math.Max(1.0, DateTimeBox.DurationSec(timeStampStart, timeStampEnd)); /// Min. 1s to prevent division by zero
|
||||
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.RefPulses); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
|
||||
tstRslt.StartTime = TestStartTime;
|
||||
tstRslt.EndTime = TestEndTime;
|
||||
tstRslt.FlowSetTime = flowSetTime;
|
||||
tstRslt.TestTime = Math.Max(1.0, DateTimeBox.DurationSec(timeStampStart, timeStampEnd)); /// Min. 1s to prevent division by zero
|
||||
tstRslt.PulsesMaster = Convert.ToDouble(finalPulsesCount);// Convert.ToDouble(cBrd.RefPulses);
|
||||
LiveLogCache.Instance.AddLog(String.Format("SSMC: tstRslt.PulsesMaster = {0}", tstRslt.PulsesMaster));
|
||||
/// Pulses of the master flow meter (test total)
|
||||
tstRslt.MassStartRaw = StartMass.Val;
|
||||
tstRslt.MassEndRaw = EndMass.Val;
|
||||
tstRslt.TimeBtwnMassMsrmnts = tMass2 - tMass1;
|
||||
|
||||
@ -739,7 +739,7 @@
|
||||
<value>processTabPageCtrl</value>
|
||||
</data>
|
||||
<data name=">>processTabPageCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UI.Process.ProcessTabPageCtrl, TBF, Version=3.9.3001.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Process.ProcessTabPageCtrl, TBF, Version=3.9.3134.107, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>processTabPageCtrl.Parent" xml:space="preserve">
|
||||
<value>processTabPage</value>
|
||||
@ -817,7 +817,7 @@
|
||||
<value>resultsTabPageCtrl</value>
|
||||
</data>
|
||||
<data name=">>resultsTabPageCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UI.ResultsMI.ResultsTabPageCtrl, TBF, Version=3.9.3001.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.ResultsMI.ResultsTabPageCtrl, TBF, Version=3.9.3134.107, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>resultsTabPageCtrl.Parent" xml:space="preserve">
|
||||
<value>resultsTabPage</value>
|
||||
@ -871,7 +871,7 @@
|
||||
<value>graphsTabPageCtrl</value>
|
||||
</data>
|
||||
<data name=">>graphsTabPageCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UI.Graphs.GraphsTabPageCtrl, TBF, Version=3.9.3001.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Graphs.GraphsTabPageCtrl, TBF, Version=3.9.3134.107, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>graphsTabPageCtrl.Parent" xml:space="preserve">
|
||||
<value>graphsTabPage</value>
|
||||
@ -925,7 +925,7 @@
|
||||
<value>eventLogsTabPageCtrl</value>
|
||||
</data>
|
||||
<data name=">>eventLogsTabPageCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UI.EventLogs.EventLogsTabPageCtrl, TBF, Version=3.9.3001.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.EventLogs.EventLogsTabPageCtrl, TBF, Version=3.9.3134.107, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>eventLogsTabPageCtrl.Parent" xml:space="preserve">
|
||||
<value>eventLogsTabPage</value>
|
||||
@ -979,7 +979,7 @@
|
||||
<value>calendarTabPageCtrl</value>
|
||||
</data>
|
||||
<data name=">>calendarTabPageCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UI.Calendar.CalendarTabPageCtrl, TBF, Version=3.9.3001.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Calendar.CalendarTabPageCtrl, TBF, Version=3.9.3134.107, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>calendarTabPageCtrl.Parent" xml:space="preserve">
|
||||
<value>calendarTabPage</value>
|
||||
@ -1033,7 +1033,7 @@
|
||||
<value>picturesTabPageCtrl</value>
|
||||
</data>
|
||||
<data name=">>picturesTabPageCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UI.Camera.PicturesTabPageCtrl, TBF, Version=3.9.3001.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Camera.PicturesTabPageCtrl, TBF, Version=3.9.3134.107, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>picturesTabPageCtrl.Parent" xml:space="preserve">
|
||||
<value>picturesTabPage</value>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user