FM2014TestBench: - refactor
This commit is contained in:
parent
3628fdafc9
commit
abfe13c896
@ -73,34 +73,49 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Config
|
|||||||
public List<Boolean?> SlotIsSelected { get; set; }
|
public List<Boolean?> SlotIsSelected { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Backup REF pulses for calibration measurement to simplify manual setup
|
/// Backup the REF pulse rate per cubic-meter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UInt16 RefPulsesRequired { get; set; } = 500;
|
public UInt32 RefPulsesPerCm { get; set; } = 1000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Backup DUT pulses for calibration measurement to simplify manual setup
|
/// Backup the DUT pulse rate per cubic-meter
|
||||||
|
/// </summary>
|
||||||
|
public UInt16 DutPulsesPerCm { get; set; } = 100;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Backup REF pulses for calibration measurement to simplify manual setup.
|
||||||
|
/// </summary>
|
||||||
|
public UInt32 RefPulsesRequired { get; set; } = 500;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Backup DUT pulses for calibration measurement to simplify manual setup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UInt16 DutPulsesRequired { get; set; } = 50;
|
public UInt16 DutPulsesRequired { get; set; } = 50;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Backup double pulses detection deadtime for calibration measurement to simplify manual setup
|
/// Current output attenuation for the tolerance display.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UInt16 DoublePulseDeadtime { get; set; }
|
public Byte CurrentOutputAttenuation { get; set; } = 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Backup tolerance maximal value for calibration measurement threshold check to simplify manual setup
|
/// Backup double pulses detection deadtime for calibration measurement to simplify manual setup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Double DutToRefToleranceMax { get; set; } = 0.8;
|
public UInt16 DoublePulseDeadtime_ms { get; set; } = 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Backup tolerance maximal value for calibration measurement threshold check to simplify manual setup
|
/// Backup tolerance maximal value for calibration measurement threshold check to simplify manual setup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Double DutToRefToleranceMin { get; set; } = -0.5;
|
public Double DutToRefCalibrationToleranceMax_percent { get; set; } = 0.8;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Backup tolerance maximal value for calibration measurement threshold check to simplify manual setup.
|
||||||
|
/// </summary>
|
||||||
|
public Double DutToRefCalibrationToleranceMin_percent { get; set; } = -0.5;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region methods
|
#region methods
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load the FM2014 configuration file from the 'C:\ProgramData\FM2014' directory
|
/// Load the FM2014 configuration file from the 'C:\ProgramData\FM2014' directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks date="2025-Nov-13..2026-F3b-16" author="Thomas Wiedebusch">
|
/// <remarks date="2025-Nov-13..2026-F3b-16" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
@ -127,16 +142,18 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Config
|
|||||||
SlotIsSelected = fm2014Setup.SlotIsSelected;
|
SlotIsSelected = fm2014Setup.SlotIsSelected;
|
||||||
RefPulsesRequired = fm2014Setup.RefPulsesRequired;
|
RefPulsesRequired = fm2014Setup.RefPulsesRequired;
|
||||||
DutPulsesRequired = fm2014Setup.DutPulsesRequired;
|
DutPulsesRequired = fm2014Setup.DutPulsesRequired;
|
||||||
DutToRefToleranceMax = fm2014Setup.DutToRefToleranceMax;
|
DutToRefCalibrationToleranceMax_percent = fm2014Setup.DutToRefCalibrationToleranceMax_percent;
|
||||||
DutToRefToleranceMin = fm2014Setup.DutToRefToleranceMin;
|
DutToRefCalibrationToleranceMin_percent = fm2014Setup.DutToRefCalibrationToleranceMin_percent;
|
||||||
DoublePulseDeadtime = fm2014Setup.DoublePulseDeadtime;
|
DoublePulseDeadtime_ms = fm2014Setup.DoublePulseDeadtime_ms;
|
||||||
|
RefPulsesPerCm = fm2014Setup.RefPulsesPerCm;
|
||||||
|
DutPulsesPerCm = fm2014Setup.DutPulsesPerCm;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Store the FM2014 configuration file from the 'C:\ProgramData\FM2014' directory
|
/// Store the FM2014 configuration file from the 'C:\ProgramData\FM2014' directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks date="2025-Nov-13..2026-Feb-16" author="Thomas Wiedebusch">
|
/// <remarks date="2025-Nov-13..2026-Feb-16" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
|
|||||||
@ -185,6 +185,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
|
|||||||
/// Progress counter maximal value for saving settings
|
/// Progress counter maximal value for saving settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const Int32 PROCESSES_SAVE_STAND_ALONE_MEASUREMENT = 5;
|
private const Int32 PROCESSES_SAVE_STAND_ALONE_MEASUREMENT = 5;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Internal sleep time to schedule processing time to other threads/tasks
|
||||||
|
/// </summary>
|
||||||
|
private const Int32 THREAD_SLEEP_TIME_ms = 20;
|
||||||
#endregion ---------------------------------------- constants -------------------------------------------------
|
#endregion ---------------------------------------- constants -------------------------------------------------
|
||||||
#region ------------------------------------------- events ----------------------------------------------------
|
#region ------------------------------------------- events ----------------------------------------------------
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -878,7 +883,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
|
|||||||
/// <returns>true if initialization successfully executed or
|
/// <returns>true if initialization successfully executed or
|
||||||
/// <see cref="SharedCyclicMeasSequ"/> marks the already started cyclic requests
|
/// <see cref="SharedCyclicMeasSequ"/> marks the already started cyclic requests
|
||||||
/// for all registered FM2014s</returns>
|
/// for all registered FM2014s</returns>
|
||||||
/// <remarks date="2026-Jan-10..Feb-14" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Jan-10..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static Boolean PulseCounterMeasurement(Boolean refPulseCtrOn, Boolean dutPulseCtrOn)
|
public static Boolean PulseCounterMeasurement(Boolean refPulseCtrOn, Boolean dutPulseCtrOn)
|
||||||
@ -1016,7 +1021,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
|
|||||||
PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError,
|
PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError,
|
||||||
specificInfoObj: response, statusReturn: StatusReturn.Failed));
|
specificInfoObj: response, statusReturn: StatusReturn.Failed));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Idle thread to free time for others
|
||||||
|
Thread.Sleep(THREAD_SLEEP_TIME_ms);
|
||||||
|
|
||||||
|
} // loop all FM2014s
|
||||||
} while (SharedCyclicMeasSequ != CyclicMeasSequ.idle);
|
} while (SharedCyclicMeasSequ != CyclicMeasSequ.idle);
|
||||||
}, SharedCancellationToken).ContinueWith(delegate
|
}, SharedCancellationToken).ContinueWith(delegate
|
||||||
{
|
{
|
||||||
@ -1060,7 +1069,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
|
|||||||
/// <param name="doublePulseDeadtime_ms"></param>
|
/// <param name="doublePulseDeadtime_ms"></param>
|
||||||
/// <param name="currentOutputAttenuation"></param>
|
/// <param name="currentOutputAttenuation"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <remarks date="2026-Jan-14..Feb-14" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Jan-14..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static Boolean RegulationMeasurement(UInt32 refPulses_per_cm, UInt16 dutPulses_per_cm,
|
public static Boolean RegulationMeasurement(UInt32 refPulses_per_cm, UInt16 dutPulses_per_cm,
|
||||||
@ -1273,7 +1282,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
|
|||||||
PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError,
|
PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError,
|
||||||
specificInfoObj: response, statusReturn: StatusReturn.Failed));
|
specificInfoObj: response, statusReturn: StatusReturn.Failed));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Idle thread to free time for others
|
||||||
|
Thread.Sleep(THREAD_SLEEP_TIME_ms);
|
||||||
|
|
||||||
|
} // loop all FM2014s
|
||||||
} while (SharedCyclicMeasSequ != CyclicMeasSequ.idle);
|
} while (SharedCyclicMeasSequ != CyclicMeasSequ.idle);
|
||||||
|
|
||||||
}, SharedCancellationToken);
|
}, SharedCancellationToken);
|
||||||
@ -1312,7 +1325,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
|
|||||||
/// <param name="doublePulseDeadtime_ms">0 if double impulse deadtime detection is off</param>
|
/// <param name="doublePulseDeadtime_ms">0 if double impulse deadtime detection is off</param>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <remarks date="2026-Jan-14..Feb-14" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Jan-14..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static Boolean PulseTimeMeasurement(UInt16? refPulsesRequired = null, UInt16? dutPulsesRequired = null,
|
public static Boolean PulseTimeMeasurement(UInt16? refPulsesRequired = null, UInt16? dutPulsesRequired = null,
|
||||||
@ -1598,7 +1611,10 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
|
|||||||
PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError,
|
PublishResponse(fm2014, new ProcessExecEventArgs(Resources.StrError,
|
||||||
specificInfoObj: response, statusReturn: StatusReturn.Failed));
|
specificInfoObj: response, statusReturn: StatusReturn.Failed));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Idle thread to free time for others
|
||||||
|
Thread.Sleep(THREAD_SLEEP_TIME_ms);
|
||||||
|
} // loop all FM2014s
|
||||||
|
|
||||||
// Check all remaining DUT and REF pulses are counted on all connected devices and finalize process by
|
// Check all remaining DUT and REF pulses are counted on all connected devices and finalize process by
|
||||||
// reading out all results
|
// reading out all results
|
||||||
@ -2210,16 +2226,18 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
|
|||||||
/// all devices.
|
/// all devices.
|
||||||
/// - Additionally, it is going to read out the individual device information for early detection
|
/// - Additionally, it is going to read out the individual device information for early detection
|
||||||
/// which one is responsive on the SharedSerialPort.
|
/// which one is responsive on the SharedSerialPort.
|
||||||
|
/// - Optional the standalone measurement can be read out for the 'MiniPrf' operation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="comPort"></param>
|
/// <param name="comPort"></param>
|
||||||
|
/// <param name="readFm2014StandaloneMeasSetup">reading out of standalone measurement required</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <remarks date="2026-Jan-28" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Jan-28" author="Thomas Wiedebusch">
|
||||||
/// - Support for multiple FM2014s.
|
/// - Support for multiple FM2014s.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <remarks date="2026-Feb-04..05" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Feb-04..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - ´Login to individual FM2014.
|
/// - ´Login to individual FM2014.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public Boolean Connect(String comPort)
|
public Boolean Connect(String comPort, Boolean readFm2014StandaloneMeasSetup = false)
|
||||||
{
|
{
|
||||||
if (SharedSerialPort == null)
|
if (SharedSerialPort == null)
|
||||||
{
|
{
|
||||||
@ -2280,7 +2298,8 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
|
|||||||
Lifetime_h = intValue;
|
Lifetime_h = intValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
IsLoggedOn = ReadStandAloneMeasurement(CmdName.CmdReadEepMeasSetup);
|
if (readFm2014StandaloneMeasSetup)
|
||||||
|
IsLoggedOn = ReadStandAloneMeasurement(CmdName.CmdReadEepMeasSetup);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -50,6 +50,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
private CancellationTokenSource _cancellationTokenSource;
|
private CancellationTokenSource _cancellationTokenSource;
|
||||||
private CancellationToken _cancellationToken;
|
private CancellationToken _cancellationToken;
|
||||||
|
|
||||||
|
// Maximal FM2014 which can be served
|
||||||
private const Int32 MaxFm2014s = 10;
|
private const Int32 MaxFm2014s = 10;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -103,7 +104,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
private static readonly Brush ColorProcessFailed = Brushes.Red;
|
private static readonly Brush ColorProcessFailed = Brushes.Red;
|
||||||
//private static readonly Color ColorOngoingProcess = Color.Blue;
|
//private static readonly Color ColorOngoingProcess = Color.Blue;
|
||||||
//private static readonly Color ColorUnknownStatus = Color.Gray;
|
//private static readonly Color ColorUnknownStatus = Color.Gray;
|
||||||
private static Brush ColorStandardInputField;
|
private static Brush ColorStandardInputField = Brushes.White;
|
||||||
private static Brush ColorStandardDisplayField;
|
private static Brush ColorStandardDisplayField;
|
||||||
//private static Brush ColorStandardTextColor;
|
//private static Brush ColorStandardTextColor;
|
||||||
|
|
||||||
@ -117,6 +118,10 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
//private readonly ILogger _logger = NLogHelper.CreateOrGetLogger("FM2014");
|
//private readonly ILogger _logger = NLogHelper.CreateOrGetLogger("FM2014");
|
||||||
private readonly FM2014Config _fm2014Config = new FM2014Config();
|
private readonly FM2014Config _fm2014Config = new FM2014Config();
|
||||||
|
|
||||||
|
// Common FM2014 to take care of all settings and limit chacks on input without real usage as
|
||||||
|
// connected device.
|
||||||
|
private readonly FM2014 _fm2014Common = new FM2014();
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
||||||
@ -130,16 +135,11 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private Boolean _fm2014RegulationSetupHasChanged;
|
private Boolean _fm2014RegulationSetupHasChanged;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If the program configuration has changed, this shall be stored to the configuration file
|
|
||||||
/// </summary>
|
|
||||||
private Boolean _programConfigSetupHasChanged;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If the program configuration for the calibration measurement has changed, this shall be stored to the
|
/// If the program configuration for the calibration measurement has changed, this shall be stored to the
|
||||||
/// configuration file
|
/// configuration file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Boolean _programCalibrationSetupHasChanged;
|
private Boolean _programConfigurationSetupHasChanged;
|
||||||
|
|
||||||
private String _lastLoggingTextToAvoidRepetition;
|
private String _lastLoggingTextToAvoidRepetition;
|
||||||
|
|
||||||
@ -167,6 +167,9 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
|
|
||||||
private const Int32 CTR_MEASURE_COUNT = 2;
|
private const Int32 CTR_MEASURE_COUNT = 2;
|
||||||
|
|
||||||
|
// Hide button to avoid stress to EEPROM of FM2014
|
||||||
|
private readonly Boolean _displayBtnSaveSetupToFm2014 = false;
|
||||||
|
|
||||||
#endregion ---------------------------------------- Properties ------------------------------------------------
|
#endregion ---------------------------------------- Properties ------------------------------------------------
|
||||||
#region ------------------------------------------- FormControls ----------------------------------------------
|
#region ------------------------------------------- FormControls ----------------------------------------------
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -183,7 +186,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
//Thread.CurrentThread.CurrentCulture = cultureInfo;
|
//Thread.CurrentThread.CurrentCulture = cultureInfo;
|
||||||
|
|
||||||
ColorStandardDisplayField = lblRefPulsesPerCm.Background;
|
ColorStandardDisplayField = lblRefPulsesPerCm.Background;
|
||||||
ColorStandardInputField = tbxRefPulsesPerCm.Background;
|
ColorStandardInputField = chkSlot1.Background;
|
||||||
//ColorStandardTextColor = lblRefPulsesPerCm.Foreground;
|
//ColorStandardTextColor = lblRefPulsesPerCm.Foreground;
|
||||||
|
|
||||||
_cancellationTokenSource = new CancellationTokenSource();
|
_cancellationTokenSource = new CancellationTokenSource();
|
||||||
@ -449,7 +452,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// - Slot selections,
|
/// - Slot selections,
|
||||||
/// - Individual hardware tolerance selection.
|
/// - Individual hardware tolerance selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks date="2025-Nov-13..09" author="Thomas Wiedebusch">
|
/// <remarks date="2025-Nov-13..2026-Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void Init()
|
private void Init()
|
||||||
@ -465,7 +468,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
}
|
}
|
||||||
|
|
||||||
_fm2014RegulationSetupHasChanged = false;
|
_fm2014RegulationSetupHasChanged = false;
|
||||||
_programCalibrationSetupHasChanged = false;
|
_programConfigurationSetupHasChanged = false;
|
||||||
|
|
||||||
// Load the configuration from the local file stored in AppData\FM2014
|
// Load the configuration from the local file stored in AppData\FM2014
|
||||||
_fm2014Config.ReadFM2014Config();
|
_fm2014Config.ReadFM2014Config();
|
||||||
@ -512,8 +515,9 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
if (_fm2014Config?.IndividualCurrentOutputDisplayRangeNominal_percent?[ctr] != null &&
|
if (_fm2014Config?.IndividualCurrentOutputDisplayRangeNominal_percent?[ctr] != null &&
|
||||||
_fm2014Config.IndividualCurrentOutputDisplayRangeNominal_percent.Count == MaxFm2014s)
|
_fm2014Config.IndividualCurrentOutputDisplayRangeNominal_percent.Count == MaxFm2014s)
|
||||||
{
|
{
|
||||||
fm2014.CurrentOutputDisplayRangeNominal_percent = _fm2014Config?.IndividualCurrentOutputDisplayRangeNominal_percent[ctr] ??
|
fm2014.CurrentOutputDisplayRangeNominal_percent =
|
||||||
FM2014.CURRENT_OUTPUT_DISPLAY_RANGE_STANDARD_NOMINAL_percent;
|
_fm2014Config?.IndividualCurrentOutputDisplayRangeNominal_percent[ctr] ??
|
||||||
|
FM2014.CURRENT_OUTPUT_DISPLAY_RANGE_STANDARD_NOMINAL_percent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_fm2014Config != null)
|
if (_fm2014Config != null)
|
||||||
@ -521,12 +525,30 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
// Restore baudrate
|
// Restore baudrate
|
||||||
FM2014.Baudrate = _fm2014Config.Baudrate;
|
FM2014.Baudrate = _fm2014Config.Baudrate;
|
||||||
|
|
||||||
// Restore calibration settings for user convenience
|
// Restore calibration settings for user convenience and use the FM2014 properties to limit the settings.
|
||||||
tbxRefPulsesRequired.Text = $"{_fm2014Config.RefPulsesRequired:D}";
|
_fm2014Common.RefPulsesRequired = _fm2014Config.RefPulsesRequired;
|
||||||
tbxDutPulsesRequired.Text = $"{_fm2014Config.DutPulsesRequired:D}";
|
_fm2014Common.DutPulsesRequired = _fm2014Config.DutPulsesRequired;
|
||||||
tbxDoublePulseDeadtime.Text = $"{_fm2014Config.DoublePulseDeadtime:D}";
|
_fm2014Common.DoublePulseDeadtime_ms = _fm2014Config.DoublePulseDeadtime_ms;
|
||||||
tbxDutToRefTolMax.Text = $"{_fm2014Config.DutToRefToleranceMax:F2}";
|
_fm2014Common.DutToRefCalibrationToleranceMax_percent = _fm2014Config.DutToRefCalibrationToleranceMax_percent;
|
||||||
tbxDutToRefTolMin.Text = $"{_fm2014Config.DutToRefToleranceMin:F2}";
|
_fm2014Common.DutToRefCalibrationToleranceMin_percent = _fm2014Config.DutToRefCalibrationToleranceMin_percent;
|
||||||
|
|
||||||
|
tbxRefPulsesRequired.Text = $"{_fm2014Common.RefPulsesRequired:D}";
|
||||||
|
tbxDutPulsesRequired.Text = $"{_fm2014Common.DutPulsesRequired:D}";
|
||||||
|
tbxDoublePulseDeadtime.Text = $"{_fm2014Common.DoublePulseDeadtime_ms:D}";
|
||||||
|
tbxDutToRefTolMax.Text = $"{_fm2014Common.DutToRefCalibrationToleranceMax_percent:F2}";
|
||||||
|
tbxDutToRefTolMin.Text = $"{_fm2014Common.DutToRefCalibrationToleranceMin_percent:F2}";
|
||||||
|
|
||||||
|
// Restore pulse to cubic-meter ratios as those will not be taken from the FM2014 standalone measurement but
|
||||||
|
// the configuration file to avoid stress to the FM2014 EEPROM if a change should remain permanently.
|
||||||
|
// Using one FM2014 with its properties to build the RefToDutScale and to limit the inputs.
|
||||||
|
_fm2014Common.RefPulses_per_cm = _fm2014Config.RefPulsesPerCm;
|
||||||
|
_fm2014Common.DutPulses_per_cm = _fm2014Config.DutPulsesPerCm;
|
||||||
|
_fm2014Common.CurrentOutputAttenuation = _fm2014Config.CurrentOutputAttenuation;
|
||||||
|
// Publish the limited and recalculated inputs to the GUI
|
||||||
|
tbxRefPulsesPerCm.Text = $"{_fm2014Common.RefPulses_per_cm:D}";
|
||||||
|
tbxDutPulsesPerCm.Text = $"{_fm2014Common.DutPulses_per_cm:D}";
|
||||||
|
tbxScaleRefToDut.Text = $"{_fm2014Common.RefToDutScale_norm:F4}";
|
||||||
|
cbxToleranceDisplayAttenuation.SelectedItem = $"{_fm2014Common.CurrentOutputAttenuation}";
|
||||||
|
|
||||||
// Display on regulation page as common setup for ALL
|
// Display on regulation page as common setup for ALL
|
||||||
cbxToleranceDisplayRange.SelectedItem = _fm2014Config.CommonCurrentOutputDisplayRangeNominal_percent.ToString();
|
cbxToleranceDisplayRange.SelectedItem = _fm2014Config.CommonCurrentOutputDisplayRangeNominal_percent.ToString();
|
||||||
@ -577,14 +599,13 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
|
|
||||||
// DUT to REF Regulation Setup
|
// DUT to REF Regulation Setup
|
||||||
lblRefPulsesPerCm.Content = Properties.Resources.StrLblRefPulsesPerCmRatio;
|
lblRefPulsesPerCm.Content = Properties.Resources.StrLblRefPulsesPerCmRatio;
|
||||||
tbxRefPulsesPerCm.Text = "";
|
|
||||||
lblDutPulsesPerCm.Content = Properties.Resources.StrLblDutPulsesPerCmRatio;
|
lblDutPulsesPerCm.Content = Properties.Resources.StrLblDutPulsesPerCmRatio;
|
||||||
tbxDutPulsesPerCm.Text = "";
|
|
||||||
lblScaleRefToDut.Content = Properties.Resources.StrLblRefToDutScale;
|
lblScaleRefToDut.Content = Properties.Resources.StrLblRefToDutScale;
|
||||||
tbxScaleRefToDut.Text = "";
|
|
||||||
tbxScaleRefToDut.IsReadOnly = true;
|
tbxScaleRefToDut.IsReadOnly = true;
|
||||||
lblToleranceDisplayAttenuation.Content = Properties.Resources.StrLblDisplayAttenuation;
|
lblToleranceDisplayAttenuation.Content = Properties.Resources.StrLblDisplayAttenuation;
|
||||||
btnSaveSetupToFm2014.Content = Properties.Resources.StrBtnSaveRegulationSetup;
|
btnSaveSetupToFm2014.Content = Properties.Resources.StrBtnSaveRegulationSetup;
|
||||||
|
UiElmEnable(btnSaveSetupToFm2014, false, _displayBtnSaveSetupToFm2014);
|
||||||
|
|
||||||
lblToleranceDisplayRange.Content = Properties.Resources.StrLblFM2014Tolerance;
|
lblToleranceDisplayRange.Content = Properties.Resources.StrLblFM2014Tolerance;
|
||||||
chkUseDampedTolerance.Content = Properties.Resources.StrChkUseDampedTolerance;
|
chkUseDampedTolerance.Content = Properties.Resources.StrChkUseDampedTolerance;
|
||||||
btnDutToRefRegulation.Content = Properties.Resources.StrBtnStartRegulation;
|
btnDutToRefRegulation.Content = Properties.Resources.StrBtnStartRegulation;
|
||||||
@ -627,11 +648,10 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
{
|
{
|
||||||
if (_fm2014Config == null)
|
if (_fm2014Config == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
_programConfigSetupHasChanged = false;
|
_programConfigurationSetupHasChanged = false;
|
||||||
_programCalibrationSetupHasChanged = false;
|
|
||||||
_fm2014Config.IndividualCurrentOutputDisplayRangeNominal_percent?.Clear();
|
_fm2014Config.IndividualCurrentOutputDisplayRangeNominal_percent?.Clear();
|
||||||
_fm2014Config.IndividualCurrentOutputDisplayRangeNominal_percent = null;
|
_fm2014Config.IndividualCurrentOutputDisplayRangeNominal_percent = null;
|
||||||
_fm2014Config.IndividualCurrentOutputDisplayRangeNominal_percent = new List<Int32?>();
|
_fm2014Config.IndividualCurrentOutputDisplayRangeNominal_percent = new List<Int32?>();
|
||||||
@ -652,25 +672,16 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
_fm2014Config.SlotIsSelected.Add(SlotSelections[ctr].IsChecked);
|
_fm2014Config.SlotIsSelected.Add(SlotSelections[ctr].IsChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore Calibration settings for user convenience
|
_fm2014Config.CommonCurrentOutputDisplayRangeNominal_percent =
|
||||||
var firstFm2014 = FM2014.GetFirstConnectedAndLoggedInFm2014();
|
_fm2014Common.CurrentOutputDisplayRangeNominal_percent;
|
||||||
if (null == firstFm2014)
|
_fm2014Config.RefPulsesRequired = _fm2014Common.RefPulsesRequired;
|
||||||
return;
|
_fm2014Config.DutPulsesRequired = (UInt16)_fm2014Common.DutPulsesRequired;
|
||||||
|
_fm2014Config.DoublePulseDeadtime_ms = _fm2014Common.DoublePulseDeadtime_ms;
|
||||||
// Preset the 'firstFm2014' with all items
|
_fm2014Config.DutToRefCalibrationToleranceMax_percent = _fm2014Common.DutToRefCalibrationToleranceMax_percent;
|
||||||
tbxRefPulsesRequired_LostFocus(this, null);
|
_fm2014Config.DutToRefCalibrationToleranceMin_percent = _fm2014Common.DutToRefCalibrationToleranceMin_percent;
|
||||||
tbxDutPulsesRequired_LostFocus(this, null);
|
_fm2014Config.RefPulsesPerCm = _fm2014Common.RefPulses_per_cm;
|
||||||
tbxDoublePulseDeadtime_LostFocus(this, null);
|
_fm2014Config.DutPulsesPerCm = _fm2014Common.DutPulses_per_cm;
|
||||||
tbxDutToRefToleranceMax_LostFocus(this, null);
|
_fm2014Config.CurrentOutputAttenuation = _fm2014Common.CurrentOutputAttenuation;
|
||||||
tbxDutToRefToleranceMin_LostFocus(this, null);
|
|
||||||
|
|
||||||
_fm2014Config.CommonCurrentOutputDisplayRangeNominal_percent =
|
|
||||||
firstFm2014.CurrentOutputDisplayRangeNominal_percent;
|
|
||||||
_fm2014Config.RefPulsesRequired = (UInt16)firstFm2014.RefPulsesRequired;
|
|
||||||
_fm2014Config.DutPulsesRequired = (UInt16)firstFm2014.DutPulsesRequired;
|
|
||||||
_fm2014Config.DoublePulseDeadtime = firstFm2014.DoublePulseDeadtime_ms;
|
|
||||||
_fm2014Config.DutToRefToleranceMax = firstFm2014.DutToRefCalibrationToleranceMax_percent;
|
|
||||||
_fm2014Config.DutToRefToleranceMin = firstFm2014.DutToRefCalibrationToleranceMin_percent;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
_fm2014Config.Update();
|
_fm2014Config.Update();
|
||||||
@ -685,7 +696,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_programConfigSetupHasChanged || _programCalibrationSetupHasChanged)
|
if (_programConfigurationSetupHasChanged)
|
||||||
StoreProgramConfiguration();
|
StoreProgramConfiguration();
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
@ -853,48 +864,43 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// This method checks if any setting applied to the FM2014 memory has been changed.
|
/// This method checks if any setting applied to the FM2014 memory has been changed.
|
||||||
/// Initially, those values will be read and preset during the connection procedure.
|
/// Initially, those values will be read and preset during the connection procedure.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks date="2026-Feb-17" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Feb-17..18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void CheckForFM2014SetupChanged()
|
private void CheckForFM2014SetupChanged()
|
||||||
{
|
{
|
||||||
var firstFm2014 = FM2014.GetFirstConnectedAndLoggedInFm2014();
|
|
||||||
if (null == firstFm2014)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Avoid stress to the FM2014 EEPROM as the identical values mustn't be stored again
|
// Avoid stress to the FM2014 EEPROM as the identical values mustn't be stored again
|
||||||
if (_initialCurrentOutputAttenuation == firstFm2014.CurrentOutputAttenuation &&
|
if (_initialCurrentOutputAttenuation == _fm2014Common.CurrentOutputAttenuation &&
|
||||||
_initialRefPulsesPerCm == firstFm2014.RefPulses_per_cm &&
|
_initialRefPulsesPerCm == _fm2014Common.RefPulses_per_cm &&
|
||||||
_initialDutPulsesPerCm == firstFm2014.DutPulses_per_cm)
|
_initialDutPulsesPerCm == _fm2014Common.DutPulses_per_cm)
|
||||||
{
|
{
|
||||||
_fm2014RegulationSetupHasChanged = false;
|
_fm2014RegulationSetupHasChanged = false;
|
||||||
UiElmEnable(btnSaveSetupToFm2014, false);
|
UiElmEnable(btnSaveSetupToFm2014, false, _displayBtnSaveSetupToFm2014);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark that the setup has to be stored to the configuration file
|
||||||
|
_programConfigurationSetupHasChanged = true;
|
||||||
DutToRefRegulationSetupHasChanged();
|
DutToRefRegulationSetupHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Common routine for REF to DUT scale check and update
|
/// Common routine for REF to DUT scale check and update
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <remarks date="2026-Jan-14..21" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Jan-14..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private Boolean UpdateRefToDutScale()
|
private Boolean UpdateRefToDutScale()
|
||||||
{
|
{
|
||||||
var firstFm2014 = FM2014.GetFirstConnectedAndLoggedInFm2014();
|
UpdateTextBox(tbxScaleRefToDut, $@"{_fm2014Common.RefToDutScale_norm:F4}");
|
||||||
if (null == firstFm2014)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
UpdateTextBox(tbxScaleRefToDut, $@"{firstFm2014.RefToDutScale_norm:F4}");
|
|
||||||
|
|
||||||
// Display error if scale doesn't fit
|
// Display error if scale doesn't fit
|
||||||
var tempRefToDutScale_norm = (Double)firstFm2014.RefPulses_per_cm / firstFm2014.DutPulses_per_cm;
|
var tempRefToDutScale_norm = (Double)_fm2014Common.RefPulses_per_cm / _fm2014Common.DutPulses_per_cm;
|
||||||
if (tempRefToDutScale_norm < FM2014.REF_TO_DUT_SCALE_MIN ||
|
if (tempRefToDutScale_norm < FM2014.REF_TO_DUT_SCALE_MIN ||
|
||||||
tempRefToDutScale_norm > FM2014.REF_TO_DUT_SCALE_MAX ||
|
tempRefToDutScale_norm > FM2014.REF_TO_DUT_SCALE_MAX ||
|
||||||
firstFm2014.RefToDutScale_norm < FM2014.REF_TO_DUT_SCALE_MIN ||
|
_fm2014Common.RefToDutScale_norm < FM2014.REF_TO_DUT_SCALE_MIN ||
|
||||||
firstFm2014.RefToDutScale_norm > FM2014.REF_TO_DUT_SCALE_MAX)
|
_fm2014Common.RefToDutScale_norm > FM2014.REF_TO_DUT_SCALE_MAX)
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
@ -913,7 +919,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Common routine to reset the cancellation token on restart or new meter
|
/// Common routine to reset the cancellation token on restart or new meter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks date="2026-Jan-26" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Jan-26" author="Thomas Wiedebusch">
|
||||||
/// - Initial
|
/// - Initial
|
||||||
@ -1021,7 +1027,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
{
|
{
|
||||||
// Disable all buttons
|
// Disable all buttons
|
||||||
UiElmEnable(btnDutToRefCalibration, false);
|
UiElmEnable(btnDutToRefCalibration, false);
|
||||||
UiElmEnable(btnSaveSetupToFm2014, false);
|
UiElmEnable(btnSaveSetupToFm2014, false, _displayBtnSaveSetupToFm2014);
|
||||||
UiElmEnable(btnDutToRefRegulation, false);
|
UiElmEnable(btnDutToRefRegulation, false);
|
||||||
UiElmEnable(btnFM2014Connect, false);
|
UiElmEnable(btnFM2014Connect, false);
|
||||||
UiElmEnable(btnRefToVolumeCalibration, false);
|
UiElmEnable(btnRefToVolumeCalibration, false);
|
||||||
@ -1062,7 +1068,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
{
|
{
|
||||||
// Enable buttons and display correct information
|
// Enable buttons and display correct information
|
||||||
UiElmEnable(btnDutToRefCalibration, true);
|
UiElmEnable(btnDutToRefCalibration, true);
|
||||||
UiElmEnable(btnSaveSetupToFm2014, _fm2014RegulationSetupHasChanged); // Activate if setup has changed
|
UiElmEnable(btnSaveSetupToFm2014, _fm2014RegulationSetupHasChanged, _displayBtnSaveSetupToFm2014);
|
||||||
UiElmEnable(btnDutToRefRegulation, true);
|
UiElmEnable(btnDutToRefRegulation, true);
|
||||||
UiElmEnable(btnFM2014Connect, true);
|
UiElmEnable(btnFM2014Connect, true);
|
||||||
UiElmEnable(btnRefToVolumeCalibration, true);
|
UiElmEnable(btnRefToVolumeCalibration, true);
|
||||||
@ -1112,15 +1118,15 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Feedback from FM2014being parsed to GUI
|
/// Feedback from FM2014being parsed to GUI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks date="2026-Feb-02..14" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Feb-02..18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void DataReceived_Handler(Object sender, ProcessExecEventArgs e)
|
private void DataReceived_Handler(Object sender, ProcessExecEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Remind the FM2014 user control based on the address of the FM2014 to dispatch received message to the
|
// Remind the FM2014 user control based on the address of the FM2014 to dispatch received message to
|
||||||
// correct device
|
// the correct device
|
||||||
UcFM2014Device ucFm2014;
|
UcFM2014Device ucFm2014;
|
||||||
if (sender is FM2014 fm2014)
|
if (sender is FM2014 fm2014)
|
||||||
{
|
{
|
||||||
@ -1151,7 +1157,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
// Data dispatcher
|
// Data dispatcher
|
||||||
var resp = (CmdResponse)e.SpecificInfoObj;
|
var resp = (CmdResponse)e.SpecificInfoObj;
|
||||||
String valueStr;
|
String valueStr;
|
||||||
|
|
||||||
// Used as marker for error, null means measurement is in range or status or health is good
|
// Used as marker for error, null means measurement is in range or status or health is good
|
||||||
Brush statusColor = null;
|
Brush statusColor = null;
|
||||||
|
|
||||||
@ -1194,16 +1200,25 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
ucFm2014.SetValue(CTR_LBL_IDX_DUT_PLS, $"{resp.IntValue:D}", statusColor);
|
ucFm2014.SetValue(CTR_LBL_IDX_DUT_PLS, $"{resp.IntValue:D}", statusColor);
|
||||||
break;
|
break;
|
||||||
case CmdName.CmdSetRefPulsesPerCm:
|
case CmdName.CmdSetRefPulsesPerCm:
|
||||||
UpdateTextBox(tbxRefPulsesPerCm, $"{resp.IntValue:D}", statusColor);
|
if (firstFm2014 != null && firstFm2014.Address == fm2014.Address)
|
||||||
_initialRefPulsesPerCm = (UInt32)resp.IntValue;
|
{
|
||||||
|
UpdateTextBox(tbxRefPulsesPerCm, $"{resp.IntValue:D}", statusColor);
|
||||||
|
_initialRefPulsesPerCm = (UInt32)resp.IntValue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CmdName.CmdSetDutPulsesPerCm:
|
case CmdName.CmdSetDutPulsesPerCm:
|
||||||
UpdateTextBox(tbxDutPulsesPerCm, $"{resp.IntValue:D}", statusColor);
|
if (firstFm2014 != null && firstFm2014.Address == fm2014.Address)
|
||||||
_initialDutPulsesPerCm = (UInt16)resp.IntValue;
|
{
|
||||||
|
UpdateTextBox(tbxDutPulsesPerCm, $"{resp.IntValue:D}", statusColor);
|
||||||
|
_initialDutPulsesPerCm = (UInt16)resp.IntValue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CmdName.CmdSetCurrentOutputAttenuation:
|
case CmdName.CmdSetCurrentOutputAttenuation:
|
||||||
Dispatcher.Invoke(() => cbxToleranceDisplayAttenuation.SelectedItem = $"{resp.IntValue}");
|
if (firstFm2014 != null && firstFm2014.Address == fm2014.Address)
|
||||||
_initialCurrentOutputAttenuation = (Byte)resp.IntValue;
|
{
|
||||||
|
Dispatcher.Invoke(() => cbxToleranceDisplayAttenuation.SelectedItem = $"{resp.IntValue}");
|
||||||
|
_initialCurrentOutputAttenuation = (Byte)resp.IntValue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CmdName.CmdGetRefFrequency:
|
case CmdName.CmdGetRefFrequency:
|
||||||
valueStr = $"{resp.IntValue:D}";
|
valueStr = $"{resp.IntValue:D}";
|
||||||
@ -1242,7 +1257,8 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
ucFm2014.SetValue(REG_LBL_IDX_DUT_TO_REF_TOL, valueStr, statusColor);
|
ucFm2014.SetValue(REG_LBL_IDX_DUT_TO_REF_TOL, valueStr, statusColor);
|
||||||
break;
|
break;
|
||||||
case CmdName.CmdRefToDutScale:
|
case CmdName.CmdRefToDutScale:
|
||||||
UpdateTextBox(tbxScaleRefToDut, $"{resp.DoubleValue:F4}", statusColor);
|
if (firstFm2014 != null && firstFm2014.Address == fm2014.Address)
|
||||||
|
UpdateTextBox(tbxScaleRefToDut, $"{resp.DoubleValue:F4}", statusColor);
|
||||||
break;
|
break;
|
||||||
// // DEBUG
|
// // DEBUG
|
||||||
// case FM2014CmdDef.CmdName.CMD_GET_REF_PERIOD:
|
// case FM2014CmdDef.CmdName.CMD_GET_REF_PERIOD:
|
||||||
@ -1297,7 +1313,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start and stop the DUT to REF calibration measurement.
|
/// Start and stop the DUT to REF calibration measurement.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks date="2026-Feb-07..11" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Feb-07..18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void btnDutToRefCalibration_Click(Object sender, EventArgs e)
|
private void btnDutToRefCalibration_Click(Object sender, EventArgs e)
|
||||||
@ -1328,45 +1344,6 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
if (FM2014.RegisteredFm2014s == null || FM2014.RegisteredFm2014s.Count == 0)
|
if (FM2014.RegisteredFm2014s == null || FM2014.RegisteredFm2014s.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Take the settings from the inputs
|
|
||||||
UInt16? refPulsesRequired = null;
|
|
||||||
UInt16? dutPulsesRequired = null;
|
|
||||||
UInt16 doublePulseDeadtime_ms = 0;
|
|
||||||
Double toleranceThresholdMax_percent = 1.0;
|
|
||||||
Double toleranceThresholdMin_percent = -0.7;
|
|
||||||
Dispatcher.Invoke(() =>
|
|
||||||
{
|
|
||||||
if (int.TryParse(tbxRefPulsesRequired.Text, out var pulses) &&
|
|
||||||
FM2014.PULSES_TIME_MEASUREMENT_INPUT_MIN <= pulses &&
|
|
||||||
FM2014.PULSES_TIME_MEASUREMENT_INPUT_MAX >= pulses)
|
|
||||||
{
|
|
||||||
refPulsesRequired = (UInt16)pulses;
|
|
||||||
}
|
|
||||||
if (int.TryParse(tbxDutPulsesRequired.Text, out pulses) &&
|
|
||||||
FM2014.PULSES_TIME_MEASUREMENT_INPUT_MIN <= pulses &&
|
|
||||||
FM2014.PULSES_TIME_MEASUREMENT_INPUT_MAX >= pulses)
|
|
||||||
{
|
|
||||||
dutPulsesRequired = (UInt16)pulses;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (int.TryParse(tbxDoublePulseDeadtime.Text, out var deadtime_ms) &&
|
|
||||||
FM2014.DOUBLE_PULSE_DEADTIME_MIN_ms <= deadtime_ms &&
|
|
||||||
FM2014.DOUBLE_PULSE_DEADTIME_MAX_ms >= deadtime_ms)
|
|
||||||
{
|
|
||||||
doublePulseDeadtime_ms = (UInt16)deadtime_ms;
|
|
||||||
}
|
|
||||||
var englishNumberFormat = tbxDutToRefTolMax.Text.Replace(',', '.');
|
|
||||||
if (double.TryParse(englishNumberFormat, NumberStyles.Any, new CultureInfo("en"), out var tolerance))
|
|
||||||
{
|
|
||||||
toleranceThresholdMax_percent = tolerance;
|
|
||||||
}
|
|
||||||
englishNumberFormat = tbxDutToRefTolMin.Text.Replace(',', '.');
|
|
||||||
if (double.TryParse(englishNumberFormat, NumberStyles.Any, new CultureInfo("en"), out tolerance))
|
|
||||||
{
|
|
||||||
toleranceThresholdMin_percent = tolerance;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Adjust the user control
|
// Adjust the user control
|
||||||
foreach (var fm2014 in FM2014.RegisteredFm2014s.Where(x => x.IsLoggedOn))
|
foreach (var fm2014 in FM2014.RegisteredFm2014s.Where(x => x.IsLoggedOn))
|
||||||
{
|
{
|
||||||
@ -1375,19 +1352,21 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
ucFM2014.EnableMeasurements(CAL_MEASURE_COUNT);
|
ucFM2014.EnableMeasurements(CAL_MEASURE_COUNT);
|
||||||
|
|
||||||
// Set initial required pulses as those are static upon the entire measurement
|
// Set initial required pulses as those are static upon the entire measurement
|
||||||
ucFM2014.SetValue(CAL_LBL_IDX_REF_REQ_PLS, refPulsesRequired != null ? $"{refPulsesRequired}" : "---");
|
ucFM2014.SetValue(CAL_LBL_IDX_REF_REQ_PLS, $"{_fm2014Common.RefPulsesRequired:D}");
|
||||||
ucFM2014.SetValue(CAL_LBL_IDX_DUT_REQ_PLS, dutPulsesRequired != null ? $"{dutPulsesRequired}" : "---");
|
ucFM2014.SetValue(CAL_LBL_IDX_DUT_REQ_PLS, $"{_fm2014Common.DutPulsesRequired:D}");
|
||||||
|
|
||||||
// Set thresholds for tolerance verification
|
// Set thresholds for tolerance verification
|
||||||
fm2014.DutToRefCalibrationToleranceMax_percent = toleranceThresholdMax_percent;
|
fm2014.DutToRefCalibrationToleranceMax_percent = _fm2014Common.DutToRefCalibrationToleranceMax_percent;
|
||||||
fm2014.DutToRefCalibrationToleranceMin_percent = toleranceThresholdMin_percent;
|
fm2014.DutToRefCalibrationToleranceMin_percent = _fm2014Common.DutToRefCalibrationToleranceMin_percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backup if meanwhile anything has changed
|
// Backup if meanwhile anything has changed
|
||||||
if (_programConfigSetupHasChanged || _programCalibrationSetupHasChanged)
|
if (_programConfigurationSetupHasChanged)
|
||||||
StoreProgramConfiguration();
|
StoreProgramConfiguration();
|
||||||
|
|
||||||
if (FM2014.PulseTimeMeasurement(refPulsesRequired, dutPulsesRequired, doublePulseDeadtime_ms))
|
if (FM2014.PulseTimeMeasurement((UInt16)_fm2014Common.RefPulsesRequired,
|
||||||
|
(UInt16)_fm2014Common.DutPulsesRequired,
|
||||||
|
_fm2014Common.DoublePulseDeadtime_ms))
|
||||||
{
|
{
|
||||||
_autoProgressBar = false;
|
_autoProgressBar = false;
|
||||||
ActionControl(true);
|
ActionControl(true);
|
||||||
@ -1403,11 +1382,10 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start and stop the DUT to REF regulation measurement.
|
/// Start and stop the DUT to REF regulation measurement.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks date="2026-Jan-14..Feb-11" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Jan-14..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void btnDutToRefRegulation_Click(Object sender, EventArgs e)
|
private void btnDutToRefRegulation_Click(Object sender, EventArgs e)
|
||||||
@ -1430,64 +1408,21 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
if (FM2014.RegisteredFm2014s == null || FM2014.RegisteredFm2014s.Count == 0)
|
if (FM2014.RegisteredFm2014s == null || FM2014.RegisteredFm2014s.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Take the settings from the inputs
|
|
||||||
UInt32 refPulses_per_cm = 1000;
|
|
||||||
UInt16 dutPulses_per_cm = 100;
|
|
||||||
UInt16 doublePulseDeadtime_ms = 0;
|
|
||||||
Byte currentOutputAttenuation = 1;
|
|
||||||
Int32 toleranceSetup = 1;
|
|
||||||
Dispatcher.Invoke(() =>
|
|
||||||
{
|
|
||||||
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 (int.TryParse(tbxDoublePulseDeadtime.Text, out var deadtime_ms) &&
|
|
||||||
FM2014.DOUBLE_PULSE_DEADTIME_MIN_ms <= deadtime_ms &&
|
|
||||||
FM2014.DOUBLE_PULSE_DEADTIME_MAX_ms >= deadtime_ms)
|
|
||||||
{
|
|
||||||
doublePulseDeadtime_ms = (UInt16)deadtime_ms;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (byte.TryParse(cbxToleranceDisplayAttenuation.SelectedItem.ToString(), out var attenuation) &&
|
|
||||||
attenuation >= FM2014.CURRENT_OUTPUT_ATTENUATION_MIN &&
|
|
||||||
attenuation <= FM2014.CURRENT_OUTPUT_ATTENUATION_MAX)
|
|
||||||
{
|
|
||||||
currentOutputAttenuation = attenuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (int.TryParse(cbxToleranceDisplayRange.SelectedItem.ToString(), out var tolerance) &&
|
|
||||||
(tolerance == FM2014.CURRENT_OUTPUT_DISPLAY_RANGE_STANDARD_NOMINAL_percent ||
|
|
||||||
tolerance == FM2014.CURRENT_OUTPUT_DISPLAY_RANGE_EXTENDED_NOMINAL_percent))
|
|
||||||
{
|
|
||||||
toleranceSetup = tolerance;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Adjust the user control
|
// Adjust the user control
|
||||||
foreach (var fm2014 in FM2014.RegisteredFm2014s.Where(x => x.IsLoggedOn))
|
foreach (var fm2014 in FM2014.RegisteredFm2014s.Where(x => x.IsLoggedOn))
|
||||||
{
|
{
|
||||||
var idx = fm2014.Address - 1;
|
var idx = fm2014.Address - 1;
|
||||||
var ucFM2014 = (UcFM2014Device)UcFM2014s[idx];
|
var ucFM2014 = (UcFM2014Device)UcFM2014s[idx];
|
||||||
ucFM2014.EnableMeasurements(REG_MEASURE_COUNT);
|
ucFM2014.EnableMeasurements(REG_MEASURE_COUNT);
|
||||||
fm2014.CurrentOutputDisplayRangeNominal_percent = toleranceSetup;
|
fm2014.CurrentOutputDisplayRangeNominal_percent = _fm2014Common.CurrentOutputDisplayRangeNominal_percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backup if meanwhile anything has changed
|
// Backup if meanwhile anything has changed
|
||||||
if (_programConfigSetupHasChanged || _programCalibrationSetupHasChanged)
|
if (_programConfigurationSetupHasChanged || _programConfigurationSetupHasChanged)
|
||||||
StoreProgramConfiguration();
|
StoreProgramConfiguration();
|
||||||
|
|
||||||
if (FM2014.RegulationMeasurement(refPulses_per_cm, dutPulses_per_cm, doublePulseDeadtime_ms,
|
if (FM2014.RegulationMeasurement(_fm2014Common.RefPulses_per_cm, _fm2014Common.DutPulses_per_cm,
|
||||||
currentOutputAttenuation))
|
_fm2014Common.DoublePulseDeadtime_ms, _fm2014Common.CurrentOutputAttenuation))
|
||||||
{
|
{
|
||||||
_autoProgressBar = true;
|
_autoProgressBar = true;
|
||||||
ActionControl(true);
|
ActionControl(true);
|
||||||
@ -1545,7 +1480,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Backup if meanwhile anything has changed
|
// Backup if meanwhile anything has changed
|
||||||
if (_programConfigSetupHasChanged || _programCalibrationSetupHasChanged)
|
if (_programConfigurationSetupHasChanged || _programConfigurationSetupHasChanged)
|
||||||
StoreProgramConfiguration();
|
StoreProgramConfiguration();
|
||||||
|
|
||||||
if (FM2014.PulseCounterMeasurement(true, measureDutPulses))
|
if (FM2014.PulseCounterMeasurement(true, measureDutPulses))
|
||||||
@ -1586,25 +1521,21 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// FM2014 tolerance setup for calculation of it item has changed:
|
/// FM2014 tolerance setup for calculation of it item has changed:
|
||||||
/// - This will dispatch the new value to all FM2014s.
|
/// - This will dispatch the new value to all FM2014s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks date="2026-Feb-09..Feb-16" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Feb-09..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void cbxToleranceDisplayRange_SelectedIndexChanged(Object sender, EventArgs e)
|
private void cbxToleranceDisplayRange_SelectedIndexChanged(Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
var firstFm2014 = FM2014.GetFirstConnectedAndLoggedInFm2014();
|
|
||||||
if (null == firstFm2014)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
if (byte.TryParse(cbxToleranceDisplayRange.SelectedItem.ToString(), out var tolerance) &&
|
if (byte.TryParse(cbxToleranceDisplayRange.SelectedItem.ToString(), out var tolerance) &&
|
||||||
(tolerance == FM2014.CURRENT_OUTPUT_DISPLAY_RANGE_STANDARD_NOMINAL_percent ||
|
(tolerance == FM2014.CURRENT_OUTPUT_DISPLAY_RANGE_STANDARD_NOMINAL_percent ||
|
||||||
tolerance == FM2014.CURRENT_OUTPUT_DISPLAY_RANGE_EXTENDED_NOMINAL_percent) &&
|
tolerance == FM2014.CURRENT_OUTPUT_DISPLAY_RANGE_EXTENDED_NOMINAL_percent) &&
|
||||||
firstFm2014.CurrentOutputDisplayRangeNominal_percent != tolerance)
|
_fm2014Common.CurrentOutputDisplayRangeNominal_percent != tolerance)
|
||||||
{
|
{
|
||||||
_programConfigSetupHasChanged = true;
|
_programConfigurationSetupHasChanged = true;
|
||||||
firstFm2014.CurrentOutputDisplayRangeNominal_percent = tolerance;
|
_fm2014Common.CurrentOutputDisplayRangeNominal_percent = tolerance;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1630,27 +1561,19 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// FM2014 current attenuation item has changed:
|
/// FM2014 current attenuation item has changed:
|
||||||
/// - This will dispatch the new value to all FM2014s.
|
/// - This will dispatch the new value to all FM2014s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks date="2026-Jan-18" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Jan-18..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void cbxToleranceDisplayAttenuation_SelectedIndexChanged(Object sender, EventArgs e)
|
private void cbxToleranceDisplayAttenuation_SelectedIndexChanged(Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
var firstFm2014 = FM2014.GetFirstConnectedAndLoggedInFm2014();
|
|
||||||
if (null == firstFm2014)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
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 &&
|
||||||
firstFm2014.CurrentOutputAttenuation != attenuation)
|
_fm2014Common.CurrentOutputAttenuation != attenuation)
|
||||||
{
|
{
|
||||||
foreach (var fm2014 in FM2014.RegisteredFm2014s)
|
_fm2014Common.CurrentOutputAttenuation = attenuation;
|
||||||
{
|
|
||||||
fm2014.CurrentOutputAttenuation = attenuation;
|
|
||||||
}
|
|
||||||
CheckForFM2014SetupChanged();
|
CheckForFM2014SetupChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1669,7 +1592,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
if (_comPortIdx != cbxProgramComPort.SelectedIndex)
|
if (_comPortIdx != cbxProgramComPort.SelectedIndex)
|
||||||
{
|
{
|
||||||
_comPortIdx = cbxProgramComPort.SelectedIndex;
|
_comPortIdx = cbxProgramComPort.SelectedIndex;
|
||||||
_programConfigSetupHasChanged = true;
|
_programConfigurationSetupHasChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1687,7 +1610,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
if (FM2014.StoreAllConfigurations())
|
if (FM2014.StoreAllConfigurations())
|
||||||
{
|
{
|
||||||
_fm2014RegulationSetupHasChanged = false;
|
_fm2014RegulationSetupHasChanged = false;
|
||||||
UiElmEnable(btnSaveSetupToFm2014, false);
|
UiElmEnable(btnSaveSetupToFm2014, false, _displayBtnSaveSetupToFm2014);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1733,6 +1656,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
UiElmEnable(tbxDutPulsesMeasured, isChecked);
|
UiElmEnable(tbxDutPulsesMeasured, isChecked);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Common check for key input to edit an integer field:
|
/// Common check for key input to edit an integer field:
|
||||||
/// - Allows Left, Right, Back, Delete and 0-9 keys . and ,
|
/// - Allows Left, Right, Back, Delete and 0-9 keys . and ,
|
||||||
@ -1823,15 +1747,11 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
/// <remarks date="2026-Feb-09..Feb-16" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Feb-09..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void tbxRefPulsesRequired_LostFocus(Object sender, EventArgs e)
|
private void tbxRefPulsesRequired_LostFocus(Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var firstFm2014 = FM2014.GetFirstConnectedAndLoggedInFm2014();
|
|
||||||
if (null == firstFm2014)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(tbxRefPulsesRequired.Text))
|
if (string.IsNullOrEmpty(tbxRefPulsesRequired.Text))
|
||||||
@ -1840,7 +1760,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check for change
|
// Check for change
|
||||||
var backupPulsesRequired = firstFm2014.RefPulsesRequired;
|
var backupPulsesRequired = _fm2014Common.RefPulsesRequired;
|
||||||
|
|
||||||
// Convert the input and check limits
|
// Convert the input and check limits
|
||||||
if (int.TryParse(tbxRefPulsesRequired.Text, out var pulses) &&
|
if (int.TryParse(tbxRefPulsesRequired.Text, out var pulses) &&
|
||||||
@ -1849,9 +1769,9 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
{
|
{
|
||||||
if (backupPulsesRequired != pulses)
|
if (backupPulsesRequired != pulses)
|
||||||
{
|
{
|
||||||
_programCalibrationSetupHasChanged = true;
|
_programConfigurationSetupHasChanged = true;
|
||||||
// Preset to fill the configuration file storage ability
|
// Preset to fill the configuration file storage ability
|
||||||
firstFm2014.RefPulsesRequired = (UInt32)pulses;
|
_fm2014Common.RefPulsesRequired = (UInt32)pulses;
|
||||||
}
|
}
|
||||||
|
|
||||||
tbxRefPulsesRequired.Background = ColorStandardInputField;
|
tbxRefPulsesRequired.Background = ColorStandardInputField;
|
||||||
@ -1926,10 +1846,6 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void tbxDutPulsesRequired_LostFocus(Object sender, EventArgs e)
|
private void tbxDutPulsesRequired_LostFocus(Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var firstFm2014 = FM2014.GetFirstConnectedAndLoggedInFm2014();
|
|
||||||
if (null == firstFm2014)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(tbxDutPulsesRequired.Text))
|
if (string.IsNullOrEmpty(tbxDutPulsesRequired.Text))
|
||||||
@ -1939,17 +1855,18 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for change
|
// Check for change
|
||||||
var backupPulsesRequired = firstFm2014.DutPulsesRequired;
|
var backupPulsesRequired = _fm2014Common.DutPulsesRequired;
|
||||||
|
|
||||||
// Convert the input and check limits
|
// Convert the input and check limits
|
||||||
if (int.TryParse(tbxDutPulsesRequired.Text, out var pulses) &&
|
if (int.TryParse(tbxDutPulsesRequired.Text, out var pulses) &&
|
||||||
FM2014.PULSES_TIME_MEASUREMENT_INPUT_MIN <= pulses &&
|
FM2014.PULSES_TIME_MEASUREMENT_INPUT_MIN <= pulses &&
|
||||||
FM2014.PULSES_TIME_MEASUREMENT_INPUT_MAX >= pulses)
|
FM2014.PULSES_TIME_MEASUREMENT_INPUT_MAX >= pulses)
|
||||||
{
|
{
|
||||||
if (backupPulsesRequired != pulses){
|
if (backupPulsesRequired != pulses)
|
||||||
_programCalibrationSetupHasChanged = true;
|
{
|
||||||
|
_programConfigurationSetupHasChanged = true;
|
||||||
// Preset to fill the configuration file storage ability
|
// Preset to fill the configuration file storage ability
|
||||||
firstFm2014.DutPulsesRequired = (UInt32)pulses;
|
_fm2014Common.DutPulsesRequired = (UInt32)pulses;
|
||||||
}
|
}
|
||||||
|
|
||||||
tbxDutPulsesRequired.Background = ColorStandardInputField;
|
tbxDutPulsesRequired.Background = ColorStandardInputField;
|
||||||
@ -2010,15 +1927,11 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
/// <remarks date="2026-Feb-09..Feb-16" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Feb-09..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void tbxDoublePulseDeadtime_LostFocus(Object sender, EventArgs e)
|
private void tbxDoublePulseDeadtime_LostFocus(Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var firstFm2014 = FM2014.GetFirstConnectedAndLoggedInFm2014();
|
|
||||||
if (null == firstFm2014)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(tbxDoublePulseDeadtime.Text))
|
if (string.IsNullOrEmpty(tbxDoublePulseDeadtime.Text))
|
||||||
@ -2028,7 +1941,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for change
|
// Check for change
|
||||||
var backupDoublePulseDeadtime = firstFm2014.DoublePulseDeadtime_ms;
|
var backupDoublePulseDeadtime = _fm2014Common.DoublePulseDeadtime_ms;
|
||||||
|
|
||||||
// Convert the input and check limits
|
// Convert the input and check limits
|
||||||
if (int.TryParse(tbxDoublePulseDeadtime.Text, out var deadtime) &&
|
if (int.TryParse(tbxDoublePulseDeadtime.Text, out var deadtime) &&
|
||||||
@ -2037,9 +1950,9 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
{
|
{
|
||||||
if (backupDoublePulseDeadtime != deadtime)
|
if (backupDoublePulseDeadtime != deadtime)
|
||||||
{
|
{
|
||||||
_programCalibrationSetupHasChanged = true;
|
_programConfigurationSetupHasChanged = true;
|
||||||
// Preset to fill the configuration file storage ability
|
// Preset to fill the configuration file storage ability
|
||||||
firstFm2014.DoublePulseDeadtime_ms = (UInt16)deadtime;
|
_fm2014Common.DoublePulseDeadtime_ms = (UInt16)deadtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
tbxDoublePulseDeadtime.Background = ColorStandardInputField;
|
tbxDoublePulseDeadtime.Background = ColorStandardInputField;
|
||||||
@ -2102,15 +2015,11 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
/// <remarks date="2026-Feb-09..Feb-16" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Feb-09..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void tbxDutToRefToleranceMax_LostFocus(Object sender, EventArgs e)
|
private void tbxDutToRefToleranceMax_LostFocus(Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var firstFm2014 = FM2014.GetFirstConnectedAndLoggedInFm2014();
|
|
||||||
if (null == firstFm2014)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -2121,32 +2030,24 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for change
|
// Check for change
|
||||||
var backupDutToRefTolerance = firstFm2014.DutToRefCalibrationToleranceMax_percent;
|
var backupDutToRefTolerance = _fm2014Common.DutToRefCalibrationToleranceMax_percent;
|
||||||
|
|
||||||
var englishNumberFormat = tbxDutToRefTolMax.Text.Replace(',', '.');
|
var englishNumberFormat = tbxDutToRefTolMax.Text.Replace(',', '.');
|
||||||
if (double.TryParse(englishNumberFormat, NumberStyles.Any, new CultureInfo("en"), out var tolerance))
|
if (double.TryParse(englishNumberFormat, NumberStyles.Any, new CultureInfo("en"), out var tolerance))
|
||||||
{
|
{
|
||||||
if (Math.Abs(backupDutToRefTolerance - tolerance) > 0.05)
|
if (Math.Abs(backupDutToRefTolerance - tolerance) > 0.05)
|
||||||
{
|
{
|
||||||
_programCalibrationSetupHasChanged = true;
|
_programConfigurationSetupHasChanged = true;
|
||||||
// Preset to fill the configuration file storage ability
|
// Preset to fill the configuration file storage ability
|
||||||
firstFm2014.DutToRefCalibrationToleranceMax_percent = tolerance;
|
_fm2014Common.DutToRefCalibrationToleranceMax_percent = tolerance;
|
||||||
}
|
}
|
||||||
|
|
||||||
tbxDutToRefTolMax.Background = ColorStandardInputField;
|
tbxDutToRefTolMax.Background = ColorStandardInputField;
|
||||||
|
|
||||||
// Dispatch settings to all connected FM2014!!!!
|
|
||||||
foreach (var fm2014 in FM2014.RegisteredFm2014s)
|
|
||||||
{
|
|
||||||
fm2014.DutToRefCalibrationToleranceMax_percent = tolerance;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tbxDutToRefTolMax.Background = ColorProcessFailed;
|
tbxDutToRefTolMax.Background = ColorProcessFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2200,15 +2101,11 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
/// <remarks date="2026-Feb-09..Feb-16" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Feb-09..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void tbxDutToRefToleranceMin_LostFocus(Object sender, EventArgs e)
|
private void tbxDutToRefToleranceMin_LostFocus(Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var firstFm2014 = FM2014.GetFirstConnectedAndLoggedInFm2014();
|
|
||||||
if (null == firstFm2014)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -2219,25 +2116,19 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for change
|
// Check for change
|
||||||
var backupDutToRefTolerance = firstFm2014.DutToRefCalibrationToleranceMin_percent;
|
var backupDutToRefTolerance = _fm2014Common.DutToRefCalibrationToleranceMin_percent;
|
||||||
|
|
||||||
var englishNumberFormat = tbxDutToRefTolMin.Text.Replace(',', '.');
|
var englishNumberFormat = tbxDutToRefTolMin.Text.Replace(',', '.');
|
||||||
if (double.TryParse(englishNumberFormat, NumberStyles.Any, new CultureInfo("en"), out var tolerance))
|
if (double.TryParse(englishNumberFormat, NumberStyles.Any, new CultureInfo("en"), out var tolerance))
|
||||||
{
|
{
|
||||||
if (Math.Abs(backupDutToRefTolerance - tolerance) > 0.05)
|
if (Math.Abs(backupDutToRefTolerance - tolerance) > 0.05)
|
||||||
{
|
{
|
||||||
_programCalibrationSetupHasChanged = true;
|
_programConfigurationSetupHasChanged = true;
|
||||||
// Preset to fill the configuration file storage ability
|
// Preset to fill the configuration file storage ability
|
||||||
firstFm2014.DutToRefCalibrationToleranceMin_percent = tolerance;
|
_fm2014Common.DutToRefCalibrationToleranceMin_percent = tolerance;
|
||||||
}
|
}
|
||||||
|
|
||||||
tbxDutToRefTolMin.Background = ColorStandardInputField;
|
tbxDutToRefTolMin.Background = ColorStandardInputField;
|
||||||
|
|
||||||
// Dispatch settings to all connected FM2014!!!!
|
|
||||||
foreach (var fm2014 in FM2014.RegisteredFm2014s)
|
|
||||||
{
|
|
||||||
fm2014.DutToRefCalibrationToleranceMin_percent = tolerance;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2295,15 +2186,11 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
/// <remarks date="2026-Jan-14..24" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Jan-14..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void tbxRefPulsesPerCm_LostFocus(Object sender, EventArgs e)
|
private void tbxRefPulsesPerCm_LostFocus(Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var firstFm2014 = FM2014.GetFirstConnectedAndLoggedInFm2014();
|
|
||||||
if (null == firstFm2014)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(tbxRefPulsesPerCm.Text))
|
if (string.IsNullOrEmpty(tbxRefPulsesPerCm.Text))
|
||||||
@ -2320,10 +2207,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
FM2014.REF_PULSES_PER_CM_REGULATION_INPUT_MAX >= pulses_per_cm)
|
FM2014.REF_PULSES_PER_CM_REGULATION_INPUT_MAX >= pulses_per_cm)
|
||||||
{
|
{
|
||||||
// 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
|
||||||
foreach (var fm2014 in FM2014.RegisteredFm2014s)
|
_fm2014Common.RefPulses_per_cm = (UInt32)pulses_per_cm;
|
||||||
{
|
|
||||||
fm2014.RefPulses_per_cm = (UInt32)pulses_per_cm;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!UpdateRefToDutScale())
|
if (!UpdateRefToDutScale())
|
||||||
{
|
{
|
||||||
@ -2331,6 +2215,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_programConfigurationSetupHasChanged = true;
|
||||||
tbxRefPulsesPerCm.Background = ColorStandardInputField;
|
tbxRefPulsesPerCm.Background = ColorStandardInputField;
|
||||||
CheckForFM2014SetupChanged();
|
CheckForFM2014SetupChanged();
|
||||||
}
|
}
|
||||||
@ -2389,15 +2274,11 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
/// <remarks date="2026-Jan-14..24" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Jan-14..Feb-18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void tbxDutPulsesPerCm_LostFocus(Object sender, EventArgs e)
|
private void tbxDutPulsesPerCm_LostFocus(Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var firstFm2014 = FM2014.GetFirstConnectedAndLoggedInFm2014();
|
|
||||||
if (null == firstFm2014)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(tbxDutPulsesPerCm.Text))
|
if (string.IsNullOrEmpty(tbxDutPulsesPerCm.Text))
|
||||||
@ -2414,10 +2295,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
FM2014.PULSES_PER_CM_REGULATION_SETUP_MAX >= pulses_per_cm)
|
FM2014.PULSES_PER_CM_REGULATION_SETUP_MAX >= pulses_per_cm)
|
||||||
{
|
{
|
||||||
// During setup of the 'Dut_pulse_per_cm' the 'RefToDutScaleStr' will be generated
|
// During setup of the 'Dut_pulse_per_cm' the 'RefToDutScaleStr' will be generated
|
||||||
foreach (var fm2014 in FM2014.RegisteredFm2014s)
|
_fm2014Common.DutPulses_per_cm = (UInt16)pulses_per_cm;
|
||||||
{
|
|
||||||
fm2014.DutPulses_per_cm = (UInt16)pulses_per_cm;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!UpdateRefToDutScale())
|
if (!UpdateRefToDutScale())
|
||||||
{
|
{
|
||||||
@ -2425,6 +2303,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_programConfigurationSetupHasChanged = true;
|
||||||
tbxDutPulsesPerCm.Background = ColorStandardInputField;
|
tbxDutPulsesPerCm.Background = ColorStandardInputField;
|
||||||
CheckForFM2014SetupChanged();
|
CheckForFM2014SetupChanged();
|
||||||
}
|
}
|
||||||
@ -2486,15 +2365,11 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
/// <remarks date="2026-Feb-09..10" author="Thomas Wiedebusch">
|
/// <remarks date="2026-Feb-09..18" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private void tbxVolumeMeasuredLiters_LostFocus(Object sender, EventArgs e)
|
private void tbxVolumeMeasuredLiters_LostFocus(Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var firstFm2014 = FM2014.GetFirstConnectedAndLoggedInFm2014();
|
|
||||||
if (null == firstFm2014)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -2514,24 +2389,24 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
var pulses_per_cm = (UInt32)(pulses / (liters / 1000.0) + 0.5);
|
var pulses_per_cm = (UInt32)(pulses / (liters / 1000.0) + 0.5);
|
||||||
|
|
||||||
// Try to set the new calculated REF pulses limited by the property setter
|
// Try to set the new calculated REF pulses limited by the property setter
|
||||||
firstFm2014.RefPulses_per_cm = pulses_per_cm;
|
_fm2014Common.RefPulses_per_cm = pulses_per_cm;
|
||||||
|
|
||||||
// If this succeeded, then update the new manual calibrated value
|
// If this succeeded, then update the new manual calibrated value
|
||||||
if (pulses_per_cm == firstFm2014.RefPulses_per_cm)
|
if (pulses_per_cm == _fm2014Common.RefPulses_per_cm)
|
||||||
{
|
{
|
||||||
tbxRefPulsesPerCm.Text = $@"{firstFm2014.RefPulses_per_cm:D}";
|
tbxRefPulsesPerCm.Text = $@"{_fm2014Common.RefPulses_per_cm:D}";
|
||||||
tbxRefPulsesPerCm.Background = ColorStandardDisplayField;
|
tbxRefPulsesPerCmCalib.Text = $@"{_fm2014Common.RefPulses_per_cm:D}";
|
||||||
tbxRefPulsesPerCmCalib.Text = $@"{firstFm2014.RefPulses_per_cm:D}";
|
|
||||||
tbxRefPulsesPerCmCalib.Background = ColorStandardDisplayField;
|
|
||||||
tbxVolumeMeasuredLiters.Background = ColorStandardInputField;
|
|
||||||
|
|
||||||
if (!UpdateRefToDutScale())
|
if (!UpdateRefToDutScale())
|
||||||
{
|
{
|
||||||
tbxVolumeMeasuredLiters.Background = ColorProcessFailed;
|
tbxVolumeMeasuredLiters.Background = ColorProcessFailed;
|
||||||
tbxRefPulsesPerCmCalib.Background = ColorProcessFailed;
|
tbxRefPulsesPerCmCalib.Background = ColorProcessFailed;
|
||||||
|
tbxRefPulsesPerCm.Background = ColorProcessFailed;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tbxVolumeMeasuredLiters.Background = ColorStandardInputField;
|
_programConfigurationSetupHasChanged = true;
|
||||||
|
tbxRefPulsesPerCmCalib.Background = ColorStandardDisplayField;
|
||||||
|
tbxRefPulsesPerCm.Background = ColorStandardInputField;
|
||||||
tbxVolumeMeasuredLiters.Background = ColorStandardInputField;
|
tbxVolumeMeasuredLiters.Background = ColorStandardInputField;
|
||||||
CheckForFM2014SetupChanged();
|
CheckForFM2014SetupChanged();
|
||||||
}
|
}
|
||||||
@ -2547,7 +2422,7 @@ namespace Sensus.Ui.FM2014TestBench
|
|||||||
|
|
||||||
private void chkAnySlot_Click(Object sender, RoutedEventArgs e)
|
private void chkAnySlot_Click(Object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
_programConfigSetupHasChanged = true;
|
_programConfigurationSetupHasChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -479,7 +479,7 @@ namespace Sensus.MiniPrf.Ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
lblActualProcess.Text = Resources.StrMsgConnecting;
|
lblActualProcess.Text = Resources.StrMsgConnecting;
|
||||||
Fm2014.Connect(cbxProgramComPort.SelectedItem.ToString());
|
Fm2014.Connect(cbxProgramComPort.SelectedItem.ToString(), true);
|
||||||
|
|
||||||
Task.Factory.StartNew(() =>
|
Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user