Earlier mass measurement and tank draining in FlyingStartMassCollProlonged, ver. 2.25.1437

This commit is contained in:
Milan Hanajik 2020-02-14 09:51:55 +01:00
parent c4b643aac7
commit dffaa1d3a8
8 changed files with 334 additions and 147 deletions

View File

@ -41,7 +41,7 @@ namespace TBF.BenchControl.Elde.Diverter
readonly IOperation diverterToSinkOp;
public bool State { get { return (controlBoard.Route & mask) != 0; } }
public bool State { get { return (controlBoard.RRoute & mask) != 0; } }
public int ThresholdGate { get { return diverterCfg.StartingLevel; } }
public int ThresholdLo { get { return diverterCfg.ThresholdLo; } }
public int ThresholdHi { get { return diverterCfg.ThresholdHi; } }

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using log4net;
@ -9,54 +9,51 @@ namespace TBF.BenchControl.Elde
public class QueryMeasurementEndOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(QueryMeasurementEndOp));
public override string ToString() { return string.Format("QueryMeasurementEndOp(.,{0})", eventDone); }
public override string ToString() { return string.Format("QueryMeasurementEndOp()"); }
/// Set by the constructor
readonly ControlBoardDev controlBoard;
readonly Event eventDone;
bool done = false;
bool done;
/// <summary>
/// Events: MeasurementCompleted
/// </summary>
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
public QueryMeasurementEndOp(ControlBoardDev controlBoardDev, Event eventDone)
{
if (controlBoardDev == null) throw new ArgumentNullException("controlBoardDev");
this.controlBoard = controlBoardDev;
this.eventDone = eventDone;
log.Debug(this.ToString());
}
public QueryMeasurementEndOp(ControlBoardDev controlBoardDev)
: this(controlBoardDev, Event.MeasurementCompleted)
{
}
if (controlBoardDev == null) throw new ArgumentNullException("controlBoardDev");
this.controlBoard = controlBoardDev;
done = false;
log.Debug(this.ToString());
}
/// <summary>Start this operation</summary>
/// <summary> Start this operation </summary>
public void Start()
{
}
done = false;
}
/// <summary>Run this operation</summary>
/// <summary> Run this operation </summary>
/// <returns>
/// Event.FlowInDone or Event.FlowOutDone
/// </returns>
public Event Run()
{
if (done) return eventDone;
if (done) return Event.MeasurementCompleted;
if (0 != (controlBoard.StatusP & StatusP.TestCompleted))
{
done = true;
return eventDone;
return Event.MeasurementCompleted;
}
return Event.None;
}
/// <summary>Stop this operation</summary>
/// <summary> Stop this operation </summary>
public void Stop()
{
}
{
}
}
}

View File

@ -0,0 +1,63 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using log4net;
using TBF.Boxes;
namespace TBF.BenchControl.Elde
{
public class ReadDiverterStateOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(ReadFlowOp));
public override string ToString() { return string.Format("ReadDiverterStateOp(div={0}, delay={1})", div.Name, delay); }
/// Set by the constructor
readonly GenericDevices.IDiverter div;
readonly ControlBoardDev ctrlBrd;
readonly int delay;
int startTime;
/// <summary>
/// Events: FlowInDone, FlowOutDone or Error
/// </summary>
/// <param name="flowMeter">Flow meter reference</param>
/// <param name="flowBox">Reference to the measured flow variable, value is in bar</param>
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
public ReadDiverterStateOp(ControlBoardDev ctrlBrd, GenericDevices.IDiverter div, int delay)
{
if (ctrlBrd == null || div == null) throw new ArgumentNullException();
this.ctrlBrd = ctrlBrd;
this.div = div;
this.delay = delay;
log.Debug(this.ToString());
}
public ReadDiverterStateOp(ControlBoardDev ctrlBrd, GenericDevices.IDiverter div)
: this(ctrlBrd, div, 0)
{
}
/// <summary>Start this operation</summary>
public void Start()
{
startTime = StateMachine.Time;
}
/// <summary>Run this operation</summary>
/// <returns> Event.ToTank or Event.ToSink </returns>
public Event Run()
{
if (StateMachine.Time - startTime <= delay)
{
return Event.None;
}
return div.State ? Event.ToTank : Event.ToSink;
}
/// <summary>Stop this operation</summary>
public void Stop() { }
}
}

