FM2014: - status decoding based on measurement or entire status

This commit is contained in:
Thomas Wiedebusch 2026-02-25 17:29:20 +01:00
parent 582de5408d
commit 1c3f071291
7 changed files with 67 additions and 24 deletions

View File

@ -199,6 +199,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
#endregion ---------------------------------------- events ----------------------------------------------------
#region ------------------------------------------- static properties -----------------------------------------
/// <summary>
/// Force to decode the entire status even if it is not important for this measurement sequence.
/// </summary>
public static Boolean DecodeEntireStatus { get; set; } = false;
/// <summary>
/// Reminder of actual ongoing measurement information
/// </summary>
@ -1000,9 +1005,6 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
if (firstActiveFm2014 == null)
return false;
// Setup status mask to ignore unimportant settings and feedbacks for the time and regulation measurement
StatusDecodingMask = GetBitMask(CyclicMeasSequ.PulseCounterMeasurement);
// Publish setting to all connected and logged in FM2014s as those will be delivered
// for all via broadcast
foreach (var fm2014 in RegisteredFm2014s.Where(fm2014 => fm2014.IsLoggedOn))
@ -1065,6 +1067,10 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
do
{
// Setup status mask to ignore unimportant settings and feedbacks for the time and regulation measurement
StatusDecodingMask = GetBitMaskForSequence(DecodeEntireStatus ? CyclicMeasSequ.Idle :
CyclicMeasSequ.PulseCounterMeasurement);
CmdName cmdNameRef;
CmdName cmdNameDut;
Boolean syncPulseCtr;
@ -1192,9 +1198,6 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
if (firstActiveFm2014 == null)
return false;
// Setup status mask to ignore unimportant settings and feedbacks for the time measurement
StatusDecodingMask = GetBitMask(CyclicMeasSequ.RegulationMeasurement);
// Publish setting to all connected and logged in FM2014s as those will be delivered
// for all via broadcast
foreach (var fm2014 in RegisteredFm2014s.Where(fm2014 => fm2014.IsLoggedOn))
@ -1255,6 +1258,10 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
do
{
// Setup status mask to ignore unimportant settings and feedbacks for the time measurement
StatusDecodingMask = GetBitMaskForSequence(DecodeEntireStatus ? CyclicMeasSequ.Idle :
CyclicMeasSequ.RegulationMeasurement);
foreach (var fm2014 in RegisteredFm2014s.Where(fm2014 => fm2014.IsLoggedOn))
{
try
@ -1460,9 +1467,6 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
return false;
}
// Setup status mask to ignore unimportant settings for this measurement 'T' and 'K'
StatusDecodingMask = GetBitMask(CyclicMeasSequ.TimeMeasurement);
// Publish setting to all connected and logged in FM2014s as those will be delivered
// for all via broadcast
foreach (var fm2014 in RegisteredFm2014s.Where(fm2014 => fm2014.IsLoggedOn))
@ -1534,6 +1538,10 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
do
{
// Setup status mask to ignore unimportant settings for this measurement 'T' and 'K'
StatusDecodingMask = GetBitMaskForSequence(DecodeEntireStatus ? CyclicMeasSequ.Idle :
CyclicMeasSequ.TimeMeasurement);
foreach (var fm2014 in RegisteredFm2014s.Where(fm2014 => fm2014.IsLoggedOn && !fm2014.MeasurementIsReady))
{
try

View File

@ -695,7 +695,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
/// </summary>
/// <param name="sequence"></param>
/// <returns></returns>
public static UInt32 GetBitMask(CyclicMeasSequ sequence)
public static UInt32 GetBitMaskForSequence(CyclicMeasSequ sequence)
{
if (sequence == CyclicMeasSequ.TimeMeasurement)
return 0xF8074D10;

View File

@ -193,20 +193,21 @@
</Grid.ColumnDefinitions>
<!-- Common labels for all devices -->
<Label x:Name="lblSlotSelection" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" Content="Slot Selection:" />
<Label x:Name="lblConnectStatusText" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5" Content="Status:" />
<Label x:Name="lblMeasurement1Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement1:" />
<Label x:Name="lblMeasurement2Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement2:" />
<Label x:Name="lblMeasurement3Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement3:" />
<Label x:Name="lblMeasurement4Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement4:" />
<Label x:Name="lblMeasurement5Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement5:" />
<Label x:Name="lblMeasurement6Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement6:" />
<Label x:Name="lblMeasurement7Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement7:" />
<Label x:Name="lblFwVersionText" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="5" Content="FW Version:" />
<Label x:Name="lblSerialNumberText" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="5" Content="Serial Number:" />
<Label x:Name="lblLifeTimeText" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="11" Grid.Column="0" Grid.ColumnSpan="5" Content="Lifetime:" />
<Label x:Name="lblSlotSelection" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" Content="Slot Selection:" />
<Label x:Name="lblConnectStatusText" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5" Content="Status:" />
<Label x:Name="lblMeasurement1Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement1:" />
<Label x:Name="lblMeasurement2Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement2:" />
<Label x:Name="lblMeasurement3Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement3:" />
<Label x:Name="lblMeasurement4Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement4:" />
<Label x:Name="lblMeasurement5Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement5:" />
<Label x:Name="lblMeasurement6Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement6:" />
<Label x:Name="lblMeasurement7Text" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="5" Content="Measurement7:" />
<Label x:Name="lblFwVersionText" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="5" Content="FW Version:" />
<Label x:Name="lblSerialNumberText" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="5" Content="Serial Number:" />
<Label x:Name="lblLifeTimeText" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="11" Grid.Column="0" Grid.ColumnSpan="5" Content="Lifetime:" />
<CheckBox x:Name="chkDecodeEntireStatus" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="1,1,1,1" Grid.Row="13" Grid.Column="5" Grid.ColumnSpan="6" Content="Decode Entire Status" Click="chkDecodeEntireStatus_CheckChanged"/>
<Button x:Name="btnFM2014Connect" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="1,1,1,1" Grid.Row="13" Grid.Column="0" Grid.ColumnSpan="4" Content="Connect" Click="btnConnect_Click" />
<Button x:Name="btnFM2014Connect" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="1,1,1,1" Grid.Row="13" Grid.Column="0" Grid.ColumnSpan="4" Content="Connect" Click="btnConnect_Click" />
<!-- Rectangle for common measurement labels for all devices -->
<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="25" Stroke="LightGray"/>

View File

@ -584,6 +584,7 @@ namespace Sensus.Ui.FM2014TestBench
// Dispatch multilingual denotation to GUI elements
btnFM2014Connect.Content = StrBtnConnect;
chkDecodeEntireStatus.Content = StrChkDecodeEntireStatus;
// Measurement selection tab setup
tabDutToRefRegulation.Header = StrGbxDutToRefRegulation;
@ -1735,6 +1736,24 @@ namespace Sensus.Ui.FM2014TestBench
}));
}
/// <summary>
/// Enable/Disable input
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void chkDecodeEntireStatus_CheckChanged(Object sender, EventArgs e)
{
Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
if (FM2014.RegisteredFm2014s == null || FM2014.RegisteredFm2014s.Count <= 0)
return;
if (chkDecodeEntireStatus.IsChecked != null)
FM2014.DecodeEntireStatus = (Boolean)chkDecodeEntireStatus.IsChecked;
}));
}
/// <summary>
/// Enable/Disable input
/// </summary>

View File

@ -123,6 +123,15 @@ namespace Sensus.Ui.Fm2014TestBench.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Decode Entire Status.
/// </summary>
internal static string StrChkDecodeEntireStatus {
get {
return ResourceManager.GetString("StrChkDecodeEntireStatus", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Damped Tolerance On.
/// </summary>

View File

@ -294,4 +294,7 @@
<data name="StrSelectDutTimeMeasurement" xml:space="preserve">
<value>DUT Impulszeitmessung</value>
</data>
<data name="StrChkDecodeEntireStatus" xml:space="preserve">
<value>Alle Statusbits Decodieren</value>
</data>
</root>

View File

@ -294,4 +294,7 @@
<data name="StrSelectDutTimeMeasurement" xml:space="preserve">
<value>DUT Pulse Time Measurement</value>
</data>
<data name="StrChkDecodeEntireStatus" xml:space="preserve">
<value>Decode Entire Status</value>
</data>
</root>