FM2014: refactoring,

MiniPrf: - checks extended
This commit is contained in:
Thomas Wiedebusch 2026-02-17 14:41:43 +01:00
parent c05f2fcf74
commit 6ea7407ed0
8 changed files with 669 additions and 574 deletions

View File

@ -27,269 +27,297 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
public enum CmdName public enum CmdName
{ {
/// <summary> /// <summary>
/// /// Connect the FM2014 by asking for the connection string.
/// </summary> /// </summary>
CMD_CONNECT, CmdConnect,
/// <summary> /// <summary>
/// /// Unlock the erase capability for the serial number and or the application code.
/// This should protect against unwanted access to the protected memory cells.
/// </summary> /// </summary>
CMD_UNLOCK_SETUP, CmdUnlockErase,
/// <summary> /// <summary>
/// /// Erase the serial number.
/// </summary> /// </summary>
CMD_ERASE_SETUP, CmdEraseSerialNumber,
/// <summary> /// <summary>
/// /// Read the default measurement table stored in the EEPROM of FM2014 for a standalone regulation
/// measurement.
/// </summary> /// </summary>
CMD_READ_EEP_MEAS_SETUP, CmdReadEepMeasSetup,
/// <summary> /// <summary>
/// /// Read the default measurement table actually set up in the RAM of FM2014 for a standalone
/// regulation measurement. This value is temporary and needs to be stored to the EEPROM to survive
/// a reboot.
/// </summary> /// </summary>
CMD_READ_RAM_MEAS_SETUP, CmdReadRamMeasSetup,
/// <summary> /// <summary>
/// /// Store the default measurement table actually set up in the RAM of FM2014 to the EEPROM to keep
/// this standalone regulation measurement setup upon a reboot.
/// </summary> /// </summary>
CMD_SAVE_RAM_TO_EEP_MEAS_SETUP, CmdSaveRamToEepMeasSetup,
/// <summary> /// <summary>
/// /// Switch from application to boot mode.
/// </summary> /// </summary>
CMD_BOOT_MODE, CmdSwitchToBootMode,
/// <summary> /// <summary>
/// /// Read out the extended application code information.
/// </summary> /// </summary>
CMD_PRINT_APP_INFO, CmdPrintAppInfo,
/// <summary> /// <summary>
/// /// Read out the extended boot code information.
/// </summary> /// </summary>
CMD_PRINT_BOOT_INFO, CmdPrintBootInfo,
/// <summary> /// <summary>
/// /// Read or set the baudrate for the shared serial interface between PC and FM2014s.
/// </summary> /// </summary>
CMD_BAUDRATE_PC, CmdBaudratePc,
/// <summary> /// <summary>
/// /// Use a virtual address the program the standalone regulation measurement for downwards compatibility
/// to the legacy FM85.
/// </summary> /// </summary>
CMD_GET_VIRTUAL_ADDRESS, CmdSetVirtualAddress,
/// <summary> /// <summary>
/// /// Use a virtual address the readout the standalone regulation measurement for downwards compatibility
/// to the legacy FM85.
/// </summary> /// </summary>
CMD_SERIAL, CmdGetVirtualAddress,
/// <summary> /// <summary>
/// /// Read or set the serial number of the FM2014. Writing is only allowed once. If the serial number is
/// accidentally setup wrong the 'CmdUnlockErase' followed by 'CmdEraseSerialNumber' can be used to erase it
/// being able to write the correct serial number again.
/// </summary> /// </summary>
CMD_GET_STATUS, CmdSerialNumber,
/// <summary> /// <summary>
/// /// Read the FM2014 device status as bitmask containing 'measure', 'error', 'fault1' and 'fault2' info.
/// </summary> /// </summary>
CMD_SET_VIRTUAL_ADDRESS, CmdGetStatus,
/// <summary> /// <summary>
/// /// Read the lifetime of the FM2014 in hours.
/// </summary> /// </summary>
CMD_PRINT_STATISTICS, CmdGetLifetime,
/// <summary> /// <summary>
/// /// Reset the measurement of the FM2014 to clean all settings and recalibrate the current output.
/// This has to be done before a new measurement can be initiated. Otherwise, a new setup will be
/// ignored.
/// </summary> /// </summary>
CMD_RST_MEAS, CmdResetMeasurement,
/// <summary> /// <summary>
/// /// Set the base value of the deadtime for double pulse detection ignorance time in milliseconds
/// </summary> /// </summary>
CMD_SET_DPLS_LOCK_TMR, CmdSetDoublePulseDeadtimeBase,
/// <summary> /// <summary>
/// /// Set the multiplier value to extend the deadtime for double pulse detection ignorance time set up
/// with the 'CmdSetDoublePulseDeadtimeBase'
/// </summary> /// </summary>
CMD_SET_DPLS_LOCK_MULT, CmdSetDoublePulseDeadtimeMultiplier,
/// <summary> /// <summary>
/// /// Switch the deadtime for double pulse ignorance off.
/// </summary> /// </summary>
CMD_SET_DBPL_UNLOCK, CmdSwitchDoublePulseDeadtimeOff,
/// <summary> /// <summary>
/// /// Set the pulses for a time measurement for the REF, if the DUT is going to be started, the first
/// rising edge of the DUT pulse will synchronize the REF and start the REF counter from the beginning
/// </summary> /// </summary>
CMD_DUT_SET_PLS, CmdRefSetPulsesRequired,
/// <summary> /// <summary>
/// /// Set the pulses for a time measurement for the DUT, if the DUT is going to be started, the first
/// rising edge of the DUT pulse will synchronize the REF and start the REF counter from the beginning
/// </summary> /// </summary>
CMD_REF_SET_PLS, CmdSetDutPulsesRequired,
/// <summary> /// <summary>
/// /// Read the remaining pulses set up with the 'CmdSetRefPulsesRequired' time measurement command
/// </summary> /// </summary>
CMD_DUT_GET_PLS_RMN, CmdRefPulsesRemaining,
/// <summary> /// <summary>
/// /// Read the remaining pulses set up with the 'CmdSetDutPulsesRequired' time measurement command
/// </summary> /// </summary>
CMD_REF_GET_PLS_RMN, CmdDutGetPulsesRemaining,
/// <summary> /// <summary>
/// /// Start the REF pulses counter
/// </summary> /// </summary>
CMD_REF_STR_PLS_CTR, CmdStartRefPulseCounter,
/// <summary> /// <summary>
/// /// Start the DUT pulse counter
/// </summary> /// </summary>
CMD_DUT_STR_PLS_CTR, CmdStartDutPulseCounter,
/// <summary> /// <summary>
/// /// Start the REF and DUT pulse counter together to get a synchronized value
/// </summary> /// </summary>
CMD_REF_GET_PLS_CTR, CmdStartRefAndDutPulseCounter,
/// <summary> /// <summary>
/// /// Read the actual counted REF pulses in time or pulse counter measurement
/// </summary> /// </summary>
CMD_DUT_GET_PLS_CTR, CmdGetRefPulsesCounted,
/// <summary> /// <summary>
/// /// Read the actual counted DUT pulses in time or pulse counter measurement
/// </summary> /// </summary>
CMD_REF_GET_PLS_CTR_BU, CmdGetDutPulsesCounted,
/// <summary> /// <summary>
/// /// Take a synchronized snapshot of pulses for REF and DUT and store it as backup pulses
/// </summary> /// </summary>
CMD_DUT_GET_PLS_CTR_BU, CmdBackupRefAndDutPulses,
/// <summary> /// <summary>
/// /// Read out the REF pulses synchronized between REF and DUT with 'CmdBackupRefAndDutPulses'
/// </summary> /// </summary>
CMD_REF_DUT_STR_PLS_CTR, CmdGetRefPulsesCountedBackup,
/// <summary> /// <summary>
/// /// Read out the DUT pulses synchronized between REF and DUT with 'CmdBackupRefAndDutPulses'
/// </summary> /// </summary>
CMD_REF_DUT_BU_PLS_CTR, CmdGetDutPulsesCountedBackup,
/// <summary> /// <summary>
/// /// Set up the REF to DUT scale for pulses per cubic-meters. This is needed for the regulation
/// measurement setup.
/// </summary> /// </summary>
CMD_REF_SET_SCALE, CmdRefToDutScale,
/// <summary> /// <summary>
/// /// Set up the DUT pulses per cubic-meter scale. This is needed for the regulation
/// measurement setup.
/// </summary> /// </summary>
CMD_DUT_LPP_SCALE, CmdSetRefPulsesPerCm,
/// <summary> /// <summary>
/// /// Set up the DUT pulses per cubic-meter scale. This is needed for the regulation
/// measurement setup.
/// </summary> /// </summary>
CMD_REF_LPP_SCALE, CmdSetDutPulsesPerCm,
/// <summary> /// <summary>
/// /// Set the current output attenuation which will stabilize the current output on bigger
/// numbers.
/// </summary> /// </summary>
CMD_MEAS_SET_ATTN, CmdSetCurrentOutputAttenuation,
/// <summary> /// <summary>
/// /// Read out the counted timer ticks during the time measurement of the REF. This is the
/// time from the first rising edge of the first pulse to the last after the counted pulses.
/// This value has to be multiplied with the timer resolution to get a real time.
/// </summary> /// </summary>
CMD_DUT_GET_TMR, CmdGetRefTimerTicks,
/// <summary> /// <summary>
/// /// Read out the counted timer ticks during the time measurement of the DUT. This is the
/// time from the first rising edge of the first pulse to the last after the counted pulses.
/// This value has to be multiplied with the timer resolution to get a real time.
/// </summary> /// </summary>
CMD_REF_GET_TMR, CmdGetDutTimerTicks,
/// <summary> /// <summary>
/// /// Get the undamped tolerance between DUT and REF during the regulation measurement.
/// This is a raw value which needs to be scaled to the resolution of the connected current
/// output scale.
/// </summary> /// </summary>
CMD_GET_UDTLC, CmdGetDutToRefToleranceUndamped,
/// <summary> /// <summary>
/// /// Get the damped tolerance between DUT and REF during the regulation measurement.
/// This is a raw value which needs to be scaled to the resolution of the connected current
/// output scale.
/// </summary> /// </summary>
CMD_GET_DTLC, CmdGetDutToRefToleranceDamped,
/// <summary> /// <summary>
/// /// Read out the REF period averaged over the ongoing measurement in timer ticks.
/// This value has to be multiplied with the timer resolution to get a real time.
/// </summary> /// </summary>
CMD_GET_REF_PERIOD, CmdGetRefPeriod,
/// <summary> /// <summary>
/// /// Read out the DUT period averaged over the ongoing measurement in timer ticks.
/// This value has to be multiplied with the timer resolution to get a real time.
/// </summary> /// </summary>
CMD_GET_DUT_PERIOD, CmdGetDutPeriod,
/// <summary> /// <summary>
/// /// Read the REF frequency in Hertz.
/// </summary> /// </summary>
CMD_GET_REF_FREQU, CmdGetRefFrequency,
/// <summary> /// <summary>
/// Calculate DUT to REF tolerance based on timer values /// Calculate DUT to REF tolerance based on timer values in the time measurement operation (calibration).
/// </summary> /// </summary>
CMD_CAL_DUT_TO_REF_TOL, CmdCalculatedDutToRefTolerance,
/// <summary> /// <summary>
/// Calculate frequency from REF period /// Calculate frequency from REF period.
/// </summary> /// </summary>
CMD_CAL_FREQU_REF_PERIOD, CmdCalculatedFrequRefPeriod,
/// <summary> /// <summary>
/// Calculate frequency from DUT period /// Calculate frequency from DUT period.
/// </summary> /// </summary>
CMD_CAL_FREQU_DUT_PERIOD, CmdCalculatedFrequencyDutPeriod,
/// <summary> /// <summary>
/// Calculated flow rate from REF frequency /// Calculated flow rate from REF frequency.
/// </summary> /// </summary>
CMD_CAL_FLOW_REF_FREQU, CmdCalculatedFlowRefFrequ,
/// <summary> /// <summary>
/// Calculated flow rate from REF period /// Calculated flow rate from REF period.
/// </summary> /// </summary>
CMD_CAL_FLOW_REF_PERIOD, CmdCalculatedFlowRefPeriod,
/// <summary> /// <summary>
/// Calculated flow rate from DUT period /// Calculated flow rate from DUT period.
/// </summary> /// </summary>
CMD_CAL_FLOW_DUT_PERIOD, CmdCalculatedFlowDutPeriod,
/// <summary> /// <summary>
/// Command to force a current offset correction (takes about 4 s) /// Command to force a current offset correction (takes about 4 s).
/// </summary> /// </summary>
CMD_COR_CURRENT, CmdStartCurrentOffsetCorrection,
/// <summary> /// <summary>
/// Set current to max value (20 mA) /// Set current to max value (20 mA).
/// </summary> /// </summary>
CMD_SET_XTR_MAX, CmdCurrentOutputMax,
/// <summary> /// <summary>
/// Set current to min value (-20 mA) /// Set current to min value (-20 mA).
/// </summary> /// </summary>
CMD_SET_XTR_MIN, CmdCurrentOutputMin,
/// <summary> /// <summary>
/// /// Read or set up the address of the FM2014.
/// </summary> /// </summary>
CMD_ADDR_PC, CmdAddress,
/// <summary> /// <summary>
/// /// Command code not assigned.
/// </summary> /// </summary>
CMD_NA CmdNotAssigned
} }
/// <summary> /// <summary>
@ -300,22 +328,22 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
/// <summary> /// <summary>
/// All measurements idle /// All measurements idle
/// </summary> /// </summary>
IDLE, idle,
/// <summary> /// <summary>
/// Pulse counter measurements /// Pulse counter measurements
/// </summary> /// </summary>
PULSE_CTR, pulseCounterMeasurement,
/// <summary> /// <summary>
/// Regulation measurement ongoing /// Regulation measurement ongoing
/// </summary> /// </summary>
REGULATION, regulationMeasurement,
/// <summary> /// <summary>
/// Calibration measurement ongoing /// Calibration measurement ongoing
/// </summary> /// </summary>
CALIBRATION timeMeasurement
} }
/// <summary> /// <summary>
@ -326,27 +354,27 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
/// <summary> /// <summary>
/// Unknown status /// Unknown status
/// </summary> /// </summary>
UNKNOWN, unknown,
/// <summary> /// <summary>
/// Offline: - not connected /// Offline: - not connected
/// </summary> /// </summary>
OFFLINE, offline,
/// <summary> /// <summary>
/// Standby: - connected but logged out /// Standby: - connected but logged out
/// </summary> /// </summary>
STANDBY, standby,
/// <summary> /// <summary>
/// Online: - connected and logged in /// Online: - connected and logged in
/// </summary> /// </summary>
ONLINE, online,
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
ERROR error
} }
/// <summary> /// <summary>
@ -381,11 +409,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
/// </summary> /// </summary>
public static readonly DeviceConnectionStatus[] DeviceConnectionStati = public static readonly DeviceConnectionStatus[] DeviceConnectionStati =
{ {
new DeviceConnectionStatus(ConnectionStatusName.UNKNOWN, "?"), new DeviceConnectionStatus(ConnectionStatusName.unknown, "?"),
new DeviceConnectionStatus(ConnectionStatusName.OFFLINE, "OFFLINE"), new DeviceConnectionStatus(ConnectionStatusName.offline, "OFFLINE"),
new DeviceConnectionStatus(ConnectionStatusName.STANDBY, "STANDBY"), new DeviceConnectionStatus(ConnectionStatusName.standby, "STANDBY"),
new DeviceConnectionStatus(ConnectionStatusName.ONLINE, "ONLINE"), new DeviceConnectionStatus(ConnectionStatusName.online, "ONLINE"),
new DeviceConnectionStatus(ConnectionStatusName.ERROR, Resources.StrError) new DeviceConnectionStatus(ConnectionStatusName.error, Resources.StrError)
}; };
/// <summary> /// <summary>
@ -396,23 +424,22 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
/// <summary> /// <summary>
/// Individual addressed command with answer /// Individual addressed command with answer
/// </summary> /// </summary>
INDIVIDUAL, individual,
/// <summary> /// <summary>
/// Individual addressed command without answer /// Individual addressed command without answer
/// </summary> /// </summary>
INDIVIDUAL_UNRESPONSIVE, individualUnresponsive,
/// <summary> /// <summary>
/// Broadcast command without answer to address 0 or individual without answer /// Broadcast command without answer to address 0 or individual without answer
/// </summary> /// </summary>
BROADCAST, broadcast,
/// <summary> /// <summary>
/// Uninitialized addressing command type /// Uninitialized addressing command type
/// </summary> /// </summary>
NOT_INITIALIZED, uninitialized
} }
/// <summary> /// <summary>
@ -423,37 +450,37 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
/// <summary> /// <summary>
/// String taken directly to send or as received /// String taken directly to send or as received
/// </summary> /// </summary>
STRING, stringValue,
/// <summary> /// <summary>
/// Double format /// Double format
/// </summary> /// </summary>
DOUBLE, doubleValue,
/// <summary> /// <summary>
/// Hexadecimal integer /// Hexadecimal integer
/// </summary> /// </summary>
UINT_HEX, uintHexValue,
/// <summary> /// <summary>
/// Hexadecimal byte plus additional sign /// Hexadecimal byte plus additional sign
/// </summary> /// </summary>
BYTE_HEX_PLUS_SIGN, byteHexValuePlusSign,
/// <summary> /// <summary>
/// Decimal integer /// Decimal integer
/// </summary> /// </summary>
UINT_DEZ, uintDecimalValue,
/// <summary> /// <summary>
/// Individual formatting required /// Individual formatting required
/// </summary> /// </summary>
INDIVIDUAL, individual,
/// <summary> /// <summary>
/// Parameterless means the command will be sent without any parameter /// Parameterless means the command will be sent without any parameter
/// </summary> /// </summary>
PARAMETERLESS parameterless
} }
/// <summary> /// <summary>
@ -521,26 +548,26 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
public const String ADDR_VALIDATION_STR = "@"; public const String ADDR_VALIDATION_STR = "@";
/// <summary> /// <summary>
/// Partial search string for <see cref="CmdName.CMD_READ_EEP_MEAS_SETUP"/> /// Partial search string for <see cref="CmdName.CmdReadEepMeasSetup"/>
/// and <see cref="CmdName.CMD_READ_RAM_MEAS_SETUP"/> for 'Attenuation'. /// and <see cref="CmdName.CmdReadRamMeasSetup"/> for 'Attenuation'.
/// </summary> /// </summary>
public const String StandAlonePartSearchAttenuationStr = "Attenuation"; public const String StandAlonePartSearchAttenuationStr = "Attenuation";
/// <summary> /// <summary>
/// Partial search string for <see cref="CmdName.CMD_READ_EEP_MEAS_SETUP"/> /// Partial search string for <see cref="CmdName.CmdReadEepMeasSetup"/>
/// and <see cref="CmdName.CMD_READ_RAM_MEAS_SETUP"/> for 'Scale REF to DUT'. /// and <see cref="CmdName.CmdReadRamMeasSetup"/> for 'Scale REF to DUT'.
/// </summary> /// </summary>
public const String StandAlonePartSearchScaleStr = "Scale"; public const String StandAlonePartSearchScaleStr = "Scale";
/// <summary> /// <summary>
/// Partial search string for <see cref="CmdName.CMD_READ_EEP_MEAS_SETUP"/> /// Partial search string for <see cref="CmdName.CmdReadEepMeasSetup"/>
/// and <see cref="CmdName.CMD_READ_RAM_MEAS_SETUP"/> for 'Pulses per volume REF'. /// and <see cref="CmdName.CmdReadRamMeasSetup"/> for 'Pulses per volume REF'.
/// </summary> /// </summary>
public const String StandAlonePartSearchRefPpvStr = "Pulses per volume REF"; public const String StandAlonePartSearchRefPpvStr = "Pulses per volume REF";
/// <summary> /// <summary>
/// Partial search string for <see cref="CmdName.CMD_READ_EEP_MEAS_SETUP"/> /// Partial search string for <see cref="CmdName.CmdReadEepMeasSetup"/>
/// and <see cref="CmdName.CMD_READ_RAM_MEAS_SETUP"/> for 'Pulses per volume DUT'. /// and <see cref="CmdName.CmdReadRamMeasSetup"/> for 'Pulses per volume DUT'.
/// </summary> /// </summary>
public const String StandAlonePartSearchDutPpvStr = "Pulses per volume DUT"; public const String StandAlonePartSearchDutPpvStr = "Pulses per volume DUT";
@ -561,65 +588,65 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co
public static readonly List<Cmd> CmdTbl = new List<Cmd> public static readonly List<Cmd> CmdTbl = new List<Cmd>
{ {
// FM2014 control and information // FM2014 control and information
new Cmd(CmdName.CMD_CONNECT, "", CmdType.INDIVIDUAL, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgConnect), new Cmd(CmdName.CmdConnect, "", CmdType.individual, ParaFormat.parameterless, Resources.StrCmdMsgConnect),
new Cmd(CmdName.CMD_UNLOCK_SETUP, "&U@", CmdType.INDIVIDUAL, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgUnlock), new Cmd(CmdName.CmdUnlockErase, "&U@", CmdType.individual, ParaFormat.parameterless, Resources.StrCmdMsgUnlock),
new Cmd(CmdName.CMD_ERASE_SETUP, "&E@", CmdType.INDIVIDUAL, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgErase), new Cmd(CmdName.CmdEraseSerialNumber, "&E@", CmdType.individual, ParaFormat.parameterless, Resources.StrCmdMsgErase),
new Cmd(CmdName.CMD_READ_EEP_MEAS_SETUP, "%D@", CmdType.INDIVIDUAL, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgReadDefMeasSetup), new Cmd(CmdName.CmdReadEepMeasSetup, "%D@", CmdType.individual, ParaFormat.parameterless, Resources.StrCmdMsgReadDefMeasSetup),
new Cmd(CmdName.CMD_READ_RAM_MEAS_SETUP, "%A@", CmdType.INDIVIDUAL, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgActualDefMeasSetup), new Cmd(CmdName.CmdReadRamMeasSetup, "%A@", CmdType.individual, ParaFormat.parameterless, Resources.StrCmdMsgActualDefMeasSetup),
new Cmd(CmdName.CMD_SAVE_RAM_TO_EEP_MEAS_SETUP, "%S@", CmdType.INDIVIDUAL, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgStoreDefMeasSetup), new Cmd(CmdName.CmdSaveRamToEepMeasSetup, "%S@", CmdType.individual, ParaFormat.parameterless, Resources.StrCmdMsgStoreDefMeasSetup),
new Cmd(CmdName.CMD_BOOT_MODE, "$B@", CmdType.INDIVIDUAL, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgBootMode), new Cmd(CmdName.CmdSwitchToBootMode, "$B@", CmdType.individual, ParaFormat.parameterless, Resources.StrCmdMsgBootMode),
new Cmd(CmdName.CMD_PRINT_APP_INFO, "?A", CmdType.INDIVIDUAL, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgPrintAppInfo), new Cmd(CmdName.CmdPrintAppInfo, "?A", CmdType.individual, ParaFormat.parameterless, Resources.StrCmdMsgPrintAppInfo),
new Cmd(CmdName.CMD_PRINT_BOOT_INFO, "?B", CmdType.INDIVIDUAL, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgPrintBootInfo), new Cmd(CmdName.CmdPrintBootInfo, "?B", CmdType.individual, ParaFormat.parameterless, Resources.StrCmdMsgPrintBootInfo),
new Cmd(CmdName.CMD_BAUDRATE_PC, "=BP", CmdType.INDIVIDUAL, ParaFormat.UINT_DEZ, Resources.StrCmdMsgBaudrateAll), new Cmd(CmdName.CmdBaudratePc, "=BP", CmdType.individual, ParaFormat.uintDecimalValue, Resources.StrCmdMsgBaudrateAll),
new Cmd(CmdName.CMD_GET_VIRTUAL_ADDRESS, " ", CmdType.INDIVIDUAL, ParaFormat.UINT_HEX, Resources.StrCmdMsgGetVirtualAddress), new Cmd(CmdName.CmdGetVirtualAddress, " ", CmdType.individual, ParaFormat.uintHexValue, Resources.StrCmdMsgGetVirtualAddress),
new Cmd(CmdName.CMD_SERIAL, "#", CmdType.INDIVIDUAL, ParaFormat.UINT_DEZ, Resources.StrCmdMsgSerial), new Cmd(CmdName.CmdSerialNumber, "#", CmdType.individual, ParaFormat.uintDecimalValue, Resources.StrCmdMsgSerial),
new Cmd(CmdName.CMD_GET_STATUS, UNICODE_ACK, CmdType.INDIVIDUAL, ParaFormat.UINT_HEX, Resources.StrCmdMsgGetStatus), new Cmd(CmdName.CmdGetStatus, UNICODE_ACK, CmdType.individual, ParaFormat.uintHexValue, Resources.StrCmdMsgGetStatus),
new Cmd(CmdName.CMD_SET_VIRTUAL_ADDRESS, "N", CmdType.INDIVIDUAL, ParaFormat.UINT_HEX, Resources.StrCmdMsgSetVirtualAddress), new Cmd(CmdName.CmdSetVirtualAddress, "N", CmdType.individual, ParaFormat.uintHexValue, Resources.StrCmdMsgSetVirtualAddress),
new Cmd(CmdName.CMD_PRINT_STATISTICS, "!", CmdType.INDIVIDUAL, ParaFormat.STRING, Resources.StrCmdMsgPrintStatistics), new Cmd(CmdName.CmdGetLifetime, "!", CmdType.individual, ParaFormat.stringValue, Resources.StrCmdMsgPrintStatistics),
//measurement reset //measurement reset
new Cmd(CmdName.CMD_RST_MEAS, "R", CmdType.BROADCAST, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgRstMeas), new Cmd(CmdName.CmdResetMeasurement, "R", CmdType.broadcast, ParaFormat.parameterless, Resources.StrCmdMsgRstMeas),
// Double impulse detection settings // Double impulse detection settings
new Cmd(CmdName.CMD_SET_DPLS_LOCK_TMR, "S", CmdType.BROADCAST, ParaFormat.UINT_DEZ, Resources.StrCmdMsgDplsLockTmr), new Cmd(CmdName.CmdSetDoublePulseDeadtimeBase, "S", CmdType.broadcast, ParaFormat.uintDecimalValue, Resources.StrCmdMsgDplsLockTmr),
new Cmd(CmdName.CMD_SET_DPLS_LOCK_MULT, "s", CmdType.BROADCAST, ParaFormat.UINT_DEZ, Resources.StrCmdMsgDplsLockMult), new Cmd(CmdName.CmdSetDoublePulseDeadtimeMultiplier, "s", CmdType.broadcast, ParaFormat.uintDecimalValue, Resources.StrCmdMsgDplsLockMult),
new Cmd(CmdName.CMD_SET_DBPL_UNLOCK, "G", CmdType.BROADCAST, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgSetDbplUnlock), new Cmd(CmdName.CmdSwitchDoublePulseDeadtimeOff, "G", CmdType.broadcast, ParaFormat.parameterless, Resources.StrCmdMsgSetDbplUnlock),
// Main measurement pulse settings and readout // Main measurement pulse settings and readout
new Cmd(CmdName.CMD_DUT_SET_PLS, "H", CmdType.BROADCAST, ParaFormat.UINT_HEX, Resources.StrCmdMsgDutSetPls), new Cmd(CmdName.CmdSetDutPulsesRequired, "H", CmdType.broadcast, ParaFormat.uintHexValue, Resources.StrCmdMsgDutSetPls),
new Cmd(CmdName.CMD_REF_SET_PLS, "M", CmdType.BROADCAST, ParaFormat.UINT_HEX, Resources.StrCmdMsgRefSetPls), new Cmd(CmdName.CmdRefSetPulsesRequired, "M", CmdType.broadcast, ParaFormat.uintHexValue, Resources.StrCmdMsgRefSetPls),
new Cmd(CmdName.CMD_DUT_GET_PLS_RMN, "I", CmdType.INDIVIDUAL, ParaFormat.UINT_HEX, Resources.StrCmdMsgDutGetPlsRmn), new Cmd(CmdName.CmdDutGetPulsesRemaining, "I", CmdType.individual, ParaFormat.uintHexValue, Resources.StrCmdMsgDutGetPlsRmn),
new Cmd(CmdName.CMD_REF_GET_PLS_RMN, "J", CmdType.INDIVIDUAL, ParaFormat.UINT_HEX, Resources.StrCmdMsgRefGetPlsRmn), new Cmd(CmdName.CmdRefPulsesRemaining, "J", CmdType.individual, ParaFormat.uintHexValue, Resources.StrCmdMsgRefGetPlsRmn),
// Pulse counters start, readout and backup // Pulse counters start, readout and backup
new Cmd(CmdName.CMD_REF_STR_PLS_CTR, "O", CmdType.BROADCAST, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgRefStrPlsCtr), new Cmd(CmdName.CmdStartRefPulseCounter, "O", CmdType.broadcast, ParaFormat.parameterless, Resources.StrCmdMsgRefStrPlsCtr),
new Cmd(CmdName.CMD_DUT_STR_PLS_CTR, "Q", CmdType.BROADCAST, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgDutStrPlsCtr), new Cmd(CmdName.CmdStartDutPulseCounter, "Q", CmdType.broadcast, ParaFormat.parameterless, Resources.StrCmdMsgDutStrPlsCtr),
new Cmd(CmdName.CMD_REF_GET_PLS_CTR, "L", CmdType.INDIVIDUAL, ParaFormat.UINT_HEX, Resources.StrCmdMsgRefGetPlsCtr), new Cmd(CmdName.CmdGetRefPulsesCounted, "L", CmdType.individual, ParaFormat.uintHexValue, Resources.StrCmdMsgRefGetPlsCtr),
new Cmd(CmdName.CMD_DUT_GET_PLS_CTR, "U", CmdType.INDIVIDUAL, ParaFormat.UINT_HEX, Resources.StrCmdMsgDutGetPlsCtr), new Cmd(CmdName.CmdGetDutPulsesCounted, "U", CmdType.individual, ParaFormat.uintHexValue, Resources.StrCmdMsgDutGetPlsCtr),
new Cmd(CmdName.CMD_REF_GET_PLS_CTR_BU, "l", CmdType.INDIVIDUAL, ParaFormat.UINT_HEX, Resources.StrCmdMsgRefGetPlsCtrBu), new Cmd(CmdName.CmdGetRefPulsesCountedBackup, "l", CmdType.individual, ParaFormat.uintHexValue, Resources.StrCmdMsgRefGetPlsCtrBu),
new Cmd(CmdName.CMD_DUT_GET_PLS_CTR_BU, "u", CmdType.INDIVIDUAL, ParaFormat.UINT_HEX, Resources.StrCmdMsgDutGetPlsCtrBu), new Cmd(CmdName.CmdGetDutPulsesCountedBackup, "u", CmdType.individual, ParaFormat.uintHexValue, Resources.StrCmdMsgDutGetPlsCtrBu),
new Cmd(CmdName.CMD_REF_DUT_STR_PLS_CTR, "o", CmdType.BROADCAST, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgRefDutStrPlsCtr), new Cmd(CmdName.CmdStartRefAndDutPulseCounter, "o", CmdType.broadcast, ParaFormat.parameterless, Resources.StrCmdMsgRefDutStrPlsCtr),
new Cmd(CmdName.CMD_REF_DUT_BU_PLS_CTR, "q", CmdType.BROADCAST, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgRefDutBuPlsCtr), new Cmd(CmdName.CmdBackupRefAndDutPulses, "q", CmdType.broadcast, ParaFormat.parameterless, Resources.StrCmdMsgRefDutBuPlsCtr),
// General measurement setup // General measurement setup
new Cmd(CmdName.CMD_REF_SET_SCALE, "K", CmdType.BROADCAST, ParaFormat.INDIVIDUAL, Resources.StrCmdMsgRefSetScale), new Cmd(CmdName.CmdRefToDutScale, "K", CmdType.broadcast, ParaFormat.individual, Resources.StrCmdMsgRefSetScale),
new Cmd(CmdName.CMD_DUT_LPP_SCALE, "V", CmdType.INDIVIDUAL_UNRESPONSIVE, ParaFormat.UINT_DEZ, Resources.StrCmdMsgDutLppScale), new Cmd(CmdName.CmdSetDutPulsesPerCm, "V", CmdType.individualUnresponsive, ParaFormat.uintDecimalValue, Resources.StrCmdMsgDutLppScale),
new Cmd(CmdName.CMD_REF_LPP_SCALE, "W", CmdType.INDIVIDUAL_UNRESPONSIVE, ParaFormat.UINT_DEZ, Resources.StrCmdMsgRefLppScale), new Cmd(CmdName.CmdSetRefPulsesPerCm, "W", CmdType.individualUnresponsive, ParaFormat.uintDecimalValue, Resources.StrCmdMsgRefLppScale),
new Cmd(CmdName.CMD_MEAS_SET_ATTN, "T", CmdType.BROADCAST, ParaFormat.UINT_DEZ, Resources.StrCmdMsgMeasSetAttn), new Cmd(CmdName.CmdSetCurrentOutputAttenuation, "T", CmdType.broadcast, ParaFormat.uintDecimalValue, Resources.StrCmdMsgMeasSetAttn),
// Measurement result request // Measurement result request
new Cmd(CmdName.CMD_DUT_GET_TMR, "X", CmdType.INDIVIDUAL, ParaFormat.UINT_HEX, Resources.StrCmdMsgDutGetTmr), new Cmd(CmdName.CmdGetDutTimerTicks, "X", CmdType.individual, ParaFormat.uintHexValue, Resources.StrCmdMsgDutGetTmr),
new Cmd(CmdName.CMD_REF_GET_TMR, "Y", CmdType.INDIVIDUAL, ParaFormat.UINT_HEX, Resources.StrCmdMsgRefGetTmr), new Cmd(CmdName.CmdGetRefTimerTicks, "Y", CmdType.individual, ParaFormat.uintHexValue, Resources.StrCmdMsgRefGetTmr),
new Cmd(CmdName.CMD_CAL_DUT_TO_REF_TOL, "", CmdType.INDIVIDUAL, ParaFormat.DOUBLE, Resources.StrCalDutToRefTol), new Cmd(CmdName.CmdCalculatedDutToRefTolerance, "", CmdType.individual, ParaFormat.doubleValue, Resources.StrCalDutToRefTol),
new Cmd(CmdName.CMD_GET_UDTLC, "Z", CmdType.INDIVIDUAL, ParaFormat.BYTE_HEX_PLUS_SIGN, Resources.StrCmdMsgGetUdtlc), new Cmd(CmdName.CmdGetDutToRefToleranceUndamped, "Z", CmdType.individual, ParaFormat.byteHexValuePlusSign, Resources.StrCmdMsgGetUdtlc),
new Cmd(CmdName.CMD_GET_DTLC, "z", CmdType.INDIVIDUAL, ParaFormat.BYTE_HEX_PLUS_SIGN, Resources.StrCmdMsgGetDtlc), new Cmd(CmdName.CmdGetDutToRefToleranceDamped, "z", CmdType.individual, ParaFormat.byteHexValuePlusSign, Resources.StrCmdMsgGetDtlc),
new Cmd(CmdName.CMD_GET_REF_PERIOD, UNICODE_DLE, CmdType.INDIVIDUAL, ParaFormat.UINT_HEX, Resources.StrCmdMsgGetRefPeriod), new Cmd(CmdName.CmdGetRefPeriod, UNICODE_DLE, CmdType.individual, ParaFormat.uintHexValue, Resources.StrCmdMsgGetRefPeriod),
new Cmd(CmdName.CMD_GET_DUT_PERIOD, UNICODE_DC1, CmdType.INDIVIDUAL,ParaFormat.UINT_HEX, Resources.StrCmdMsgGetDutPeriod), new Cmd(CmdName.CmdGetDutPeriod, UNICODE_DC1, CmdType.individual,ParaFormat.uintHexValue, Resources.StrCmdMsgGetDutPeriod),
new Cmd(CmdName.CMD_GET_REF_FREQU, UNICODE_DC2, CmdType.INDIVIDUAL, ParaFormat.UINT_HEX, Resources.StrCmdMsgGetRefFrequ), new Cmd(CmdName.CmdGetRefFrequency, UNICODE_DC2, CmdType.individual, ParaFormat.uintHexValue, Resources.StrCmdMsgGetRefFrequ),
new Cmd(CmdName.CMD_CAL_FREQU_REF_PERIOD, "", CmdType.INDIVIDUAL, ParaFormat.DOUBLE, Resources.StrCalRefFrequFromRefPeriod), new Cmd(CmdName.CmdCalculatedFrequRefPeriod, "", CmdType.individual, ParaFormat.doubleValue, Resources.StrCalRefFrequFromRefPeriod),
new Cmd(CmdName.CMD_CAL_FREQU_DUT_PERIOD, "", CmdType.INDIVIDUAL, ParaFormat.DOUBLE, Resources.StrCalDutFrequFromDutPeriod), new Cmd(CmdName.CmdCalculatedFrequencyDutPeriod, "", CmdType.individual, ParaFormat.doubleValue, Resources.StrCalDutFrequFromDutPeriod),
new Cmd(CmdName.CMD_CAL_FLOW_REF_FREQU, "", CmdType.INDIVIDUAL, ParaFormat.DOUBLE, Resources.StrCalRefFlowRateFromRefFrequ), new Cmd(CmdName.CmdCalculatedFlowRefFrequ, "", CmdType.individual, ParaFormat.doubleValue, Resources.StrCalRefFlowRateFromRefFrequ),
new Cmd(CmdName.CMD_CAL_FLOW_REF_PERIOD, "", CmdType.INDIVIDUAL, ParaFormat.DOUBLE, Resources.StrCalRefFlowRateFromRefPeriod), new Cmd(CmdName.CmdCalculatedFlowRefPeriod, "", CmdType.individual, ParaFormat.doubleValue, Resources.StrCalRefFlowRateFromRefPeriod),
new Cmd(CmdName.CMD_CAL_FLOW_DUT_PERIOD, "", CmdType.INDIVIDUAL, ParaFormat.DOUBLE, Resources.StrCalDutFlowRateFromDutPeriod), new Cmd(CmdName.CmdCalculatedFlowDutPeriod, "", CmdType.individual, ParaFormat.doubleValue, Resources.StrCalDutFlowRateFromDutPeriod),
// Adjustment, place here Ids which may represent digital numbers from A to F // Adjustment, place here Ids which may represent digital numbers from A to F
new Cmd(CmdName.CMD_COR_CURRENT, "C", CmdType.BROADCAST, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgCorCurrent), new Cmd(CmdName.CmdStartCurrentOffsetCorrection, "C", CmdType.broadcast, ParaFormat.parameterless, Resources.StrCmdMsgCorCurrent),
new Cmd(CmdName.CMD_SET_XTR_MAX, "+", CmdType.BROADCAST, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgSetXtrMax), new Cmd(CmdName.CmdCurrentOutputMax, "+", CmdType.broadcast, ParaFormat.parameterless, Resources.StrCmdMsgSetXtrMax),
new Cmd(CmdName.CMD_SET_XTR_MIN, "-", CmdType.BROADCAST, ParaFormat.PARAMETERLESS, Resources.StrCmdMsgSetXtrMin), new Cmd(CmdName.CmdCurrentOutputMin, "-", CmdType.broadcast, ParaFormat.parameterless, Resources.StrCmdMsgSetXtrMin),
new Cmd(CmdName.CMD_ADDR_PC, "A", CmdType.INDIVIDUAL, ParaFormat.UINT_DEZ, Resources.StrCmdMsgAddrPc) new Cmd(CmdName.CmdAddress, "A", CmdType.individual, ParaFormat.uintDecimalValue, Resources.StrCmdMsgAddrPc)
}; };
/// <summary> /// <summary>

