GenesisMeter: - Avoid doubled or tripled register entries in _configRegister,

RegisterRestorer: - List for excluded compare registers
This commit is contained in:
Thomas Wiedebusch 2023-12-08 11:06:48 +01:00
parent 34595d9fb0
commit 43953671fc
5 changed files with 35 additions and 2 deletions

View File

@ -55,6 +55,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=perc/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Preadjustment/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=prot/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=restorable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=RFID/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=SENSUSRADIO/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Thermo/@EntryIndexedValue">True</s:Boolean>

View File

@ -1316,6 +1316,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <remarks date="2023-Nov-27" author="Thomas Wiedebusch">
/// - Remind installed FW version of FLEXNETVERSION for StoreAllConfigurations.
/// </remarks>
/// <remarks date="2023-Dec-08" author="Thomas Wiedebusch">
/// - Avoid doubled or tripled registers in register dictionary as the configuration.json may overlap
/// on some versions. If one register has been added, this passed the test and is valid for this FW.
/// It has to be avoided to have the register multiple times as it may cause unpredictable
/// assignments of values to one and reading and compare from another which doesn't have a value!
/// </remarks>
private void ReadMeterFirmwareAndAssignRegisters()
{
//avoid overwriting of list if this already exits
@ -1451,6 +1457,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
registerToCheck.Key.RegisterDetail.Version.Last.Value >= currentGroup.Version)
{
registerToCheck.Key.IsAvailable = true;
// Avoid doubled or tripled registers in dictionary if one has passed the test
if (_configRegister.MeterRegisterDic.Any(reg => reg.Key.GetIdent().Equals(registerToCheck.Key.GetIdent())))
continue;
_configRegister.MeterRegisterDic.TryAdd(registerToCheck.Key, null);
}
}

View File

@ -165,6 +165,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
//the DecodeMsg has assigned either a DataCalib or DataFlowTest data set
var calibrationRecord = sd.DataCalib;
var flowTestRecord = sd.DataFlowTest;
var bendDetectRecord = sd.DataBendDetectTest;
if (flowTestRecord != null)
{
@ -172,6 +173,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
continue;
}
if (bendDetectRecord != null)
{
TotalValidationWithoutErrorsCount++;
continue;
}
if (calibrationRecord != null)
{
if (calibrationRecord.Validation == 0)

View File

@ -58,7 +58,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <summary>
/// List for parameters which need to be removed from parameter list
/// if meter has radio
/// </summary>
public static readonly List<String> ProhibitedParameters = new List<String>
{
@ -66,7 +65,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
};
/// <summary>
/// List for un-reversed parameters, all others need to be swapped byte-wise
/// if meter has radio
/// </summary>
public static readonly List<String> UnRevertedParameters = new List<String>
{
@ -75,6 +73,13 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
"METROLOGYASST_FlowPoint"
};
/// <summary>
///
/// </summary>
public static readonly List<String> ExcludedFromCompareParameters = new List<String>
{
"SENSUSRADIO_UpgFWVersion" // After a FW-Update the FW version has changed and the compare will fail
};
/// <summary>
/// Pre programming parameters for all devices defined here, will be filled with radio parameters
/// if meter has radio
/// </summary>
@ -387,6 +392,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// - Compare registers reactivated based on new interface (configuration.json) with new
/// "StaticType": “approximate”.
/// </remarks>
/// <remarks date="2023-Dec-08" author="Thomas Wiedebusch">
/// - Removed <see cref="ExcludedFromCompareParameters"/> as those will change on e.g. FW update.
/// </remarks>
public Boolean CompareRegisters()
{
if (_pcbIdFinalRegisterRead != _pcbIdInitialRegisterRead ||
@ -400,6 +408,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
// build a string list of the registers being able to sort those
var registerNames = _restoreRegisters.MeterRegisterDic.Select(register => register.Key.GetIdent()).ToList();
// Remove all excluded registers
foreach (var regName in ExcludedFromCompareParameters.Where(regName => registerNames.Any(reg => reg == regName)))
{
registerNames.Remove(regName);
}
// sort the list of register names
registerNames.Sort();
// limit the count to 1 to avoid division by zero

View File

@ -138,6 +138,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.StreamingProtocol
/// <remarks date="2023-Mar-09" author="T.Wiedebusch">
/// - Modified using common CRC check before branching to the protocol specific decoder.
/// </remarks>
/// <remarks date="2023-Dec-06" author="T.Wiedebusch">
/// - Introduced protocol 'm' for bending detection.
/// </remarks>
public Boolean DecodeMsg(String rawMsg)
{
var rawRecordIsValid = false;