add revers mesuremnt to magflux
This commit is contained in:
@@ -42,6 +42,9 @@ namespace Xylem.Common.Metrology.Measurements
|
||||
/// </summary>
|
||||
public IMeasurementRecord IntermediateRecord;
|
||||
|
||||
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler OnActionStateHasChanged;
|
||||
|
||||
@@ -116,6 +119,10 @@ namespace Xylem.Common.Metrology.Measurements
|
||||
}
|
||||
}
|
||||
|
||||
public MeasurementDirection FlowDirectionforCalculatingVol { get; set; } = MeasurementDirection.TakeBoth;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -216,7 +223,7 @@ namespace Xylem.Common.Metrology.Measurements
|
||||
throw new ApplicationException("Measurement records missing");
|
||||
|
||||
return new MeasurementResults(DutStartRecord, DutStopRecord, _accuDutOverflowVolumeCm,
|
||||
_accuDutOverflowTimeS, refVolumeCm, refTimeS, _channel);
|
||||
_accuDutOverflowTimeS, refVolumeCm, refTimeS, _channel, FlowDirectionforCalculatingVol);
|
||||
}
|
||||
|
||||
private void CheckForOverFlowVolumeAndTime()
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Xylem.Common.Metrology.Measurements.Consts
|
||||
{
|
||||
public enum MeasurementDirection
|
||||
{
|
||||
|
||||
TakeBoth,
|
||||
TakeOnlyForward,
|
||||
TakeOnlyBackward,
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,6 +31,12 @@ namespace Xylem.Common.Metrology.Measurements
|
||||
/// </summary>
|
||||
MeasurementStates MeasurementState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Actual state of the measurement
|
||||
/// </summary>
|
||||
MeasurementDirection FlowDirectionforCalculatingVol { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Clear start, intermediate and end record and set action state to idle
|
||||
/// </summary>
|
||||
|
||||
@@ -14,7 +14,13 @@ namespace Xylem.Common.Metrology.Measurements
|
||||
/// Get volume of the record
|
||||
/// </summary>
|
||||
Double GetVolumeCm();
|
||||
|
||||
|
||||
|
||||
|
||||
Double GetNegativeReserveVolumeCm();
|
||||
|
||||
Double GetForwardVolumeCm();
|
||||
|
||||
/// <summary>
|
||||
/// Get time stamp of the record from meter
|
||||
/// </summary>
|
||||
|
||||
@@ -116,5 +116,17 @@ namespace Xylem.Common.Metrology.Measurements
|
||||
{
|
||||
return MemberwiseClone();
|
||||
}
|
||||
|
||||
public Double GetNegativeReserveVolumeCm()
|
||||
{
|
||||
return NegativeReverseVolumeCm;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Double GetForwardVolumeCm()
|
||||
{
|
||||
return ForwardVolumeCm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Xylem.Common.Metrology.Measurements
|
||||
/// </summary>
|
||||
public struct MeasurementResults
|
||||
{
|
||||
|
||||
/// <inheritdoc cref="MeasurementResultsStates"/>
|
||||
public readonly MeasurementResultsStates State;
|
||||
|
||||
@@ -157,7 +158,7 @@ namespace Xylem.Common.Metrology.Measurements
|
||||
/// <param name="requiredChannel">physical channel of measurement path (0 for main measurement)</param>
|
||||
public MeasurementResults(IMeasurementRecord dutStartRecord, IMeasurementRecord dutStopRecord,
|
||||
Double accuDutOverflowVolumeCm = 0.0, Double accuDutOverflowTimeS = 0.0, Double? refVolumeCm = null,
|
||||
Double? refTimeS = null, Int32 requiredChannel = 0)
|
||||
Double? refTimeS = null, Int32 requiredChannel = 0, MeasurementDirection takeDirections = MeasurementDirection.TakeBoth)
|
||||
{
|
||||
//backup input
|
||||
DutStartRecord = dutStartRecord;
|
||||
@@ -185,9 +186,26 @@ namespace Xylem.Common.Metrology.Measurements
|
||||
State = MeasurementResultsStates.WrongChannel;
|
||||
return;
|
||||
}
|
||||
|
||||
//build the measured volume
|
||||
DutVolumeCm = (DutStopRecord.GetVolumeCm() + accuDutOverflowVolumeCm) - DutStartRecord.GetVolumeCm();
|
||||
switch (takeDirections)
|
||||
{
|
||||
case MeasurementDirection.TakeBoth:
|
||||
//build the measured volume
|
||||
DutVolumeCm = (DutStopRecord.GetVolumeCm() + accuDutOverflowVolumeCm) - DutStartRecord.GetVolumeCm();
|
||||
break;
|
||||
case MeasurementDirection.TakeOnlyForward:
|
||||
//build the measured volume
|
||||
DutVolumeCm = (DutStopRecord.GetForwardVolumeCm() + accuDutOverflowVolumeCm) - DutStartRecord.GetForwardVolumeCm();
|
||||
break;
|
||||
case MeasurementDirection.TakeOnlyBackward:
|
||||
//build the measured volume
|
||||
DutVolumeCm = (DutStopRecord.GetNegativeReserveVolumeCm() + accuDutOverflowVolumeCm) - DutStartRecord.GetNegativeReserveVolumeCm();
|
||||
break;
|
||||
default:
|
||||
//build the measured volume
|
||||
DutVolumeCm = (DutStopRecord.GetVolumeCm() + accuDutOverflowVolumeCm) - DutStartRecord.GetVolumeCm();
|
||||
break;
|
||||
}
|
||||
|
||||
//assume a correct measurement for static start/stop procedure, in case of flying start/stop
|
||||
//this is going to be overwritten if REF time is set
|
||||
CorrectedDutVolumeCm = DutVolumeCm;
|
||||
|
||||
@@ -176,6 +176,7 @@
|
||||
</Compile>
|
||||
<Compile Include="BaseMeasurement.cs" />
|
||||
<Compile Include="CalibrationMeasurement.cs" />
|
||||
<Compile Include="Consts\MeasurementDirection.cs" />
|
||||
<Compile Include="Consts\MeasurementResultsStates.cs" />
|
||||
<Compile Include="Consts\MeasurementStates.cs" />
|
||||
<Compile Include="Consts\ProcessStates.cs" />
|
||||
|
||||
Reference in New Issue
Block a user