View File

@ -562,7 +562,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
} while (mantissa < REF_TO_DUT_SCALE_MANTISSA_MIN); } while (mantissa < REF_TO_DUT_SCALE_MANTISSA_MIN);
// The pre-generated string will be used to send it to the FM2014 directly // The pre-generated string will be used to send it to the FM2014 directly
RefToDutScaleStr = $"{mantissa}{GetCmdStr(CmdName.CMD_REF_SET_SCALE)}{exponent}"; RefToDutScaleStr = $"{mantissa}{GetCmdStr(CmdName.CmdRefToDutScale)}{exponent}";
} }
} }
@ -700,7 +700,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
/// </remarks> /// </remarks>
public static Boolean ResetHardwareAllDevices() public static Boolean ResetHardwareAllDevices()
{ {
if (SharedCyclicMeasSequ == CyclicMeasSequ.IDLE) if (SharedCyclicMeasSequ == CyclicMeasSequ.idle)
return true; return true;
var firstActiveFm2014 = GetFirstConnectedAndLoggedInFm2014(); var firstActiveFm2014 = GetFirstConnectedAndLoggedInFm2014();
@ -708,7 +708,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
return false; return false;
// Exit tasks // Exit tasks
SharedCyclicMeasSequ = CyclicMeasSequ.IDLE; SharedCyclicMeasSequ = CyclicMeasSequ.idle;
// Schedule to other tasks to avoid side effects through the reset command // Schedule to other tasks to avoid side effects through the reset command
Task.Factory.StartNew(() => Task.Factory.StartNew(() =>
@ -717,8 +717,8 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
}).ContinueWith(delegate }).ContinueWith(delegate
{ {
// Reset measurement // Reset measurement
var infoStr = GetCmdInfo(CmdName.CMD_RST_MEAS); var infoStr = GetCmdInfo(CmdName.CmdResetMeasurement);
if (!Write(CmdName.CMD_RST_MEAS, firstActiveFm2014)) if (!Write(CmdName.CmdResetMeasurement, firstActiveFm2014))
return; return;
// Wait until FM2014 calibration finished // Wait until FM2014 calibration finished
@ -728,7 +728,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
do do
{ {
// Change the SI unit to ms instead of seconds // Change the SI unit to ms instead of seconds
var response = new CmdResponse(CmdName.CMD_RST_MEAS, infoStr, (UInt32)resetDelayCtr_ms, var response = new CmdResponse(CmdName.CmdResetMeasurement, infoStr, (UInt32)resetDelayCtr_ms,
unit: "m" + Units.GetInfo(Units.Name.TIME_s)); unit: "m" + Units.GetInfo(Units.Name.TIME_s));
PublishResponse(firstActiveFm2014, new ProcessExecEventArgs("", PublishResponse(firstActiveFm2014, new ProcessExecEventArgs("",
actualProcessMessage: infoStr, actualProcessMessage: infoStr,
@ -752,7 +752,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
/// </remarks> /// </remarks>
public static Boolean StoreAllConfigurations() public static Boolean StoreAllConfigurations()
{ {
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE || if (SharedCyclicMeasSequ != CyclicMeasSequ.idle ||
RegisteredFm2014s == null || RegisteredFm2014s == null ||
RegisteredFm2014s.Count == 0 || RegisteredFm2014s.Count == 0 ||
RegisteredFm2014s.All(x => !x.IsLoggedOn)) RegisteredFm2014s.All(x => !x.IsLoggedOn))
@ -883,11 +883,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
public static Boolean PulseCounterMeasurement(Boolean refPulseCtrOn, Boolean dutPulseCtrOn) public static Boolean PulseCounterMeasurement(Boolean refPulseCtrOn, Boolean dutPulseCtrOn)
{ {
// If the cyclic task has already been started everything is fine // If the cyclic task has already been started everything is fine
if (SharedCyclicMeasSequ == CyclicMeasSequ.PULSE_CTR) if (SharedCyclicMeasSequ == CyclicMeasSequ.pulseCounterMeasurement)
return true; return true;
// Marked measurement isn't pulse counter measurement, other FM2014s cannot activate this // Marked measurement isn't pulse counter measurement, other FM2014s cannot activate this
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle)
return false; return false;
var firstActiveFm2014 = GetFirstConnectedAndLoggedInFm2014(); var firstActiveFm2014 = GetFirstConnectedAndLoggedInFm2014();
@ -912,7 +912,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
return false; return false;
} }
var cmdName = CmdName.CMD_NA; var cmdName = CmdName.CmdNotAssigned;
// Prepare REF and/or DUT pulse counter measurement, the first call activates if one or both are started! // Prepare REF and/or DUT pulse counter measurement, the first call activates if one or both are started!
try try
@ -920,15 +920,15 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
switch (firstActiveFm2014.RefPulseCtrOn) switch (firstActiveFm2014.RefPulseCtrOn)
{ {
case true when firstActiveFm2014.DutPulseCtrOn: case true when firstActiveFm2014.DutPulseCtrOn:
cmdName = CmdName.CMD_REF_DUT_STR_PLS_CTR; cmdName = CmdName.CmdStartRefAndDutPulseCounter;
MeasurementInfo = Resources.StrMeasMsgPulseCtrRefDut; MeasurementInfo = Resources.StrMeasMsgPulseCtrRefDut;
break; break;
case true: case true:
cmdName = CmdName.CMD_REF_STR_PLS_CTR; cmdName = CmdName.CmdStartRefPulseCounter;
MeasurementInfo = Resources.StrMeasMsgPulseCtrRef; MeasurementInfo = Resources.StrMeasMsgPulseCtrRef;
break; break;
default: default:
cmdName = CmdName.CMD_DUT_STR_PLS_CTR; cmdName = CmdName.CmdStartDutPulseCounter;
MeasurementInfo = Resources.StrMeasMsgPulseCtrDut; MeasurementInfo = Resources.StrMeasMsgPulseCtrDut;
break; break;
} }
@ -952,7 +952,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
{ {
// Mark pulse counter measurement as active // Mark pulse counter measurement as active
SharedCyclicMeasSequ = CyclicMeasSequ.PULSE_CTR; SharedCyclicMeasSequ = CyclicMeasSequ.pulseCounterMeasurement;
do do
{ {
@ -963,14 +963,14 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Check if any FM2014 has a synchronized request to synchronize all FM2014 pulse counter values // Check if any FM2014 has a synchronized request to synchronize all FM2014 pulse counter values
if (RegisteredFm2014s.Any(x => x.RefPulseCtrOn && x.DutPulseCtrOn)) if (RegisteredFm2014s.Any(x => x.RefPulseCtrOn && x.DutPulseCtrOn))
{ {
cmdNameDut = CmdName.CMD_DUT_GET_PLS_CTR_BU; cmdNameDut = CmdName.CmdGetDutPulsesCountedBackup;
cmdNameRef = CmdName.CMD_REF_GET_PLS_CTR_BU; cmdNameRef = CmdName.CmdGetRefPulsesCountedBackup;
syncPulseCtr = true; syncPulseCtr = true;
} }
else else
{ {
cmdNameDut = CmdName.CMD_DUT_GET_PLS_CTR; cmdNameDut = CmdName.CmdGetDutPulsesCounted;
cmdNameRef = CmdName.CMD_REF_GET_PLS_CTR; cmdNameRef = CmdName.CmdGetRefPulsesCounted;
syncPulseCtr = false; syncPulseCtr = false;
} }
@ -979,17 +979,17 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
var infoDut = GetCmdInfo(cmdNameDut); var infoDut = GetCmdInfo(cmdNameDut);
// Make a backup of the pulse counters to synchronize those and read out the backups // Make a backup of the pulse counters to synchronize those and read out the backups
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE && syncPulseCtr) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle && syncPulseCtr)
{ {
// Synchronized backup of REF and DUT pulse counter // Synchronized backup of REF and DUT pulse counter
Write(CmdName.CMD_REF_DUT_BU_PLS_CTR, firstActiveFm2014); Write(CmdName.CmdBackupRefAndDutPulses, firstActiveFm2014);
} }
foreach (var fm2014 in RegisteredFm2014s.Where(fm2014 => fm2014.IsLoggedOn)) foreach (var fm2014 in RegisteredFm2014s.Where(fm2014 => fm2014.IsLoggedOn))
{ {
try try
{ {
if (SharedCyclicMeasSequ == CyclicMeasSequ.IDLE) continue; if (SharedCyclicMeasSequ == CyclicMeasSequ.idle) continue;
if (fm2014.RefPulseCtrOn && Write(cmdNameRef, fm2014)) if (fm2014.RefPulseCtrOn && Write(cmdNameRef, fm2014))
{ {
@ -1016,7 +1016,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
specificInfoObj: response, statusReturn: StatusReturn.Failed)); specificInfoObj: response, statusReturn: StatusReturn.Failed));
} }
} }
} while (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE); } while (SharedCyclicMeasSequ != CyclicMeasSequ.idle);
}, SharedCancellationToken).ContinueWith(delegate }, SharedCancellationToken).ContinueWith(delegate
{ {
foreach (var fm2014 in RegisteredFm2014s) foreach (var fm2014 in RegisteredFm2014s)
@ -1066,11 +1066,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
UInt16 doublePulseDeadtime_ms, Byte currentOutputAttenuation) UInt16 doublePulseDeadtime_ms, Byte currentOutputAttenuation)
{ {
// If the cyclic task has already been started everything is fine // If the cyclic task has already been started everything is fine
if (SharedCyclicMeasSequ == CyclicMeasSequ.REGULATION) if (SharedCyclicMeasSequ == CyclicMeasSequ.regulationMeasurement)
return true; return true;
// Marked measurement isn't pulse counter measurement, other FM2014s cannot activate this // Marked measurement isn't pulse counter measurement, other FM2014s cannot activate this
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle)
return false; return false;
// Initially, check if any device is connected and logged in, if not => exit // Initially, check if any device is connected and logged in, if not => exit
@ -1103,23 +1103,23 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
return false; return false;
} }
var cmdName = CmdName.CMD_NA; var cmdName = CmdName.CmdNotAssigned;
MeasurementInfo = Resources.StrMeasMsgRegulation; MeasurementInfo = Resources.StrMeasMsgRegulation;
// Prepare regulation measurement // Prepare regulation measurement
try try
{ {
cmdName = CmdName.CMD_SET_DBPL_UNLOCK; cmdName = CmdName.CmdSwitchDoublePulseDeadtimeOff;
if (!Write(cmdName, firstActiveFm2014)) if (!Write(cmdName, firstActiveFm2014))
{ {
return false; return false;
} }
cmdName = CmdName.CMD_MEAS_SET_ATTN; cmdName = CmdName.CmdSetCurrentOutputAttenuation;
if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.CurrentOutputAttenuation)) if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.CurrentOutputAttenuation))
{ {
return false; return false;
} }
cmdName = CmdName.CMD_REF_SET_SCALE; cmdName = CmdName.CmdRefToDutScale;
if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.RefToDutScaleStr)) if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.RefToDutScaleStr))
{ {
return false; return false;
@ -1137,7 +1137,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
Task.Run(() => Task.Run(() =>
{ {
// Mark regulation measurement as active // Mark regulation measurement as active
SharedCyclicMeasSequ = CyclicMeasSequ.REGULATION; SharedCyclicMeasSequ = CyclicMeasSequ.regulationMeasurement;
do do
{ {
@ -1148,9 +1148,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Read out the damped/undamped tolerance and convert the raw value (0, +/-1..255 digits) to the // Read out the damped/undamped tolerance and convert the raw value (0, +/-1..255 digits) to the
// tolerance in percent depending on the setup to 3 % (3.3) of 5 % (5.5) // tolerance in percent depending on the setup to 3 % (3.3) of 5 % (5.5)
StatusReturn statusReturn; StatusReturn statusReturn;
cmdName = fm2014.UseDampedTolerance ? CmdName.CMD_GET_DTLC : CmdName.CMD_GET_UDTLC; cmdName = fm2014.UseDampedTolerance ? CmdName.CmdGetDutToRefToleranceDamped : CmdName.CmdGetDutToRefToleranceUndamped;
var info = GetCmdInfo(cmdName); var info = GetCmdInfo(cmdName);
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE && Write(cmdName, fm2014)) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle && Write(cmdName, fm2014))
{ {
if (Read(cmdName, fm2014, out _, out _, out var doubleValue)) if (Read(cmdName, fm2014, out _, out _, out var doubleValue))
{ {
@ -1171,9 +1171,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
} }
// Read the REF period and calculate the frequency [Hz] and flow rate [m³/h] based on this period // Read the REF period and calculate the frequency [Hz] and flow rate [m³/h] based on this period
cmdName = CmdName.CMD_GET_REF_PERIOD; cmdName = CmdName.CmdGetRefPeriod;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
if (fm2014.RequestDebugInformation && SharedCyclicMeasSequ != CyclicMeasSequ.IDLE && if (fm2014.RequestDebugInformation && SharedCyclicMeasSequ != CyclicMeasSequ.idle &&
Write(cmdName, fm2014)) Write(cmdName, fm2014))
{ {
if (Read(cmdName, fm2014, out _, out var period, out _)) if (Read(cmdName, fm2014, out _, out var period, out _))
@ -1185,7 +1185,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
ResponseEvent(fm2014, response); ResponseEvent(fm2014, response);
// Publish the frequency in [Hz] // Publish the frequency in [Hz]
cmdName = CmdName.CMD_CAL_FREQU_REF_PERIOD; cmdName = CmdName.CmdCalculatedFrequRefPeriod;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
response = new CmdResponse(cmdName, info, response = new CmdResponse(cmdName, info,
doubleValue: 1.0 / (TMR_RESOLUTION_s * period), doubleValue: 1.0 / (TMR_RESOLUTION_s * period),
@ -1195,7 +1195,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Convert to m³/h (3600 s/h) based on REF pulse rate // Convert to m³/h (3600 s/h) based on REF pulse rate
fm2014.RefFlowRate_cm_per_h = 3600.0 / ((Double)period * TMR_RESOLUTION_s) / fm2014.RefPulses_per_cm; fm2014.RefFlowRate_cm_per_h = 3600.0 / ((Double)period * TMR_RESOLUTION_s) / fm2014.RefPulses_per_cm;
// Publish the calculated flow rate [m³/h] // Publish the calculated flow rate [m³/h]
cmdName = CmdName.CMD_CAL_FLOW_REF_PERIOD; cmdName = CmdName.CmdCalculatedFlowRefPeriod;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
response = new CmdResponse(cmdName, info, doubleValue: fm2014.RefFlowRate_cm_per_h, response = new CmdResponse(cmdName, info, doubleValue: fm2014.RefFlowRate_cm_per_h,
unit: Units.GetInfo(Units.Name.FLOW_RATE_cm_per_h)); unit: Units.GetInfo(Units.Name.FLOW_RATE_cm_per_h));
@ -1205,10 +1205,10 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Read the DUT period and calculate the frequency [Hz] and flow rate [m³/h] based on this period // Read the DUT period and calculate the frequency [Hz] and flow rate [m³/h] based on this period
cmdName = CmdName.CMD_GET_DUT_PERIOD; cmdName = CmdName.CmdGetDutPeriod;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
if (fm2014.RequestDebugInformation && if (fm2014.RequestDebugInformation &&
SharedCyclicMeasSequ != CyclicMeasSequ.IDLE && SharedCyclicMeasSequ != CyclicMeasSequ.idle &&
Write(cmdName, fm2014)) Write(cmdName, fm2014))
{ {
if (Read(cmdName, fm2014, out _, out var period, out _)) if (Read(cmdName, fm2014, out _, out var period, out _))
@ -1220,7 +1220,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
ResponseEvent(fm2014, response); ResponseEvent(fm2014, response);
// Publish the frequency in [Hz] // Publish the frequency in [Hz]
cmdName = CmdName.CMD_CAL_FREQU_DUT_PERIOD; cmdName = CmdName.CmdCalculatedFrequencyDutPeriod;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
response = new CmdResponse(cmdName, info, response = new CmdResponse(cmdName, info,
doubleValue: 1.0 / (TMR_RESOLUTION_s * period), doubleValue: 1.0 / (TMR_RESOLUTION_s * period),
@ -1230,7 +1230,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Convert to m³/h (3600 s/h) based on DUT pulse rate // Convert to m³/h (3600 s/h) based on DUT pulse rate
fm2014.DutFlowRate_cm_per_h = 3600.0 / ((Double)period * TMR_RESOLUTION_s) / fm2014.DutPulses_per_cm; fm2014.DutFlowRate_cm_per_h = 3600.0 / ((Double)period * TMR_RESOLUTION_s) / fm2014.DutPulses_per_cm;
// Publish the calculated flow rate [m³/h] // Publish the calculated flow rate [m³/h]
cmdName = CmdName.CMD_CAL_FLOW_DUT_PERIOD; cmdName = CmdName.CmdCalculatedFlowDutPeriod;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
response = new CmdResponse(cmdName, info, doubleValue: fm2014.DutFlowRate_cm_per_h, response = new CmdResponse(cmdName, info, doubleValue: fm2014.DutFlowRate_cm_per_h,
unit: Units.GetInfo(Units.Name.FLOW_RATE_cm_per_h)); unit: Units.GetInfo(Units.Name.FLOW_RATE_cm_per_h));
@ -1239,9 +1239,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
} }
// Read the REF frequency [Hz] directly and calculate the flow rate [m³/h] based on this frequency // Read the REF frequency [Hz] directly and calculate the flow rate [m³/h] based on this frequency
cmdName = CmdName.CMD_GET_REF_FREQU; cmdName = CmdName.CmdGetRefFrequency;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE && Write(cmdName, fm2014)) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle && Write(cmdName, fm2014))
{ {
if (Read(cmdName, fm2014, out _, out var refFrequency, out _)) if (Read(cmdName, fm2014, out _, out var refFrequency, out _))
{ {
@ -1258,7 +1258,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Convert to m³/h (3600 s/h) and save the value // Convert to m³/h (3600 s/h) and save the value
fm2014.RefFlowRate_cm_per_h = 3600.0 * (Double)refFrequency / fm2014.RefPulses_per_cm; fm2014.RefFlowRate_cm_per_h = 3600.0 * (Double)refFrequency / fm2014.RefPulses_per_cm;
// Publish the calculated flow rate [m³/h] // Publish the calculated flow rate [m³/h]
cmdName = CmdName.CMD_CAL_FLOW_REF_FREQU; cmdName = CmdName.CmdCalculatedFlowRefFrequ;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
response = new CmdResponse(cmdName, info, doubleValue: fm2014.RefFlowRate_cm_per_h, response = new CmdResponse(cmdName, info, doubleValue: fm2014.RefFlowRate_cm_per_h,
unit: Units.GetInfo(Units.Name.FLOW_RATE_cm_per_h)); unit: Units.GetInfo(Units.Name.FLOW_RATE_cm_per_h));
@ -1273,7 +1273,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
specificInfoObj: response, statusReturn: StatusReturn.Failed)); specificInfoObj: response, statusReturn: StatusReturn.Failed));
} }
} }
} while (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE); } while (SharedCyclicMeasSequ != CyclicMeasSequ.idle);
}, SharedCancellationToken); }, SharedCancellationToken);
@ -1318,11 +1318,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
UInt16 doublePulseDeadtime_ms = 0) UInt16 doublePulseDeadtime_ms = 0)
{ {
// If the cyclic task has already been started everything is fine // If the cyclic task has already been started everything is fine
if (SharedCyclicMeasSequ == CyclicMeasSequ.CALIBRATION) if (SharedCyclicMeasSequ == CyclicMeasSequ.timeMeasurement)
return true; return true;
// Marked measurement isn't pulse counter measurement, other FM2014s cannot activate this // Marked measurement isn't pulse counter measurement, other FM2014s cannot activate this
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle)
return false; return false;
// Initially, check if any device is connected and logged in, if not => exit // Initially, check if any device is connected and logged in, if not => exit
@ -1353,7 +1353,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
} }
var cmdName = CmdName.CMD_NA; var cmdName = CmdName.CmdNotAssigned;
MeasurementInfo = Resources.StrMeasMsgCalibration; MeasurementInfo = Resources.StrMeasMsgCalibration;
// Prepare pulse time measurement with all broadcast command - avoid read // Prepare pulse time measurement with all broadcast command - avoid read
@ -1363,7 +1363,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
if (DOUBLE_PULSE_DEADTIME_MIN_ms == firstActiveFm2014.DoublePulseDeadtime_ms) if (DOUBLE_PULSE_DEADTIME_MIN_ms == firstActiveFm2014.DoublePulseDeadtime_ms)
{ {
// This is a command without parameter // This is a command without parameter
cmdName = CmdName.CMD_SET_DBPL_UNLOCK; cmdName = CmdName.CmdSwitchDoublePulseDeadtimeOff;
if (!Write(cmdName, firstActiveFm2014)) if (!Write(cmdName, firstActiveFm2014))
{ {
return false; return false;
@ -1371,12 +1371,12 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
} }
else else
{ {
cmdName = CmdName.CMD_SET_DPLS_LOCK_TMR; cmdName = CmdName.CmdSetDoublePulseDeadtimeBase;
if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.DoublePulseBaseDeadTime_ms)) if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.DoublePulseBaseDeadTime_ms))
{ {
return false; return false;
} }
cmdName = CmdName.CMD_SET_DPLS_LOCK_MULT; cmdName = CmdName.CmdSetDoublePulseDeadtimeMultiplier;
if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.DoublePulseMultiplier)) if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.DoublePulseMultiplier))
{ {
return false; return false;
@ -1385,7 +1385,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
if (firstActiveFm2014.RefPulsesRequired != 0) if (firstActiveFm2014.RefPulsesRequired != 0)
{ {
cmdName = CmdName.CMD_REF_SET_PLS; cmdName = CmdName.CmdRefSetPulsesRequired;
if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.RefPulsesRequired)) if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.RefPulsesRequired))
{ {
return false; return false;
@ -1394,7 +1394,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
if (firstActiveFm2014.DutPulsesRequired != 0) if (firstActiveFm2014.DutPulsesRequired != 0)
{ {
cmdName = CmdName.CMD_DUT_SET_PLS; cmdName = CmdName.CmdSetDutPulsesRequired;
if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.DutPulsesRequired)) if (!Write(cmdName, firstActiveFm2014, firstActiveFm2014.DutPulsesRequired))
{ {
return false; return false;
@ -1413,7 +1413,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
Task.Run(() => Task.Run(() =>
{ {
// Mark calibration measurement as active // Mark calibration measurement as active
SharedCyclicMeasSequ = CyclicMeasSequ.CALIBRATION; SharedCyclicMeasSequ = CyclicMeasSequ.timeMeasurement;
// Set up the progress maximal counter value base on required pulses for REF or DUT // Set up the progress maximal counter value base on required pulses for REF or DUT
InitActualProcessProgress( InitActualProcessProgress(
@ -1431,9 +1431,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
StatusReturn statusReturn; StatusReturn statusReturn;
// Read the device status to check for timeout between pulses // Read the device status to check for timeout between pulses
cmdName = CmdName.CMD_GET_STATUS; cmdName = CmdName.CmdGetStatus;
var info = GetCmdInfo(cmdName); var info = GetCmdInfo(cmdName);
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE && Write(cmdName, fm2014)) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle && Write(cmdName, fm2014))
{ {
if (Read(cmdName, fm2014, out responseStr, out var status, out _)) if (Read(cmdName, fm2014, out responseStr, out var status, out _))
{ {
@ -1446,9 +1446,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Read the remaining REF pulses if required // Read the remaining REF pulses if required
if (fm2014.RefPulsesRequired != 0) if (fm2014.RefPulsesRequired != 0)
{ {
cmdName = CmdName.CMD_REF_GET_PLS_RMN; cmdName = CmdName.CmdRefPulsesRemaining;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE && Write(cmdName, fm2014)) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle && Write(cmdName, fm2014))
{ {
if (Read(cmdName, fm2014, out responseStr, out var pulses, out _)) if (Read(cmdName, fm2014, out responseStr, out var pulses, out _))
{ {
@ -1481,9 +1481,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Read the remaining DUT pulses if required // Read the remaining DUT pulses if required
if (fm2014.DutPulsesRequired != 0) if (fm2014.DutPulsesRequired != 0)
{ {
cmdName = CmdName.CMD_DUT_GET_PLS_RMN; cmdName = CmdName.CmdDutGetPulsesRemaining;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE && Write(cmdName, fm2014)) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle && Write(cmdName, fm2014))
{ {
if (Read(cmdName, fm2014, out responseStr, out var pulses, out _)) if (Read(cmdName, fm2014, out responseStr, out var pulses, out _))
{ {
@ -1520,9 +1520,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Read the REF timer ticks for the counted pulses // Read the REF timer ticks for the counted pulses
if (fm2014.RefPulsesRequired != 0) if (fm2014.RefPulsesRequired != 0)
{ {
cmdName = CmdName.CMD_REF_GET_TMR; cmdName = CmdName.CmdGetRefTimerTicks;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE && Write(cmdName, fm2014)) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle && Write(cmdName, fm2014))
{ {
if (Read(cmdName, fm2014, out responseStr, out var timerTicks, out _)) if (Read(cmdName, fm2014, out responseStr, out var timerTicks, out _))
{ {
@ -1542,9 +1542,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Read the DUT timer ticks for the counted pulses // Read the DUT timer ticks for the counted pulses
if (fm2014.DutPulsesRequired != 0) if (fm2014.DutPulsesRequired != 0)
{ {
cmdName = CmdName.CMD_DUT_GET_TMR; cmdName = CmdName.CmdGetDutTimerTicks;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE && Write(cmdName, fm2014)) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle && Write(cmdName, fm2014))
{ {
if (Read(cmdName, fm2014, out responseStr, out var timerTicks, out _)) if (Read(cmdName, fm2014, out responseStr, out var timerTicks, out _))
{ {
@ -1564,7 +1564,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Calculate the DUT to REF tolerance if both timer had been active // Calculate the DUT to REF tolerance if both timer had been active
if (fm2014.RefPulsesRequired != 0 && fm2014.DutPulsesRequired != 0) if (fm2014.RefPulsesRequired != 0 && fm2014.DutPulsesRequired != 0)
{ {
cmdName = CmdName.CMD_CAL_DUT_TO_REF_TOL; cmdName = CmdName.CmdCalculatedDutToRefTolerance;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
// Is converting to a real time in seconds // Is converting to a real time in seconds
if (fm2014.RefTimeMeasured_s > 0.0) if (fm2014.RefTimeMeasured_s > 0.0)
@ -1606,9 +1606,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
{ {
ResetHardwareAllDevices(); ResetHardwareAllDevices();
// Exit this task // Exit this task
SharedCyclicMeasSequ = CyclicMeasSequ.IDLE; SharedCyclicMeasSequ = CyclicMeasSequ.idle;
} }
} while (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE); } while (SharedCyclicMeasSequ != CyclicMeasSequ.idle);
}, SharedCancellationToken); }, SharedCancellationToken);
@ -1634,14 +1634,14 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
var statusReturn = StatusReturn.Unknown; var statusReturn = StatusReturn.Unknown;
var numberStyle = NumberStyles.None; var numberStyle = NumberStyles.None;
var paraFormat = GetParaFormat(cmdName); var paraFormat = GetParaFormat(cmdName);
if (paraFormat == ParaFormat.UINT_HEX || paraFormat == ParaFormat.BYTE_HEX_PLUS_SIGN) if (paraFormat == ParaFormat.uintHexValue || paraFormat == ParaFormat.byteHexValuePlusSign)
{ {
numberStyle = NumberStyles.HexNumber; numberStyle = NumberStyles.HexNumber;
} }
switch (paraFormat) switch (paraFormat)
{ {
case ParaFormat.BYTE_HEX_PLUS_SIGN: case ParaFormat.byteHexValuePlusSign:
// The response contains a sign! // The response contains a sign!
var signMultiplier = responseStr.Contains("+") ? 1.0 : -1.0; var signMultiplier = responseStr.Contains("+") ? 1.0 : -1.0;
var cleanedStr = responseStr.Replace("+", "").Replace("-", ""); var cleanedStr = responseStr.Replace("+", "").Replace("-", "");
@ -1651,8 +1651,8 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
} }
break; break;
case ParaFormat.UINT_HEX: case ParaFormat.uintHexValue:
case ParaFormat.UINT_DEZ: case ParaFormat.uintDecimalValue:
if (uint.TryParse(responseStr, numberStyle, new CultureInfo("en"), out intValueParsed)) if (uint.TryParse(responseStr, numberStyle, new CultureInfo("en"), out intValueParsed))
{ {
intValue = intValueParsed; intValue = intValueParsed;
@ -1690,13 +1690,13 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
ActualProcessProgress++; ActualProcessProgress++;
// Check for individual command without response // Check for individual command without response
if (CmdType.INDIVIDUAL_UNRESPONSIVE == SharedCmdTypeReminderLastCmd && if (CmdType.individualUnresponsive == SharedCmdTypeReminderLastCmd &&
CmdType.INDIVIDUAL_UNRESPONSIVE == GetCmdType(cmdName)) CmdType.individualUnresponsive == GetCmdType(cmdName))
{ {
statusReturn = StatusReturn.Skipped; statusReturn = StatusReturn.Skipped;
} }
else if (CmdType.INDIVIDUAL == SharedCmdTypeReminderLastCmd && else if (CmdType.individual == SharedCmdTypeReminderLastCmd &&
CmdType.INDIVIDUAL == GetCmdType(cmdName)) CmdType.individual == GetCmdType(cmdName))
{ {
// Read or timeout with a TimeoutException // Read or timeout with a TimeoutException
var answerStr = SharedSerialPort?.ReadTo(END_OF_STR); var answerStr = SharedSerialPort?.ReadTo(END_OF_STR);
@ -1745,9 +1745,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
if (SharedSerialPort == null) if (SharedSerialPort == null)
{ {
SharedCmdTypeReminderLastCmd = CmdType.NOT_INITIALIZED; SharedCmdTypeReminderLastCmd = CmdType.uninitialized;
fm2014.IsLoggedOn = false; fm2014.IsLoggedOn = false;
SharedCyclicMeasSequ = CyclicMeasSequ.IDLE; SharedCyclicMeasSequ = CyclicMeasSequ.idle;
return false; return false;
} }
if (!DisableWriteReadActualProcessIncreasing) if (!DisableWriteReadActualProcessIncreasing)
@ -1755,9 +1755,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Initiate communication using the individual or broadcast address // Initiate communication using the individual or broadcast address
var retVal = true; var retVal = true;
if (CmdType.BROADCAST == GetCmdType(cmdName)) if (CmdType.broadcast == GetCmdType(cmdName))
{ {
if (SharedCmdTypeReminderLastCmd != CmdType.BROADCAST) if (SharedCmdTypeReminderLastCmd != CmdType.broadcast)
{ {
retVal = InitiateBroadcastComm(fm2014); retVal = InitiateBroadcastComm(fm2014);
} }
@ -1765,8 +1765,8 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
else else
{ {
if (ReminderLastIndividualCommFm2014Address != fm2014.Address || if (ReminderLastIndividualCommFm2014Address != fm2014.Address ||
SharedCmdTypeReminderLastCmd != CmdType.INDIVIDUAL || SharedCmdTypeReminderLastCmd != CmdType.individual ||
SharedCmdTypeReminderLastCmd != CmdType.INDIVIDUAL) SharedCmdTypeReminderLastCmd != CmdType.individual)
{ {
retVal = InitiateIndividualComm(fm2014); retVal = InitiateIndividualComm(fm2014);
if (retVal) if (retVal)
@ -1781,13 +1781,13 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
var cmdCodeStr = GetCmdStr(cmdName); var cmdCodeStr = GetCmdStr(cmdName);
var info = GetCmdInfo(cmdName) + $": {cmdCodeStr}"; var info = GetCmdInfo(cmdName) + $": {cmdCodeStr}";
var isHexFormat = GetParaFormat(cmdName) == ParaFormat.UINT_HEX; var isHexFormat = GetParaFormat(cmdName) == ParaFormat.uintHexValue;
CmdResponse response; CmdResponse response;
// Without data the command alone needs to be sent // Without data the command alone needs to be sent
if (dataObj == null) if (dataObj == null)
{ {
SharedSerialPort.Write($"{cmdCodeStr}{END_OF_STR}"); SharedSerialPort.Write($"{cmdCodeStr}{END_OF_STR}");
var additionalInfo = GetCmdType(cmdName) == CmdType.BROADCAST var additionalInfo = GetCmdType(cmdName) == CmdType.broadcast
? Resources.StrCommDirectionSetup ? Resources.StrCommDirectionSetup
: Resources.StrCommDirectionRequest; : Resources.StrCommDirectionRequest;
response = new CmdResponse(cmdName, $"{additionalInfo}: {info}"); response = new CmdResponse(cmdName, $"{additionalInfo}: {info}");
@ -1849,38 +1849,38 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
SharedSerialPort.Open(); SharedSerialPort.Open();
if (!SharedSerialPort.IsOpen) if (!SharedSerialPort.IsOpen)
{ {
response = new CmdResponse(CmdName.CMD_ADDR_PC, response = new CmdResponse(CmdName.CmdAddress,
$"{Resources.StrCmdRespErrorBroadcast}"); $"{Resources.StrCmdRespErrorBroadcast}");
PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError, PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError,
specificInfoObj: response, specificInfoObj: response,
statusReturn: StatusReturn.Failed)); statusReturn: StatusReturn.Failed));
SharedCmdTypeReminderLastCmd = CmdType.NOT_INITIALIZED; SharedCmdTypeReminderLastCmd = CmdType.uninitialized;
return false; return false;
} }
} }
// If broadcast communication is already active // If broadcast communication is already active
if (SharedCmdTypeReminderLastCmd == CmdType.BROADCAST) if (SharedCmdTypeReminderLastCmd == CmdType.broadcast)
{ {
return true; return true;
} }
// Establish connection to all FM2014s with broadcast address // Establish connection to all FM2014s with broadcast address
// The direct write has to be used as this is being called from the 'Write' routine!!!! // The direct write has to be used as this is being called from the 'Write' routine!!!!
SharedSerialPort.Write(BROADCAST_ADDRESS + END_OF_STR); SharedSerialPort.Write(BROADCAST_ADDRESS + END_OF_STR);
var cmdName = CmdName.CMD_CONNECT; var cmdName = CmdName.CmdConnect;
var info = GetCmdInfo(cmdName) + ": " + BROADCAST_ADDRESS; var info = GetCmdInfo(cmdName) + ": " + BROADCAST_ADDRESS;
response = new CmdResponse(cmdName, info); response = new CmdResponse(cmdName, info);
PublishResponse(fm2014, new ProcessExecEventArgs("", specificInfoObj: response)); PublishResponse(fm2014, new ProcessExecEventArgs("", specificInfoObj: response));
SharedCmdTypeReminderLastCmd = CmdType.BROADCAST; SharedCmdTypeReminderLastCmd = CmdType.broadcast;
return true; return true;
} }
catch (Exception e) catch (Exception e)
{ {
response = new CmdResponse(CmdName.CMD_ADDR_PC, response = new CmdResponse(CmdName.CmdAddress,
$"{Resources.StrCmdRespErrorBroadcast} - {e.Message}"); $"{Resources.StrCmdRespErrorBroadcast} - {e.Message}");
PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError, PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError,
specificInfoObj: response, statusReturn: StatusReturn.Failed)); specificInfoObj: response, statusReturn: StatusReturn.Failed));
SharedCmdTypeReminderLastCmd = CmdType.NOT_INITIALIZED; SharedCmdTypeReminderLastCmd = CmdType.uninitialized;
return false; return false;
} }
} }
@ -1909,11 +1909,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
SharedSerialPort.Open(); SharedSerialPort.Open();
if (!SharedSerialPort.IsOpen) if (!SharedSerialPort.IsOpen)
{ {
response = new CmdResponse(CmdName.CMD_ADDR_PC, $"{Resources.StrCmdRespErrorIndividual}"); response = new CmdResponse(CmdName.CmdAddress, $"{Resources.StrCmdRespErrorIndividual}");
PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError, PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError,
specificInfoObj: response, specificInfoObj: response,
statusReturn: StatusReturn.Failed)); statusReturn: StatusReturn.Failed));
SharedCmdTypeReminderLastCmd = CmdType.NOT_INITIALIZED; SharedCmdTypeReminderLastCmd = CmdType.uninitialized;
fm2014.IsLoggedOn = false; fm2014.IsLoggedOn = false;
return false; return false;
} }
@ -1926,7 +1926,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
if (!string.IsNullOrEmpty(fm2014.ConnectResponse)) if (!string.IsNullOrEmpty(fm2014.ConnectResponse))
{ {
var cmdName = CmdName.CMD_CONNECT; var cmdName = CmdName.CmdConnect;
var info = GetCmdInfo(cmdName) + ": " + fm2014.AddressStr; var info = GetCmdInfo(cmdName) + ": " + fm2014.AddressStr;
response = new CmdResponse(cmdName, info); response = new CmdResponse(cmdName, info);
PublishResponse(fm2014, new ProcessExecEventArgs("", specificInfoObj: response)); PublishResponse(fm2014, new ProcessExecEventArgs("", specificInfoObj: response));
@ -1939,19 +1939,19 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
} }
catch (Exception e) catch (Exception e)
{ {
response = new CmdResponse(CmdName.CMD_CONNECT, $"{Resources.StrCmdRespErrorIndividual}" + response = new CmdResponse(CmdName.CmdConnect, $"{Resources.StrCmdRespErrorIndividual}" +
$": {fm2014.AddressStr}" + $" - {e.Message}"); $": {fm2014.AddressStr}" + $" - {e.Message}");
PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError, PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError,
specificInfoObj: response, statusReturn: StatusReturn.Failed)); specificInfoObj: response, statusReturn: StatusReturn.Failed));
SharedCmdTypeReminderLastCmd = CmdType.NOT_INITIALIZED; SharedCmdTypeReminderLastCmd = CmdType.uninitialized;
fm2014.IsLoggedOn = false; fm2014.IsLoggedOn = false;
return false; return false;
} }
response = new CmdResponse(CmdName.CMD_CONNECT, $"{Resources.StrCmdRespErrorIndividual}"); response = new CmdResponse(CmdName.CmdConnect, $"{Resources.StrCmdRespErrorIndividual}");
PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError, PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError,
specificInfoObj: response, statusReturn: StatusReturn.Failed)); specificInfoObj: response, statusReturn: StatusReturn.Failed));
SharedCmdTypeReminderLastCmd = CmdType.NOT_INITIALIZED; SharedCmdTypeReminderLastCmd = CmdType.uninitialized;
return false; return false;
} }
@ -1974,6 +1974,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
RegisteredFm2014s?.Clear(); RegisteredFm2014s?.Clear();
RegisteredFm2014s = null; RegisteredFm2014s = null;
SharedSerialPort?.Dispose(); SharedSerialPort?.Dispose();
SharedSerialPort = null;
} }
#endregion ---------------------------------------- static methods -------------------------------------------- #endregion ---------------------------------------- static methods --------------------------------------------
@ -1989,10 +1990,10 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
private Boolean SaveStandAloneMeasurement() private Boolean SaveStandAloneMeasurement()
{ {
// If the cyclic task has already been started everything is fine // If the cyclic task has already been started everything is fine
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE || !IsLoggedOn) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle || !IsLoggedOn)
return false; return false;
var cmdName = CmdName.CMD_REF_LPP_SCALE; var cmdName = CmdName.CmdSetRefPulsesPerCm;
try try
{ {
// Set to zero if it doesn't fit to the limit which can be stored as indicator for invalid value // Set to zero if it doesn't fit to the limit which can be stored as indicator for invalid value
@ -2003,27 +2004,27 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
if (retVal) if (retVal)
{ {
cmdName = CmdName.CMD_DUT_LPP_SCALE; cmdName = CmdName.CmdSetDutPulsesPerCm;
retVal = Write(cmdName, this, DutPulses_per_cm); retVal = Write(cmdName, this, DutPulses_per_cm);
} }
if (retVal) if (retVal)
{ {
cmdName = CmdName.CMD_REF_SET_SCALE; cmdName = CmdName.CmdRefToDutScale;
// During setup of the 'Ref_pulse_per_cm' the '_refToDutScaleStr' will be generated // During setup of the 'Ref_pulse_per_cm' the '_refToDutScaleStr' will be generated
retVal = Write(cmdName, this, RefToDutScaleStr); retVal = Write(cmdName, this, RefToDutScaleStr);
} }
if (retVal) if (retVal)
{ {
cmdName = CmdName.CMD_MEAS_SET_ATTN; cmdName = CmdName.CmdSetCurrentOutputAttenuation;
retVal = Write(cmdName, this, CurrentOutputAttenuation); retVal = Write(cmdName, this, CurrentOutputAttenuation);
} }
if (retVal) if (retVal)
{ {
// Save all settings from RAM to nonvolatile EEPROM // Save all settings from RAM to nonvolatile EEPROM
cmdName = CmdName.CMD_SAVE_RAM_TO_EEP_MEAS_SETUP; cmdName = CmdName.CmdSaveRamToEepMeasSetup;
return Write(cmdName, this); return Write(cmdName, this);
} }
} }
@ -2052,12 +2053,12 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
private Boolean ReadStandAloneMeasurement(CmdName cmdName) private Boolean ReadStandAloneMeasurement(CmdName cmdName)
{ {
// If the cyclic task has already been started everything is fine // If the cyclic task has already been started everything is fine
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE || !IsLoggedOn) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle || !IsLoggedOn)
return false; return false;
// Allow explicit standalone measurement commands // Allow explicit standalone measurement commands
if (cmdName != CmdName.CMD_READ_EEP_MEAS_SETUP && if (cmdName != CmdName.CmdReadEepMeasSetup &&
cmdName != CmdName.CMD_READ_RAM_MEAS_SETUP) cmdName != CmdName.CmdReadRamMeasSetup)
{ {
return false; return false;
} }
@ -2067,7 +2068,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
var responseStrs = new List<String>(); var responseStrs = new List<String>();
if (Write(cmdName, this)) if (Write(cmdName, this))
{ {
if (cmdName == CmdName.CMD_READ_EEP_MEAS_SETUP) if (cmdName == CmdName.CmdReadEepMeasSetup)
{ {
// From here 5 lines need to be read to get the information // From here 5 lines need to be read to get the information
var loopCtr = 4; var loopCtr = 4;
@ -2097,7 +2098,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
attenuation >= CURRENT_OUTPUT_ATTENUATION_MIN && attenuation >= CURRENT_OUTPUT_ATTENUATION_MIN &&
attenuation <= CURRENT_OUTPUT_ATTENUATION_MAX) attenuation <= CURRENT_OUTPUT_ATTENUATION_MAX)
{ {
cmdName = CmdName.CMD_MEAS_SET_ATTN; cmdName = CmdName.CmdSetCurrentOutputAttenuation;
var info = GetCmdInfo(cmdName); var info = GetCmdInfo(cmdName);
CurrentOutputAttenuation = attenuation; CurrentOutputAttenuation = attenuation;
var response = new CmdResponse(cmdName, info, CurrentOutputAttenuation); var response = new CmdResponse(cmdName, info, CurrentOutputAttenuation);
@ -2110,7 +2111,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
var strCleaned = strFields[1].Replace(" ", ""); var strCleaned = strFields[1].Replace(" ", "");
if (double.TryParse(strCleaned, NumberStyles.Float, new CultureInfo("en"), out var value)) if (double.TryParse(strCleaned, NumberStyles.Float, new CultureInfo("en"), out var value))
{ {
cmdName = CmdName.CMD_REF_SET_SCALE; cmdName = CmdName.CmdRefToDutScale;
var info = GetCmdInfo(cmdName); var info = GetCmdInfo(cmdName);
RefToDutScale_norm = value; RefToDutScale_norm = value;
var response = new CmdResponse(cmdName, info, doubleValue: RefToDutScale_norm); var response = new CmdResponse(cmdName, info, doubleValue: RefToDutScale_norm);
@ -2123,13 +2124,13 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
var strCleaned = Regex.Replace(str, "[^0-9]", string.Empty); var strCleaned = Regex.Replace(str, "[^0-9]", string.Empty);
if (ushort.TryParse(strCleaned, out var value)) if (ushort.TryParse(strCleaned, out var value))
{ {
cmdName = CmdName.CMD_DUT_LPP_SCALE; cmdName = CmdName.CmdSetDutPulsesPerCm;
var info = GetCmdInfo(cmdName); var info = GetCmdInfo(cmdName);
DutPulses_per_cm = value; DutPulses_per_cm = value;
var response = new CmdResponse(cmdName, info, DutPulses_per_cm); var response = new CmdResponse(cmdName, info, DutPulses_per_cm);
ResponseEvent(this, response); ResponseEvent(this, response);
// Added 2026-Jan-01 to overcome limitation of max 9999 Impulses per volume // Added 2026-Jan-01 to overcome limitation of max 9999 Impulses per volume
cmdName = CmdName.CMD_REF_LPP_SCALE; cmdName = CmdName.CmdSetRefPulsesPerCm;
info = GetCmdInfo(cmdName); info = GetCmdInfo(cmdName);
// Calculate REF pulses per cubic meter // Calculate REF pulses per cubic meter
RefPulses_per_cm = (UInt32)Math.Round(DutPulses_per_cm * RefToDutScale_norm, 1); RefPulses_per_cm = (UInt32)Math.Round(DutPulses_per_cm * RefToDutScale_norm, 1);
@ -2162,7 +2163,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
{ {
// If the cyclic task has already been started the login isn't allowed anymore // If the cyclic task has already been started the login isn't allowed anymore
// until this has been finished // until this has been finished
if (SharedCyclicMeasSequ != CyclicMeasSequ.IDLE) if (SharedCyclicMeasSequ != CyclicMeasSequ.idle)
return false; return false;
return InitiateIndividualComm(this); return InitiateIndividualComm(this);
@ -2229,7 +2230,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
SharedSerialPort.ReadTimeout = 1000; SharedSerialPort.ReadTimeout = 1000;
SharedSerialPort.WriteTimeout = 1000; SharedSerialPort.WriteTimeout = 1000;
} }
var cmdName = CmdName.CMD_SERIAL; var cmdName = CmdName.CmdSerialNumber;
try try
{ {
if (!SharedSerialPort.IsOpen) if (!SharedSerialPort.IsOpen)
@ -2237,12 +2238,12 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
SharedSerialPort.Open(); SharedSerialPort.Open();
if (!SharedSerialPort.IsOpen) if (!SharedSerialPort.IsOpen)
{ {
var response = new CmdResponse(CmdName.CMD_ADDR_PC, var response = new CmdResponse(CmdName.CmdAddress,
$"{Resources.StrCmdRespErrorBroadcast}"); $"{Resources.StrCmdRespErrorBroadcast}");
PublishResponse(this, new ProcessExecEventArgs(Resources.StrError, PublishResponse(this, new ProcessExecEventArgs(Resources.StrError,
specificInfoObj: response, specificInfoObj: response,
statusReturn: StatusReturn.Failed)); statusReturn: StatusReturn.Failed));
SharedCmdTypeReminderLastCmd = CmdType.NOT_INITIALIZED; SharedCmdTypeReminderLastCmd = CmdType.uninitialized;
return false; return false;
} }
} }
@ -2264,7 +2265,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
SerialNumber = SerialNumber.Replace(cmdCode, ""); SerialNumber = SerialNumber.Replace(cmdCode, "");
} }
cmdName = CmdName.CMD_PRINT_STATISTICS; cmdName = CmdName.CmdGetLifetime;
// Read out the lifetime of this FM2014 // Read out the lifetime of this FM2014
if (!Write(cmdName, this)) if (!Write(cmdName, this))
{ {
@ -2278,7 +2279,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
Lifetime_h = intValue; Lifetime_h = intValue;
} }
IsLoggedOn = ReadStandAloneMeasurement(CmdName.CMD_READ_EEP_MEAS_SETUP); IsLoggedOn = ReadStandAloneMeasurement(CmdName.CmdReadEepMeasSetup);
} }
catch (Exception e) catch (Exception e)
{ {

@ -1 +1 @@
Subproject commit 1cd877ff8628cdcb94a7ad2751d61dc77e1211da Subproject commit 653498d43dcca1234a8fba95959ca02bb2c3f480

View File

@ -46,6 +46,22 @@
this.tbxFM2014FullId = new System.Windows.Forms.TextBox(); this.tbxFM2014FullId = new System.Windows.Forms.TextBox();
this.tbxFM2014ApplicationFwVersion = new System.Windows.Forms.TextBox(); this.tbxFM2014ApplicationFwVersion = new System.Windows.Forms.TextBox();
this.gbxRegulationSetup = new System.Windows.Forms.GroupBox(); this.gbxRegulationSetup = new System.Windows.Forms.GroupBox();
this.gbxBoxDebug = new System.Windows.Forms.GroupBox();
this.label7 = new System.Windows.Forms.Label();
this.tbxRefFlowRateFromRefFrequencyCmPerH = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.tbxRefFrequencyDirectHz = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.tbxDutPeriodMs = new System.Windows.Forms.TextBox();
this.tbxRefFlowRateFromRefPeriodCmPerH = new System.Windows.Forms.TextBox();
this.tbxDutFrequencyFromDutPeriodHz = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.tbxDutFlowRateFromDutPeriodCmPerH = new System.Windows.Forms.TextBox();
this.tbxRefFrequencyFromRefPeriodHz = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.tbxRefPeriodMs = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.btnSaveSetupToFm2014 = new System.Windows.Forms.Button(); this.btnSaveSetupToFm2014 = new System.Windows.Forms.Button();
this.cbxToleranceDisplayAttenuation = new System.Windows.Forms.ComboBox(); this.cbxToleranceDisplayAttenuation = new System.Windows.Forms.ComboBox();
this.lblRefPulsePerVolume = new System.Windows.Forms.Label(); this.lblRefPulsePerVolume = new System.Windows.Forms.Label();
@ -81,30 +97,14 @@
this.lblActualFlowRateCmPerHour = new System.Windows.Forms.Label(); this.lblActualFlowRateCmPerHour = new System.Windows.Forms.Label();
this.tbxActualFlowRateCmPerHour = new System.Windows.Forms.TextBox(); this.tbxActualFlowRateCmPerHour = new System.Windows.Forms.TextBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.tbxRefFrequencyFromRefPeriodHz = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.tbxRefFlowRateFromRefPeriodCmPerH = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.tbxRefPeriodMs = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.tbxDutPeriodMs = new System.Windows.Forms.TextBox();
this.tbxDutFrequencyFromDutPeriodHz = new System.Windows.Forms.TextBox();
this.tbxDutFlowRateFromDutPeriodCmPerH = new System.Windows.Forms.TextBox();
this.grpBoxDebug = new System.Windows.Forms.GroupBox();
this.label7 = new System.Windows.Forms.Label();
this.tbxRefFlowRateFromRefFrequencyCmPerH = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.tbxRefFrequencyDirectHz = new System.Windows.Forms.TextBox();
this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.gbxFM2014Setup.SuspendLayout(); this.gbxFM2014Setup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picFM2014)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picFM2014)).BeginInit();
this.gbxRegulationSetup.SuspendLayout(); this.gbxRegulationSetup.SuspendLayout();
this.gbxBoxDebug.SuspendLayout();
this.gbxManualRefCalibration.SuspendLayout(); this.gbxManualRefCalibration.SuspendLayout();
this.gbxDutToRefRegulation.SuspendLayout(); this.gbxDutToRefRegulation.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.grpBoxDebug.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// gbxFM2014Setup // gbxFM2014Setup
@ -147,10 +147,11 @@
"5"}); "5"});
this.cbxToleranceDisplayRange.Location = new System.Drawing.Point(220, 150); this.cbxToleranceDisplayRange.Location = new System.Drawing.Point(220, 150);
this.cbxToleranceDisplayRange.Name = "cbxToleranceDisplayRange"; this.cbxToleranceDisplayRange.Name = "cbxToleranceDisplayRange";
this.cbxToleranceDisplayRange.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cbxToleranceDisplayRange.Size = new System.Drawing.Size(60, 21); this.cbxToleranceDisplayRange.Size = new System.Drawing.Size(60, 21);
this.cbxToleranceDisplayRange.TabIndex = 3; this.cbxToleranceDisplayRange.TabIndex = 3;
this.cbxToleranceDisplayRange.Text = "3"; this.cbxToleranceDisplayRange.Text = "3";
this.cbxToleranceDisplayRange.SelectedValueChanged += new System.EventHandler(this.cbxFM2014BaseSettings_SelectedValueChanged); this.cbxToleranceDisplayRange.SelectedValueChanged += new System.EventHandler(this.cbxProgramSettings_Changed);
// //
// picFM2014 // picFM2014
// //
@ -169,8 +170,10 @@
this.tbxFM2014SerialNumber.Location = new System.Drawing.Point(220, 75); this.tbxFM2014SerialNumber.Location = new System.Drawing.Point(220, 75);
this.tbxFM2014SerialNumber.Name = "tbxFM2014SerialNumber"; this.tbxFM2014SerialNumber.Name = "tbxFM2014SerialNumber";
this.tbxFM2014SerialNumber.ReadOnly = true; this.tbxFM2014SerialNumber.ReadOnly = true;
this.tbxFM2014SerialNumber.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.tbxFM2014SerialNumber.Size = new System.Drawing.Size(60, 20); this.tbxFM2014SerialNumber.Size = new System.Drawing.Size(60, 20);
this.tbxFM2014SerialNumber.TabIndex = 29; this.tbxFM2014SerialNumber.TabIndex = 29;
this.tbxFM2014SerialNumber.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
// //
// lblFM2014Tolerance // lblFM2014Tolerance
// //
@ -204,10 +207,11 @@
"22"}); "22"});
this.cbxFM2014Address.Location = new System.Drawing.Point(220, 125); this.cbxFM2014Address.Location = new System.Drawing.Point(220, 125);
this.cbxFM2014Address.Name = "cbxFM2014Address"; this.cbxFM2014Address.Name = "cbxFM2014Address";
this.cbxFM2014Address.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cbxFM2014Address.Size = new System.Drawing.Size(60, 21); this.cbxFM2014Address.Size = new System.Drawing.Size(60, 21);
this.cbxFM2014Address.TabIndex = 2; this.cbxFM2014Address.TabIndex = 2;
this.cbxFM2014Address.Text = "1"; this.cbxFM2014Address.Text = "1";
this.cbxFM2014Address.SelectedValueChanged += new System.EventHandler(this.cbxFM2014BaseSettings_SelectedValueChanged); this.cbxFM2014Address.SelectedValueChanged += new System.EventHandler(this.cbxProgramSettings_Changed);
// //
// lblFM2014Address // lblFM2014Address
// //
@ -229,9 +233,9 @@
// //
// btnFM2014Connect // btnFM2014Connect
// //
this.btnFM2014Connect.Location = new System.Drawing.Point(170, 179); this.btnFM2014Connect.Location = new System.Drawing.Point(163, 179);
this.btnFM2014Connect.Name = "btnFM2014Connect"; this.btnFM2014Connect.Name = "btnFM2014Connect";
this.btnFM2014Connect.Size = new System.Drawing.Size(110, 25); this.btnFM2014Connect.Size = new System.Drawing.Size(120, 25);
this.btnFM2014Connect.TabIndex = 0; this.btnFM2014Connect.TabIndex = 0;
this.btnFM2014Connect.Text = "Connect"; this.btnFM2014Connect.Text = "Connect";
this.btnFM2014Connect.UseVisualStyleBackColor = true; this.btnFM2014Connect.UseVisualStyleBackColor = true;
@ -242,10 +246,11 @@
this.cbxProgramComPort.FormattingEnabled = true; this.cbxProgramComPort.FormattingEnabled = true;
this.cbxProgramComPort.Location = new System.Drawing.Point(220, 100); this.cbxProgramComPort.Location = new System.Drawing.Point(220, 100);
this.cbxProgramComPort.Name = "cbxProgramComPort"; this.cbxProgramComPort.Name = "cbxProgramComPort";
this.cbxProgramComPort.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cbxProgramComPort.Size = new System.Drawing.Size(60, 21); this.cbxProgramComPort.Size = new System.Drawing.Size(60, 21);
this.cbxProgramComPort.TabIndex = 1; this.cbxProgramComPort.TabIndex = 1;
this.cbxProgramComPort.Text = "NA"; this.cbxProgramComPort.Text = "NA";
this.cbxProgramComPort.SelectedValueChanged += new System.EventHandler(this.cbxFM2014BaseSettings_SelectedValueChanged); this.cbxProgramComPort.SelectedValueChanged += new System.EventHandler(this.cbxProgramSettings_Changed);
// //
// lblFM2014SerialPort // lblFM2014SerialPort
// //
@ -281,11 +286,14 @@
this.tbxFM2014ApplicationFwVersion.Location = new System.Drawing.Point(220, 50); this.tbxFM2014ApplicationFwVersion.Location = new System.Drawing.Point(220, 50);
this.tbxFM2014ApplicationFwVersion.Name = "tbxFM2014ApplicationFwVersion"; this.tbxFM2014ApplicationFwVersion.Name = "tbxFM2014ApplicationFwVersion";
this.tbxFM2014ApplicationFwVersion.ReadOnly = true; this.tbxFM2014ApplicationFwVersion.ReadOnly = true;
this.tbxFM2014ApplicationFwVersion.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.tbxFM2014ApplicationFwVersion.Size = new System.Drawing.Size(60, 20); this.tbxFM2014ApplicationFwVersion.Size = new System.Drawing.Size(60, 20);
this.tbxFM2014ApplicationFwVersion.TabIndex = 31; this.tbxFM2014ApplicationFwVersion.TabIndex = 31;
this.tbxFM2014ApplicationFwVersion.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
// //
// gbxRegulationSetup // gbxRegulationSetup
// //
this.gbxRegulationSetup.Controls.Add(this.gbxBoxDebug);
this.gbxRegulationSetup.Controls.Add(this.btnSaveSetupToFm2014); this.gbxRegulationSetup.Controls.Add(this.btnSaveSetupToFm2014);
this.gbxRegulationSetup.Controls.Add(this.cbxToleranceDisplayAttenuation); this.gbxRegulationSetup.Controls.Add(this.cbxToleranceDisplayAttenuation);
this.gbxRegulationSetup.Controls.Add(this.lblRefPulsePerVolume); this.gbxRegulationSetup.Controls.Add(this.lblRefPulsePerVolume);
@ -302,11 +310,179 @@
this.gbxRegulationSetup.TabStop = false; this.gbxRegulationSetup.TabStop = false;
this.gbxRegulationSetup.Text = "Regulation Setup"; this.gbxRegulationSetup.Text = "Regulation Setup";
// //
// grpBoxDebug
//
this.gbxBoxDebug.Controls.Add(this.label7);
this.gbxBoxDebug.Controls.Add(this.tbxRefFlowRateFromRefFrequencyCmPerH);
this.gbxBoxDebug.Controls.Add(this.label6);
this.gbxBoxDebug.Controls.Add(this.tbxRefFrequencyDirectHz);
this.gbxBoxDebug.Controls.Add(this.label1);
this.gbxBoxDebug.Controls.Add(this.tbxDutPeriodMs);
this.gbxBoxDebug.Controls.Add(this.tbxRefFlowRateFromRefPeriodCmPerH);
this.gbxBoxDebug.Controls.Add(this.tbxDutFrequencyFromDutPeriodHz);
this.gbxBoxDebug.Controls.Add(this.label2);
this.gbxBoxDebug.Controls.Add(this.tbxDutFlowRateFromDutPeriodCmPerH);
this.gbxBoxDebug.Controls.Add(this.tbxRefFrequencyFromRefPeriodHz);
this.gbxBoxDebug.Controls.Add(this.label5);
this.gbxBoxDebug.Controls.Add(this.tbxRefPeriodMs);
this.gbxBoxDebug.Controls.Add(this.label4);
this.gbxBoxDebug.Controls.Add(this.label3);
this.gbxBoxDebug.Location = new System.Drawing.Point(0, -1);
this.gbxBoxDebug.Name = "gbxBoxDebug";
this.gbxBoxDebug.Size = new System.Drawing.Size(288, 175);
this.gbxBoxDebug.TabIndex = 83;
this.gbxBoxDebug.TabStop = false;
this.gbxBoxDebug.Text = "Debug";
this.gbxBoxDebug.Visible = false;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(10, 101);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(128, 13);
this.label7.TabIndex = 96;
this.label7.Text = "Flow Rate f(frequ.) [m³/h]:";
//
// tbxRefFlowRateFromRefFrequencyCmPerH
//
this.tbxRefFlowRateFromRefFrequencyCmPerH.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxRefFlowRateFromRefFrequencyCmPerH.Location = new System.Drawing.Point(153, 99);
this.tbxRefFlowRateFromRefFrequencyCmPerH.Name = "tbxRefFlowRateFromRefFrequencyCmPerH";
this.tbxRefFlowRateFromRefFrequencyCmPerH.ReadOnly = true;
this.tbxRefFlowRateFromRefFrequencyCmPerH.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.tbxRefFlowRateFromRefFrequencyCmPerH.Size = new System.Drawing.Size(60, 20);
this.tbxRefFlowRateFromRefFrequencyCmPerH.TabIndex = 95;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(10, 52);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(117, 13);
this.label6.TabIndex = 94;
this.label6.Text = "Frequency (direct) [Hz]:";
//
// tbxRefFrequencyDirectHz
//
this.tbxRefFrequencyDirectHz.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxRefFrequencyDirectHz.Location = new System.Drawing.Point(153, 50);
this.tbxRefFrequencyDirectHz.Name = "tbxRefFrequencyDirectHz";
this.tbxRefFrequencyDirectHz.ReadOnly = true;
this.tbxRefFrequencyDirectHz.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.tbxRefFrequencyDirectHz.Size = new System.Drawing.Size(60, 20);
this.tbxRefFrequencyDirectHz.TabIndex = 93;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(10, 25);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(123, 13);
this.label1.TabIndex = 83;
this.label1.Text = "Frequency f(period) [Hz]:";
//
// tbxDutPeriodMs
//
this.tbxDutPeriodMs.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxDutPeriodMs.Location = new System.Drawing.Point(220, 123);
this.tbxDutPeriodMs.Name = "tbxDutPeriodMs";
this.tbxDutPeriodMs.ReadOnly = true;
this.tbxDutPeriodMs.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.tbxDutPeriodMs.Size = new System.Drawing.Size(60, 20);
this.tbxDutPeriodMs.TabIndex = 92;
//
// tbxRefFlowRateFromRefPeriodCmPerH
//
this.tbxRefFlowRateFromRefPeriodCmPerH.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxRefFlowRateFromRefPeriodCmPerH.Location = new System.Drawing.Point(153, 74);
this.tbxRefFlowRateFromRefPeriodCmPerH.Name = "tbxRefFlowRateFromRefPeriodCmPerH";
this.tbxRefFlowRateFromRefPeriodCmPerH.ReadOnly = true;
this.tbxRefFlowRateFromRefPeriodCmPerH.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.tbxRefFlowRateFromRefPeriodCmPerH.Size = new System.Drawing.Size(60, 20);
this.tbxRefFlowRateFromRefPeriodCmPerH.TabIndex = 81;
//
// tbxDutFrequencyFromDutPeriodHz
//
this.tbxDutFrequencyFromDutPeriodHz.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxDutFrequencyFromDutPeriodHz.Location = new System.Drawing.Point(220, 25);
this.tbxDutFrequencyFromDutPeriodHz.Name = "tbxDutFrequencyFromDutPeriodHz";
this.tbxDutFrequencyFromDutPeriodHz.ReadOnly = true;
this.tbxDutFrequencyFromDutPeriodHz.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.tbxDutFrequencyFromDutPeriodHz.Size = new System.Drawing.Size(60, 20);
this.tbxDutFrequencyFromDutPeriodHz.TabIndex = 91;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(10, 76);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(130, 13);
this.label2.TabIndex = 80;
this.label2.Text = "Flow Rate f(period) [m³/h]:";
//
// tbxDutFlowRateFromDutPeriodCmPerH
//
this.tbxDutFlowRateFromDutPeriodCmPerH.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxDutFlowRateFromDutPeriodCmPerH.Location = new System.Drawing.Point(220, 74);
this.tbxDutFlowRateFromDutPeriodCmPerH.Name = "tbxDutFlowRateFromDutPeriodCmPerH";
this.tbxDutFlowRateFromDutPeriodCmPerH.ReadOnly = true;
this.tbxDutFlowRateFromDutPeriodCmPerH.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.tbxDutFlowRateFromDutPeriodCmPerH.Size = new System.Drawing.Size(60, 20);
this.tbxDutFlowRateFromDutPeriodCmPerH.TabIndex = 90;
//
// tbxRefFrequencyFromRefPeriodHz
//
this.tbxRefFrequencyFromRefPeriodHz.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxRefFrequencyFromRefPeriodHz.Location = new System.Drawing.Point(153, 25);
this.tbxRefFrequencyFromRefPeriodHz.Name = "tbxRefFrequencyFromRefPeriodHz";
this.tbxRefFrequencyFromRefPeriodHz.ReadOnly = true;
this.tbxRefFrequencyFromRefPeriodHz.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.tbxRefFrequencyFromRefPeriodHz.Size = new System.Drawing.Size(60, 20);
this.tbxRefFrequencyFromRefPeriodHz.TabIndex = 82;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(232, 9);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(30, 13);
this.label5.TabIndex = 89;
this.label5.Text = "DUT";
//
// tbxRefPeriodMs
//
this.tbxRefPeriodMs.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxRefPeriodMs.Location = new System.Drawing.Point(153, 123);
this.tbxRefPeriodMs.Name = "tbxRefPeriodMs";
this.tbxRefPeriodMs.ReadOnly = true;
this.tbxRefPeriodMs.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.tbxRefPeriodMs.Size = new System.Drawing.Size(60, 20);
this.tbxRefPeriodMs.TabIndex = 85;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(169, 9);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(28, 13);
this.label4.TabIndex = 88;
this.label4.Text = "REF";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(10, 125);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(62, 13);
this.label3.TabIndex = 84;
this.label3.Text = "Period [ms]:";
//
// btnSaveSetupToFm2014 // btnSaveSetupToFm2014
// //
this.btnSaveSetupToFm2014.Location = new System.Drawing.Point(173, 144); this.btnSaveSetupToFm2014.Location = new System.Drawing.Point(163, 144);
this.btnSaveSetupToFm2014.Name = "btnSaveSetupToFm2014"; this.btnSaveSetupToFm2014.Name = "btnSaveSetupToFm2014";
this.btnSaveSetupToFm2014.Size = new System.Drawing.Size(110, 25); this.btnSaveSetupToFm2014.Size = new System.Drawing.Size(120, 25);
this.btnSaveSetupToFm2014.TabIndex = 7; this.btnSaveSetupToFm2014.TabIndex = 7;
this.btnSaveSetupToFm2014.Text = "Save"; this.btnSaveSetupToFm2014.Text = "Save";
this.btnSaveSetupToFm2014.UseVisualStyleBackColor = true; this.btnSaveSetupToFm2014.UseVisualStyleBackColor = true;
@ -327,6 +503,7 @@
"9"}); "9"});
this.cbxToleranceDisplayAttenuation.Location = new System.Drawing.Point(220, 101); this.cbxToleranceDisplayAttenuation.Location = new System.Drawing.Point(220, 101);
this.cbxToleranceDisplayAttenuation.Name = "cbxToleranceDisplayAttenuation"; this.cbxToleranceDisplayAttenuation.Name = "cbxToleranceDisplayAttenuation";
this.cbxToleranceDisplayAttenuation.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cbxToleranceDisplayAttenuation.Size = new System.Drawing.Size(60, 21); this.cbxToleranceDisplayAttenuation.Size = new System.Drawing.Size(60, 21);
this.cbxToleranceDisplayAttenuation.TabIndex = 6; this.cbxToleranceDisplayAttenuation.TabIndex = 6;
this.cbxToleranceDisplayAttenuation.Text = "3"; this.cbxToleranceDisplayAttenuation.Text = "3";
@ -374,8 +551,10 @@
this.tbxRefPulsesPerCm.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tbxRefPulsesPerCm.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxRefPulsesPerCm.Location = new System.Drawing.Point(220, 26); this.tbxRefPulsesPerCm.Location = new System.Drawing.Point(220, 26);
this.tbxRefPulsesPerCm.Name = "tbxRefPulsesPerCm"; this.tbxRefPulsesPerCm.Name = "tbxRefPulsesPerCm";
this.tbxRefPulsesPerCm.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.tbxRefPulsesPerCm.Size = new System.Drawing.Size(60, 20); this.tbxRefPulsesPerCm.Size = new System.Drawing.Size(60, 20);
this.tbxRefPulsesPerCm.TabIndex = 4; this.tbxRefPulsesPerCm.TabIndex = 4;
this.tbxRefPulsesPerCm.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.tbxRefPulsesPerCm.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxRefPulsesPerCm_KeyDown); this.tbxRefPulsesPerCm.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxRefPulsesPerCm_KeyDown);
this.tbxRefPulsesPerCm.Leave += new System.EventHandler(this.tbxRefPulsesPerCm_Leave); this.tbxRefPulsesPerCm.Leave += new System.EventHandler(this.tbxRefPulsesPerCm_Leave);
// //
@ -384,8 +563,10 @@
this.tbxDutPulsesPerCm.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tbxDutPulsesPerCm.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxDutPulsesPerCm.Location = new System.Drawing.Point(220, 51); this.tbxDutPulsesPerCm.Location = new System.Drawing.Point(220, 51);
this.tbxDutPulsesPerCm.Name = "tbxDutPulsesPerCm"; this.tbxDutPulsesPerCm.Name = "tbxDutPulsesPerCm";
this.tbxDutPulsesPerCm.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.tbxDutPulsesPerCm.Size = new System.Drawing.Size(60, 20); this.tbxDutPulsesPerCm.Size = new System.Drawing.Size(60, 20);
this.tbxDutPulsesPerCm.TabIndex = 5; this.tbxDutPulsesPerCm.TabIndex = 5;
this.tbxDutPulsesPerCm.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.tbxDutPulsesPerCm.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxDutPulsesPerCm_KeyDown); this.tbxDutPulsesPerCm.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxDutPulsesPerCm_KeyDown);
this.tbxDutPulsesPerCm.Leave += new System.EventHandler(this.tbxDutPulsesPerCm_Leave); this.tbxDutPulsesPerCm.Leave += new System.EventHandler(this.tbxDutPulsesPerCm_Leave);
// //
@ -395,8 +576,10 @@
this.tbxScaleRefToDut.Location = new System.Drawing.Point(220, 76); this.tbxScaleRefToDut.Location = new System.Drawing.Point(220, 76);
this.tbxScaleRefToDut.Name = "tbxScaleRefToDut"; this.tbxScaleRefToDut.Name = "tbxScaleRefToDut";
this.tbxScaleRefToDut.ReadOnly = true; this.tbxScaleRefToDut.ReadOnly = true;
this.tbxScaleRefToDut.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.tbxScaleRefToDut.Size = new System.Drawing.Size(60, 20); this.tbxScaleRefToDut.Size = new System.Drawing.Size(60, 20);
this.tbxScaleRefToDut.TabIndex = 66; this.tbxScaleRefToDut.TabIndex = 66;
this.tbxScaleRefToDut.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
// //
// lblUpdateTimeValue // lblUpdateTimeValue
// //
@ -450,9 +633,9 @@
// //
// btnDutToRefRegulation // btnDutToRefRegulation
// //
this.btnDutToRefRegulation.Location = new System.Drawing.Point(113, 144); this.btnDutToRefRegulation.Location = new System.Drawing.Point(104, 144);
this.btnDutToRefRegulation.Name = "btnDutToRefRegulation"; this.btnDutToRefRegulation.Name = "btnDutToRefRegulation";
this.btnDutToRefRegulation.Size = new System.Drawing.Size(110, 25); this.btnDutToRefRegulation.Size = new System.Drawing.Size(120, 25);
this.btnDutToRefRegulation.TabIndex = 11; this.btnDutToRefRegulation.TabIndex = 11;
this.btnDutToRefRegulation.Text = "Start Regulation"; this.btnDutToRefRegulation.Text = "Start Regulation";
this.btnDutToRefRegulation.UseVisualStyleBackColor = true; this.btnDutToRefRegulation.UseVisualStyleBackColor = true;
@ -492,8 +675,10 @@
this.tbxDutPulsesMeasured.Location = new System.Drawing.Point(164, 51); this.tbxDutPulsesMeasured.Location = new System.Drawing.Point(164, 51);
this.tbxDutPulsesMeasured.Name = "tbxDutPulsesMeasured"; this.tbxDutPulsesMeasured.Name = "tbxDutPulsesMeasured";
this.tbxDutPulsesMeasured.ReadOnly = true; this.tbxDutPulsesMeasured.ReadOnly = true;
this.tbxDutPulsesMeasured.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.tbxDutPulsesMeasured.Size = new System.Drawing.Size(60, 20); this.tbxDutPulsesMeasured.Size = new System.Drawing.Size(60, 20);
this.tbxDutPulsesMeasured.TabIndex = 75; this.tbxDutPulsesMeasured.TabIndex = 75;
this.tbxDutPulsesMeasured.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
// //
// lblPulseVolumeCmRelation // lblPulseVolumeCmRelation
// //
@ -510,8 +695,10 @@
this.tbxRefCalibrationResultPulsePerCm.Location = new System.Drawing.Point(164, 102); this.tbxRefCalibrationResultPulsePerCm.Location = new System.Drawing.Point(164, 102);
this.tbxRefCalibrationResultPulsePerCm.Name = "tbxRefCalibrationResultPulsePerCm"; this.tbxRefCalibrationResultPulsePerCm.Name = "tbxRefCalibrationResultPulsePerCm";
this.tbxRefCalibrationResultPulsePerCm.ReadOnly = true; this.tbxRefCalibrationResultPulsePerCm.ReadOnly = true;
this.tbxRefCalibrationResultPulsePerCm.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.tbxRefCalibrationResultPulsePerCm.Size = new System.Drawing.Size(60, 20); this.tbxRefCalibrationResultPulsePerCm.Size = new System.Drawing.Size(60, 20);
this.tbxRefCalibrationResultPulsePerCm.TabIndex = 73; this.tbxRefCalibrationResultPulsePerCm.TabIndex = 73;
this.tbxRefCalibrationResultPulsePerCm.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
// //
// lblWeightScaleVolume // lblWeightScaleVolume
// //
@ -527,8 +714,10 @@
this.tbxVolumeMeasuredLiters.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tbxVolumeMeasuredLiters.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxVolumeMeasuredLiters.Location = new System.Drawing.Point(164, 77); this.tbxVolumeMeasuredLiters.Location = new System.Drawing.Point(164, 77);
this.tbxVolumeMeasuredLiters.Name = "tbxVolumeMeasuredLiters"; this.tbxVolumeMeasuredLiters.Name = "tbxVolumeMeasuredLiters";
this.tbxVolumeMeasuredLiters.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.tbxVolumeMeasuredLiters.Size = new System.Drawing.Size(60, 20); this.tbxVolumeMeasuredLiters.Size = new System.Drawing.Size(60, 20);
this.tbxVolumeMeasuredLiters.TabIndex = 8; this.tbxVolumeMeasuredLiters.TabIndex = 8;
this.tbxVolumeMeasuredLiters.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.tbxVolumeMeasuredLiters.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxManualInputVolumeLiters_KeyStoke); this.tbxVolumeMeasuredLiters.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxManualInputVolumeLiters_KeyStoke);
this.tbxVolumeMeasuredLiters.Leave += new System.EventHandler(this.tbxManualInputVolumeLiters_Leave); this.tbxVolumeMeasuredLiters.Leave += new System.EventHandler(this.tbxManualInputVolumeLiters_Leave);
// //
@ -547,14 +736,16 @@
this.tbxRefPulsesMeasured.Location = new System.Drawing.Point(164, 26); this.tbxRefPulsesMeasured.Location = new System.Drawing.Point(164, 26);
this.tbxRefPulsesMeasured.Name = "tbxRefPulsesMeasured"; this.tbxRefPulsesMeasured.Name = "tbxRefPulsesMeasured";
this.tbxRefPulsesMeasured.ReadOnly = true; this.tbxRefPulsesMeasured.ReadOnly = true;
this.tbxRefPulsesMeasured.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.tbxRefPulsesMeasured.Size = new System.Drawing.Size(60, 20); this.tbxRefPulsesMeasured.Size = new System.Drawing.Size(60, 20);
this.tbxRefPulsesMeasured.TabIndex = 69; this.tbxRefPulsesMeasured.TabIndex = 69;
this.tbxRefPulsesMeasured.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
// //
// btnManualRefCalibration // btnManualRefCalibration
// //
this.btnManualRefCalibration.Location = new System.Drawing.Point(114, 130); this.btnManualRefCalibration.Location = new System.Drawing.Point(104, 130);
this.btnManualRefCalibration.Name = "btnManualRefCalibration"; this.btnManualRefCalibration.Name = "btnManualRefCalibration";
this.btnManualRefCalibration.Size = new System.Drawing.Size(110, 25); this.btnManualRefCalibration.Size = new System.Drawing.Size(120, 25);
this.btnManualRefCalibration.TabIndex = 9; this.btnManualRefCalibration.TabIndex = 9;
this.btnManualRefCalibration.Text = "Start Calibration"; this.btnManualRefCalibration.Text = "Start Calibration";
this.btnManualRefCalibration.UseVisualStyleBackColor = true; this.btnManualRefCalibration.UseVisualStyleBackColor = true;
@ -592,8 +783,10 @@
this.tbxRefFrequencyHz.Location = new System.Drawing.Point(163, 51); this.tbxRefFrequencyHz.Location = new System.Drawing.Point(163, 51);
this.tbxRefFrequencyHz.Name = "tbxRefFrequencyHz"; this.tbxRefFrequencyHz.Name = "tbxRefFrequencyHz";
this.tbxRefFrequencyHz.ReadOnly = true; this.tbxRefFrequencyHz.ReadOnly = true;
this.tbxRefFrequencyHz.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.tbxRefFrequencyHz.Size = new System.Drawing.Size(60, 20); this.tbxRefFrequencyHz.Size = new System.Drawing.Size(60, 20);
this.tbxRefFrequencyHz.TabIndex = 78; this.tbxRefFrequencyHz.TabIndex = 78;
this.tbxRefFrequencyHz.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
// //
// chkUseDampedTolerance // chkUseDampedTolerance
// //
@ -622,8 +815,10 @@
this.tbxActualMeasuredToleranceDutToRef.Location = new System.Drawing.Point(163, 25); this.tbxActualMeasuredToleranceDutToRef.Location = new System.Drawing.Point(163, 25);
this.tbxActualMeasuredToleranceDutToRef.Name = "tbxActualMeasuredToleranceDutToRef"; this.tbxActualMeasuredToleranceDutToRef.Name = "tbxActualMeasuredToleranceDutToRef";
this.tbxActualMeasuredToleranceDutToRef.ReadOnly = true; this.tbxActualMeasuredToleranceDutToRef.ReadOnly = true;
this.tbxActualMeasuredToleranceDutToRef.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.tbxActualMeasuredToleranceDutToRef.Size = new System.Drawing.Size(60, 20); this.tbxActualMeasuredToleranceDutToRef.Size = new System.Drawing.Size(60, 20);
this.tbxActualMeasuredToleranceDutToRef.TabIndex = 77; this.tbxActualMeasuredToleranceDutToRef.TabIndex = 77;
this.tbxActualMeasuredToleranceDutToRef.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
// //
// lblActualFlowRateCmPerHour // lblActualFlowRateCmPerHour
// //
@ -640,8 +835,10 @@
this.tbxActualFlowRateCmPerHour.Location = new System.Drawing.Point(163, 77); this.tbxActualFlowRateCmPerHour.Location = new System.Drawing.Point(163, 77);
this.tbxActualFlowRateCmPerHour.Name = "tbxActualFlowRateCmPerHour"; this.tbxActualFlowRateCmPerHour.Name = "tbxActualFlowRateCmPerHour";
this.tbxActualFlowRateCmPerHour.ReadOnly = true; this.tbxActualFlowRateCmPerHour.ReadOnly = true;
this.tbxActualFlowRateCmPerHour.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.tbxActualFlowRateCmPerHour.Size = new System.Drawing.Size(60, 20); this.tbxActualFlowRateCmPerHour.Size = new System.Drawing.Size(60, 20);
this.tbxActualFlowRateCmPerHour.TabIndex = 75; this.tbxActualFlowRateCmPerHour.TabIndex = 75;
this.tbxActualFlowRateCmPerHour.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
// //
// pictureBox1 // pictureBox1
// //
@ -653,166 +850,6 @@
this.pictureBox1.TabIndex = 86; this.pictureBox1.TabIndex = 86;
this.pictureBox1.TabStop = false; this.pictureBox1.TabStop = false;
// //
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(10, 25);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(123, 13);
this.label1.TabIndex = 83;
this.label1.Text = "Frequency f(period) [Hz]:";
//
// tbxRefFrequencyFromRefPeriodHz
//
this.tbxRefFrequencyFromRefPeriodHz.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxRefFrequencyFromRefPeriodHz.Location = new System.Drawing.Point(153, 25);
this.tbxRefFrequencyFromRefPeriodHz.Name = "tbxRefFrequencyFromRefPeriodHz";
this.tbxRefFrequencyFromRefPeriodHz.ReadOnly = true;
this.tbxRefFrequencyFromRefPeriodHz.Size = new System.Drawing.Size(60, 20);
this.tbxRefFrequencyFromRefPeriodHz.TabIndex = 82;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(10, 76);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(130, 13);
this.label2.TabIndex = 80;
this.label2.Text = "Flow Rate f(period) [m³/h]:";
//
// tbxRefFlowRateFromRefPeriodCmPerH
//
this.tbxRefFlowRateFromRefPeriodCmPerH.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxRefFlowRateFromRefPeriodCmPerH.Location = new System.Drawing.Point(153, 74);
this.tbxRefFlowRateFromRefPeriodCmPerH.Name = "tbxRefFlowRateFromRefPeriodCmPerH";
this.tbxRefFlowRateFromRefPeriodCmPerH.ReadOnly = true;
this.tbxRefFlowRateFromRefPeriodCmPerH.Size = new System.Drawing.Size(60, 20);
this.tbxRefFlowRateFromRefPeriodCmPerH.TabIndex = 81;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(10, 125);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(62, 13);
this.label3.TabIndex = 84;
this.label3.Text = "Period [ms]:";
//
// tbxRefPeriodMs
//
this.tbxRefPeriodMs.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxRefPeriodMs.Location = new System.Drawing.Point(153, 123);
this.tbxRefPeriodMs.Name = "tbxRefPeriodMs";
this.tbxRefPeriodMs.ReadOnly = true;
this.tbxRefPeriodMs.Size = new System.Drawing.Size(60, 20);
this.tbxRefPeriodMs.TabIndex = 85;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(169, 9);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(28, 13);
this.label4.TabIndex = 88;
this.label4.Text = "REF";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(232, 9);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(30, 13);
this.label5.TabIndex = 89;
this.label5.Text = "DUT";
//
// tbxDutPeriodMs
//
this.tbxDutPeriodMs.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxDutPeriodMs.Location = new System.Drawing.Point(220, 123);
this.tbxDutPeriodMs.Name = "tbxDutPeriodMs";
this.tbxDutPeriodMs.ReadOnly = true;
this.tbxDutPeriodMs.Size = new System.Drawing.Size(60, 20);
this.tbxDutPeriodMs.TabIndex = 92;
//
// tbxDutFrequencyFromDutPeriodHz
//
this.tbxDutFrequencyFromDutPeriodHz.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxDutFrequencyFromDutPeriodHz.Location = new System.Drawing.Point(220, 25);
this.tbxDutFrequencyFromDutPeriodHz.Name = "tbxDutFrequencyFromDutPeriodHz";
this.tbxDutFrequencyFromDutPeriodHz.ReadOnly = true;
this.tbxDutFrequencyFromDutPeriodHz.Size = new System.Drawing.Size(60, 20);
this.tbxDutFrequencyFromDutPeriodHz.TabIndex = 91;
//
// tbxDutFlowRateFromDutPeriodCmPerH
//
this.tbxDutFlowRateFromDutPeriodCmPerH.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxDutFlowRateFromDutPeriodCmPerH.Location = new System.Drawing.Point(220, 74);
this.tbxDutFlowRateFromDutPeriodCmPerH.Name = "tbxDutFlowRateFromDutPeriodCmPerH";
this.tbxDutFlowRateFromDutPeriodCmPerH.ReadOnly = true;
this.tbxDutFlowRateFromDutPeriodCmPerH.Size = new System.Drawing.Size(60, 20);
this.tbxDutFlowRateFromDutPeriodCmPerH.TabIndex = 90;
//
// grpBoxDebug
//
this.grpBoxDebug.Controls.Add(this.label7);
this.grpBoxDebug.Controls.Add(this.tbxRefFlowRateFromRefFrequencyCmPerH);
this.grpBoxDebug.Controls.Add(this.label6);
this.grpBoxDebug.Controls.Add(this.tbxRefFrequencyDirectHz);
this.grpBoxDebug.Controls.Add(this.label1);
this.grpBoxDebug.Controls.Add(this.tbxDutPeriodMs);
this.grpBoxDebug.Controls.Add(this.tbxRefFlowRateFromRefPeriodCmPerH);
this.grpBoxDebug.Controls.Add(this.tbxDutFrequencyFromDutPeriodHz);
this.grpBoxDebug.Controls.Add(this.label2);
this.grpBoxDebug.Controls.Add(this.tbxDutFlowRateFromDutPeriodCmPerH);
this.grpBoxDebug.Controls.Add(this.tbxRefFrequencyFromRefPeriodHz);
this.grpBoxDebug.Controls.Add(this.label5);
this.grpBoxDebug.Controls.Add(this.tbxRefPeriodMs);
this.grpBoxDebug.Controls.Add(this.label4);
this.grpBoxDebug.Controls.Add(this.label3);
this.grpBoxDebug.Location = new System.Drawing.Point(8, 238);
this.grpBoxDebug.Name = "grpBoxDebug";
this.grpBoxDebug.Size = new System.Drawing.Size(288, 175);
this.grpBoxDebug.TabIndex = 83;
this.grpBoxDebug.TabStop = false;
this.grpBoxDebug.Text = "Debug";
this.grpBoxDebug.Visible = false;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(10, 101);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(128, 13);
this.label7.TabIndex = 96;
this.label7.Text = "Flow Rate f(frequ.) [m³/h]:";
//
// tbxRefFlowRateFromRefFrequencyCmPerH
//
this.tbxRefFlowRateFromRefFrequencyCmPerH.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxRefFlowRateFromRefFrequencyCmPerH.Location = new System.Drawing.Point(153, 99);
this.tbxRefFlowRateFromRefFrequencyCmPerH.Name = "tbxRefFlowRateFromRefFrequencyCmPerH";
this.tbxRefFlowRateFromRefFrequencyCmPerH.ReadOnly = true;
this.tbxRefFlowRateFromRefFrequencyCmPerH.Size = new System.Drawing.Size(60, 20);
this.tbxRefFlowRateFromRefFrequencyCmPerH.TabIndex = 95;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(10, 52);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(117, 13);
this.label6.TabIndex = 94;
this.label6.Text = "Frequency (direct) [Hz]:";
//
// tbxRefFrequencyDirectHz
//
this.tbxRefFrequencyDirectHz.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxRefFrequencyDirectHz.Location = new System.Drawing.Point(153, 50);
this.tbxRefFrequencyDirectHz.Name = "tbxRefFrequencyDirectHz";
this.tbxRefFrequencyDirectHz.ReadOnly = true;
this.tbxRefFrequencyDirectHz.Size = new System.Drawing.Size(60, 20);
this.tbxRefFrequencyDirectHz.TabIndex = 93;
//
// menuStrip1 // menuStrip1
// //
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
@ -825,8 +862,7 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(543, 461); this.ClientSize = new System.Drawing.Size(543, 460);
this.Controls.Add(this.grpBoxDebug);
this.Controls.Add(this.gbxRegulationSetup); this.Controls.Add(this.gbxRegulationSetup);
this.Controls.Add(this.gbxDutToRefRegulation); this.Controls.Add(this.gbxDutToRefRegulation);
this.Controls.Add(this.pictureBox1); this.Controls.Add(this.pictureBox1);
@ -852,13 +888,13 @@
((System.ComponentModel.ISupportInitialize)(this.picFM2014)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picFM2014)).EndInit();
this.gbxRegulationSetup.ResumeLayout(false); this.gbxRegulationSetup.ResumeLayout(false);
this.gbxRegulationSetup.PerformLayout(); this.gbxRegulationSetup.PerformLayout();
this.gbxBoxDebug.ResumeLayout(false);
this.gbxBoxDebug.PerformLayout();
this.gbxManualRefCalibration.ResumeLayout(false); this.gbxManualRefCalibration.ResumeLayout(false);
this.gbxManualRefCalibration.PerformLayout(); this.gbxManualRefCalibration.PerformLayout();
this.gbxDutToRefRegulation.ResumeLayout(false); this.gbxDutToRefRegulation.ResumeLayout(false);
this.gbxDutToRefRegulation.PerformLayout(); this.gbxDutToRefRegulation.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.grpBoxDebug.ResumeLayout(false);
this.grpBoxDebug.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -925,7 +961,7 @@
private System.Windows.Forms.TextBox tbxDutPeriodMs; private System.Windows.Forms.TextBox tbxDutPeriodMs;
private System.Windows.Forms.TextBox tbxDutFrequencyFromDutPeriodHz; private System.Windows.Forms.TextBox tbxDutFrequencyFromDutPeriodHz;
private System.Windows.Forms.TextBox tbxDutFlowRateFromDutPeriodCmPerH; private System.Windows.Forms.TextBox tbxDutFlowRateFromDutPeriodCmPerH;
private System.Windows.Forms.GroupBox grpBoxDebug; private System.Windows.Forms.GroupBox gbxBoxDebug;
private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox tbxRefFrequencyDirectHz; private System.Windows.Forms.TextBox tbxRefFrequencyDirectHz;
private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label7;

