Flows are internally stored and processed in double variables (except of Qfrom, Qto, flowmeter nominal flow)

This commit is contained in:
Milan Hanajik
2016-10-07 16:22:36 +02:00
parent 010afcd1e4
commit 438028506e
25 changed files with 84 additions and 84 deletions
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.Elde
/// prsNr0 = 0 .. nrPressureMeters-1 (zero based)
///
public StatusP StatusP { get { return controlCom.StatusP; } }
public float ReferenceFreq { get { return controlCom.ReferenceFreq; } } /// In [Hz] 0..2500, nom.=2000
public double ReferenceFreq { get { return controlCom.ReferenceFreq; } } /// In [Hz] 0..2500, nom.=2000
public int EtPulses(int wmNr0) { return (int)controlCom.EtPulses(wmNr0); }
public UInt16 WMeterPulses(int wmNr0) { return controlCom.WMeterPulses(wmNr0); }
public int WMeterReference(int wmNr0) { return controlCom.WMeterReference(wmNr0); }
@@ -53,7 +53,7 @@ namespace TBF.BenchControl.Elde
public float TTime { get { return controlCom.TTime; } }
public uint FmState { get { return controlCom.FmState; } }
public uint BeginState(int wmNr0) { return controlCom.BeginState(wmNr0); }
public float ReferenceFlow { get { return controlCom.ReferenceFlow; } }
public double ReferenceFlow { get { return controlCom.ReferenceFlow; } }
public float RValvePosition(int rvNr1) { return controlCom.RValvePosition(rvNr1); }
public float DivSamples(int ms) { return controlCom.DivSamples(ms); }
public int ScopeSamples(int i, int j, int k) { return controlCom.ScopeSamples(i, j, k); }
@@ -57,7 +57,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
/// </summary>
/// <param name="flow">Reference to a variable for the flow in Bar</param>
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
public IOperation ReadFlowOp(ref FloatBox flow)
public IOperation ReadFlowOp(ref DoubleBox flow)
{
return new ReadFlowOp(this, ref flow);
}
@@ -68,7 +68,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
/// <param name="flow">Reference to a variable for the flow in Bar</param>
/// <param name="flowDone">Event returned when measurement done</param>
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
public IOperation ReadFlowOp(ref FloatBox flow, Event flowDone)
public IOperation ReadFlowOp(ref DoubleBox flow, Event flowDone)
{
return new ReadFlowOp(this, ref flow, flowDone);
}
@@ -16,7 +16,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
readonly ControlBoardDev controlBoard;
readonly int flowMeterNr;
readonly Event eventDone;
FloatBox flow;
DoubleBox flow;
/// <summary>
/// Events: FlowInDone, FlowOutDone or Error
@@ -24,7 +24,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
/// <param name="flowMeter">Flow meter reference</param>
/// <param name="flow">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 ReadFlowOp(FlowMeter flowMeter, ref FloatBox flow, Event eventDone)
public ReadFlowOp(FlowMeter flowMeter, ref DoubleBox flow, Event eventDone)
{
if (flowMeter == null) throw new ArgumentNullException("flowMeter");
this.controlBoard = flowMeter.ControlBoard;
@@ -34,7 +34,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
log.Debug(this.ToString());
}
public ReadFlowOp(FlowMeter flowMeter, ref FloatBox flow)
public ReadFlowOp(FlowMeter flowMeter, ref DoubleBox flow)
: this(flowMeter, ref flow, Event.FlowMeasurementDone)
{
}
@@ -64,7 +64,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
/// </summary>
/// <param name="flow">Reference to a variable for the flow in Bar</param>
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
public IOperation ReadFlowOp(ref FloatBox flow)
public IOperation ReadFlowOp(ref DoubleBox flow)
{
return new ReadFlowOp(this, ref flow);
}
@@ -75,7 +75,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
/// <param name="flow">Reference to a variable for the flow in Bar</param>
/// <param name="flowDone">Event returned when measurement done</param>
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
public IOperation ReadFlowOp(ref FloatBox flow, Event flowDone)
public IOperation ReadFlowOp(ref DoubleBox flow, Event flowDone)
{
return new ReadFlowOp(this, ref flow, flowDone);
}
@@ -16,7 +16,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
readonly ControlBoardDev controlBoard;
readonly int flowMeterNr;
readonly Event eventDone;
FloatBox flow;
DoubleBox flow;
/// <summary>
/// Events: FlowInDone, FlowOutDone or Error
@@ -24,7 +24,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
/// <param name="flowMeter">Flow meter reference</param>
/// <param name="flow">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 ReadFlowOp(FlowMeter flowMeter, ref FloatBox flow, Event eventDone)
public ReadFlowOp(FlowMeter flowMeter, ref DoubleBox flow, Event eventDone)
{
if (flowMeter == null) throw new ArgumentNullException("flowMeter");
this.controlBoard = flowMeter.ControlBoard;
@@ -34,7 +34,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
log.Debug(this.ToString());
}
public ReadFlowOp(FlowMeter flowMeter, ref FloatBox flow)
public ReadFlowOp(FlowMeter flowMeter, ref DoubleBox flow)
: this(flowMeter, ref flow, Event.FlowMeasurementDone)
{
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2016 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -126,7 +126,7 @@ namespace TBF.BenchControl.Elde.RegulValve
/// <param name="measuredFlow">Measured flow [m3/h]</param>
/// <param name="timeout">Timeout in [s]</param>
/// <returns>SetFlowOp instance</returns>
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow, int timeout)
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow, int timeout)
{
return new SetFlowOp(ControlBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout);
}
@@ -141,7 +141,7 @@ namespace TBF.BenchControl.Elde.RegulValve
/// <param name="measuredFlow">Measured flow [m3/h]</param>
/// <param name="timeout">Timeout in [s]</param>
/// <returns>SetFlowOp instance</returns>
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow, int timeout, float filterConstant)
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow, int timeout, float filterConstant)
{
return new SetFlowOp(ControlBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout, true);
}
@@ -59,7 +59,7 @@ namespace TBF.BenchControl.Elde.RegulValve
float targetPositionHi;
int expireTime;
FloatBox measuredFlow;
DoubleBox measuredFlow;
int flowWithinBoundsTime;
@@ -77,7 +77,7 @@ namespace TBF.BenchControl.Elde.RegulValve
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve _regulValve, IFlowMeter flowMeter,
float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow,
float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow,
int timeout, bool leaveMeasurementRunning)
{
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
@@ -120,7 +120,7 @@ namespace TBF.BenchControl.Elde.RegulValve
/// Events: FlowSet
/// </summary>
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter,
float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow, int timeout)
float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow, int timeout)
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout, false)
{
}
@@ -130,7 +130,7 @@ namespace TBF.BenchControl.Elde.RegulValve
/// Events: FlowSet
/// </summary>
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter,
float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow)
float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow)
: this(controlBoard, regValve, flowMeter, requiredFlowLo, pidCoef, requiredFlowHi, measuredFlow, int.MaxValue, false)
{
}
@@ -206,8 +206,8 @@ namespace TBF.BenchControl.Elde.RegulValve
public Event Run()
{
float rvPosition = controlBoard.RValvePosition(regulValveNr);
float flowMtrFreq = controlBoard.ReferenceFreq;
float flow = flowMtrFreq * nominalFlow / 2000.0f;
double flowMtrFreq = controlBoard.ReferenceFreq;
double flow = flowMtrFreq * nominalFlow / 2000.0;
if (measuredFlow != null) measuredFlow.Val = flow;
@@ -72,7 +72,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
/// <param name="timeout">Timeout in [s]</param>
/// <returns>SetFlowOp instance</returns>
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi,
float pidCoef, FloatBox measuredFlow, int timeout)
float pidCoef, DoubleBox measuredFlow, int timeout)
{
return new SetFlowOp(controlBoard, regulValve, fixedRV, fixedPctLo, fixedPctHi,
flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout);
@@ -89,7 +89,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
/// <param name="timeout">Timeout in [s]</param>
/// <returns>SetFlowOp instance</returns>
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi,
float pidCoef, FloatBox measuredFlow, int timeout, float filterConstant)
float pidCoef, DoubleBox measuredFlow, int timeout, float filterConstant)
{
return new SetFlowOp(controlBoard, regulValve, fixedRV, fixedPctLo, fixedPctHi,
flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout, true);
@@ -53,7 +53,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
float targetPositionHi;
int expireTime;
FloatBox measuredFlow;
DoubleBox measuredFlow;
int flowWithinBoundsTime;
@@ -74,7 +74,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regV, IRegulValve fxdRV, float fxdPctLo, float fxdPctHi,
IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow,
IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow,
int timeout, bool leaveMeasurementRunning)
{
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
@@ -124,7 +124,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
/// Events: FlowSet
/// </summary>
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IRegulValve fixedRV, float fixedPctLo, float fixedPctHi,
IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow, int timeout)
IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow, int timeout)
: this(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout, false)
{
}
@@ -134,7 +134,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
/// Events: FlowSet
/// </summary>
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IRegulValve fixedRV, float fixedPctLo, float fixedPctHi,
IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow)
IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow)
: this(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, pidCoef, requiredFlowHi, measuredFlow, int.MaxValue, false)
{
}
@@ -211,8 +211,8 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
{
float rvPosition = controlBoard.RValvePosition(regulValveNr);
float fixedRVPosition = controlBoard.RValvePosition(fixedRVNr);
float flowMtrFreq = controlBoard.ReferenceFreq;
float flow = flowMtrFreq * nominalFlow / 2000.0f;
double flowMtrFreq = controlBoard.ReferenceFreq;
double flow = flowMtrFreq * nominalFlow / 2000.0;
if (measuredFlow != null) measuredFlow.Val = flow;
@@ -44,7 +44,7 @@ namespace TBF.BenchControl.GenericDevices
/// </summary>
/// <param name="flow">Reference to a variable for the measured flow in xxx</param>
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
IOperation ReadFlowOp(ref FloatBox flow);
IOperation ReadFlowOp(ref DoubleBox flow);
/// <summary>
/// Events: flowDone, Error
@@ -52,6 +52,6 @@ namespace TBF.BenchControl.GenericDevices
/// <param name="flow">Reference to a variable for the measured flow in xxx</param>
/// <param name="flowDone">Event returned when measurement done</param>
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
IOperation ReadFlowOp(ref FloatBox flow, Event flowDone);
IOperation ReadFlowOp(ref DoubleBox flow, Event flowDone);
}
}
@@ -36,7 +36,7 @@ namespace TBF.BenchControl.GenericDevices
/// <param name="timeout">Timeout in [s]</param>
/// <returns>SetFlowOp instance</returns>
IOperation SetFlowOp(IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi,
float pidCoef, FloatBox measuredFlow, int timeout);
float pidCoef, DoubleBox measuredFlow, int timeout);
/// <summary>
/// Operation to set the water flow within tolerances. Leave the measurement running.
@@ -50,7 +50,7 @@ namespace TBF.BenchControl.GenericDevices
/// <param name="filter">Passed to SendCommand() as argument filterContant</param>
/// <returns>SetFlowOp instance</returns>
IOperation SetFlowAndMeasureOp(IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi,
float pidCoef, FloatBox measuredFlow, int timeout, float filter);
float pidCoef, DoubleBox measuredFlow, int timeout, float filter);
/// <summary>
/// Operation to set the regulation valve to a required position
@@ -8,33 +8,33 @@ namespace TBF.BenchControl.Sequences
{
public static IBenchInfo BenchInfo;
public static FloatBox AmbientTemp = new FloatBox() { Name = "Ambient Temperature", Format = "F1" }; /// [Celsius]
public static FloatBox AmbientPressure = new FloatBox() { Name = "Ambient Pressure", Format = "F0", Factor = 1000 }; /// [bar], printed by ToString() in [mbar]
public static FloatBox AmbientHumidity = new FloatBox() { Name = "Ambient Humidity", Format = "F1" }; /// [%]
public static DoubleBox TempIn = new DoubleBox() { Name = "Temperature In", Format = "F2" }; /// [°C]
public static DoubleBox TempOut = new DoubleBox() { Name = "Temperature Out", Format = "F2" }; /// [°C]
public static DoubleBox TempDiv = new DoubleBox() { Name = "Temperature Div", Format = "F2" }; /// [°C]
public static FloatBox PressureUp = new FloatBox() { Name = "Pressure In", Format = "F2" }; /// [bar]
public static FloatBox PressureDown = new FloatBox() { Name = "Pressure Out", Format = "F2" }; /// [bar]
public static FloatBox AmbientTemp = new FloatBox() { Name = "Ambient Temperature", Format = "F1" }; /// [Celsius]
public static FloatBox AmbientPressure = new FloatBox() { Name = "Ambient Pressure", Format = "F0", Factor = 1000 }; /// [bar], printed by ToString() in [mbar]
public static FloatBox AmbientHumidity = new FloatBox() { Name = "Ambient Humidity", Format = "F1" }; /// [%]
public static DoubleBox TempIn = new DoubleBox() { Name = "Temperature In", Format = "F2" }; /// [°C]
public static DoubleBox TempOut = new DoubleBox() { Name = "Temperature Out", Format = "F2" }; /// [°C]
public static DoubleBox TempDiv = new DoubleBox() { Name = "Temperature Div", Format = "F2" }; /// [°C]
public static FloatBox PressureUp = new FloatBox() { Name = "Pressure In", Format = "F2" }; /// [bar]
public static FloatBox PressureDown = new FloatBox() { Name = "Pressure Out", Format = "F2" }; /// [bar]
public static float LtrPerRefPulse; /// to calculate the ref.volume
public static int RefPulses;
public static int RefPulsesDelta;
public static FloatBox RefFreq = new FloatBox() { Name = "RefFreq", Format = "F2" };
public static FloatBox RefFlow = new FloatBox() { Name = "RefFlow", Format = "F2" }; /// [m3/h]
public static float LtrPerRefPulse; /// to calculate the ref.volume
public static int RefPulses;
public static int RefPulsesDelta;
public static DoubleBox RefFreq = new DoubleBox() { Name = "RefFreq", Format = "F2" };
public static DoubleBox RefFlow = new DoubleBox() { Name = "RefFlow", Format = "F2" }; /// [m3/h]
public static DoubleBox Mass = new DoubleBox() { Name = "Mass", Format = "F3" }; /// [kg]
public static DoubleBox StartMass = new DoubleBox() { Name = "Start Mass", Format = "F3" }; /// [kg]
public static DoubleBox EndMass = new DoubleBox() { Name = "End Mass", Format = "F3" }; /// [kg]
public static DoubleBox Mass = new DoubleBox() { Name = "Mass", Format = "F3" }; /// [kg]
public static DoubleBox StartMass = new DoubleBox() { Name = "Start Mass", Format = "F3" }; /// [kg]
public static DoubleBox EndMass = new DoubleBox() { Name = "End Mass", Format = "F3" }; /// [kg]
public static DateTime TestStartTime;
public static DateTime TestEndTime;
public static DateTime TestStartTime;
public static DateTime TestEndTime;
/// Heat meters only
public static DoubleBox TempRefWarm1 = new DoubleBox() { Name = "T ref warm 1", Format = "F3" }; /// [°C]
public static DoubleBox TempRefWarm2 = new DoubleBox() { Name = "T ref warm 2", Format = "F3" }; /// [°C]
public static DoubleBox TempRefCold1 = new DoubleBox() { Name = "T ref cold 1", Format = "F3" }; /// [°C]
public static DoubleBox TempRefCold2 = new DoubleBox() { Name = "T ref cold 2", Format = "F3" }; /// [°C]
public static DoubleBox TempRefWarm1 = new DoubleBox() { Name = "T ref warm 1", Format = "F3" }; /// [°C]
public static DoubleBox TempRefWarm2 = new DoubleBox() { Name = "T ref warm 2", Format = "F3" }; /// [°C]
public static DoubleBox TempRefCold1 = new DoubleBox() { Name = "T ref cold 1", Format = "F3" }; /// [°C]
public static DoubleBox TempRefCold2 = new DoubleBox() { Name = "T ref cold 2", Format = "F3" }; /// [°C]
public static Results.BatchResults BatchRslts;
@@ -89,7 +89,7 @@ namespace TBF.BenchControl.Sequences
{
logger.InfoFormat("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {15}",
DateTime.Now.ToLongTimeString(),
Utils.FloatToStr(RefFlow.Val, 4),
Utils.DoubleToStr(RefFlow.Val, 4),
StateMachine.ControlBoard.TTime.ToString("F3"),
StateMachine.ControlBoard.EtPulses(0),
Formulas.VolumeFromPulses(StateMachine.ControlBoard.EtPulses(0), 1.0f / LtrPerRefPulse).ToString("F3"),
@@ -158,7 +158,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
loop:
int time = StateMachine.Time;
float currentFlow = RefFlow.Val;
double currentFlow = RefFlow.Val;
/// Extract cameras from the current sensors path, add operations to the detection state
IList<IOperation> measureOperations = new List<IOperation>();
@@ -82,7 +82,7 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
flow_set:
int time = StateMachine.Time;
float currentFlow = RefFlow.Val;
double currentFlow = RefFlow.Val;
//------------------------------------------------
Bridge.OnActivity(this, Strings.ROI_Detection_in_Progress);
@@ -179,8 +179,8 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//====================================
/// Allocate detection buffers
float[] flowsForDetection = new float[DetectionBufferSize];
float[] pulseFreqsForDetection = new float[DetectionBufferSize];
double[] flowsForDetection = new double[DetectionBufferSize];
double[] pulseFreqsForDetection = new double[DetectionBufferSize];
/// Current values
flowsForDetection[0] = RefFlow.Val;
@@ -194,7 +194,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
bool detected = false;
bool targetReached = false;
float detectedFlow = 0;
double detectedFlow = 0;
int detectionStartTime = StateMachine.Time;
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
@@ -242,10 +242,10 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
{
if ((flowsForDetection[0] > 0) && (flowsForDetection[DetectionBufferSize - 1] > 0))
{
float[] flowBefore = new float[DetectionKernelSize];
float[] flowAfter = new float[DetectionKernelSize];
float[] freqBefore = new float[DetectionKernelSize];
float[] freqAfter = new float[DetectionKernelSize];
double[] flowBefore = new double[DetectionKernelSize];
double[] flowAfter = new double[DetectionKernelSize];
double[] freqBefore = new double[DetectionKernelSize];
double[] freqAfter = new double[DetectionKernelSize];
for (int i = 0; i < DetectionKernelSize; i++)
{
flowBefore[i] = flowsForDetection[DetectionBufferSize - DetectionKernelSize + i];
@@ -265,18 +265,18 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
flowAfter[DetectionKernelSize - 1] = 0;
//freqBefore[DetectionKernelSize - 1] = 0;
//freqAfter[DetectionKernelSize - 1] = 0;
float aveFlowBefore = 0;
float aveFlowAfter = 0;
float aveFreqBefore = 0;
float aveFreqAfter = 0;
double aveFlowBefore = 0;
double aveFlowAfter = 0;
double aveFreqBefore = 0;
double aveFreqAfter = 0;
foreach (var f in flowBefore) aveFlowBefore += f;
foreach (var f in flowAfter) aveFlowAfter += f;
foreach (var f in freqBefore) aveFreqBefore += f;
foreach (var f in freqAfter) aveFreqAfter += f;
aveFlowBefore /= (float)(DetectionKernelSize - 2);
aveFlowAfter /= (float)(DetectionKernelSize - 2);
aveFreqBefore /= (float)(DetectionKernelSize);
aveFreqAfter /= (float)(DetectionKernelSize);
aveFlowBefore /= (double)(DetectionKernelSize - 2);
aveFlowAfter /= (double)(DetectionKernelSize - 2);
aveFreqBefore /= (double)(DetectionKernelSize);
aveFreqAfter /= (double)(DetectionKernelSize);
UiBridge.Bridge.OnLog(this, string.Format("time={0}, flow{1}, aveFlowB={2}, aveFlowA={3}, pulseFreq={4}, aveFreqB={5}, aveFreqA={6}\r\n",
time - startTime,
@@ -316,8 +316,8 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
UiBridge.Bridge.OnLog(this, string.Format("detected flow={0}\r\n", detectedFlow.ToString("F2")));
float qfrom_detected = detectedFlow + testParams.RelativeQfrom;
float qto_detected = detectedFlow + testParams.RelativeQto;
float qfrom_detected = (float)(detectedFlow + testParams.RelativeQfrom);
float qto_detected = (float)(detectedFlow + testParams.RelativeQto);
/// Update test results with the test flow determined from the detected switching flow
float Qave_lps = (qfrom_detected + qto_detected) / 7.2f;
@@ -205,7 +205,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
int time = StateMachine.Time;
float currentFlow = RefFlow.Val;
double currentFlow = RefFlow.Val;
/// Extract cameras from the current sensors path, add operations to the detection state
@@ -279,7 +279,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
int time = StateMachine.Time;
float currentFlow = RefFlow.Val;
double currentFlow = RefFlow.Val;
/// Extract cameras from the current sensors path, add operations to the detection state
@@ -131,7 +131,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
flow_set:
int flowSetTime = StateMachine.Time - flowSetTime0;
float currentFlow = RefFlow.Val;
double currentFlow = RefFlow.Val;
if (heatMetersTestParams != null && heatMetersPath != null)
{
@@ -233,7 +233,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
flow_set:
int flowSetTime = StateMachine.Time - flowSetTime0;
float currentFlow = RefFlow.Val;
double currentFlow = RefFlow.Val;
if (heatMetersTestParams != null && heatMetersPath != null)
{
@@ -167,7 +167,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
flow_set:
int flowSetTime = StateMachine.Time - flowSetTime0;
float currentFlow = RefFlow.Val;
double currentFlow = RefFlow.Val;
//------------------------------------------------
Bridge.OnActivity(this, Strings.Measuring_the_weight);
@@ -96,7 +96,7 @@ namespace TBF.BenchControl.WaterMeters.iPerl
{
DateTime = DateTime.Now;
Counter = counter;
RefFlow = Sequences.ProcessData.RefFlow.Val;
RefFlow = (float)Sequences.ProcessData.RefFlow.Val;
if ((telegram == null) || (telegram.Length < Length) ||
(telegram[6] != '\t') || (telegram[11] != '\t') || (telegram[16] != '\t') ||
@@ -431,7 +431,7 @@ namespace TBF.Screens
/// Available when setting the flow and during a test
///
refFreqLabel.Text = ProcessData.RefFreq.ToString();
refFlowLabel.Text = Utils.FloatToStr(ProcessData.RefFlow.Val, 4);
refFlowLabel.Text = Utils.DoubleToStr(ProcessData.RefFlow.Val, 4);
}
if (args.TestPhase == Config.Entities.Progress.Test)
@@ -460,7 +460,7 @@ namespace TBF.Screens
/// Available when setting the flow and during a test
///
refFreqLabel.Text = ProcessData.RefFreq.ToString();
refFlowLabel.Text = Utils.FloatToStr(ProcessData.RefFlow.Val, 4);
refFlowLabel.Text = Utils.DoubleToStr(ProcessData.RefFlow.Val, 4);
}
if (args.TestPhase == Config.Entities.Progress.Test)
@@ -465,7 +465,7 @@ namespace TBF.Screens
/// Available when setting the flow and during a test
///
refFreqLabel.Text = ProcessData.RefFreq.ToString();
refFlowLabel.Text = Utils.FloatToStr(ProcessData.RefFlow.Val, 4);
refFlowLabel.Text = Utils.DoubleToStr(ProcessData.RefFlow.Val, 4);
}
if (args.TestPhase == Config.Entities.Progress.Test)