View File

@ -156,6 +156,10 @@ namespace TBF.BenchControl
/// Timer events
TimerExpired,
/// ReadDiverterState events
ToSink, /// State = false
ToTank, /// State = true
/// Process camera events
CameraBusy,
GrabPassed,

View File

@ -206,6 +206,21 @@ namespace TBF.BenchControl.Sequences
RefFlow));
}
/// <summary>
/// Used in tests in measurement loop to display remaining test time
/// </summary>
/// <param name="remainingTime">Remaining time in seconds</param>
protected void ShowRemainingTime(int remainingTime)
{
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));
}
}
protected Event DrainTheTank(IScaleOrTank tank)
{

View File

@ -1,13 +1,10 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Text;
using log4net;
using Config;
using TBF.BenchControl;
using TBF.Boxes;
using TBF.Resources;
using TBF.UiBridge;
using TBF.BenchControl.GenericDevices;
@ -427,8 +424,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
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> cameraMeasurementOperations = new List<IOperation>();
foreach (var camera in cameras) cameraMeasurementOperations.Add(camera.MeasurementOp());
if (drainTheTank)
@ -491,7 +488,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(measureOperations)
.AddOperations(cameraMeasurementOperations)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
@ -524,7 +521,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperations(cameraMeasurementOperations)
.AddOperation(processDataLoggingOp)
.AddOperation(cBrd.StartProlongedMeasurementOp(outPath,
Elde.TestMethods.Diverter | Elde.TestMethods.Synchro | Elde.TestMethods.MassAndContinue,
@ -549,72 +546,200 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
}
}
/// Measurement loop - preparation
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
int estimtdEndTime = StateMachine.Time + (int)test.TstTime;
///
/// Measurement loop - preparation
///
int estimtdEndTime = StateMachine.Time + (int)test.TstTime;
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
bool isMeasurementCompleted = false;
/// Measurement loop - begin
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(readRegistersOp)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(cBrd.QueryMeasurementEndOp())
.AddOperation(processDataLoggingOp)
IList<IOperation> measurementCompletedOperations = new List<IOperation>();
measurementCompletedOperations.Add(checkUiOp);
foreach (var op in readTempPressOps) measurementCompletedOperations.Add(op);
measurementCompletedOperations.Add(processDataLoggingOp);
IList<IOperation> measurementLoopOperations = new List<IOperation>();
foreach (var op in measurementCompletedOperations) measurementLoopOperations.Add(op);
foreach (var op in cameraMeasurementOperations) measurementLoopOperations.Add(op);
measurementLoopOperations.Add(new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders));
measurementLoopOperations.Add(cBrd.QueryMeasurementEndOp()); /// Event.MeasurementCompleted
IOperation readMassOp = scale.ReadMassOp(ref Mass);
/// Measurement loop - 1st part
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperations(measurementLoopOperations)
.AddOperation(readMassOp)
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv,
true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(new TBF.BenchControl.Elde.ReadDiverterStateOp(cBrd, outPath.Diverter))
.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;
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)) { retVal = Event.Error; goto stopTest; }
DoInsideMeasurementLoop(heatMetersTestParams, test, repetitionNr, estimtdEndTime);
}
while (!e.Contains(Event.ToSink) && !e.Contains(Event.Next)); /// Proceed to 2nd part of the measurement loop when diverter turns back to sink
/// 'Next' button can be used in Debug version
///
/// Waiting before the 2nd mass measurement
///
bool waitingBeforeEndMassMeasurementCompleted = false;
IOperation readDiverterTransitionOp = cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv,
false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr);
IOperation stop2MassTimerOp = new Operations.TimerOp(test.TimeStop2Mass);
do {
State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name))
.AddOperations(isMeasurementCompleted ? measurementCompletedOperations : measurementLoopOperations)
.AddOperation(readMassOp)
.AddOperation(readDiverterTransitionOp)
.AddOperation(stop2MassTimerOp)
.EnterState();
//------------------------------------------------
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));
}
//------------------------------------------------
RefFreq.Val = cBrd.ReferenceFreq;
RefFlow.Val = cBrd.ReferenceFlow;
UpdateAllStatistics(StateMachine.Time);
if (heatMetersTestParams != null)
if (!isMeasurementCompleted)
{
if (lastEnergyUpdateTime == 0)
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)) isMeasurementCompleted = true;
waitingBeforeEndMassMeasurementCompleted = (e.Contains(Event.TimerExpired) && e.Contains(Event.BalanceDone));
DoInsideMeasurementLoop(heatMetersTestParams, test, repetitionNr, estimtdEndTime);
}
while (!isMeasurementCompleted && !waitingBeforeEndMassMeasurementCompleted);
}
else
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
waitingBeforeEndMassMeasurementCompleted = (e.Contains(Event.TimerExpired) && e.Contains(Event.BalanceDone));
}
while (!waitingBeforeEndMassMeasurementCompleted);
}
}
while (!waitingBeforeEndMassMeasurementCompleted);
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "End mass");
else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass");
///
/// Measuring the end mass
///
Bridge.OnActivity(this, Strings.Measuring_the_weight);
IOperation readStableMassOp = scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod);
IOperation massMsrmntTimerOp = new Operations.TimerOp(StableMassMsrmntTimeoutSec);
bool measuringEndMassCompleted = false;
do
{
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperations(isMeasurementCompleted ? measurementCompletedOperations : measurementLoopOperations)
.AddOperation(readStableMassOp)
.AddOperation(massMsrmntTimerOp)
.EnterState();
if (!isMeasurementCompleted)
{
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.TimerExpired))
{
Bridge.OnError(this, Strings.Mass_measurement_timeout);
retVal = Event.RecoverableError;
goto stopTest;
}
if (e.Contains(Event.MeasurementCompleted)) isMeasurementCompleted = true;
measuringEndMassCompleted = e.Contains(Event.BalanceDone);
DoInsideMeasurementLoop(heatMetersTestParams, test, repetitionNr, estimtdEndTime, false);
}
while (!isMeasurementCompleted && !measuringEndMassCompleted);
}
else
{
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.TimerExpired))
{
Bridge.OnError(this, Strings.Mass_measurement_timeout);
retVal = Event.RecoverableError;
goto stopTest;
}
measuringEndMassCompleted = e.Contains(Event.BalanceDone);
}
while (!measuringEndMassCompleted);
}
}
while (!measuringEndMassCompleted);
///
tMass2 = StateMachine.Time;
log.WarnFormat("End mass = {0}kg", EndMass);
TestEndTime = DateTime.Now;
if (test.DoDrainingAfter)
{
///
/// Draining after the 2nd mass measurement enabled, empty the tank
///
IOperation setValvesOp = StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null);
bool openingDrainValveCompleted = false;
do {
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperations(isMeasurementCompleted ? measurementCompletedOperations : measurementLoopOperations)
.AddOperation(setValvesOp)
.AddOperation(readMassOp)
.EnterState();
if (!isMeasurementCompleted)
{
lastEnergyUpdateTime = StateMachine.Time;
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)) isMeasurementCompleted = true;
openingDrainValveCompleted = !e.Contains(Event.ValvesBusy);
DoInsideMeasurementLoop(heatMetersTestParams, test, repetitionNr, estimtdEndTime);
}
while (!isMeasurementCompleted && !openingDrainValveCompleted);
}
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 deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l]
double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)]
Energy.Update(deltaEnergy);
VolumeForEnergy.Update(deltaVolume);
lastEnergyUpdateTime = StateMachine.Time;
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
openingDrainValveCompleted = !e.Contains(Event.ValvesBusy);
}
while (!openingDrainValveCompleted);
}
}
while (!openingDrainValveCompleted);
}
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.Next)); /// 'Next' button can be used in Debug version
/// Measurement loop - end
if (!isMeasurementCompleted)
{
///
/// Measurement loop - 2nd part, diverter is in state 'To sink'
///
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperations(measurementLoopOperations)
.AddOperation(readMassOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
DoInsideMeasurementLoop(heatMetersTestParams, test, repetitionNr, estimtdEndTime);
}
while (!e.Contains(Event.MeasurementCompleted) && !e.Contains(Event.Next)); /// Quit the measurement loop when there is Event.MeasurementCompleted
/// 'Next' button can be used in Debug version
}
test_completed:
@ -655,67 +780,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
while (!e.Contains(Event.ValvesSet));
}
//------------------------------------------------
Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.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.TimerExpired) || !e.Contains(Event.BalanceDone));
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "End mass");
else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass");
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.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.TimerExpired))
{
Bridge.OnError(this, Strings.Mass_measurement_timeout);
retVal = Event.RecoverableError;
goto stopTest;
}
}
while (!e.Contains(Event.BalanceDone));
///
tMass2 = StateMachine.Time;
log.WarnFormat("End mass = {0}kg", EndMass);
TestEndTime = DateTime.Now;
if (test.DoDrainingAfter)
{
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.AddOperations(readTempPressOps)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
}
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_completed);
//------------------------------------------------
@ -1062,6 +1126,49 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
}
/// <summary>
/// Collection of actions executed inside measurement loop
/// </summary>
void DoInsideMeasurementLoop(HeatMeters.TestParams heatMetersTestParams, Config.Entities.Test test, int repetitionNr, int estimtdEndTime, bool showRemainingTimeMsg = true)
{
RefFreq.Val = StateMachine.ControlBoard.ReferenceFreq;
RefFlow.Val = StateMachine.ControlBoard.ReferenceFlow;
UpdateAllStatistics(StateMachine.Time);
UpdateEnergy(heatMetersTestParams);
if (showRemainingTimeMsg) ShowRemainingTime(Math.Max(estimtdEndTime - StateMachine.Time, 0));
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
}
/// <summary>
/// This function is invoked in the measurement loop
/// </summary>
/// <param name="heatMetersTestParams">Heat meter test parameters or null</param>
void UpdateEnergy(HeatMeters.TestParams heatMetersTestParams)
{
if (heatMetersTestParams == null) return;
if (lastEnergyUpdateTime == 0)
{
lastEnergyUpdateTime = StateMachine.Time;
}
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 deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l]
double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)]
Energy.Update(deltaEnergy);
VolumeForEnergy.Update(deltaVolume);
lastEnergyUpdateTime = StateMachine.Time;
}
}
IList<Event> Simulate(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
Single.TestParams singleTestParams,
Compound.TestParams compoundTestParams,

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.25.1434.0")]
[assembly: AssemblyFileVersion("2.25.1434.0")]
[assembly: AssemblyVersion("2.25.1437.0")]
[assembly: AssemblyFileVersion("2.25.1437.0")]

View File

@ -559,6 +559,7 @@
<Compile Include="BenchControl\Elde\PressureMeterInternal\PressureMeterFactory.cs" />
<Compile Include="BenchControl\Elde\PressureMeterInternal\ReadPressureOp.cs" />
<Compile Include="BenchControl\Elde\ExecuteCommandOp.cs" />
<Compile Include="BenchControl\Elde\ReadDiverterStateOp.cs" />
<Compile Include="BenchControl\Elde\ReadDiverterTransitionOp.cs" />
<Compile Include="BenchControl\Elde\ReadFlowOp.cs" />
<Compile Include="BenchControl\Elde\RegulValveCoax\ChangeValvePositionOp.cs" />