View File

@ -90,8 +90,12 @@ namespace Sensus.MiniPrf.Ui
// internal reminders of changed items to avoid write access on startup if items are preloaded // internal reminders of changed items to avoid write access on startup if items are preloaded
private Int32 _comPortIdx; private Int32 _comPortIdx;
private Int32 _addressIdx; private Int32 _addressIdx;
private Int32 _currentOutputDisplayRange_percent; private Int32 _currentOutputDisplayRangeIdx;
private Byte _toleranceDisplayAttenuation;
// Reminder of settings in standalone measurement to avoid repeated storage af already stored values
private UInt32 _initialRefPulsesPerCm;
private UInt16 _initialDutPulsesPerCm;
private Byte _initialCurrentOutputAttenuation;
/// <summary> /// <summary>
/// The regulation setup will be stored directly to the FM2014 being able to use it at startup /// The regulation setup will be stored directly to the FM2014 being able to use it at startup
@ -140,7 +144,7 @@ namespace Sensus.MiniPrf.Ui
_fm2014RegulationSetupHasChanged = false; _fm2014RegulationSetupHasChanged = false;
_programConfigSetupHasChanged = false; _programConfigSetupHasChanged = false;
grpBoxDebug.Visible = false; gbxBoxDebug.Visible = false;
gbxDutToRefRegulation.Visible = true; gbxDutToRefRegulation.Visible = true;
gbxRegulationSetup.Visible = true; gbxRegulationSetup.Visible = true;
@ -165,10 +169,11 @@ namespace Sensus.MiniPrf.Ui
{ {
cbxProgramComPort.Items.Add(comPort); cbxProgramComPort.Items.Add(comPort);
} }
cbxProgramComPort.Text = cbxProgramComPort.Items[_comPortIdx].ToString(); cbxProgramComPort.Text = cbxProgramComPort.Items[_comPortIdx].ToString();
// Select the last address
var itemContent = _fm2014Config.Address ?? 1; var itemContent = _fm2014Config.Address ?? 1;
for (var idx = 0; idx < cbxFM2014Address.MaxDropDownItems; idx++) for (var idx = 0; idx < cbxFM2014Address.Items.Count; idx++)
{ {
if (!cbxFM2014Address.Items[idx].ToString().Equals(itemContent.ToString())) continue; if (!cbxFM2014Address.Items[idx].ToString().Equals(itemContent.ToString())) continue;
@ -177,12 +182,13 @@ namespace Sensus.MiniPrf.Ui
break; break;
} }
// Select the current output range
itemContent = _fm2014Config.CommonCurrentOutputDisplayRangeNominal_percent; itemContent = _fm2014Config.CommonCurrentOutputDisplayRangeNominal_percent;
for (var idx = 0; idx < cbxToleranceDisplayRange.MaxDropDownItems; idx++) for (var idx = 0; idx < cbxToleranceDisplayRange.Items.Count; idx++)
{ {
if (!cbxToleranceDisplayRange.Items[idx].ToString().Equals(itemContent.ToString())) continue; if (!cbxToleranceDisplayRange.Items[idx].ToString().Equals(itemContent.ToString())) continue;
_currentOutputDisplayRange_percent = idx; _currentOutputDisplayRangeIdx = idx;
cbxToleranceDisplayRange.SelectedItem = cbxToleranceDisplayRange.Items[idx]; cbxToleranceDisplayRange.SelectedItem = cbxToleranceDisplayRange.Items[idx];
break; break;
} }
@ -230,11 +236,13 @@ namespace Sensus.MiniPrf.Ui
gbxDutToRefRegulation.Text = Resources.StrGbxDutToRefRegulation; gbxDutToRefRegulation.Text = Resources.StrGbxDutToRefRegulation;
lblActualFlowRateCmPerHour.Text = Resources.StrLblActualMeasuredFlowRate; lblActualFlowRateCmPerHour.Text = Resources.StrLblActualMeasuredFlowRate;
tbxActualFlowRateCmPerHour.Text = ""; tbxActualFlowRateCmPerHour.Text = "";
tbxActualFlowRateCmPerHour.BackColor = ColorStandardDisplayField;
lblActualMeasuredTolerance.Text = Resources.StrLblActualMeasuredToleranceDutToRef; lblActualMeasuredTolerance.Text = Resources.StrLblActualMeasuredToleranceDutToRef;
tbxActualMeasuredToleranceDutToRef.Text = ""; tbxActualMeasuredToleranceDutToRef.Text = "";
chkUseDampedTolerance.Text = Resources.StrChkUseDampedTolerance; chkUseDampedTolerance.Text = Resources.StrChkUseDampedTolerance;
btnDutToRefRegulation.Text = Resources.StrBtnStartRegulation; btnDutToRefRegulation.Text = Resources.StrBtnStartRegulation;
tbxRefFrequencyHz.Text = ""; tbxRefFrequencyHz.Text = "";
tbxRefFrequencyHz.BackColor = ColorStandardDisplayField;
// Process status // Process status
lblActualProcess.Text = Resources.StrLblProcessStatus; lblActualProcess.Text = Resources.StrLblProcessStatus;
@ -267,9 +275,16 @@ namespace Sensus.MiniPrf.Ui
_programConfigSetupHasChanged = false; _programConfigSetupHasChanged = false;
_fm2014Config.SharedSerialPort = cbxProgramComPort.Text; _fm2014Config.SharedSerialPort = cbxProgramComPort.Text;
_fm2014Config.Address = _addressIdx; if (int.TryParse(cbxFM2014Address.SelectedItem.ToString(), out var address))
_fm2014Config.CommonCurrentOutputDisplayRangeNominal_percent = _currentOutputDisplayRange_percent; {
_fm2014Config.Address = address;
}
if (int.TryParse(cbxToleranceDisplayRange.SelectedItem.ToString(), out var tolerancePercent)
&& (tolerancePercent == FM2014.CURRENT_OUTPUT_DISPLAY_RANGE_STANDARD_NOMINAL_percent ||
tolerancePercent == FM2014.CURRENT_OUTPUT_DISPLAY_RANGE_EXTENDED_NOMINAL_percent))
{
_fm2014Config.CommonCurrentOutputDisplayRangeNominal_percent = tolerancePercent;
}
_fm2014Config.Update(); _fm2014Config.Update();
})); }));
} }
@ -759,31 +774,34 @@ namespace Sensus.MiniPrf.Ui
LogText($"{resp.AnswerStr}: {resp.IntValue:D} {resp.Unit}"); LogText($"{resp.AnswerStr}: {resp.IntValue:D} {resp.Unit}");
switch (resp.CmdName) switch (resp.CmdName)
{ {
case CmdName.CMD_REF_GET_PLS_CTR: case CmdName.CmdGetRefPulsesCounted:
case CmdName.CMD_REF_GET_PLS_CTR_BU: case CmdName.CmdGetRefPulsesCountedBackup:
tbxRefPulsesMeasured.Text = $@"{resp.IntValue:D}"; tbxRefPulsesMeasured.Text = $@"{resp.IntValue:D}";
break; break;
case CmdName.CMD_DUT_GET_PLS_CTR: case CmdName.CmdGetDutPulsesCounted:
case CmdName.CMD_DUT_GET_PLS_CTR_BU: case CmdName.CmdGetDutPulsesCountedBackup:
tbxDutPulsesMeasured.Text = $@"{resp.IntValue:D}"; tbxDutPulsesMeasured.Text = $@"{resp.IntValue:D}";
break; break;
case CmdName.CMD_REF_LPP_SCALE: case CmdName.CmdSetRefPulsesPerCm:
tbxRefPulsesPerCm.Text = $@"{resp.IntValue:D}"; tbxRefPulsesPerCm.Text = $@"{resp.IntValue:D}";
_initialRefPulsesPerCm = (UInt32)resp.IntValue;
break; break;
case CmdName.CMD_DUT_LPP_SCALE: case CmdName.CmdSetDutPulsesPerCm:
tbxDutPulsesPerCm.Text = $@"{resp.IntValue:D}"; tbxDutPulsesPerCm.Text = $@"{resp.IntValue:D}";
_initialDutPulsesPerCm = (UInt16)resp.IntValue;
break; break;
case CmdName.CMD_MEAS_SET_ATTN: case CmdName.CmdSetCurrentOutputAttenuation:
var idx = cbxToleranceDisplayAttenuation.FindString($@"{resp.IntValue}"); var idx = cbxToleranceDisplayAttenuation.FindString($@"{resp.IntValue}");
cbxToleranceDisplayAttenuation.SelectedIndex = idx; cbxToleranceDisplayAttenuation.SelectedIndex = idx;
_initialCurrentOutputAttenuation = (Byte)resp.IntValue;
break; break;
case CmdName.CMD_GET_REF_FREQU: case CmdName.CmdGetRefFrequency:
tbxRefFrequencyHz.Text = $@"{resp.IntValue:D}"; tbxRefFrequencyHz.Text = $@"{resp.IntValue:D}";
tbxRefFrequencyDirectHz.Text = $@"{resp.IntValue:D}"; tbxRefFrequencyDirectHz.Text = $@"{resp.IntValue:D}";
tbxRefFrequencyHz.BackColor = statusColor; tbxRefFrequencyHz.BackColor = statusColor;
tbxActualFlowRateCmPerHour.BackColor = statusColor; tbxActualFlowRateCmPerHour.BackColor = statusColor;
break; break;
case CmdName.CMD_RST_MEAS: case CmdName.CmdResetMeasurement:
// Immediately lock all buttons and input fields until reset is finished // Immediately lock all buttons and input fields until reset is finished
SetFM2014AccessLocked(); SetFM2014AccessLocked();
// Check countdown of reset method // Check countdown of reset method
@ -798,36 +816,36 @@ namespace Sensus.MiniPrf.Ui
LogText($"{resp.AnswerStr}: {resp.DoubleValue:F2} {resp.Unit}"); LogText($"{resp.AnswerStr}: {resp.DoubleValue:F2} {resp.Unit}");
switch (resp.CmdName) switch (resp.CmdName)
{ {
case CmdName.CMD_GET_UDTLC: case CmdName.CmdGetDutToRefToleranceUndamped:
case CmdName.CMD_GET_DTLC: case CmdName.CmdGetDutToRefToleranceDamped:
tbxActualMeasuredToleranceDutToRef.Text = $@"{resp.DoubleValue:F2}"; tbxActualMeasuredToleranceDutToRef.Text = $@"{resp.DoubleValue:F2}";
tbxActualMeasuredToleranceDutToRef.BackColor = statusColor; tbxActualMeasuredToleranceDutToRef.BackColor = statusColor;
break; break;
case CmdName.CMD_REF_SET_SCALE: case CmdName.CmdRefToDutScale:
tbxScaleRefToDut.Text = $@"{resp.DoubleValue:F4}"; tbxScaleRefToDut.Text = $@"{resp.DoubleValue:F4}";
break; break;
// DEBUG // DEBUG
case CmdName.CMD_GET_REF_PERIOD: case CmdName.CmdGetRefPeriod:
tbxRefPeriodMs.Text = $@"{resp.DoubleValue:F3}"; tbxRefPeriodMs.Text = $@"{resp.DoubleValue:F3}";
break; break;
case CmdName.CMD_GET_DUT_PERIOD: case CmdName.CmdGetDutPeriod:
tbxDutPeriodMs.Text = $@"{resp.DoubleValue:F3}"; tbxDutPeriodMs.Text = $@"{resp.DoubleValue:F3}";
break; break;
case CmdName.CMD_CAL_FREQU_REF_PERIOD: case CmdName.CmdCalculatedFrequRefPeriod:
tbxRefFrequencyFromRefPeriodHz.Text = $@"{resp.DoubleValue:F3}"; tbxRefFrequencyFromRefPeriodHz.Text = $@"{resp.DoubleValue:F3}";
break; break;
case CmdName.CMD_CAL_FREQU_DUT_PERIOD: case CmdName.CmdCalculatedFrequencyDutPeriod:
tbxDutFrequencyFromDutPeriodHz.Text = $@"{resp.DoubleValue:F3}"; tbxDutFrequencyFromDutPeriodHz.Text = $@"{resp.DoubleValue:F3}";
break; break;
case CmdName.CMD_CAL_FLOW_REF_FREQU: case CmdName.CmdCalculatedFlowRefFrequ:
tbxRefFlowRateFromRefFrequencyCmPerH.Text = $@"{resp.DoubleValue:F3}"; tbxRefFlowRateFromRefFrequencyCmPerH.Text = $@"{resp.DoubleValue:F3}";
// TODO THW Check if the actual flow shall be taken based on 'REF Frequency' // TODO THW Check if the actual flow shall be taken based on 'REF Frequency'
tbxActualFlowRateCmPerHour.Text = $@"{resp.DoubleValue:F3}"; tbxActualFlowRateCmPerHour.Text = $@"{resp.DoubleValue:F3}";
break; break;
case CmdName.CMD_CAL_FLOW_REF_PERIOD: case CmdName.CmdCalculatedFlowRefPeriod:
tbxRefFlowRateFromRefPeriodCmPerH.Text = $@"{resp.DoubleValue:F3}"; tbxRefFlowRateFromRefPeriodCmPerH.Text = $@"{resp.DoubleValue:F3}";
break; break;
case CmdName.CMD_CAL_FLOW_DUT_PERIOD: case CmdName.CmdCalculatedFlowDutPeriod:
tbxDutFlowRateFromDutPeriodCmPerH.Text = $@"{resp.DoubleValue:F3}"; tbxDutFlowRateFromDutPeriodCmPerH.Text = $@"{resp.DoubleValue:F3}";
break; break;
@ -879,30 +897,13 @@ namespace Sensus.MiniPrf.Ui
_startTime = DateTimeOffset.UtcNow; _startTime = DateTimeOffset.UtcNow;
Invoke(new Action(() => Invoke(new Action(() =>
{ {
if (FM2014.SharedCyclicMeasSequ == CyclicMeasSequ.IDLE) if (FM2014.SharedCyclicMeasSequ == CyclicMeasSequ.idle)
{ {
if (FM2014.RegisteredFm2014s == null || FM2014.RegisteredFm2014s.Count == 0) if (FM2014.RegisteredFm2014s == null || FM2014.RegisteredFm2014s.Count == 0)
return; return;
// Take the settings from the inputs if (FM2014.RegulationMeasurement(Fm2014.RefPulses_per_cm, Fm2014.DutPulses_per_cm,
UInt32 refPulses_per_cm = 1000; Fm2014.DoublePulseDeadtime_ms, Fm2014.CurrentOutputAttenuation))
UInt16 dutPulses_per_cm = 100;
UInt16 doublePulseDeadtime_ms = 0;
if (int.TryParse(tbxRefPulsesPerCm.Text, out var pulses_per_cm) &&
FM2014.PULSES_PER_CM_REGULATION_SETUP_MIN <= pulses_per_cm &&
FM2014.REF_PULSES_PER_CM_REGULATION_INPUT_MAX >= pulses_per_cm)
{
refPulses_per_cm = (UInt32)pulses_per_cm;
}
if (int.TryParse(tbxDutPulsesPerCm.Text, out pulses_per_cm) &&
FM2014.PULSES_PER_CM_REGULATION_SETUP_MIN <= pulses_per_cm &&
FM2014.PULSES_PER_CM_REGULATION_SETUP_MAX >= pulses_per_cm)
{
dutPulses_per_cm = (UInt16)pulses_per_cm;
}
if (FM2014.RegulationMeasurement(refPulses_per_cm, dutPulses_per_cm, doublePulseDeadtime_ms,
_toleranceDisplayAttenuation))
{ {
_autoProgressBar = true; _autoProgressBar = true;
ActionControl(true); ActionControl(true);
@ -912,11 +913,10 @@ namespace Sensus.MiniPrf.Ui
} }
else else
{ {
_autoProgressBar = false;
// Deactivate the button temporary to avoid repeated execution as the reset takes a certain time // Deactivate the button temporary to avoid repeated execution as the reset takes a certain time
_autoProgressBar = false;
btnDutToRefRegulation.Enabled = false; btnDutToRefRegulation.Enabled = false;
FM2014.ResetHardwareAllDevices(); FM2014.ResetHardwareAllDevices();
ActionControl(false);
btnDutToRefRegulation.Text = Resources.StrBtnStartRegulation; btnDutToRefRegulation.Text = Resources.StrBtnStartRegulation;
} }
})); }));
@ -933,7 +933,7 @@ namespace Sensus.MiniPrf.Ui
_startTime = DateTimeOffset.UtcNow; _startTime = DateTimeOffset.UtcNow;
Invoke(new Action(() => Invoke(new Action(() =>
{ {
if (FM2014.SharedCyclicMeasSequ == CyclicMeasSequ.IDLE) if (FM2014.SharedCyclicMeasSequ == CyclicMeasSequ.idle)
{ {
tbxRefPulsesMeasured.Text = ""; tbxRefPulsesMeasured.Text = "";
tbxDutPulsesMeasured.Text = ""; tbxDutPulsesMeasured.Text = "";
@ -954,8 +954,8 @@ namespace Sensus.MiniPrf.Ui
else else
{ {
// Deactivate the button temporary to avoid repeated execution as the reset takes a certain time // Deactivate the button temporary to avoid repeated execution as the reset takes a certain time
btnManualRefCalibration.Enabled = false;
_autoProgressBar = false; _autoProgressBar = false;
btnManualRefCalibration.Enabled = false;
FM2014.ResetHardwareAllDevices(); FM2014.ResetHardwareAllDevices();
} }
})); }));
@ -969,18 +969,19 @@ namespace Sensus.MiniPrf.Ui
/// <remarks date="2023-Jan-04" author="Thomas Wiedebusch"> /// <remarks date="2023-Jan-04" author="Thomas Wiedebusch">
/// - Initial. /// - Initial.
/// </remarks> /// </remarks>
private void cbxFM2014BaseSettings_SelectedValueChanged(Object sender, EventArgs e) private void cbxProgramSettings_Changed(Object sender, EventArgs e)
{ {
Invoke(new Action(() => Invoke(new Action(() =>
{ {
if (_currentOutputDisplayRange_percent != cbxToleranceDisplayRange.SelectedIndex || if (_currentOutputDisplayRangeIdx != cbxToleranceDisplayRange.SelectedIndex ||
_addressIdx != cbxFM2014Address.SelectedIndex || _addressIdx != cbxFM2014Address.SelectedIndex ||
_comPortIdx != cbxProgramComPort.SelectedIndex) _comPortIdx != cbxProgramComPort.SelectedIndex)
{ {
_currentOutputDisplayRange_percent = cbxToleranceDisplayRange.SelectedIndex; _currentOutputDisplayRangeIdx = cbxToleranceDisplayRange.SelectedIndex;
_addressIdx = cbxFM2014Address.SelectedIndex; _addressIdx = cbxFM2014Address.SelectedIndex;
_comPortIdx = cbxProgramComPort.SelectedIndex; _comPortIdx = cbxProgramComPort.SelectedIndex;
StoreProgramConfiguration(); StoreProgramConfiguration();
Init();
} }
})); }));
} }
@ -1079,7 +1080,7 @@ namespace Sensus.MiniPrf.Ui
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
/// <remarks date="2023-Jan-14..24" author="Thomas Wiedebusch"> /// <remarks date="2023-Jan-14..Feb-17" author="Thomas Wiedebusch">
/// - Initial. /// - Initial.
/// </remarks> /// </remarks>
private void tbxRefPulsesPerCm_Leave(Object sender, EventArgs e) private void tbxRefPulsesPerCm_Leave(Object sender, EventArgs e)
@ -1114,15 +1115,24 @@ namespace Sensus.MiniPrf.Ui
return; return;
} }
tbxRefPulsesPerCm.BackColor = ColorStandardInputField;
// Check if values have changed and need to be updated in the standalone setup // Check if values have changed and need to be updated in the standalone setup
if (backupPulses_per_cm != pulses_per_cm || tbxRefPulsesPerCm.BackColor == ColorProcessFailed) if (backupPulses_per_cm != pulses_per_cm && _initialRefPulsesPerCm != pulses_per_cm)
{ {
DutToRefRegulationSetupHasChanged(); DutToRefRegulationSetupHasChanged();
} }
else
{
_fm2014RegulationSetupHasChanged = false;
btnSaveSetupToFm2014.Enabled = false;
}
} }
else else
{ {
tbxRefPulsesPerCm.BackColor = ColorProcessFailed; tbxRefPulsesPerCm.BackColor = ColorProcessFailed;
_fm2014RegulationSetupHasChanged = false;
btnSaveSetupToFm2014.Enabled = false;
} }
})); }));
} }
@ -1203,15 +1213,24 @@ namespace Sensus.MiniPrf.Ui
return; return;
} }
tbxDutPulsesPerCm.BackColor = ColorStandardInputField;
// Check if values have changed and need to be updated in the standalone setup // Check if values have changed and need to be updated in the standalone setup
if (backupPulses_per_cm != Fm2014.DutPulses_per_cm) if (backupPulses_per_cm != pulses_per_cm && _initialDutPulsesPerCm != pulses_per_cm)
{ {
DutToRefRegulationSetupHasChanged(); DutToRefRegulationSetupHasChanged();
} }
else
{
_fm2014RegulationSetupHasChanged = false;
btnSaveSetupToFm2014.Enabled = false;
}
} }
else else
{ {
tbxDutPulsesPerCm.BackColor = ColorProcessFailed; tbxDutPulsesPerCm.BackColor = ColorProcessFailed;
_fm2014RegulationSetupHasChanged = false;
btnSaveSetupToFm2014.Enabled = false;
} }
})); }));
} }
@ -1305,15 +1324,24 @@ namespace Sensus.MiniPrf.Ui
tbxRefCalibrationResultPulsePerCm.BackColor = ColorProcessFailed; tbxRefCalibrationResultPulsePerCm.BackColor = ColorProcessFailed;
return; return;
} }
tbxVolumeMeasuredLiters.BackColor = ColorStandardInputField;
tbxRefCalibrationResultPulsePerCm.BackColor = ColorStandardInputField;
// Check if values have changed and need to be updated in the standalone setup // Check if values have changed and need to be updated in the standalone setup
if (backupPulses_per_cm != Fm2014.RefPulses_per_cm) if (backupPulses_per_cm != pulses_per_cm && _initialRefPulsesPerCm != pulses_per_cm)
{ {
DutToRefRegulationSetupHasChanged(); DutToRefRegulationSetupHasChanged();
} }
else
{
_fm2014RegulationSetupHasChanged = false;
btnSaveSetupToFm2014.Enabled = false;
}
} }
else else
{ {
_fm2014RegulationSetupHasChanged = false;
btnSaveSetupToFm2014.Enabled = false;
tbxVolumeMeasuredLiters.BackColor = ColorProcessFailed; tbxVolumeMeasuredLiters.BackColor = ColorProcessFailed;
tbxRefCalibrationResultPulsePerCm.BackColor = ColorProcessFailed; tbxRefCalibrationResultPulsePerCm.BackColor = ColorProcessFailed;
tbxRefCalibrationResultPulsePerCm.Text = Resources.StrError; tbxRefCalibrationResultPulsePerCm.Text = Resources.StrError;
@ -1331,13 +1359,10 @@ namespace Sensus.MiniPrf.Ui
{ {
Invoke(new Action(() => Invoke(new Action(() =>
{ {
grpBoxDebug.Visible = !grpBoxDebug.Visible; gbxBoxDebug.Visible = !gbxBoxDebug.Visible;
gbxRegulationSetup.Visible = !gbxBoxDebug.Visible;
if (Fm2014 != null) if (Fm2014 != null)
Fm2014.RequestDebugInformation = grpBoxDebug.Visible; Fm2014.RequestDebugInformation = gbxBoxDebug.Visible;
//gbxDutToRefRegulation.Visible = !grpBoxDebug.Visible;
gbxRegulationSetup.Visible = !grpBoxDebug.Visible;
})); }));
} }
@ -1353,15 +1378,21 @@ namespace Sensus.MiniPrf.Ui
Invoke(new Action(() => Invoke(new Action(() =>
{ {
//Backup the actual setting to detect changes
var backupAttenuation = Fm2014.CurrentOutputAttenuation;
if (byte.TryParse(cbxToleranceDisplayAttenuation.SelectedItem.ToString(), out var attenuation) && if (byte.TryParse(cbxToleranceDisplayAttenuation.SelectedItem.ToString(), out var attenuation) &&
attenuation >= FM2014.CURRENT_OUTPUT_ATTENUATION_MIN && attenuation >= FM2014.CURRENT_OUTPUT_ATTENUATION_MIN &&
attenuation <= FM2014.CURRENT_OUTPUT_ATTENUATION_MAX && attenuation <= FM2014.CURRENT_OUTPUT_ATTENUATION_MAX &&
_toleranceDisplayAttenuation != attenuation) backupAttenuation != attenuation && _initialCurrentOutputAttenuation != attenuation)
{ {
_fm2014RegulationSetupHasChanged = true;
_toleranceDisplayAttenuation = attenuation;
Fm2014.CurrentOutputAttenuation = attenuation; Fm2014.CurrentOutputAttenuation = attenuation;
btnSaveSetupToFm2014.Enabled = true; DutToRefRegulationSetupHasChanged();
}
else
{
_fm2014RegulationSetupHasChanged = false;
btnSaveSetupToFm2014.Enabled = false;
} }
})); }));
} }

