From e98bd03b03d00a9fc98ab4379d136f280188007e Mon Sep 17 00:00:00 2001 From: Thomas Wiedebusch Date: Tue, 20 Jan 2026 13:45:07 +0100 Subject: [PATCH] MiniPrf: - debug output --- .../FM2014/FM2014Core/Consts/FM2014CmdDef.cs | 32 ++- .../FM2014/FM2014Core/FM2014.cs | 142 +++++++---- .../Properties/Resources.Designer.cs | 64 +++-- .../FM2014Core/Properties/Resources.de.resx | 42 ++-- .../FM2014Core/Properties/Resources.resx | 38 ++- MiniPrf/Ui/FrmMainMiniPrf.Designer.cs | 236 ++++++++++++++++-- MiniPrf/Ui/FrmMainMiniPrf.cs | 99 ++++++-- 7 files changed, 523 insertions(+), 130 deletions(-) diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Consts/FM2014CmdDef.cs b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Consts/FM2014CmdDef.cs index 8651d1db..5efacd9b 100644 --- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Consts/FM2014CmdDef.cs +++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Consts/FM2014CmdDef.cs @@ -218,19 +218,35 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co /// CMD_GET_REF_FREQU, /// - /// + /// Calculate frequency from REF period /// - CMD_CAL_FLOW_RATE, + CMD_CAL_FREQU_REF_PERIOD, /// - /// + /// Calculate frequency from DUT period + /// + CMD_CAL_FREQU_DUT_PERIOD, + /// + /// Calculated flow rate from REF frequency + /// + CMD_CAL_FLOW_REF_FREQU, + /// + /// Calculated flow rate from REF period + /// + CMD_CAL_FLOW_REF_PERIOD, + /// + /// Calculated flow rate from DUT period + /// + CMD_CAL_FLOW_DUT_PERIOD, + /// + /// Command to force a current offset correction (takes about 4 s) /// CMD_COR_CURRENT, /// - /// + /// Set current to max value (20 mA) /// CMD_SET_XTR_MAX, /// - /// + /// Set current to min value (-20 mA) /// CMD_SET_XTR_MIN, /// @@ -409,7 +425,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Co new Cmd(CmdName.CMD_GET_REF_PERIOD, UNICODE_DLE, CmdType.INDIVIDUAL_WA, Resources.StrCmdMsgGetRefPeriod), new Cmd(CmdName.CMD_GET_DUT_PERIOD, UNICODE_DC1, CmdType.INDIVIDUAL_WA, Resources.StrCmdMsgGetDutPeriod), new Cmd(CmdName.CMD_GET_REF_FREQU, UNICODE_DC2, CmdType.INDIVIDUAL_WA, Resources.StrCmdMsgGetRefFrequ), - new Cmd(CmdName.CMD_CAL_FLOW_RATE, "", CmdType.INDIVIDUAL_WA, Resources.StrCalFlowRate), + new Cmd(CmdName.CMD_CAL_FREQU_REF_PERIOD, "", CmdType.INDIVIDUAL_WA, Resources.StrCalRefFrequFromRefPeriod), + new Cmd(CmdName.CMD_CAL_FREQU_DUT_PERIOD, "", CmdType.INDIVIDUAL_WA, Resources.StrCalDutFrequFromDutPeriod), + new Cmd(CmdName.CMD_CAL_FLOW_REF_FREQU, "", CmdType.INDIVIDUAL_WA, Resources.StrCalRefFlowRateFromRefFrequ), + new Cmd(CmdName.CMD_CAL_FLOW_REF_PERIOD, "", CmdType.INDIVIDUAL_WA, Resources.StrCalRefFlowRateFromRefPeriod), + new Cmd(CmdName.CMD_CAL_FLOW_DUT_PERIOD, "", CmdType.INDIVIDUAL_WA, Resources.StrCalDutFlowRateFromDutPeriod), // Adjustment, place here Ids which may represent digital numbers from A to F new Cmd(CmdName.CMD_COR_CURRENT, "C", CmdType.BROADCAST, Resources.StrCmdMsgCorCurrent), new Cmd(CmdName.CMD_SET_XTR_MAX, "+", CmdType.BROADCAST, Resources.StrCmdMsgSetXtrMax), diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs index c038ee94..997cc144 100644 --- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs +++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs @@ -271,6 +271,15 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core private set; } + /// + /// Request debug information + /// + public Boolean RequestDebugInformation + { + get; + set; + } + /// /// Number of processing steps for this actual process progress /// @@ -406,7 +415,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core try { cmdName = CmdName.CMD_REF_GET_PLS_CTR; - if (refCtrOn && Write(cmdName)) + if (CyclicReceiveTaskLoopIsActive && refCtrOn && Write(cmdName)) { var refPulseStr = SerialPort.ReadTo(END_OF_STR); @@ -420,7 +429,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core } cmdName = CmdName.CMD_DUT_GET_PLS_CTR; - if (dutCtrOn && Write(cmdName)) + if (CyclicReceiveTaskLoopIsActive && dutCtrOn && Write(cmdName)) { var dutPulseStr = SerialPort.ReadTo(END_OF_STR); @@ -469,7 +478,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core /// - Set to false. /// /// - /// + /// /// - Initial. /// public Boolean RegulationMeasurement() @@ -519,10 +528,12 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core { try { + // 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) String responseStr; cmdName = UseDampedTolerance ? CmdName.CMD_GET_DTLC : CmdName.CMD_GET_UDTLC; var info = GetCmdInfo(cmdName); - if (Write(cmdName)) + if (CyclicReceiveTaskLoopIsActive && Write(cmdName)) { responseStr = SerialPort.ReadTo(END_OF_STR); // The response contains a sign! @@ -539,59 +550,104 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core } } - //cmdName = CmdName.CMD_GET_REF_PERIOD; - //info = GetCmdInfo(cmdName); - //if (Write(cmdName)) - //{ - // responseStr = SerialPort.ReadTo(END_OF_STR); - // if (int.TryParse(responseStr, NumberStyles.HexNumber, new CultureInfo("en"), out var refPeriod)) - // { - // // Convert to m³/h (3600 s/h) and save the value - // RefFlowRate_cm_per_h = 3600.0f / (refPeriod * TMR_RESOLUTION_s) / Ref_pulse_per_cm; + // Read the REF period and calculate the frequency [Hz] and flow rate [m³/h] based on this period + cmdName = CmdName.CMD_GET_REF_PERIOD; + info = GetCmdInfo(cmdName); + if (RequestDebugInformation && CyclicReceiveTaskLoopIsActive && Write(cmdName)) + { + responseStr = SerialPort.ReadTo(END_OF_STR); + if (int.TryParse(responseStr, NumberStyles.HexNumber, new CultureInfo("en"), out var period)) + { + // Publish the period [ms] + var response = new CmdResponse(cmdName, info, + doubleValue: TMR_RESOLUTION_s * 1000.0f * period, + siUnit: "m" + SiUnits.GetInfo(SiUnits.SiUnitName.TIME)); + OnRawRecordReceived?.Invoke(this, + new ProcessExecEventArgs("", actualProcessMessage: measurementInfo, + specificInfoObj: response)); - // //var response = new CmdResponse(cmdName, info, - // // doubleValue: TMR_RESOLUTION_s * 1000.0f * refPeriod, - // // siUnit: SiUnits.GetInfo(SiUnits.SiUnitName.TIME)); - // //OnRawRecordReceived?.Invoke(this, - // // new ProcessExecEventArgs("", actualProcessMessage: measurementInfo, - // // specificInfoObj: response)); + // Publish the frequency in [Hz] + cmdName = CmdName.CMD_CAL_FREQU_REF_PERIOD; + info = GetCmdInfo(cmdName); + response = new CmdResponse(cmdName, info, + doubleValue: 1.0f / (TMR_RESOLUTION_s * period), + siUnit: SiUnits.GetInfo(SiUnits.SiUnitName.FREQUENCY)); + OnRawRecordReceived?.Invoke(this, + new ProcessExecEventArgs("", actualProcessMessage: measurementInfo, + specificInfoObj: response)); - // cmdName = CmdName.CMD_GET_REF_FREQU; - // var response = new CmdResponse(cmdName, info, - // doubleValue: 1.0f /(TMR_RESOLUTION_s * refPeriod), - // siUnit: SiUnits.GetInfo(SiUnits.SiUnitName.FREQUENCY)); - // OnRawRecordReceived?.Invoke(this, - // new ProcessExecEventArgs("", actualProcessMessage: measurementInfo, - // specificInfoObj: response)); + // Convert to m³/h (3600 s/h) based on REF pulse rate + var flowRate_cm_per_h = 3600.0f / (period * TMR_RESOLUTION_s) / Ref_pulse_per_cm; + // Publish the calculated flow rate [m³/h] + cmdName = CmdName.CMD_CAL_FLOW_REF_PERIOD; + info = GetCmdInfo(cmdName); + response = new CmdResponse(cmdName, info, doubleValue: flowRate_cm_per_h, + siUnit: SiUnits.GetInfo(SiUnits.SiUnitName.FLOW_RATE_NON_SI)); + OnRawRecordReceived?.Invoke(this, + new ProcessExecEventArgs("", actualProcessMessage: measurementInfo, + specificInfoObj: response)); + } + } - // // Transmit additionally the calculated flow rate - // cmdName = CmdName.CMD_CAL_FLOW_RATE; - // info = GetCmdInfo(cmdName); - // response = new CmdResponse(cmdName, info, doubleValue: RefFlowRate_cm_per_h, - // siUnit: "m" + SiUnits.GetInfo(SiUnits.SiUnitName.FLOW_RATE_NON_SI)); - // OnRawRecordReceived?.Invoke(this, - // new ProcessExecEventArgs("", actualProcessMessage: measurementInfo, - // specificInfoObj: response)); - // } - //} + + // Read the DUT period and calculate the frequency [Hz] and flow rate [m³/h] based on this period + cmdName = CmdName.CMD_GET_DUT_PERIOD; + info = GetCmdInfo(cmdName); + if (RequestDebugInformation && CyclicReceiveTaskLoopIsActive && Write(cmdName)) + { + responseStr = SerialPort.ReadTo(END_OF_STR); + if (int.TryParse(responseStr, NumberStyles.HexNumber, new CultureInfo("en"), out var period)) + { + // Publish the period [ms] + var response = new CmdResponse(cmdName, info, + doubleValue: TMR_RESOLUTION_s * 1000.0f * period, + siUnit: "m" + SiUnits.GetInfo(SiUnits.SiUnitName.TIME)); + OnRawRecordReceived?.Invoke(this, + new ProcessExecEventArgs("", actualProcessMessage: measurementInfo, + specificInfoObj: response)); + // Publish the frequency in [Hz] + cmdName = CmdName.CMD_CAL_FREQU_DUT_PERIOD; + info = GetCmdInfo(cmdName); + response = new CmdResponse(cmdName, info, + doubleValue: 1.0f / (TMR_RESOLUTION_s * period), + siUnit: SiUnits.GetInfo(SiUnits.SiUnitName.FREQUENCY)); + OnRawRecordReceived?.Invoke(this, + new ProcessExecEventArgs("", actualProcessMessage: measurementInfo, + specificInfoObj: response)); + + // Convert to m³/h (3600 s/h) based on DUT pulse rate + var flowRate_cm_per_h = 3600.0f / (period * TMR_RESOLUTION_s) / Dut_pulse_per_cm; + // Publish the calculated flow rate [m³/h] + cmdName = CmdName.CMD_CAL_FLOW_DUT_PERIOD; + info = GetCmdInfo(cmdName); + response = new CmdResponse(cmdName, info, doubleValue: flowRate_cm_per_h, + siUnit: SiUnits.GetInfo(SiUnits.SiUnitName.FLOW_RATE_NON_SI)); + OnRawRecordReceived?.Invoke(this, + new ProcessExecEventArgs("", actualProcessMessage: measurementInfo, + specificInfoObj: response)); + } + } + + + // Read the REF frequency [Hz] directly and calculate the flow rate [m³/h] based on this frequency cmdName = CmdName.CMD_GET_REF_FREQU; info = GetCmdInfo(cmdName); - if (Write(cmdName)) + if (CyclicReceiveTaskLoopIsActive && Write(cmdName)) { responseStr = SerialPort.ReadTo(END_OF_STR); if (int.TryParse(responseStr, NumberStyles.HexNumber, new CultureInfo("en"), out var refFrequency)) { - // Convert to m³/h (3600 s/h) and save the value - RefFlowRate_cm_per_h = 3600.0f * refFrequency / Ref_pulse_per_cm; - + // Publish the frequency in [Hz] var response = new CmdResponse(cmdName, info, refFrequency, siUnit: SiUnits.GetInfo(SiUnits.SiUnitName.FREQUENCY)); OnRawRecordReceived?.Invoke(this, new ProcessExecEventArgs("", actualProcessMessage: measurementInfo, specificInfoObj: response)); - // Transmit additionally the calculated flow rate - cmdName = CmdName.CMD_CAL_FLOW_RATE; + // Convert to m³/h (3600 s/h) and save the value + RefFlowRate_cm_per_h = 3600.0f * refFrequency / Ref_pulse_per_cm; + // Publish the calculated flow rate [m³/h] + cmdName = CmdName.CMD_CAL_FLOW_REF_FREQU; info = GetCmdInfo(cmdName); response = new CmdResponse(cmdName, info, doubleValue: RefFlowRate_cm_per_h, siUnit: SiUnits.GetInfo(SiUnits.SiUnitName.FLOW_RATE_NON_SI)); @@ -600,6 +656,8 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core specificInfoObj: response)); } } + + Thread.Sleep(500); } catch (Exception e) { diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.Designer.cs b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.Designer.cs index c68b4011..c6101f27 100644 --- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.Designer.cs +++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.Designer.cs @@ -62,11 +62,47 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Flow rate. + /// Looks up a localized string similar to DUT flow rate f(DUT period). /// - internal static string StrCalFlowRate { + internal static string StrCalDutFlowRateFromDutPeriod { get { - return ResourceManager.GetString("StrCalFlowRate", resourceCulture); + return ResourceManager.GetString("StrCalDutFlowRateFromDutPeriod", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to DUT frequency f(DUT period). + /// + internal static string StrCalDutFrequFromDutPeriod { + get { + return ResourceManager.GetString("StrCalDutFrequFromDutPeriod", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to REF flow rate f(REF frequency). + /// + internal static string StrCalRefFlowRateFromRefFrequ { + get { + return ResourceManager.GetString("StrCalRefFlowRateFromRefFrequ", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to REF flow rate f(REF period). + /// + internal static string StrCalRefFlowRateFromRefPeriod { + get { + return ResourceManager.GetString("StrCalRefFlowRateFromRefPeriod", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to REF frequency f(REF period). + /// + internal static string StrCalRefFrequFromRefPeriod { + get { + return ResourceManager.GetString("StrCalRefFrequFromRefPeriod", resourceCulture); } } @@ -170,7 +206,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Counted DUT timer ticks (334 us). + /// Looks up a localized string similar to Counted DUT timer ticks. /// internal static string StrCmdMsgDutGetTmr { get { @@ -179,7 +215,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to DUT pulses per m³. + /// Looks up a localized string similar to DUT pulses ratio. /// internal static string StrCmdMsgDutLppScale { get { @@ -215,7 +251,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Measured damped tolerance DUT to REF in percent. + /// Looks up a localized string similar to Damped tolerance DUT to REF. /// internal static string StrCmdMsgGetDtlc { get { @@ -224,7 +260,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Measured DUT period in ticks (334 us). + /// Looks up a localized string similar to DUT period. /// internal static string StrCmdMsgGetDutPeriod { get { @@ -233,7 +269,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Measured REF frequency in Hz. + /// Looks up a localized string similar to REF frequency. /// internal static string StrCmdMsgGetRefFrequ { get { @@ -242,7 +278,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Measured REF period in ticks (334 us). + /// Looks up a localized string similar to REF period. /// internal static string StrCmdMsgGetRefPeriod { get { @@ -260,7 +296,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Measured undamped tolerance DUT to REF in percent. + /// Looks up a localized string similar to Undamped tolerance DUT to REF. /// internal static string StrCmdMsgGetUdtlc { get { @@ -305,7 +341,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Readout lifetime in hours. + /// Looks up a localized string similar to Lifetime counter. /// internal static string StrCmdMsgPrintStatistics { get { @@ -368,7 +404,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Get REF timer ticks (334 us). + /// Looks up a localized string similar to REF timer ticks. /// internal static string StrCmdMsgRefGetTmr { get { @@ -377,7 +413,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to REF pulses per m³. + /// Looks up a localized string similar to REF pulses ratio. /// internal static string StrCmdMsgRefLppScale { get { @@ -413,7 +449,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core.Pr } /// - /// Looks up a localized string similar to Measurement STOP & RESET. + /// Looks up a localized string similar to Measurement stop and reset. /// internal static string StrCmdMsgRstMeas { get { diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.de.resx b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.de.resx index 9caef61c..8eac8129 100644 --- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.de.resx +++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.de.resx @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Einstellung zu zählende REF Impulse + Geforderte REF Impulse Start REF Impulszähler @@ -157,7 +157,7 @@ Zwischengespeicherte DUT Impulse - Messung STOPP & RESET + Messung beenden und zurücksetzen REF zu DUT Impulsverhältnis @@ -172,10 +172,10 @@ REF zu DUT Dämpfung - DUT Impulse pro m³ + DUT Impulswertigkeit - REF Impulse pro m³ + REF Impulswertigkeit Parameterbereichsüberschreitung @@ -196,25 +196,25 @@ Kommando nicht unterstützt - Gezählte DUT Zeitticks (334 us) + Gezählte DUT Zeitimpulse - Gezählte REF Zeitticks (334 us) + REF Zeiteinheiten - Gemessene ungedämpfte Toleranz DUT zu REF in Prozent + Ungedämpfte Toleranz DUT zu REF - Gemessene gedämpfte Toleranz DUT zu REF in Prozent + Gedämpfte Toleranz DUT zu REF - Gemessene REF Periodendauer in Ticks (334 us) + REF Periodendauer - Gemessene DUT Periode in Ticks (334 us) + DUT Periodendauer - Gemessene REF Frequenz in Hz + REF Frequenz Starte Stromnullpunktkalibrierung @@ -223,7 +223,7 @@ Toleranzanzeige auf Maximum stellen - Toleranzanzeige auf Miniimum stellen + Toleranzanzeige auf Minimum stellen Löschverriegelung aufheben @@ -253,7 +253,7 @@ Virtuelle EEPROM Adresse schreiben - Ermittelte Laufzeit in Stunden + Betriebsstundenzähler FEHLER @@ -303,7 +303,19 @@ Abfrage - - Durchflußrate + + REF Frequenz f(REF Periodendauer) + + + DUT Frequenz f(DUT Periodendauer) + + + REF Durchflußrate f(REF Frequenz) + + + REF Durchflußrate f(REF Periodendauer) + + + DUT Durchflußrate f(DUT Periodendauer) \ No newline at end of file diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.resx b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.resx index c2ec391e..2607c56d 100644 --- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.resx +++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/Properties/Resources.resx @@ -157,7 +157,7 @@ Backup counted DUT pulses - Measurement STOP & RESET + Measurement stop and reset REF to DUT pulse ratio @@ -172,10 +172,10 @@ REF to DUT attenuation - DUT pulses per m³ + DUT pulses ratio - REF pulses per m³ + REF pulses ratio Parameter is out of range @@ -196,25 +196,25 @@ Command not supported - Counted DUT timer ticks (334 us) + Counted DUT timer ticks - Get REF timer ticks (334 us) + REF timer ticks - Measured undamped tolerance DUT to REF in percent + Undamped tolerance DUT to REF - Measured damped tolerance DUT to REF in percent + Damped tolerance DUT to REF - Measured REF period in ticks (334 us) + REF period - Measured DUT period in ticks (334 us) + DUT period - Measured REF frequency in Hz + REF frequency Start current offset correction @@ -253,7 +253,7 @@ Set virtual EEPROM address - Readout lifetime in hours + Lifetime counter ERROR @@ -303,7 +303,19 @@ Request - - Flow rate + + REF frequency f(REF period) + + + DUT frequency f(DUT period) + + + REF flow rate f(REF frequency) + + + REF flow rate f(REF period) + + + DUT flow rate f(DUT period) \ No newline at end of file diff --git a/MiniPrf/Ui/FrmMainMiniPrf.Designer.cs b/MiniPrf/Ui/FrmMainMiniPrf.Designer.cs index 64e91db5..3c01eb49 100644 --- a/MiniPrf/Ui/FrmMainMiniPrf.Designer.cs +++ b/MiniPrf/Ui/FrmMainMiniPrf.Designer.cs @@ -80,12 +80,29 @@ this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.picFM2014 = 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.gbxFM2014Setup.SuspendLayout(); this.gbxRegulationSetup.SuspendLayout(); this.gbxManualRefCalibration.SuspendLayout(); this.gbxDutToRefRegulation.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picFM2014)).BeginInit(); + this.grpBoxDebug.SuspendLayout(); this.SuspendLayout(); // // gbxFM2014Setup @@ -263,7 +280,7 @@ this.gbxRegulationSetup.Controls.Add(this.tbxRefPulsePerCm); this.gbxRegulationSetup.Controls.Add(this.tbxDutPulsePerCm); this.gbxRegulationSetup.Controls.Add(this.tbxScaleRefToDut); - this.gbxRegulationSetup.Location = new System.Drawing.Point(77, 243); + this.gbxRegulationSetup.Location = new System.Drawing.Point(78, 242); this.gbxRegulationSetup.Name = "gbxRegulationSetup"; this.gbxRegulationSetup.Size = new System.Drawing.Size(260, 161); this.gbxRegulationSetup.TabIndex = 82; @@ -368,7 +385,7 @@ // lblUpdateTimeValue // this.lblUpdateTimeValue.AutoSize = true; - this.lblUpdateTimeValue.Location = new System.Drawing.Point(331, 413); + this.lblUpdateTimeValue.Location = new System.Drawing.Point(331, 416); this.lblUpdateTimeValue.Name = "lblUpdateTimeValue"; this.lblUpdateTimeValue.Size = new System.Drawing.Size(28, 13); this.lblUpdateTimeValue.TabIndex = 81; @@ -382,7 +399,7 @@ // lblTimeText // this.lblTimeText.AutoSize = true; - this.lblTimeText.Location = new System.Drawing.Point(259, 413); + this.lblTimeText.Location = new System.Drawing.Point(259, 416); this.lblTimeText.Name = "lblTimeText"; this.lblTimeText.Size = new System.Drawing.Size(66, 13); this.lblTimeText.TabIndex = 79; @@ -392,7 +409,7 @@ // this.lblWaitingForMeterResponse.AutoSize = true; this.lblWaitingForMeterResponse.ForeColor = System.Drawing.Color.Red; - this.lblWaitingForMeterResponse.Location = new System.Drawing.Point(421, 413); + this.lblWaitingForMeterResponse.Location = new System.Drawing.Point(421, 416); this.lblWaitingForMeterResponse.Name = "lblWaitingForMeterResponse"; this.lblWaitingForMeterResponse.Size = new System.Drawing.Size(183, 13); this.lblWaitingForMeterResponse.TabIndex = 76; @@ -400,7 +417,7 @@ // // barSingleProgressUpdate // - this.barSingleProgressUpdate.Location = new System.Drawing.Point(7, 429); + this.barSingleProgressUpdate.Location = new System.Drawing.Point(7, 432); this.barSingleProgressUpdate.Name = "barSingleProgressUpdate"; this.barSingleProgressUpdate.Size = new System.Drawing.Size(597, 18); this.barSingleProgressUpdate.TabIndex = 75; @@ -409,7 +426,7 @@ // lblActualProcess // this.lblActualProcess.AutoSize = true; - this.lblActualProcess.Location = new System.Drawing.Point(5, 413); + this.lblActualProcess.Location = new System.Drawing.Point(5, 416); this.lblActualProcess.Name = "lblActualProcess"; this.lblActualProcess.Size = new System.Drawing.Size(76, 13); this.lblActualProcess.TabIndex = 74; @@ -516,9 +533,9 @@ this.gbxDutToRefRegulation.Controls.Add(this.lblActualFlowRateCmPerHour); this.gbxDutToRefRegulation.Controls.Add(this.tbxActualFlowRateCmPerHour); this.gbxDutToRefRegulation.Controls.Add(this.btnDutToRefRegulation); - this.gbxDutToRefRegulation.Location = new System.Drawing.Point(344, 244); + this.gbxDutToRefRegulation.Location = new System.Drawing.Point(344, 243); this.gbxDutToRefRegulation.Name = "gbxDutToRefRegulation"; - this.gbxDutToRefRegulation.Size = new System.Drawing.Size(260, 161); + this.gbxDutToRefRegulation.Size = new System.Drawing.Size(260, 160); this.gbxDutToRefRegulation.TabIndex = 84; this.gbxDutToRefRegulation.TabStop = false; this.gbxDutToRefRegulation.Text = "DUT to REF Regulation"; @@ -526,7 +543,7 @@ // lblRefFrequencyHz // this.lblRefFrequencyHz.AutoSize = true; - this.lblRefFrequencyHz.Location = new System.Drawing.Point(10, 76); + this.lblRefFrequencyHz.Location = new System.Drawing.Point(10, 52); this.lblRefFrequencyHz.Name = "lblRefFrequencyHz"; this.lblRefFrequencyHz.Size = new System.Drawing.Size(106, 13); this.lblRefFrequencyHz.TabIndex = 79; @@ -535,7 +552,7 @@ // tbxRefFrequencyHz // this.tbxRefFrequencyHz.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.tbxRefFrequencyHz.Location = new System.Drawing.Point(150, 74); + this.tbxRefFrequencyHz.Location = new System.Drawing.Point(150, 50); this.tbxRefFrequencyHz.Name = "tbxRefFrequencyHz"; this.tbxRefFrequencyHz.ReadOnly = true; this.tbxRefFrequencyHz.Size = new System.Drawing.Size(100, 20); @@ -544,7 +561,7 @@ // chkUseDampedTolerance // this.chkUseDampedTolerance.AutoSize = true; - this.chkUseDampedTolerance.Location = new System.Drawing.Point(9, 100); + this.chkUseDampedTolerance.Location = new System.Drawing.Point(10, 106); this.chkUseDampedTolerance.Name = "chkUseDampedTolerance"; this.chkUseDampedTolerance.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.chkUseDampedTolerance.Size = new System.Drawing.Size(134, 17); @@ -556,7 +573,7 @@ // lblActualMeasuredTolerance // this.lblActualMeasuredTolerance.AutoSize = true; - this.lblActualMeasuredTolerance.Location = new System.Drawing.Point(10, 53); + this.lblActualMeasuredTolerance.Location = new System.Drawing.Point(10, 27); this.lblActualMeasuredTolerance.Name = "lblActualMeasuredTolerance"; this.lblActualMeasuredTolerance.Size = new System.Drawing.Size(75, 13); this.lblActualMeasuredTolerance.TabIndex = 76; @@ -565,7 +582,7 @@ // tbxActualMeasuredToleranceDutToRef // this.tbxActualMeasuredToleranceDutToRef.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.tbxActualMeasuredToleranceDutToRef.Location = new System.Drawing.Point(150, 50); + this.tbxActualMeasuredToleranceDutToRef.Location = new System.Drawing.Point(150, 24); this.tbxActualMeasuredToleranceDutToRef.Name = "tbxActualMeasuredToleranceDutToRef"; this.tbxActualMeasuredToleranceDutToRef.ReadOnly = true; this.tbxActualMeasuredToleranceDutToRef.Size = new System.Drawing.Size(100, 20); @@ -574,7 +591,7 @@ // lblActualFlowRateCmPerHour // this.lblActualFlowRateCmPerHour.AutoSize = true; - this.lblActualFlowRateCmPerHour.Location = new System.Drawing.Point(10, 28); + this.lblActualFlowRateCmPerHour.Location = new System.Drawing.Point(10, 79); this.lblActualFlowRateCmPerHour.Name = "lblActualFlowRateCmPerHour"; this.lblActualFlowRateCmPerHour.Size = new System.Drawing.Size(89, 13); this.lblActualFlowRateCmPerHour.TabIndex = 74; @@ -583,7 +600,7 @@ // tbxActualFlowRateCmPerHour // this.tbxActualFlowRateCmPerHour.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.tbxActualFlowRateCmPerHour.Location = new System.Drawing.Point(150, 25); + this.tbxActualFlowRateCmPerHour.Location = new System.Drawing.Point(150, 76); this.tbxActualFlowRateCmPerHour.Name = "tbxActualFlowRateCmPerHour"; this.tbxActualFlowRateCmPerHour.ReadOnly = true; this.tbxActualFlowRateCmPerHour.Size = new System.Drawing.Size(100, 20); @@ -616,29 +633,190 @@ this.picFM2014.Size = new System.Drawing.Size(60, 176); this.picFM2014.TabIndex = 87; this.picFM2014.TabStop = false; + this.picFM2014.Click += new System.EventHandler(this.picFM2014_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(18, 27); + 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(158, 25); + this.tbxRefFrequencyFromRefPeriodHz.Name = "tbxRefFrequencyFromRefPeriodHz"; + this.tbxRefFrequencyFromRefPeriodHz.ReadOnly = true; + this.tbxRefFrequencyFromRefPeriodHz.Size = new System.Drawing.Size(100, 20); + this.tbxRefFrequencyFromRefPeriodHz.TabIndex = 82; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(18, 77); + 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(158, 74); + this.tbxRefFlowRateFromRefPeriodCmPerH.Name = "tbxRefFlowRateFromRefPeriodCmPerH"; + this.tbxRefFlowRateFromRefPeriodCmPerH.ReadOnly = true; + this.tbxRefFlowRateFromRefPeriodCmPerH.Size = new System.Drawing.Size(100, 20); + this.tbxRefFlowRateFromRefPeriodCmPerH.TabIndex = 81; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(18, 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(158, 123); + this.tbxRefPeriodMs.Name = "tbxRefPeriodMs"; + this.tbxRefPeriodMs.ReadOnly = true; + this.tbxRefPeriodMs.Size = new System.Drawing.Size(100, 20); + this.tbxRefPeriodMs.TabIndex = 85; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(190, 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(313, 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(285, 123); + this.tbxDutPeriodMs.Name = "tbxDutPeriodMs"; + this.tbxDutPeriodMs.ReadOnly = true; + this.tbxDutPeriodMs.Size = new System.Drawing.Size(100, 20); + this.tbxDutPeriodMs.TabIndex = 92; + // + // tbxDutFrequencyFromDutPeriodHz + // + this.tbxDutFrequencyFromDutPeriodHz.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.tbxDutFrequencyFromDutPeriodHz.Location = new System.Drawing.Point(285, 25); + this.tbxDutFrequencyFromDutPeriodHz.Name = "tbxDutFrequencyFromDutPeriodHz"; + this.tbxDutFrequencyFromDutPeriodHz.ReadOnly = true; + this.tbxDutFrequencyFromDutPeriodHz.Size = new System.Drawing.Size(100, 20); + this.tbxDutFrequencyFromDutPeriodHz.TabIndex = 91; + // + // tbxDutFlowRateFromDutPeriodCmPerH + // + this.tbxDutFlowRateFromDutPeriodCmPerH.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.tbxDutFlowRateFromDutPeriodCmPerH.Location = new System.Drawing.Point(285, 74); + this.tbxDutFlowRateFromDutPeriodCmPerH.Name = "tbxDutFlowRateFromDutPeriodCmPerH"; + this.tbxDutFlowRateFromDutPeriodCmPerH.ReadOnly = true; + this.tbxDutFlowRateFromDutPeriodCmPerH.Size = new System.Drawing.Size(100, 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(78, 246); + this.grpBoxDebug.Name = "grpBoxDebug"; + this.grpBoxDebug.Size = new System.Drawing.Size(526, 158); + this.grpBoxDebug.TabIndex = 83; + this.grpBoxDebug.TabStop = false; + this.grpBoxDebug.Text = "Debug"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(18, 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(158, 99); + this.tbxRefFlowRateFromRefFrequencyCmPerH.Name = "tbxRefFlowRateFromRefFrequencyCmPerH"; + this.tbxRefFlowRateFromRefFrequencyCmPerH.ReadOnly = true; + this.tbxRefFlowRateFromRefFrequencyCmPerH.Size = new System.Drawing.Size(100, 20); + this.tbxRefFlowRateFromRefFrequencyCmPerH.TabIndex = 95; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(18, 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(158, 50); + this.tbxRefFrequencyDirectHz.Name = "tbxRefFrequencyDirectHz"; + this.tbxRefFrequencyDirectHz.ReadOnly = true; + this.tbxRefFrequencyDirectHz.Size = new System.Drawing.Size(100, 20); + this.tbxRefFrequencyDirectHz.TabIndex = 93; // // FrmMainMiniPrf // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(610, 464); + this.ClientSize = new System.Drawing.Size(610, 462); + this.Controls.Add(this.gbxDutToRefRegulation); + this.Controls.Add(this.gbxRegulationSetup); this.Controls.Add(this.picFM2014); this.Controls.Add(this.pictureBox1); - this.Controls.Add(this.gbxDutToRefRegulation); this.Controls.Add(this.gbxFM2014Setup); - this.Controls.Add(this.gbxRegulationSetup); this.Controls.Add(this.lblUpdateTimeValue); this.Controls.Add(this.gbxManualRefCalibration); this.Controls.Add(this.lblTimeText); this.Controls.Add(this.lblWaitingForMeterResponse); this.Controls.Add(this.barSingleProgressUpdate); + this.Controls.Add(this.grpBoxDebug); this.Controls.Add(this.lblActualProcess); this.Controls.Add(this.menuStrip1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip1; - this.MaximumSize = new System.Drawing.Size(626, 503); - this.MinimumSize = new System.Drawing.Size(626, 503); this.Name = "FrmMainMiniPrf"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "MiniPrf"; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmMainMiniPrf_FormClosed); this.Load += new System.EventHandler(this.FrmMainMiniPrf_Load); @@ -652,6 +830,8 @@ this.gbxDutToRefRegulation.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picFM2014)).EndInit(); + this.grpBoxDebug.ResumeLayout(false); + this.grpBoxDebug.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -709,6 +889,22 @@ private System.Windows.Forms.PictureBox picFM2014; private System.Windows.Forms.TextBox tbxRefFrequencyHz; private System.Windows.Forms.Label lblRefFrequencyHz; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox tbxRefPeriodMs; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox tbxRefFrequencyFromRefPeriodHz; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox tbxRefFlowRateFromRefPeriodCmPerH; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.TextBox tbxDutPeriodMs; + private System.Windows.Forms.TextBox tbxDutFrequencyFromDutPeriodHz; + private System.Windows.Forms.TextBox tbxDutFlowRateFromDutPeriodCmPerH; + private System.Windows.Forms.GroupBox grpBoxDebug; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox tbxRefFrequencyDirectHz; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.TextBox tbxRefFlowRateFromRefFrequencyCmPerH; } } diff --git a/MiniPrf/Ui/FrmMainMiniPrf.cs b/MiniPrf/Ui/FrmMainMiniPrf.cs index 84d2e850..db57f105 100644 --- a/MiniPrf/Ui/FrmMainMiniPrf.cs +++ b/MiniPrf/Ui/FrmMainMiniPrf.cs @@ -142,6 +142,9 @@ namespace Sensus.MiniPrf.Ui ViewProcessControl(false); _autoProgressBar = false; _regulationSetupHasChanged = false; + grpBoxDebug.Visible = false; + gbxDutToRefRegulation.Visible = true; + gbxRegulationSetup.Visible = true; // Load the configuration from the local file stored in AppData\FM2014 _fm2014Config.ReadFM2014Config(); @@ -553,6 +556,19 @@ namespace Sensus.MiniPrf.Ui barSingleProgressUpdate.Update(); Update(); } + + /// + /// Common method to prepare for changed setup. + /// + private void SetupHasChanged() + { + _regulationSetupHasChanged = true; + btnSaveRegulationSetup.Enabled = true; + tbxActualFlowRateCmPerHour.Text = ""; + tbxActualMeasuredToleranceDutToRef.Text = ""; + tbxRefFrequencyHz.Text = ""; + + } #endregion ProcessControls @@ -823,18 +839,6 @@ namespace Sensus.MiniPrf.Ui } } - /// - /// Common method to prepare for changed setup. - /// - private void SetupHasChanged() - { - _regulationSetupHasChanged = true; - btnSaveRegulationSetup.Enabled = true; - tbxActualFlowRateCmPerHour.Text = ""; - tbxActualMeasuredToleranceDutToRef.Text = ""; - tbxRefFrequencyHz.Text = ""; - - } /// /// After manual input of the REF pulses per cubic meter the scale REF to DUT has to be recalculated /// @@ -991,6 +995,23 @@ namespace Sensus.MiniPrf.Ui } } } + + /// + /// Switch between DEBUG and regular operation + /// + /// + /// + private void picFM2014_Click(Object sender, EventArgs e) + { + grpBoxDebug.Visible = !grpBoxDebug.Visible; + if (Fm2014 != null) + Fm2014.RequestDebugInformation = grpBoxDebug.Visible; + + gbxDutToRefRegulation.Visible = !grpBoxDebug.Visible; + gbxRegulationSetup.Visible = !grpBoxDebug.Visible; + + } + #endregion Buttons and Controls #region Event handler @@ -1006,7 +1027,8 @@ namespace Sensus.MiniPrf.Ui Invoke(new Action(() => { // Process info - lblActualProcess.Text = e.ActualProcessMessage; + if (e.ActualProcessMessage != null) + lblActualProcess.Text = e.ActualProcessMessage; lblActualProcess.Update(); SetTimeDisplay(); lblUpdateTimeValue.Update(); @@ -1039,6 +1061,18 @@ namespace Sensus.MiniPrf.Ui break; case FM2014CmdDef.CmdName.CMD_GET_REF_FREQU: tbxRefFrequencyHz.Text = $@"{resp.IntValue:D}"; + // DEBUG + tbxRefFrequencyDirectHz.Text = $@"{resp.IntValue:D}"; + if (resp.IntValue < 1 || resp.IntValue > 254) + { + tbxRefFrequencyHz.BackColor = Color.Red; + tbxActualFlowRateCmPerHour.BackColor = Color.Red; + } + else + { + tbxRefFrequencyHz.BackColor = gbxDutToRefRegulation.BackColor; + tbxActualFlowRateCmPerHour.BackColor = gbxDutToRefRegulation.BackColor; + } break; } } @@ -1050,16 +1084,42 @@ namespace Sensus.MiniPrf.Ui case FM2014CmdDef.CmdName.CMD_GET_UDTLC: case FM2014CmdDef.CmdName.CMD_GET_DTLC: tbxActualMeasuredToleranceDutToRef.Text = $@"{resp.DoubleValue:F2}"; - break; - case FM2014CmdDef.CmdName.CMD_CAL_FLOW_RATE: - tbxActualFlowRateCmPerHour.Text = $@"{resp.DoubleValue:F3}"; - break; + if (resp.DoubleValue < -Fm2014.Tolerance_percent || + resp.DoubleValue > Fm2014.Tolerance_percent) + { + tbxActualMeasuredToleranceDutToRef.BackColor = Color.Red; + } + else + { + tbxActualMeasuredToleranceDutToRef.BackColor = gbxDutToRefRegulation.BackColor; + } + break; case FM2014CmdDef.CmdName.CMD_REF_SET_SCALE: tbxScaleRefToDut.Text = $@"{resp.DoubleValue:F2}"; break; + // DEBUG case FM2014CmdDef.CmdName.CMD_GET_REF_PERIOD: - case FM2014CmdDef.CmdName.CMD_GET_REF_FREQU: - tbxRefFrequencyHz.Text = $@"{resp.DoubleValue:F6}"; + tbxRefPeriodMs.Text = $@"{resp.DoubleValue:F3}"; + break; + case FM2014CmdDef.CmdName.CMD_GET_DUT_PERIOD: + tbxDutPeriodMs.Text = $@"{resp.DoubleValue:F3}"; + break; + case FM2014CmdDef.CmdName.CMD_CAL_FREQU_REF_PERIOD: + tbxRefFrequencyFromRefPeriodHz.Text = $@"{resp.DoubleValue:F3}"; + break; + case FM2014CmdDef.CmdName.CMD_CAL_FREQU_DUT_PERIOD: + tbxDutFrequencyFromDutPeriodHz.Text = $@"{resp.DoubleValue:F3}"; + break; + case FM2014CmdDef.CmdName.CMD_CAL_FLOW_REF_FREQU: + tbxRefFlowRateFromRefFrequencyCmPerH.Text = $@"{resp.DoubleValue:F3}"; + // TODO THW Check if the actual flow shall be taken based on 'REF Frequency' + tbxActualFlowRateCmPerHour.Text = $@"{resp.DoubleValue:F3}"; + break; + case FM2014CmdDef.CmdName.CMD_CAL_FLOW_REF_PERIOD: + tbxRefFlowRateFromRefPeriodCmPerH.Text = $@"{resp.DoubleValue:F3}"; + break; + case FM2014CmdDef.CmdName.CMD_CAL_FLOW_DUT_PERIOD: + tbxDutFlowRateFromDutPeriodCmPerH.Text = $@"{resp.DoubleValue:F3}"; break; } @@ -1070,6 +1130,5 @@ namespace Sensus.MiniPrf.Ui } #endregion - } }