Debug: GenesisMeter builds lists of doubled parameters

This commit is contained in:
Thomas Wiedebusch
2024-02-22 15:02:18 +01:00
parent 58b1cec994
commit b9822fe6fa
10 changed files with 67357 additions and 240 deletions
+2
View File
@@ -53,11 +53,13 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Modbus/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=PCBID/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=perc/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=PERIODICLOG/@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/=TESTMANAGER/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Thermo/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Uart/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Vako/@EntryIndexedValue">True</s:Boolean>
@@ -1449,6 +1449,13 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
var tempConfigRegisters = _configRegister.MeterRegisterDic.ToList();
_configRegister.MeterRegisterDic.Clear();
// ReSharper disable once CollectionNeverQueried.Local this is used for debug to check the configuration.json
// for overlapping versions (indicated multiple assignment of identical register)
var configRegisterListForDebug = new List<String>();
// ReSharper disable once UnusedVariable this is used for debug to check the configuration.json
// for overlapping versions (indicated multiple assignment of identical register)
var configRegisterListOverlappingVersionForDebug = new List<String>();
foreach (var registerToCheck in tempConfigRegisters)
{
var currentGroup = MeterAppListVersion.First(f => f.AppId == registerToCheck.Key.AppAddress);
@@ -1465,15 +1472,21 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
registerToCheck.Key.RegisterDetail.Version.First.Value <= currentGroup.Version &&
registerToCheck.Key.RegisterDetail.Version.Last.Value >= currentGroup.Version))
{
configRegisterListForDebug.Add(registerToCheck.Key.GetIdent());
// Avoid multiple assignment of identical register in dictionary if one has passed the test
if (_configRegister.MeterRegisterDic.Any(reg =>
reg.Key.GetIdent().Equals(registerToCheck.Key.GetIdent())))
{
configRegisterListOverlappingVersionForDebug.Add(registerToCheck.Key.GetIdent());
continue;
}
registerToCheck.Key.IsAvailable = true;
_configRegister.MeterRegisterDic.TryAdd(registerToCheck.Key, null);
}
}
configRegisterListOverlappingVersionForDebug.Sort();
configRegisterListForDebug.Sort();
foreach (var checkMinRegister in Register.GetMinRequiredRegisters())
{
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -112,6 +112,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
private List<String> _dbParameterRegisterList = new List<String>();
private List<String> _initialRegisterList = new List<String>();
private List<String> _finalRegisterList = new List<String>();
private List<String> _readableRegisterList = new List<String>();
/// <summary>
@@ -146,7 +147,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
new RecoveryRegisterItem("GENESISFLOW_ResetAccumulators", new Byte[] { 0x01 }),
new RecoveryRegisterItem("NFC_EraseRMA", new Byte[] { 0x01 }),
new RecoveryRegisterItem("CUSTOMER_RebootCount", new Byte[] {0x00})
new RecoveryRegisterItem("CUSTOMER_RebootCount", new Byte[] { 0x00 })
};
/// <summary>
@@ -908,20 +909,23 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
return false;
registers.Clear();
_readableRegisterList.Clear();
// get the pre-defined dictionary
var meterRegisters = _currentGenesis.GetConfigRegistersDefinitions();
// extract all registers which can be read and create two dictionaries for before update to safe program
// internally the register content for comparison ability.
foreach (var reg in meterRegisters.MeterRegisterDic.Where(r => r.Key.RegisterDetail?.Version.First != null
foreach (var reg in meterRegisters.MeterRegisterDic.Where(r => r.Key.RegisterDetail.Version.First != null
&& r.Key.RegisterDetail.Version.Last != null && r.Key.RestoreCapability.StaticTypeValue != null
&& r.Key.DataType != typeof(Rpc) && r.Key.IsAvailable &&
(r.Key.RegisterDetail.Privilege.Lvl8 == Access.RW || r.Key.RegisterDetail.Privilege.Lvl8 == Access.RO)))
{
registers.Add(new RecoveryRegisterItem(reg.Key.GetIdent(), reg.Value));
_readableRegisterList.Add(reg.Key.GetIdent());
}
_readableRegisterList.Sort();
registers.Sort((a, b) => String.Compare(a.RegisterIdent, b.RegisterIdent, StringComparison.Ordinal));
return registers.Count > 0;
}
File diff suppressed because it is too large Load Diff
@@ -458,7 +458,7 @@
"lvl7": "RW",
"lvl8": "RW"
},
"description": "Flow rate above which broken pipe alarm is set in 1/256 l/h. Due to rounding the value read back may not be exactly the value written. This is why the statictype is given as 'approximate'",
"description": "Flow rate above which broken pipe alarm is set in 1/256 l/h",
"version": {
"first": 61,
"last": 110
@@ -468,7 +468,7 @@
"minimum": 0,
"maximum": 4294967295
},
"statictype": "approximate"
"statictype": "static"
},
{
"type": "uint32_t",
@@ -482,7 +482,7 @@
"lvl7": "RW",
"lvl8": "RW"
},
"description": "Flow rate above which broken pipe alarm is set in 1/256 l/h. Due to rounding the value read back may not be exactly the value written. This is why the statictype is given as 'approximate'",
"description": "Flow rate above which broken pipe alarm is set in 1/256 l/h",
"version": {
"first": 111,
"last": 118
@@ -492,7 +492,7 @@
"minimum": 0,
"maximum": 4294967295
},
"statictype": "approximate"
"statictype": "static"
},
{
"type": "uint32_t",
@@ -506,7 +506,7 @@
"lvl7": "RW",
"lvl8": "RW"
},
"description": "Flow rate above which broken pipe alarm is set in 1/256 l/h. Due to rounding the value read back may not be exactly the value written. This is why the statictype is given as 'approximate'",
"description": "Flow rate above which broken pipe alarm is set in 1/256 l/h",
"version": {
"first": 119,
"last": 132
@@ -516,7 +516,7 @@
"minimum": 0,
"maximum": 4294967295
},
"statictype": "approximate"
"statictype": "static"
},
{
"type": "uint32_t",
@@ -530,7 +530,7 @@
"lvl7": "RW",
"lvl8": "RW"
},
"description": "Flow rate above which broken pipe alarm is set in 1/256 l/h. Due to rounding the value read back may not be exactly the value written. This is why the statictype is given as 'approximate'",
"description": "Flow rate above which broken pipe alarm is set in 1/256 l/h",
"version": {
"first": 133,
"last": 157
@@ -540,7 +540,7 @@
"minimum": 0,
"maximum": 4294967295
},
"statictype": "approximate"
"statictype": "static"
}
]
},
@@ -894,7 +894,7 @@
"lvl7": "RW",
"lvl8": "RW"
},
"description": "Flow rate above which leak alarm can be set in 1/256 l/h. Due to rounding the value read back may not be exactly the value written. This is why the statictype is given as 'approximate'",
"description": "Flow rate above which leak alarm can be set in 1/256 l/h",
"version": {
"first": 80,
"last": 110
@@ -904,7 +904,7 @@
"minimum": 0,
"maximum": 4294967295
},
"statictype": "approximate"
"statictype": "static"
},
{
"type": "uint32_t",
@@ -918,7 +918,7 @@
"lvl7": "RW",
"lvl8": "RW"
},
"description": "Flow rate above which leak alarm can be set in 1/256 l/h. Due to rounding the value read back may not be exactly the value written. This is why the statictype is given as 'approximate'",
"description": "Flow rate above which leak alarm can be set in 1/256 l/h",
"version": {
"first": 111,
"last": 118
@@ -928,7 +928,7 @@
"minimum": 0,
"maximum": 4294967295
},
"statictype": "approximate"
"statictype": "static"
},
{
"type": "uint32_t",
@@ -942,7 +942,7 @@
"lvl7": "RW",
"lvl8": "RW"
},
"description": "Flow rate above which leak alarm can be set in 1/256 l/h. Due to rounding the value read back may not be exactly the value written. This is why the statictype is given as 'approximate'",
"description": "Flow rate above which leak alarm can be set in 1/256 l/h",
"version": {
"first": 119,
"last": 132
@@ -952,7 +952,7 @@
"minimum": 0,
"maximum": 4294967295
},
"statictype": "approximate"
"statictype": "static"
},
{
"type": "uint32_t",
@@ -966,7 +966,7 @@
"lvl7": "RW",
"lvl8": "RW"
},
"description": "Flow rate above which leak alarm can be set in 1/256 l/h. Due to rounding the value read back may not be exactly the value written. This is why the statictype is given as 'approximate'",
"description": "Flow rate above which leak alarm can be set in 1/256 l/h",
"version": {
"first": 133,
"last": 157
@@ -976,7 +976,7 @@
"minimum": 0,
"maximum": 4294967295
},
"statictype": "approximate"
"statictype": "static"
}
]
},