diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Consts/FM2014CmdDef.cs b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Consts/FM2014CmdDef.cs
index c51a716b..3aa19e6a 100644
--- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Consts/FM2014CmdDef.cs
+++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Consts/FM2014CmdDef.cs
@@ -237,6 +237,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
///
CMD_GET_REF_FREQU,
+ ///
+ /// Calculate DUT to REF tolerance based on timer values
+ ///
+ CMD_CAL_DUT_TO_REF_TOL,
+
///
/// Calculate frequency from REF period
///
@@ -309,9 +314,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
REGULATION,
///
- /// Time measurement ongoing
+ /// Calibration measurement ongoing
///
- TIME
+ CALIBRATION
}
///
@@ -551,6 +556,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
// Measurement result request
new Cmd(CmdName.CMD_DUT_GET_TMR, "X", CmdType.INDIVIDUAL, Resources.StrCmdMsgDutGetTmr),
new Cmd(CmdName.CMD_REF_GET_TMR, "Y", CmdType.INDIVIDUAL, Resources.StrCmdMsgRefGetTmr),
+ new Cmd(CmdName.CMD_CAL_DUT_TO_REF_TOL, "", CmdType.INDIVIDUAL, Resources.StrCalDutToRefTol),
new Cmd(CmdName.CMD_GET_UDTLC, "Z", CmdType.INDIVIDUAL, Resources.StrCmdMsgGetUdtlc),
new Cmd(CmdName.CMD_GET_DTLC, "z", CmdType.INDIVIDUAL, Resources.StrCmdMsgGetDtlc),
new Cmd(CmdName.CMD_GET_REF_PERIOD, UNICODE_DLE, CmdType.INDIVIDUAL, Resources.StrCmdMsgGetRefPeriod),
diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs
index bd730fec..2878c1bf 100644
--- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs
+++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs
@@ -88,7 +88,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
/// Default tolerance if not properly setup.
///
public const Int32 STANDARD_NOMINAL_TOLERANCE_INPUT_percent = 3;
-
+
///
/// Default tolerance if not properly setup.
///
@@ -98,69 +98,69 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
/// Standard tolerance (nominal 3 %) multiplicator for calculation of value based on feedback from FM2014
/// (+/- 255 digits).
///
- public const Double STANDARD_TOLERANCE_VALUE_percent = 3.3;
-
+ private const Double STANDARD_TOLERANCE_VALUE_percent = 3.3;
+
///
/// Extended tolerance (nominal 5 %) multiplicator for calculation of value based on feedback from FM2014
/// (+/- 255 digits).
///
- public const Double EXTENDED_TOLERANCE_VALUE_percent = 5.5;
+ private const Double EXTENDED_TOLERANCE_VALUE_percent = 5.5;
///
/// Resolution of tolerance raw value feedback from FM2014 (+/- 255 digits).
///
- public const Double RESOLUTION_TOLERANCE_RAW_VALUE = 255;
+ private const Double RESOLUTION_TOLERANCE_RAW_VALUE = 255;
///
/// Minimal value for attenuation.
///
- public const Int32 ATTENUATION_MIN = 1;
+ public const Byte ATTENUATION_MIN = 1;
///
/// Maximal value for attenuation.
///
- public const Int32 ATTENUATION_MAX = 9;
+ public const Byte ATTENUATION_MAX = 9;
///
- /// Minimal value for double pulse lock time in seconds.
+ /// Minimal value for double pulse lock time in milliseconds, 0.0 means it is disabled.
///
- public const Double DOUBLE_PULSE_LOCK_TIME_MIN_s = 0.0;
+ public const Double DOUBLE_PULSE_DEADTIME_MIN_ms = 0.0;
///
- /// Maximal value for double pulse lock time in seconds.
- /// A timeout will be rose if the time between two subsequent pulses on REF or DUT exceeds after 21.889 s
+ /// Maximal value for double pulse lock time in milliseconds.
+ /// A timeout will be risen if the time between two subsequent pulses on REF or DUT exceeds after 21,889.0 ms
///
- public const Double DOUBLE_PULSE_LOCK_TIME_MAX_s = 22.0;
+ public const Double DOUBLE_PULSE_DEADTIME_MAX_ms = 22000.0;
///
/// Minimal input value for double pulse lock multiplier (multiplier for double pulse lock time in milliseconds).
///
- public const Int32 DOUBLE_PULSE_LOCK_MULTIPLIER_INPUT_MIN = 1;
+ private const Byte DOUBLE_PULSE_DEADTIME_MULTIPLIER_INPUT_MIN = 1;
///
/// Maximal input value for double pulse lock multiplier (multiplier for double pulse lock time in milliseconds).
///
- public const Int32 DOUBLE_PULSE_LOCK_MULTIPLIER_INPUT_MAX = 99;
+ private const Byte DOUBLE_PULSE_DEADTIME_MULTIPLIER_INPUT_MAX = 99;
///
/// Minimal input value for double pulse lock time in milliseconds.
///
- public const Int32 DOUBLE_PULSE_LOCK_TIME_INPUT_MIN_ms = 0;
+ private const UInt16 DOUBLE_PULSE_BASE_DEADTIME_MIN_ms = 0;
///
/// Maximal input value for double pulse lock time in milliseconds.
///
- public const Int32 DOUBLE_PULSE_LOCK_TIME_INPUT_MAX_ms = 9999;
+ private const UInt16 DOUBLE_PULSE_BASE_DEADTIME_MAX_ms = 9999;
///
/// FM2014 minimal pulses for REF and DUT time measurement.
///
- public const UInt32 TIME_MEASUREMENT_INPUT_MIN_pulses = 1;
+ public const UInt16 TIME_MEASUREMENT_INPUT_MIN_pulses = 1;
///
/// FM2014 maximal pulses for REF and DUT time measurement.
///
- public const UInt32 TIME_MEASUREMENT_INPUT_MAX_pulses = 0xFFFF;
+ public const UInt16 TIME_MEASUREMENT_INPUT_MAX_pulses = 0xFFFF;
///
/// Minimal baudrate for serial communication.
@@ -269,7 +269,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
{
if (value > BAUDRATE_INPUT_MAX || value < BAUDRATE_INPUT_MIN)
_baudrate = BAUDRATE_INPUT_MIN;
- else
+ else
_baudrate = value;
}
}
@@ -359,7 +359,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
percentage = EXTENDED_TOLERANCE_VALUE_percent;
else
percentage = STANDARD_TOLERANCE_VALUE_percent;
-
+
_tolerance_percent = value;
ToleranceRawToPercentScale = percentage / RESOLUTION_TOLERANCE_RAW_VALUE;
}
@@ -370,18 +370,17 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
///
public Boolean UseDampedTolerance { get; set; }
- private UInt32 _refRequiredTimeMeasurement_pulses;
+ private UInt16 _refRequiredTimeMeasurement_pulses;
///
/// Required REF pulses for time measurement.
///
- public UInt32 RefRequiredTimeMeasurement_pulses
+ public UInt16 RefRequiredTimeMeasurement_pulses
{
get => _refRequiredTimeMeasurement_pulses;
- private set
+ set
{
// Check limits and equality
if (value < TIME_MEASUREMENT_INPUT_MIN_pulses ||
- value > TIME_MEASUREMENT_INPUT_MAX_pulses ||
value == _refRequiredTimeMeasurement_pulses)
return;
@@ -389,18 +388,17 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
}
}
- private UInt32 _dutRequiredTimeMeasurement_pulses;
+ private UInt16 _dutRequiredTimeMeasurement_pulses;
///
/// Required DUT pulses for time measurement.
///
- public UInt32 DutRequiredTimeMeasurement_pulses
+ public UInt16 DutRequiredTimeMeasurement_pulses
{
get => _dutRequiredTimeMeasurement_pulses;
- private set
+ set
{
// Check limits and equality
if (value < TIME_MEASUREMENT_INPUT_MIN_pulses ||
- value > TIME_MEASUREMENT_INPUT_MAX_pulses ||
value == _dutRequiredTimeMeasurement_pulses)
return;
@@ -408,11 +406,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
}
}
- private Int32 _refMeasuredTimer_ticks;
+ private UInt32 _refMeasuredTimer_ticks;
///
/// REF timer ticks of measured pulses
///
- public Int32 RefMeasuredTimer_ticks
+ public UInt32 RefMeasuredTimer_ticks
{
get => _refMeasuredTimer_ticks;
private set
@@ -422,11 +420,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
}
}
- private Int32 _dutMeasuredTimer_ticks;
+ private UInt32 _dutMeasuredTimer_ticks;
///
/// DUT timer ticks of measured pulses
///
- public Int32 DutMeasuredTimer_ticks
+ public UInt32 DutMeasuredTimer_ticks
{
get => _dutMeasuredTimer_ticks;
private set
@@ -437,14 +435,25 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
}
///
+ /// Maximal tolerance for DUT to REF calibration used as threshold for verification in percent
+ ///
+ public Double DutToRefCalibrationToleranceMax_percent { set; get; }
+
+ ///
+ /// Minimal tolerance for DUT to REF calibration used as threshold for verification in percent
+ ///
+ public Double DutToRefCalibrationToleranceMin_percent { set; get; }
+
+ ///
+ ///
/// Remaining REF pulses for time measurement.
///
- public UInt32 RefRemainingTimeMeasurement_pulses { get; private set; }
+ public UInt16 RefRemainingTimeMeasurement_pulses { get; private set; }
///
/// Remaining DT pulses for time measurement.
///
- public UInt32 DutRemainingTimeMeasurement_pulses { get; private set; }
+ public UInt16 DutRemainingTimeMeasurement_pulses { get; private set; }
///
/// Measured REF time of required pulses.
@@ -477,11 +486,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
}
}
- private UInt32 _dut_pulse_per_cm;
+ private UInt16 _dut_pulse_per_cm;
///
/// Device under test pulses per cubic-meter
///
- public UInt32 Dut_pulse_per_cm
+ public UInt16 Dut_pulse_per_cm
{
get => _dut_pulse_per_cm;
set
@@ -551,32 +560,95 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
}
}
- private Byte _attenuation = 3;
+ private Byte _fm2014CurrentOutputAttenuation = 3;
///
- /// Filter value to attenuate the velocity of
- /// the current output on the tolerance display
+ /// Filter value to attenuate the velocity of the current output on the tolerance display.
+ /// This value will be sent to the FM2014
///
- public Byte Attenuation
+ public Byte FM2014CurrentOutputAttenuation
{
- get => _attenuation;
+ get => _fm2014CurrentOutputAttenuation;
set
{
if (value < ATTENUATION_MIN || value > ATTENUATION_MAX)
return;
- _attenuation = value;
+ _fm2014CurrentOutputAttenuation = value;
+ }
+ }
+
+ private Double _doublePulseDeadtime_ms = 0.0;
+ ///
+ /// Double pulse deadtime in milliseconds to avoid on small oscillating input a repeated pulse.
+ ///
+ public Double DoublePulseDeadtime_ms
+ {
+ get => _doublePulseDeadtime_ms;
+ set
+ {
+ if (value < DOUBLE_PULSE_DEADTIME_MIN_ms ||
+ value > DOUBLE_PULSE_DEADTIME_MAX_ms)
+ return;
+ _doublePulseDeadtime_ms = value;
+
+ // Calculate and set up the values 'S' and 's' needed for the FM2014
+ var tempBase_ms = (UInt16) value;
+ var tempMultiplier = 1;
+ while (tempBase_ms > DOUBLE_PULSE_BASE_DEADTIME_MAX_ms &&
+ tempMultiplier < DOUBLE_PULSE_DEADTIME_MULTIPLIER_INPUT_MAX)
+ {
+ tempMultiplier++;
+ tempBase_ms = (UInt16)(value / tempMultiplier);
+ }
+ DoublePulseBaseDeadTime_ms = tempBase_ms;
+ DoublePulseMultiplier = (Byte)tempMultiplier;
+ }
+ }
+
+ private Byte _doublePulseMultiplier = DOUBLE_PULSE_DEADTIME_MULTIPLIER_INPUT_MIN;
+ ///
+ /// Multiplier to extend the double pulse deadtime by maximum x 99,
+ /// as it is a multiplier the minimal value is 1.
+ ///
+ private Byte DoublePulseMultiplier
+ {
+ get => _doublePulseMultiplier;
+ set
+ {
+ if (value < DOUBLE_PULSE_DEADTIME_MULTIPLIER_INPUT_MIN ||
+ value > DOUBLE_PULSE_DEADTIME_MULTIPLIER_INPUT_MAX)
+ return;
+
+ _doublePulseMultiplier = value;
+ }
+ }
+
+ private UInt16 _doublePulseBaseDeadTime_ms = DOUBLE_PULSE_BASE_DEADTIME_MIN_ms;
+
+ ///
+ /// Base value for double impulse deadtime from 0 to 9999 milliseconds .
+ ///
+ private UInt16 DoublePulseBaseDeadTime_ms
+ {
+ get => _doublePulseBaseDeadTime_ms;
+ set
+ {
+ if (value > DOUBLE_PULSE_BASE_DEADTIME_MAX_ms)
+ return;
+
+ _doublePulseBaseDeadTime_ms = value;
}
}
///
/// The measured flow rate in cubic meters per hour using the REF
///
- public Double RefFlowRate_cm_per_h { private set; get; }
+ private Double RefFlowRate_cm_per_h { set; get; }
///
/// The measured flow rate in cubic meters per hour using the DUT
///
- public Double DutFlowRate_cm_per_h { private set; get; }
+ private Double DutFlowRate_cm_per_h { set; get; }
///
/// Successfully logged on to FM2014
@@ -597,7 +669,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
#region ------------------------------------------- static methods --------------------------------------------
///
- /// Reset the measurement but only if receive task is active:
+ /// Reset the measurement for all connected and logged in devices but only if receive task is active:
/// - This should prepare the hardware for a new measurement which takes about 4 s.
/// - It is a broadcast command which will reset all connected devices!
///
@@ -749,17 +821,22 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
}
///
- /// The regulation measurement compares the DUT to REF tolerance:
+ /// The regulation measurement compares the DUT to REF tolerance
+ ///
+ /// ATTENTION:
+ /// The settings from the first listed FM2014 will be used for ALL FM2014s!
+ /// These settings will be delivered via broadcast to all connected and logged in devices!
+ ///
/// Preconditions:
/// - The has to be executed in advance,
/// - The REF pulses per cubic meter has to be preset,
/// - The DUT pulses per cubic meter has to be preset,
/// - The Scale for REF to DUT pulses has to be preset.
/// Initial setup:
- /// - Setup double impulse,
+ /// - Setup double impulse deadtime,
/// - Setup damping to attenuate the result,
/// - Setup scale between REF to DUT pulses,
- /// - Setup ref pulse counting mode to get REF pulses for flow rate.
+ /// - Setup REF pulse counting mode to get REF pulses for flow rate.
/// Cyclic:
/// - Request damped or undamped tolerance,
/// - Request REF pulse counter value and uses to calculate
@@ -792,8 +869,10 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
return false;
// Check if regulation can be done
- if (firstActiveFm2014.Ref_pulse_per_cm == 0 ||
- firstActiveFm2014.Dut_pulse_per_cm == 0 ||
+ if (firstActiveFm2014.Ref_pulse_per_cm < PULSES_PER_CM_REGULATION_SETUP_MIN ||
+ firstActiveFm2014.Dut_pulse_per_cm < PULSES_PER_CM_REGULATION_SETUP_MIN ||
+ firstActiveFm2014.Ref_pulse_per_cm > PULSES_PER_CM_REGULATION_SETUP_MAX ||
+ firstActiveFm2014.Dut_pulse_per_cm > PULSES_PER_CM_REGULATION_SETUP_MAX ||
firstActiveFm2014.RefToDutScale_norm < REF_TO_DUT_SCALE_MIN ||
firstActiveFm2014.RefToDutScale_norm > REF_TO_DUT_SCALE_MAX)
{
@@ -814,7 +893,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
}
ActualProcessProgress++;
cmdName = CmdName.CMD_MEAS_SET_ATTN;
- if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.Attenuation))
+ if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.FM2014CurrentOutputAttenuation))
{
return false;
}
@@ -998,6 +1077,181 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
return true;
}
+ ///
+ /// The calibration measurement compares the DUT to REF tolerance
+ ///
+ /// ATTENTION:
+ /// The settings from the first listed FM2014 will be used for ALL FM2014s!
+ /// These settings will be delivered via broadcast to all connected and logged in devices!
+ ///
+ /// Preconditions:
+ /// - The has to be executed in advance,
+ /// - The REF pulses to count has to be preset,
+ /// - The DUT pulses to count has to be preset,
+ /// - Setup double impulse deadtime using the whichautomatically
+ /// calculates the and .
+ /// Initial setup:
+ /// - Setup double pulse deadtime,
+ /// - Setup REF pulses to count,
+ /// - Setup DUT pulses to count.
+ /// Cyclic:
+ /// - Request damped or undamped tolerance,
+ /// - Request REF pulse counter value and uses to calculate
+ /// the 'Flow rate'.
+ /// Exit:
+ /// - Set to false.
+ ///
+ ///
+ ///
+ /// - Initial.
+ ///
+ ///
+ /// - Support for multiple FM2014s.
+ ///
+ ///
+ /// - Static.
+ ///
+ public static Boolean CalibrationMeasurement()
+ {
+ // If the cyclic task has already been started everything is fine
+ if (SharedCyclicMeasSequ == CyclicMeasSequ.CALIBRATION)
+ return true;
+
+ // Marked measurement isn't pulse counter measurement, other FM2014s cannot activate this
+ if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE)
+ return false;
+
+ var firstActiveFm2014 = GetFirstConnectedAndLoggedInFm2014();
+ if (firstActiveFm2014 == null)
+ return false;
+
+ // Check if regulation can be done
+ if (firstActiveFm2014.RefRequiredTimeMeasurement_pulses < TIME_MEASUREMENT_INPUT_MIN_pulses ||
+ firstActiveFm2014.DutRequiredTimeMeasurement_pulses < TIME_MEASUREMENT_INPUT_MIN_pulses)
+ {
+ return false;
+ }
+
+ var cmdName = CmdName.CMD_NA;
+ var measurementInfo = Resources.StrMeasMsgCalibration;
+ InitActualProcessProgress(3);
+
+ // Prepare calibration measurement
+ try
+ {
+ // Check if double pulse deadtime has been set
+ if (Math.Abs(DOUBLE_PULSE_DEADTIME_MIN_ms - firstActiveFm2014.DoublePulseDeadtime_ms) < 0.9)
+ {
+ // This is a command without parameter
+ cmdName = CmdName.CMD_SET_DBPL_UNLOCK;
+ if (!Write(cmdName, firstActiveFm2014))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ cmdName = CmdName.CMD_SET_DPLS_LOCK_TMR;
+ if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.DoublePulseBaseDeadTime_ms))
+ {
+ return false;
+ }
+ cmdName = CmdName.CMD_SET_DPLS_LOCK_MULT;
+ if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.DoublePulseMultiplier))
+ {
+ return false;
+ }
+ }
+
+ ActualProcessProgress++;
+ cmdName = CmdName.CMD_REF_SET_PLS;
+ if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.RefRequiredTimeMeasurement_pulses, true))
+ {
+ return false;
+ }
+ ActualProcessProgress++;
+ cmdName = CmdName.CMD_DUT_SET_PLS;
+ if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.DutRequiredTimeMeasurement_pulses, true))
+ {
+ return false;
+ }
+ ActualProcessProgress++;
+ }
+ catch (Exception e)
+ {
+ var response = new CmdResponse(cmdName, e.Message);
+ PublishResponse(firstActiveFm2014, new ProcessExecEventArgs(Resources.StrError,
+ specificInfoObj: response, statusReturn: StatusReturn.Failed));
+ return false;
+ }
+
+ // Measurement Loop
+ Task.Run(() =>
+ {
+ // Mark calibration measurement as active
+ SharedCyclicMeasSequ = CyclicMeasSequ.CALIBRATION;
+ InitActualProcessProgress(firstActiveFm2014.RefRequiredTimeMeasurement_pulses);
+
+ do
+ {
+ foreach (var fm2014 in RegisteredFm2014s.Where(fm2014 => fm2014.IsLoggedOn))
+ {
+ try
+ {
+ String responseStr;
+ cmdName = CmdName.CMD_REF_GET_PLS_RMN;
+ var info = GetCmdInfo(cmdName);
+ if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE && Write(cmdName, fm2014))
+ {
+ if (Read(cmdName, fm2014, out responseStr) &&
+ ushort.TryParse(responseStr, NumberStyles.HexNumber, new CultureInfo("en"), out var pulses))
+ {
+ fm2014.RefRequiredTimeMeasurement_pulses = pulses;
+ var response = new CmdResponse(cmdName, info, pulses);
+ PublishResponse(fm2014, new ProcessExecEventArgs("",
+ actualProcessMessage: measurementInfo,
+ specificInfoObj: response));
+ ActualProcessProgress = fm2014.RefRequiredTimeMeasurement_pulses -
+ fm2014.RefRemainingTimeMeasurement_pulses;
+ }
+ }
+ cmdName = CmdName.CMD_DUT_GET_PLS_RMN;
+ info = GetCmdInfo(cmdName);
+ if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE && Write(cmdName, fm2014))
+ {
+ if (Read(cmdName, fm2014, out responseStr) &&
+ ushort.TryParse(responseStr, NumberStyles.HexNumber, new CultureInfo("en"), out var pulses))
+ {
+ fm2014.DutRemainingTimeMeasurement_pulses = pulses;
+ var response = new CmdResponse(cmdName, info, pulses);
+ PublishResponse(fm2014, new ProcessExecEventArgs("",
+ actualProcessMessage: measurementInfo,
+ specificInfoObj: response));
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ var response = new CmdResponse(cmdName, e.Message);
+ PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError,
+ specificInfoObj: response, statusReturn: StatusReturn.Failed));
+ }
+ }
+ // Check all remaining DUT and REF pulses are counted on all connected devices and finalize process by
+ // reading out all results
+ if (RegisteredFm2014s.All(fm2014 => fm2014.RefRemainingTimeMeasurement_pulses == 0 &&
+ fm2014.DutRemainingTimeMeasurement_pulses == 0))
+ {
+ // Read out the result
+ SharedCyclicMeasSequ = CyclicMeasSequ.IDLE;
+ }
+ } while (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE);
+
+ }, SharedCancellationToken);
+
+ return true;
+ }
+
///
/// Read FM2014:
/// - Accesses directly to the 'SerialPort.ReadTo',
@@ -1061,6 +1315,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
///
///
///
+ ///
///
///
/// - Initial.
@@ -1068,7 +1323,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
///
/// - Support for multiple FM2014s.
///
- private static Boolean Write(CmdName cmdName, FM2014 fm2014, Object dataObj = null)
+ private static Boolean Write(CmdName cmdName, FM2014 fm2014, Object dataObj = null, Boolean isHexFormat = false)
{
if (fm2014 == null)
return false;
@@ -1131,9 +1386,10 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// The data contains the preceding setup, the command code and string delimiter will be added here
else if (dataObj is UInt16 || dataObj is Byte)
{
- SharedSerialPort.Write($"{dataObj}{cmdCodeStr}{END_OF_STR}");
+ var valueStr = isHexFormat ? $"{dataObj:X}{cmdCodeStr}" : $"{dataObj}{cmdCodeStr}";
+ SharedSerialPort.Write($"{valueStr}{END_OF_STR}");
response = new CmdResponse(cmdName,
- $"{Resources.StrCommDirectionSetup}: {info}: {dataObj}{cmdCodeStr}");
+ $"{Resources.StrCommDirectionSetup}: {info}: {valueStr}");
}
else
@@ -1526,7 +1782,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
if (retVal)
{
cmdName = CmdName.CMD_DUT_LPP_SCALE;
- retVal = Write(cmdName, this, (UInt16)Dut_pulse_per_cm);
+ retVal = Write(cmdName, this, Dut_pulse_per_cm);
}
if (retVal)
@@ -1539,7 +1795,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
if (retVal)
{
cmdName = CmdName.CMD_MEAS_SET_ATTN;
- retVal = Write(cmdName, this, Attenuation);
+ retVal = Write(cmdName, this, FM2014CurrentOutputAttenuation);
}
if (retVal)
@@ -1625,8 +1881,8 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
{
cmdName = CmdName.CMD_MEAS_SET_ATTN;
var info = GetCmdInfo(cmdName);
- Attenuation = attenuation;
- var response = new CmdResponse(cmdName, info, Attenuation);
+ FM2014CurrentOutputAttenuation = attenuation;
+ var response = new CmdResponse(cmdName, info, FM2014CurrentOutputAttenuation);
PublishResponse(this, new ProcessExecEventArgs("",
actualProcessMessage: measurementInfoStr, specificInfoObj: response));
}
@@ -1650,12 +1906,12 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
if (str.Contains(StandAlonePartSearchDutPpvStr))
{
var strCleaned = Regex.Replace(str, "[^0-9]", string.Empty);
- if (uint.TryParse(strCleaned, out var value))
+ if (ushort.TryParse(strCleaned, out var value))
{
cmdName = CmdName.CMD_DUT_LPP_SCALE;
var info = GetCmdInfo(cmdName);
Dut_pulse_per_cm = value;
- var response = new CmdResponse(cmdName, info, (Int32)Dut_pulse_per_cm);
+ var response = new CmdResponse(cmdName, info, Dut_pulse_per_cm);
PublishResponse(this,
new ProcessExecEventArgs("", actualProcessMessage: measurementInfoStr,
specificInfoObj: response));
diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.Designer.cs b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.Designer.cs
index 8fe3b623..7fe19bb1 100644
--- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.Designer.cs
+++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.Designer.cs
@@ -79,6 +79,15 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr
}
}
+ ///
+ /// Looks up a localized string similar to DUT to REF tolerance.
+ ///
+ internal static string StrCalDutToRefTol {
+ get {
+ return ResourceManager.GetString("StrCalDutToRefTol", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to REF flow rate f(REF frequency).
///
@@ -161,7 +170,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr
}
///
- /// Looks up a localized string similar to Set double pulse dead time multiplier.
+ /// Looks up a localized string similar to Set double pulse deadtime multiplier.
///
internal static string StrCmdMsgDplsLockMult {
get {
@@ -170,7 +179,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr
}
///
- /// Looks up a localized string similar to Set double pulse dead time milliseconds.
+ /// Looks up a localized string similar to Set double pulse deadtime milliseconds.
///
internal static string StrCmdMsgDplsLockTmr {
get {
@@ -251,7 +260,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr
}
///
- /// Looks up a localized string similar to Damped tolerance DUT to REF.
+ /// Looks up a localized string similar to DUT to REF tolerance (damped).
///
internal static string StrCmdMsgGetDtlc {
get {
@@ -296,7 +305,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr
}
///
- /// Looks up a localized string similar to Undamped tolerance DUT to REF.
+ /// Looks up a localized string similar to DUT to REF tolerance (un-damped).
///
internal static string StrCmdMsgGetUdtlc {
get {
@@ -637,6 +646,15 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr
}
}
+ ///
+ /// Looks up a localized string similar to Calibration DUT to REF.
+ ///
+ internal static string StrMeasMsgCalibration {
+ get {
+ return ResourceManager.GetString("StrMeasMsgCalibration", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to DUT pulse counter.
///
diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.de.resx b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.de.resx
index 36a7dd7e..9c2ccd3c 100644
--- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.de.resx
+++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.de.resx
@@ -202,10 +202,10 @@
REF Zeiteinheiten
- Ungedämpfte Toleranz DUT zu REF
+ DUT zu REF Toleranz (Ungedämpft)
- Gedämpfte Toleranz DUT zu REF
+ DUT zu REF Toleranz (gedämpft)
REF Periodendauer
@@ -324,4 +324,10 @@
Antwort
+
+ DUT zu REF Toleranz
+
+
+ Kalibrierung DUT zu REF
+
\ No newline at end of file
diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.resx b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.resx
index d293ca20..3ac592ed 100644
--- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.resx
+++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.resx
@@ -163,10 +163,10 @@
REF to DUT pulse ratio
- Set double pulse dead time milliseconds
+ Set double pulse deadtime milliseconds
- Set double pulse dead time multiplier
+ Set double pulse deadtime multiplier
REF to DUT attenuation
@@ -202,10 +202,10 @@
REF timer ticks
- Undamped tolerance DUT to REF
+ DUT to REF tolerance (un-damped)
- Damped tolerance DUT to REF
+ DUT to REF tolerance (damped)
REF period
@@ -324,4 +324,10 @@
Response
+
+ DUT to REF tolerance
+
+
+ Calibration DUT to REF
+
\ No newline at end of file
diff --git a/FM2014TestApp/Ui/FM2014TestBenchWinFrms/FrmFm2014TestApp.cs b/FM2014TestApp/Ui/FM2014TestBenchWinFrms/FrmFm2014TestApp.cs
index 940e6227..9348cd2a 100644
--- a/FM2014TestApp/Ui/FM2014TestBenchWinFrms/FrmFm2014TestApp.cs
+++ b/FM2014TestApp/Ui/FM2014TestBenchWinFrms/FrmFm2014TestApp.cs
@@ -857,9 +857,9 @@ namespace Sensus.Ui.FM2014TestApp
if (Fm2014 != null)
{
if (byte.TryParse(cbxAttenuation.SelectedItem.ToString(), out var attenuation) &&
- attenuation > 0 && attenuation <= 9 && Fm2014.Attenuation != attenuation)
+ attenuation > 0 && attenuation <= 9 && Fm2014.FM2014CurrentOutputAttenuation != attenuation)
{
- Fm2014.Attenuation = attenuation;
+ Fm2014.FM2014CurrentOutputAttenuation = attenuation;
_regulationSetupHasChanged = true;
btnSaveRegulationSetup.Enabled = true;
}
diff --git a/FM2014TestApp/Ui/Fm2014sTest/FM2014TestBenchWindow.xaml b/FM2014TestApp/Ui/Fm2014sTest/FM2014TestBenchWindow.xaml
index 3e7089c9..24c01657 100644
--- a/FM2014TestApp/Ui/Fm2014sTest/FM2014TestBenchWindow.xaml
+++ b/FM2014TestApp/Ui/Fm2014sTest/FM2014TestBenchWindow.xaml
@@ -247,16 +247,16 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -281,6 +281,7 @@
+
@@ -339,7 +340,56 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FM2014TestApp/Ui/Fm2014sTest/FM2014TestBenchWindow.xaml.cs b/FM2014TestApp/Ui/Fm2014sTest/FM2014TestBenchWindow.xaml.cs
index 9680d995..e739869a 100644
--- a/FM2014TestApp/Ui/Fm2014sTest/FM2014TestBenchWindow.xaml.cs
+++ b/FM2014TestApp/Ui/Fm2014sTest/FM2014TestBenchWindow.xaml.cs
@@ -133,11 +133,28 @@ namespace Sensus.Ui.FM2014TestBench
private String _lastLoggingTextToAvoidRepetition;
// DUT to REF regulation label index published to UcFM2014s measurement positions 0..6
- private const Int32 REG_LBL_IDX_TOLERANCE = 0;
+ private const Int32 REG_LBL_IDX_DUT_TO_REF_TOL = 0;
private const Int32 REG_LBL_IDX_REF_FREQU = 1;
private const Int32 REG_LBL_IDX_FLOW_RATE = 2;
private const Int32 REG_MEASURE_COUNT = 3;
+ // DUT to REF calibration label index published to UcFM2014s measurement positions 0..6
+ private const Int32 CAL_LBL_IDX_REF_REQ_PLS = 0;
+ private const Int32 CAL_LBL_IDX_REF_RMN_PLS = 1;
+ private const Int32 CAL_LBL_IDX_DUT_REQ_PLS = 2;
+ private const Int32 CAL_LBL_IDX_DUT_RMN_PLS = 3;
+ private const Int32 CAL_LBL_IDX_REF_MEAS_TMR = 4;
+ private const Int32 CAL_LBL_IDX_DUT_MEAS_TMR = 5;
+ private const Int32 CAL_LBL_IDX_DUT_TO_REF_TOL = 6;
+ private const Int32 CAL_MEASURE_COUNT = 7;
+
+ // Pulse counter measurements label index published to UcFM2014s measurement positions 0..6
+ private const Int32 CTR_LBL_IDX_REF_PLS = 0;
+ private const Int32 CTR_LBL_IDX_DUT_PLS = 1;
+ private const Int32 CTR_LBL_IDX_REF_FREQU = 2;
+ private const Int32 CTR_LBL_IDX_FLOW_RATE = 3;
+ private const Int32 CTR_MEASURE_COUNT = 4;
+
#endregion ---------------------------------------- Properties ------------------------------------------------
#region ------------------------------------------- FormControls ----------------------------------------------
///
@@ -523,9 +540,9 @@ namespace Sensus.Ui.FM2014TestBench
lblSlotSelection.Content = Properties.Resources.StrLblSlotSelection;
// Regulation Setup
- lblRefPulsesPerCm.Content = Properties.Resources.StrLblRefPulsesPerCm;
+ lblRefPulsesPerCm.Content = Properties.Resources.StrLblRatioRefPulsesPerCm;
tbxRefPulsesPerCm.Text = "";
- lblDutPulsesPerCm.Content = Properties.Resources.StrLblDutPulsesPerCm;
+ lblDutPulsesPerCm.Content = Properties.Resources.StrLblRatioDutPulsesPerCm;
tbxDutPulsesPerCm.Text = "";
lblScaleRefToDut.Content = Properties.Resources.StrLblScaleRefToDut;
tbxScaleRefToDut.Text = "";
@@ -556,7 +573,8 @@ namespace Sensus.Ui.FM2014TestBench
//btnManualRefCalibration.Text = Properties.Resources.StrBtnStartCalibration;
//// Process status
- lblActualProcessLabel.Content = Properties.Resources.StrLblProcessStatus;
+ lblActualProcessLabel.Content = Properties.Resources.StrLblActualProcessStatus;
+ lblTotalProcessLabel.Content = Properties.Resources.StrLblOverallProcessStatus;
lblTimeText.Text = Properties.Resources.StrLblTime;
ActionControl(false);
@@ -628,7 +646,7 @@ namespace Sensus.Ui.FM2014TestBench
ResetCancellationToken();
FM2014.SharedCancellationToken = _cancellationToken;
- UpdateContentControl(lblTotalProcessLabel, Properties.Resources.StrMsgConnecting);
+ UpdateContentControl(lblTotalProcessText, Properties.Resources.StrMsgConnecting);
var comPort = cbxFM2014ComPort.SelectedItem.ToString();
@@ -984,17 +1002,16 @@ namespace Sensus.Ui.FM2014TestBench
///
/// Feedback from FM2014being parsed to GUI
///
- ///
+ ///
/// - Initial.
///
private void DataReceived_Handler(Object sender, ProcessExecEventArgs e)
{
try
{
-
// Remind the FM2014 user control based on the address of the FM2014 to dispatch received message to the
// correct device
- UcFM2014Device ucFm2014 = null;
+ UcFM2014Device ucFm2014;
if (sender is FM2014 fm2014)
{
var idx = fm2014.Address - 1;
@@ -1029,13 +1046,13 @@ namespace Sensus.Ui.FM2014TestBench
// Data dispatcher
var resp = (CmdResponse)e.SpecificInfoObj;
+ String valueStr;
if (e.StatusReturn == StatusReturn.Failed)
{
LogErrorText(resp.AnswerStr);
//ErrorHandler(resp.CmdName);
}
-
else if (resp.IntValue == null && resp.DoubleValue == null)
{
LogText(resp.AnswerStr);
@@ -1045,6 +1062,12 @@ namespace Sensus.Ui.FM2014TestBench
LogText($"{resp.AnswerStr}: {resp.IntValue:D} {resp.SiUnit}");
switch (resp.CmdName)
{
+ case CmdName.CMD_REF_GET_PLS_RMN:
+ ucFm2014.SetValue(CAL_LBL_IDX_REF_RMN_PLS, $"{resp.IntValue:D}");
+ break;
+ case CmdName.CMD_DUT_GET_PLS_RMN:
+ ucFm2014.SetValue(CAL_LBL_IDX_DUT_RMN_PLS, $"{resp.IntValue:D}");
+ break;
case CmdName.CMD_REF_GET_PLS_CTR:
case CmdName.CMD_REF_GET_PLS_CTR_BU:
//UpdateTextBox(tbxMeasuredRefPulses, $"{resp.IntValue:D}");
@@ -1063,7 +1086,7 @@ namespace Sensus.Ui.FM2014TestBench
Dispatcher.Invoke(() => cbxAttenuation.SelectedItem = $"{resp.IntValue}");
break;
case CmdName.CMD_GET_REF_FREQU:
- var valueStr = $"{resp.IntValue:D}";
+ valueStr = $"{resp.IntValue:D}";
if (resp.IntValue < FM2014.REF_FREQU_MIN || resp.IntValue > FM2014.REF_FREQU_MAX)
ucFm2014.SetValue(REG_LBL_IDX_REF_FREQU, valueStr, ColorProcessFailed);
else
@@ -1076,13 +1099,29 @@ namespace Sensus.Ui.FM2014TestBench
LogText($"{resp.AnswerStr}: {resp.DoubleValue:F2} {resp.SiUnit}");
switch (resp.CmdName)
{
+ case CmdName.CMD_REF_GET_TMR:
+ valueStr = $"{resp.DoubleValue:F3}";
+ ucFm2014.SetValue(CAL_LBL_IDX_REF_MEAS_TMR, valueStr);
+ break;
+ case CmdName.CMD_DUT_GET_TMR:
+ valueStr = $"{resp.DoubleValue:F3}";
+ ucFm2014.SetValue(CAL_LBL_IDX_DUT_MEAS_TMR, valueStr);
+ break;
+ case CmdName.CMD_CAL_DUT_TO_REF_TOL:
+ valueStr = $"{resp.DoubleValue:F2}";
+ if ((Double)resp.DoubleValue > fm2014.DutToRefCalibrationToleranceMax_percent ||
+ (Double)resp.DoubleValue < fm2014.DutToRefCalibrationToleranceMin_percent)
+ ucFm2014.SetValue(CAL_LBL_IDX_DUT_TO_REF_TOL, valueStr, ColorProcessFailed);
+ else
+ ucFm2014.SetValue(CAL_LBL_IDX_DUT_TO_REF_TOL, valueStr, ColorSuccess);
+ break;
case CmdName.CMD_GET_UDTLC:
case CmdName.CMD_GET_DTLC:
- var valueStr = $"{resp.DoubleValue:F2}";
+ valueStr = $"{resp.DoubleValue:F2}";
if (Math.Abs((Double)resp.DoubleValue) > fm2014.Tolerance_percent)
- ucFm2014.SetValue(REG_LBL_IDX_TOLERANCE, valueStr, ColorProcessFailed);
+ ucFm2014.SetValue(REG_LBL_IDX_DUT_TO_REF_TOL, valueStr, ColorProcessFailed);
else
- ucFm2014.SetValue(REG_LBL_IDX_TOLERANCE, valueStr);
+ ucFm2014.SetValue(REG_LBL_IDX_DUT_TO_REF_TOL, valueStr);
break;
case CmdName.CMD_REF_SET_SCALE:
UpdateTextBox(tbxScaleRefToDut, $"{resp.DoubleValue:F4}");
@@ -1116,7 +1155,7 @@ namespace Sensus.Ui.FM2014TestBench
}
}
}
- catch (Exception exception)
+ catch (Exception)
{
//
}
@@ -1137,6 +1176,80 @@ namespace Sensus.Ui.FM2014TestBench
Connect();
}
+ ///
+ /// Start and stop the DUT to REF calibration measurement.
+ ///
+ ///
+ /// - Initial.
+ ///
+ private void btnDutToRefCalibration_Click(Object sender, EventArgs e)
+ {
+ _startTime = DateTimeOffset.UtcNow;
+ if (FM2014.SharedCyclicMeasSequ == CyclicMeasSequ.IDLE)
+ {
+ ActionControl(true);
+ // Disable and hide dynamic measurement labels
+ foreach (var measLbl in MeasurementLabels)
+ UiElmEnable(measLbl, false, false);
+
+ // Set the measurement labels
+ UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_REF_REQ_PLS], Properties.Resources.StrLblRequiredRefPulses);
+ UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_REF_RMN_PLS], Properties.Resources.StrLblRemainingRefPulses);
+ UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_DUT_REQ_PLS], Properties.Resources.StrLblRequiredDutPulses);
+ UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_DUT_RMN_PLS], Properties.Resources.StrLblRemainingDutPulses);
+ UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_REF_MEAS_TMR], Properties.Resources.StrLblMeasuredRefTime);
+ UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_DUT_MEAS_TMR], Properties.Resources.StrLblMeasuredDutTime);
+ UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_DUT_TO_REF_TOL], Properties.Resources.StrLblMeasuredDutToRefTolerance);
+ UiElmEnable(MeasurementLabels[CAL_LBL_IDX_REF_REQ_PLS], true);
+ UiElmEnable(MeasurementLabels[CAL_LBL_IDX_REF_RMN_PLS], true);
+ UiElmEnable(MeasurementLabels[CAL_LBL_IDX_DUT_REQ_PLS], true);
+ UiElmEnable(MeasurementLabels[CAL_LBL_IDX_DUT_RMN_PLS], true);
+ UiElmEnable(MeasurementLabels[CAL_LBL_IDX_REF_MEAS_TMR], true);
+ UiElmEnable(MeasurementLabels[CAL_LBL_IDX_DUT_MEAS_TMR], true);
+ UiElmEnable(MeasurementLabels[CAL_LBL_IDX_DUT_TO_REF_TOL], true);
+
+ if (FM2014.RegisteredFm2014s == null || FM2014.RegisteredFm2014s.Count == 0)
+ return;
+ // Adjust the user control
+ foreach (var fm2014 in FM2014.RegisteredFm2014s.Where(x => x.IsLoggedOn))
+ {
+ var idx = fm2014.Address - 1;
+ var ucFM2014 = (UcFM2014Device)UcFM2014s[idx];
+ ucFM2014.EnableMeasurements(CAL_MEASURE_COUNT);
+
+ //TODO THW test assignment
+ fm2014.RefRequiredTimeMeasurement_pulses = 500;
+ fm2014.DutRequiredTimeMeasurement_pulses = 500;
+ fm2014.DutToRefCalibrationToleranceMax_percent = 1.1;
+ fm2014.DutToRefCalibrationToleranceMin_percent = -0.5;
+ fm2014.DoublePulseDeadtime_ms = 0.0;
+ //TODO THW Test assignment
+
+ // Set initial required pulses as those are static upon the entire measurement
+ ucFM2014.SetValue(CAL_LBL_IDX_REF_REQ_PLS, $"{fm2014.RefRequiredTimeMeasurement_pulses}");
+ ucFM2014.SetValue(CAL_LBL_IDX_DUT_REQ_PLS, $"{fm2014.DutRequiredTimeMeasurement_pulses}");
+ }
+
+ if (FM2014.CalibrationMeasurement())
+ {
+ // Progress will be fed by the calibration routine
+ _autoProgressBar = false;
+ UpdateContentControl(btnDutToRefCalibration, Properties.Resources.StrBtnStopCalibration);
+ UiElmEnable(btnDutToRefCalibration, true);
+ }
+ }
+ else
+ {
+ _autoProgressBar = false;
+ // Deactivate the button temporary to avoid repeated execution as the reset takes a certain time
+ UiElmEnable(btnDutToRefCalibration, false);
+ FM2014.ResetHardwareAllDevices();
+ ActionControl(false);
+ UpdateContentControl(btnDutToRefCalibration, Properties.Resources.StrBtnStartCalibration);
+ }
+ }
+
+
///
/// Start and stop the DUT to REF regulation measurement.
///
@@ -1149,19 +1262,18 @@ namespace Sensus.Ui.FM2014TestBench
if (FM2014.SharedCyclicMeasSequ == CyclicMeasSequ.IDLE)
{
ActionControl(true);
- // Remove old measurement labels
// Disable and hide dynamic measurement labels
foreach (var measLbl in MeasurementLabels)
UiElmEnable(measLbl, false, false);
// Set the measurement labels
- UpdateContentControl(MeasurementLabels[REG_LBL_IDX_TOLERANCE],
- Properties.Resources.StrLblActualMeasuredToleranceDutToRef);
+ UpdateContentControl(MeasurementLabels[REG_LBL_IDX_DUT_TO_REF_TOL],
+ Properties.Resources.StrLblMeasuredDutToRefTolerance);
UpdateContentControl(MeasurementLabels[REG_LBL_IDX_REF_FREQU],
Properties.Resources.StrLblRefFrequencyHz);
UpdateContentControl(MeasurementLabels[REG_LBL_IDX_FLOW_RATE],
- Properties.Resources.StrLblActualMeasuredFlowRate);
- UiElmEnable(MeasurementLabels[REG_LBL_IDX_TOLERANCE], true);
+ Properties.Resources.StrLblMeasuredFlowRate);
+ UiElmEnable(MeasurementLabels[REG_LBL_IDX_DUT_TO_REF_TOL], true);
UiElmEnable(MeasurementLabels[REG_LBL_IDX_REF_FREQU], true);
UiElmEnable(MeasurementLabels[REG_LBL_IDX_FLOW_RATE], true);
@@ -1238,7 +1350,8 @@ namespace Sensus.Ui.FM2014TestBench
}
///
- /// Attenuation item has changed.
+ /// FM2014 current attenuation item has changed:
+ /// - This will dispatch the new value to all FM2014s.
///
///
/// - Initial.
@@ -1253,13 +1366,15 @@ namespace Sensus.Ui.FM2014TestBench
Dispatcher.Invoke(() =>
{
if (byte.TryParse(cbxAttenuation.SelectedItem.ToString(), out var attenuation) &&
- attenuation > 0 && attenuation <= 9 && firstFm2014.Attenuation != attenuation)
+ attenuation >= FM2014.ATTENUATION_MIN &&
+ attenuation <= FM2014.ATTENUATION_MAX &&
+ firstFm2014.FM2014CurrentOutputAttenuation != attenuation)
{
- firstFm2014.Attenuation = attenuation;
+ firstFm2014.FM2014CurrentOutputAttenuation = attenuation;
// Dispatch settings to all connected FM2014
foreach (var fm2014 in FM2014.RegisteredFm2014s)
{
- fm2014.Attenuation = firstFm2014.Attenuation;
+ fm2014.FM2014CurrentOutputAttenuation = attenuation;
}
_regulationSetupHasChanged = true;
btnSaveRegulationSetup.IsEnabled = true;
@@ -1285,7 +1400,8 @@ namespace Sensus.Ui.FM2014TestBench
}
///
- /// Safe standalone measurement setup.
+ /// Safe standalone measurement setup:
+ /// - This will save the setup in all FM2014s.
///
///
///
@@ -1304,7 +1420,8 @@ namespace Sensus.Ui.FM2014TestBench
///
/// Switch between damped or undamped tolerance display. This can be changed during the
/// 'Regulation Measurement' on the fly as it will just collect a different dataset and
- /// not change anything on the measurement setup.
+ /// not change anything on the measurement setup:
+ /// - This will dispatch the new value to all FM2014s.
///
///
///
@@ -1389,7 +1506,8 @@ namespace Sensus.Ui.FM2014TestBench
}
///
- /// After manual input of the REF pulses per cubic meter the scale REF to DUT has to be recalculated
+ /// After manual input of the REF pulses per cubic meter the scale REF to DUT has to be recalculated:
+ /// - This will dispatch the new value to all FM2014s.
///
///
///
@@ -1487,7 +1605,8 @@ namespace Sensus.Ui.FM2014TestBench
}
///
- /// After manual input of the DUT pulses per cubic meter the scale REF to DUT has to be recalculated
+ /// After manual input of the DUT pulses per cubic meter the scale REF to DUT has to be recalculated:
+ /// - This will dispatch the new value to all FM2014s.
///
///
///
@@ -1516,10 +1635,10 @@ namespace Sensus.Ui.FM2014TestBench
var backupPulses_per_cm = firstFm2014.Dut_pulse_per_cm;
// Setup all FM2014s
- if (int.TryParse(tbxDutPulsesPerCm.Text, out var pulses_per_cm))
+ if (ushort.TryParse(tbxDutPulsesPerCm.Text, out var pulses_per_cm))
{
// Try to set the new calculated REF pulses limited by the property setter
- firstFm2014.Dut_pulse_per_cm = (UInt32)pulses_per_cm;
+ firstFm2014.Dut_pulse_per_cm = pulses_per_cm;
// Dispatch settings to all connected FM2014!!!!
foreach (var fm2014 in FM2014.RegisteredFm2014s)
@@ -1586,7 +1705,8 @@ namespace Sensus.Ui.FM2014TestBench
///
/// After manual input of measured weight scale or reservoir in liters this will calculate the
/// REF pulses per cubic meter and copy from REF pulses per cubic meter in 'Manual REF Calibration'
- /// to 'Regulation Setup'.
+ /// to 'Regulation Setup':
+ /// - This will dispatch the new value to all FM2014s.
///
///
///
@@ -1667,7 +1787,7 @@ namespace Sensus.Ui.FM2014TestBench
}
}
- private void chkSlot1_Click(Object sender, RoutedEventArgs e)
+ private void chkAnySlot_Click(Object sender, RoutedEventArgs e)
{
_configSetupHasChanged = true;
}
diff --git a/FM2014TestApp/Ui/Fm2014sTest/Properties/Resources.Designer.cs b/FM2014TestApp/Ui/Fm2014sTest/Properties/Resources.Designer.cs
index e1ea5e6a..c185a573 100644
--- a/FM2014TestApp/Ui/Fm2014sTest/Properties/Resources.Designer.cs
+++ b/FM2014TestApp/Ui/Fm2014sTest/Properties/Resources.Designer.cs
@@ -187,7 +187,7 @@ namespace Sensus.Ui.Fm2014TestBench.Properties {
}
///
- /// Looks up a localized string similar to Manual Calibration REF to Weight-Scale.
+ /// Looks up a localized string similar to REF to Volume Calibration.
///
internal static string StrGbxManualRefCalibration {
get {
@@ -205,20 +205,11 @@ namespace Sensus.Ui.Fm2014TestBench.Properties {
}
///
- /// Looks up a localized string similar to Flow Rate [m³/h]:.
+ /// Looks up a localized string similar to Actual Process:.
///
- internal static string StrLblActualMeasuredFlowRate {
+ internal static string StrLblActualProcessStatus {
get {
- return ResourceManager.GetString("StrLblActualMeasuredFlowRate", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to DUT/REF Tolerance [%]:.
- ///
- internal static string StrLblActualMeasuredToleranceDutToRef {
- get {
- return ResourceManager.GetString("StrLblActualMeasuredToleranceDutToRef", resourceCulture);
+ return ResourceManager.GetString("StrLblActualProcessStatus", resourceCulture);
}
}
@@ -232,7 +223,7 @@ namespace Sensus.Ui.Fm2014TestBench.Properties {
}
///
- /// Looks up a localized string similar to Serial Port.
+ /// Looks up a localized string similar to Serial Port:.
///
internal static string StrLblComPort {
get {
@@ -241,11 +232,29 @@ namespace Sensus.Ui.Fm2014TestBench.Properties {
}
///
- /// Looks up a localized string similar to DUT [pulses/m³]:.
+ /// Looks up a localized string similar to Double Pulses Deadtime:.
///
- internal static string StrLblDutPulsesPerCm {
+ internal static string StrLblDoublePulseDeadTime {
get {
- return ResourceManager.GetString("StrLblDutPulsesPerCm", resourceCulture);
+ return ResourceManager.GetString("StrLblDoublePulseDeadTime", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to DUT/REF Tolerance max [%]:.
+ ///
+ internal static string StrLblDutToRefToleranceMax {
+ get {
+ return ResourceManager.GetString("StrLblDutToRefToleranceMax", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to DUT/REF Tolerance min [%]:.
+ ///
+ internal static string StrLblDutToRefToleranceMin {
+ get {
+ return ResourceManager.GetString("StrLblDutToRefToleranceMin", resourceCulture);
}
}
@@ -322,7 +331,7 @@ namespace Sensus.Ui.Fm2014TestBench.Properties {
}
///
- /// Looks up a localized string similar to Measured DUT [pulses]:.
+ /// Looks up a localized string similar to DUT Captured Pulses: .
///
internal static string StrLblMeasuredDutPulses {
get {
@@ -331,7 +340,34 @@ namespace Sensus.Ui.Fm2014TestBench.Properties {
}
///
- /// Looks up a localized string similar to Measured REF [pulses]:.
+ /// Looks up a localized string similar to DUT Measured Time [s]:.
+ ///
+ internal static string StrLblMeasuredDutTime {
+ get {
+ return ResourceManager.GetString("StrLblMeasuredDutTime", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to DUT/REF Tolerance [%]:.
+ ///
+ internal static string StrLblMeasuredDutToRefTolerance {
+ get {
+ return ResourceManager.GetString("StrLblMeasuredDutToRefTolerance", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Flow Rate [m³/h]:.
+ ///
+ internal static string StrLblMeasuredFlowRate {
+ get {
+ return ResourceManager.GetString("StrLblMeasuredFlowRate", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to REF Captured Pulses:.
///
internal static string StrLblMeasuredRefPulses {
get {
@@ -339,12 +375,21 @@ namespace Sensus.Ui.Fm2014TestBench.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to REF Measured Time [s]:.
+ ///
+ internal static string StrLblMeasuredRefTime {
+ get {
+ return ResourceManager.GetString("StrLblMeasuredRefTime", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Volume [liters]:.
///
- internal static string StrLblMeasuredWeightScaleVolume {
+ internal static string StrLblMeasuredVolume {
get {
- return ResourceManager.GetString("StrLblMeasuredWeightScaleVolume", resourceCulture);
+ return ResourceManager.GetString("StrLblMeasuredVolume", resourceCulture);
}
}
@@ -385,11 +430,29 @@ namespace Sensus.Ui.Fm2014TestBench.Properties {
}
///
- /// Looks up a localized string similar to Process status.
+ /// Looks up a localized string similar to Overall Process:.
///
- internal static string StrLblProcessStatus {
+ internal static string StrLblOverallProcessStatus {
get {
- return ResourceManager.GetString("StrLblProcessStatus", resourceCulture);
+ return ResourceManager.GetString("StrLblOverallProcessStatus", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to DUT Pulse Ratio [pulses/m³]:.
+ ///
+ internal static string StrLblRatioDutPulsesPerCm {
+ get {
+ return ResourceManager.GetString("StrLblRatioDutPulsesPerCm", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to REF Pulse Ratio [pulses/m³]:.
+ ///
+ internal static string StrLblRatioRefPulsesPerCm {
+ get {
+ return ResourceManager.GetString("StrLblRatioRefPulsesPerCm", resourceCulture);
}
}
@@ -403,16 +466,43 @@ namespace Sensus.Ui.Fm2014TestBench.Properties {
}
///
- /// Looks up a localized string similar to REF [pulses/m³]:.
+ /// Looks up a localized string similar to DUT Remaining Pulses:.
///
- internal static string StrLblRefPulsesPerCm {
+ internal static string StrLblRemainingDutPulses {
get {
- return ResourceManager.GetString("StrLblRefPulsesPerCm", resourceCulture);
+ return ResourceManager.GetString("StrLblRemainingDutPulses", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Scale REF/DUT [norm]:.
+ /// Looks up a localized string similar to REF Remaining Pulses:.
+ ///
+ internal static string StrLblRemainingRefPulses {
+ get {
+ return ResourceManager.GetString("StrLblRemainingRefPulses", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to DUT Required Pulses:.
+ ///
+ internal static string StrLblRequiredDutPulses {
+ get {
+ return ResourceManager.GetString("StrLblRequiredDutPulses", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to REF Required Pulses:.
+ ///
+ internal static string StrLblRequiredRefPulses {
+ get {
+ return ResourceManager.GetString("StrLblRequiredRefPulses", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to REF/DUT Ratio [norm]:.
///
internal static string StrLblScaleRefToDut {
get {
diff --git a/FM2014TestApp/Ui/Fm2014sTest/Properties/Resources.de.resx b/FM2014TestApp/Ui/Fm2014sTest/Properties/Resources.de.resx
index d5e82054..ad66980b 100644
--- a/FM2014TestApp/Ui/Fm2014sTest/Properties/Resources.de.resx
+++ b/FM2014TestApp/Ui/Fm2014sTest/Properties/Resources.de.resx
@@ -168,17 +168,17 @@
ONLINE
-
- REF [Pulse/m³]:
+
+ REF Pulsratio [Pulse/m³]:
Regulierungseinstellungen
-
- DUT [Pulse/m³]:
+
+ DUT Pulsratio [Pulse/m³]:
- REF/DUT Relation [norm]:
+ REF/DUT Ratio [norm]:
Dämpfung []:
@@ -187,22 +187,22 @@
Speichern
- Handkalibrierung REF zu Waage
+ REF zu Volumen Kalibrierung
- Gemessene REF [Pulse]:
+ REF Erfaßte Imulse:
-
+
Volumen [Liter]:
DUT zu REF Regulierung
-
+
Durchfluß [m³/h]:
-
- DUT/REF Abweichung [%]:
+
+ DUT/REF Toleranz [%]:
Toleranzdämpfung Ein
@@ -210,8 +210,8 @@
WARTE AUF FM2014 ANTWORT
-
- Prozeßfortschritt
+
+ Aktueller Prozeß:
Zeit [min:s]:
@@ -223,7 +223,7 @@
REF Frequenz [Hz]:
- Gemessene DUT [Pulse]:
+ DUT Erfaßte Impulse:
DUT zu REF Kalibrierung
@@ -252,4 +252,34 @@
Einbauplatz:
+
+ REF Erfordeliche Pulse:
+
+
+ REF Verbleibende Pulse:
+
+
+ DUT Erforderliche Pulse:
+
+
+ DUT Verbleibende Pulse:
+
+
+ REF Gemessene Zeit [s]:
+
+
+ DUT Gemessene Zeit [s]:
+
+
+ Doppelimpulstotozeit:
+
+
+ DUT/REF Toleranz min [%]:
+
+
+ DUT/REF Toleranz max [%]:
+
+
+ Gesamtprozeß:
+
\ No newline at end of file
diff --git a/FM2014TestApp/Ui/Fm2014sTest/Properties/Resources.resx b/FM2014TestApp/Ui/Fm2014sTest/Properties/Resources.resx
index b18c0bd0..405e226b 100644
--- a/FM2014TestApp/Ui/Fm2014sTest/Properties/Resources.resx
+++ b/FM2014TestApp/Ui/Fm2014sTest/Properties/Resources.resx
@@ -168,17 +168,17 @@
ONLINE
-
- REF [pulses/m³]:
+
+ REF Pulse Ratio [pulses/m³]:
Regulation Setup
-
- DUT [pulses/m³]:
+
+ DUT Pulse Ratio [pulses/m³]:
- Scale REF/DUT [norm]:
+ REF/DUT Ratio [norm]:
Attenuation []:
@@ -187,21 +187,21 @@
Save
- Manual Calibration REF to Weight-Scale
+ REF to Volume Calibration
- Measured REF [pulses]:
+ REF Captured Pulses:
-
+
Volume [liters]:
DUT to REF Regulation
-
+
Flow Rate [m³/h]:
-
+
DUT/REF Tolerance [%]:
@@ -210,8 +210,8 @@
WAITING FOR FM2014 RESPONSE
-
- Process status
+
+ Actual Process:
Time [min:s]:
@@ -223,7 +223,7 @@
REF Frequency [Hz]:
- Measured DUT [pulses]:
+ DUT Captured Pulses:
DUT to REF Calibration
@@ -232,7 +232,7 @@
_Options
- Serial Port
+ Serial Port:
_Login
@@ -252,4 +252,34 @@
Slot Selection:
+
+ REF Required Pulses:
+
+
+ REF Remaining Pulses:
+
+
+ DUT Required Pulses:
+
+
+ DUT Remaining Pulses:
+
+
+ REF Measured Time [s]:
+
+
+ DUT Measured Time [s]:
+
+
+ Double Pulses Deadtime:
+
+
+ DUT/REF Tolerance min [%]:
+
+
+ DUT/REF Tolerance max [%]:
+
+
+ Overall Process:
+
\ No newline at end of file