View File

@ -90,7 +90,7 @@ namespace Sensus.MiniPrf.Ui.Properties {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Save. /// Looks up a localized string similar to Store in FM2014.
/// </summary> /// </summary>
internal static string StrBtnSaveRegulationSetup { internal static string StrBtnSaveRegulationSetup {
get { get {

View File

@ -184,7 +184,7 @@
<value>Dämpfung []:</value> <value>Dämpfung []:</value>
</data> </data>
<data name="StrBtnSaveRegulationSetup" xml:space="preserve"> <data name="StrBtnSaveRegulationSetup" xml:space="preserve">
<value>Speichern</value> <value>In FM2014 Speichern</value>
</data> </data>
<data name="StrGbxManualRefCalibration" xml:space="preserve"> <data name="StrGbxManualRefCalibration" xml:space="preserve">
<value>Handkalibrierung REF zu Waage</value> <value>Handkalibrierung REF zu Waage</value>

View File

@ -184,7 +184,7 @@
<value>Attenuation []:</value> <value>Attenuation []:</value>
</data> </data>
<data name="StrBtnSaveRegulationSetup" xml:space="preserve"> <data name="StrBtnSaveRegulationSetup" xml:space="preserve">
<value>Save</value> <value>Store in FM2014</value>
</data> </data>
<data name="StrGbxManualRefCalibration" xml:space="preserve"> <data name="StrGbxManualRefCalibration" xml:space="preserve">
<value>Manual Calibration REF to Weight-Scale</value> <value>Manual Calibration REF to Weight-Scale</value>