ReSharper: -GenesisMeter
This commit is contained in:
@@ -155,7 +155,7 @@
|
|||||||
</site>
|
</site>
|
||||||
<site name="MeterProcessState" id="2">
|
<site name="MeterProcessState" id="2">
|
||||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||||
<virtualDirectory path="/" physicalPath="C:\ProgrammeSensus\Repo\Lab\La_Operations\laa_production\Common\Service\MeterProcessState" />
|
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\laa_production\Common\Service\MeterProcessState" />
|
||||||
</application>
|
</application>
|
||||||
<bindings>
|
<bindings>
|
||||||
<binding protocol="http" bindingInformation="*:56011:localhost" />
|
<binding protocol="http" bindingInformation="*:56011:localhost" />
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
<s:Boolean x:Key="/Default/Environment/Hierarchy/EntityFrameworkOptions/IsAlreadyNotifiedAboutEntityFramework/@EntryValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/Environment/Hierarchy/EntityFrameworkOptions/IsAlreadyNotifiedAboutEntityFramework/@EntryValue">True</s:Boolean>
|
||||||
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">C:\Users\Thomas\AppData\Local\Temp\JetBrains\ReSharperPlatformVs15\vAny_33007af5\CoverageData\_Common.-1885154465\Snapshot\snapshot.utdcvr</s:String>
|
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">C:\Users\Thomas\AppData\Local\Temp\JetBrains\ReSharperPlatformVs15\vAny_33007af5\CoverageData\_Common.-1885154465\Snapshot\snapshot.utdcvr</s:String>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=a44a776d_002Dd671_002D4675_002Dac7b_002Db6775ec7f289/@EntryIndexedValue"><SessionState ContinuousTestingIsOn="True" ContinuousTestingMode="1" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=a44a776d_002Dd671_002D4675_002Dac7b_002Db6775ec7f289/@EntryIndexedValue"><SessionState ContinuousTestingIsOn="True" ContinuousTestingMode="1" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||||
<Solution />
|
<Solution />
|
||||||
</SessionState></s:String>
|
</SessionState></s:String>
|
||||||
|
|||||||
@@ -5,55 +5,75 @@ using System.Windows.Data;
|
|||||||
|
|
||||||
namespace CordonelAssemblyLine.Converter
|
namespace CordonelAssemblyLine.Converter
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
/// <summary>
|
||||||
|
/// Conversion between strings and doubles
|
||||||
|
/// </summary>
|
||||||
public class MathConverter : IValueConverter
|
public class MathConverter : IValueConverter
|
||||||
{
|
{
|
||||||
public Object Convert(Object value, Type targetType, Object parameter, System.Globalization.CultureInfo culture)
|
/// <summary>
|
||||||
|
/// Converts a string to double which contains a pure floating point value
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">string containing the double</param>
|
||||||
|
/// <param name="targetType">UNUSED</param>
|
||||||
|
/// <param name="parameter">UNUSED</param>
|
||||||
|
/// <param name="culture"></param>
|
||||||
|
/// <returns>value in double format</returns>
|
||||||
|
public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
|
return double.Parse((String)value ?? string.Empty, CultureInfo.CurrentUICulture);
|
||||||
return double.Parse((String)value, CultureInfo.CurrentUICulture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object ConvertBack(Object value, Type targetType, Object parameter, System.Globalization.CultureInfo culture)
|
/// <summary>
|
||||||
|
/// Converts a string containing an exponential value to a pure double returned as string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <param name="targetType"></param>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
/// <param name="culture"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
String format = "";
|
String format = "";
|
||||||
String strValue = (String)value;
|
String strValue = (String)value;
|
||||||
strValue = strValue.Replace("x", "*").Replace("X", "*");
|
if (strValue != null)
|
||||||
if (strValue.ToUpper().Contains("E"))
|
|
||||||
{
|
{
|
||||||
|
strValue = strValue.Replace("x", "*").Replace("X", "*");
|
||||||
|
|
||||||
return double.Parse(strValue, CultureInfo.InvariantCulture).ToString(format);
|
|
||||||
//2E-07
|
//2E-07
|
||||||
}
|
if (strValue.ToUpper().Contains("E"))
|
||||||
else if (strValue.Contains("^-") && strValue.Contains("*"))
|
{
|
||||||
{
|
return double.Parse(strValue, CultureInfo.InvariantCulture).ToString(format);
|
||||||
var split = strValue.Split('*');
|
}
|
||||||
var mulit = double.Parse(split.First());
|
|
||||||
var powNumber = double.Parse(split.Last().Split('^').First());
|
|
||||||
var powBy = double.Parse(split.Last().Split('^').Last());
|
|
||||||
|
|
||||||
|
|
||||||
return (mulit * Math.Pow(powNumber, powBy)).ToString(format);
|
|
||||||
//2*10^-3
|
//2*10^-3
|
||||||
}
|
if (strValue.Contains("^-") && strValue.Contains("*"))
|
||||||
else if (strValue.Contains("-") && strValue.Contains("*"))
|
{
|
||||||
{
|
var split = strValue.Split('*');
|
||||||
|
var multiply = double.Parse(split.First());
|
||||||
|
var powNumber = double.Parse(split.Last().Split('^').First());
|
||||||
|
var powBy = double.Parse(split.Last().Split('^').Last());
|
||||||
|
return (multiply * Math.Pow(powNumber, powBy)).ToString(format);
|
||||||
|
}
|
||||||
|
|
||||||
var split = strValue.Split('*');
|
|
||||||
var mulit = double.Parse(split.First());
|
|
||||||
var powNumber = double.Parse(split.Last().Split('-').First());
|
|
||||||
var powBy = double.Parse(split.Last().Split('-').Last());
|
|
||||||
powBy = powBy * -1;
|
|
||||||
return (mulit * Math.Pow(powNumber, powBy)).ToString(format);
|
|
||||||
|
|
||||||
}
|
if (strValue.Contains("-") && strValue.Contains("*"))
|
||||||
else if (strValue.Contains("0,0"))
|
{
|
||||||
{
|
var split = strValue.Split('*');
|
||||||
return double.Parse(strValue, CultureInfo.CurrentUICulture).ToString(format);
|
var multiply = double.Parse(split.First());
|
||||||
}
|
var powNumber = double.Parse(split.Last().Split('-').First());
|
||||||
|
var powBy = double.Parse(split.Last().Split('-').Last());
|
||||||
|
powBy *= -1;
|
||||||
|
return (multiply * Math.Pow(powNumber, powBy)).ToString(format);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strValue.Contains("0,0") || strValue.Contains("0.0"))
|
||||||
|
{
|
||||||
|
return double.Parse(strValue, CultureInfo.CurrentUICulture).ToString(format);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,10 +97,10 @@ namespace Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol
|
|||||||
// check the record length and start of frame information
|
// check the record length and start of frame information
|
||||||
if (irdaRecord.Count < IrdaProtocolFrameLength + irdaRecord[IrdaPayLoadLengthIndex]
|
if (irdaRecord.Count < IrdaProtocolFrameLength + irdaRecord[IrdaPayLoadLengthIndex]
|
||||||
|| irdaRecord[IrdaSyncByteIndex] != IrdaSyncByte
|
|| irdaRecord[IrdaSyncByteIndex] != IrdaSyncByte
|
||||||
|| ((irdaRecord[IrdaHeaderIndex] & IrdaReceiveHeaderMask) != (IrdaReceiveHeader & IrdaReceiveHeaderMask)
|
|| (((irdaRecord[IrdaHeaderIndex] & IrdaReceiveHeaderMask) != (IrdaReceiveHeader & IrdaReceiveHeaderMask)
|
||||||
&& (irdaRecord[IrdaHeaderIndex] != IrdaWakeupHeader)
|
&& (irdaRecord[IrdaHeaderIndex] != IrdaWakeupHeader))
|
||||||
|| (irdaRecord[IrdaMessageIndex] != IrdaMessageId)
|
|| ((irdaRecord[IrdaMessageIndex] != IrdaMessageId)
|
||||||
&& irdaRecord[IrdaMessageIndex] != IrdaWakeupId))
|
&& irdaRecord[IrdaMessageIndex] != IrdaWakeupId)))
|
||||||
{
|
{
|
||||||
var error = new ApplicationException("Reply from IrDA is invalid.");
|
var error = new ApplicationException("Reply from IrDA is invalid.");
|
||||||
Logger.Error(error.Message, error);
|
Logger.Error(error.Message, error);
|
||||||
|
|||||||
@@ -1627,9 +1627,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
/// Read Privilege is always needed to BUGFIX read access to PCB ID
|
/// Read Privilege is always needed to BUGFIX read access to PCB ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>PCB ID</returns>
|
/// <returns>PCB ID</returns>
|
||||||
|
/// <remarks date="2022-Okt-20" author="T.Wiedebusch">
|
||||||
|
/// - PcbId handling corrected:
|
||||||
|
/// - read pcbId locally,
|
||||||
|
/// </remarks>
|
||||||
public String GetPcbId(Int32 expectedLength = 12, Int32 retriesLeft = 2)
|
public String GetPcbId(Int32 expectedLength = 12, Int32 retriesLeft = 2)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var pcbId = "";
|
||||||
if (RequestPort == null)
|
if (RequestPort == null)
|
||||||
{
|
{
|
||||||
return "Request port not assigned";
|
return "Request port not assigned";
|
||||||
@@ -1638,11 +1643,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
_logger.Info($"Slot:{Slot} - Get privilege level");
|
_logger.Info($"Slot:{Slot} - Get privilege level");
|
||||||
ReadRegister(Register.Configexchange.Privilege);
|
ReadRegister(Register.Configexchange.Privilege);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_logger.Info($"Slot:{Slot} - Get PCB identification old{PcbId}");
|
_logger.Info($"Slot:{Slot} - Get PCB identification old{PcbId}");
|
||||||
|
|
||||||
var listPcb = new List<Byte>();
|
var listPcb = new List<Byte>();
|
||||||
|
|
||||||
var hasZero = false;
|
var hasZero = false;
|
||||||
var maxReads = 4;
|
var maxReads = 4;
|
||||||
while (!hasZero)
|
while (!hasZero)
|
||||||
@@ -1665,7 +1668,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_logger.Info("First read ");
|
_logger.Info("First read ");
|
||||||
if (listPcb.Any())
|
if (listPcb.Any())
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
46bd00889699f5a20a4981a22f62b66368323855
|
1a3d4919c9c702245832d925951f2b7cb72fc333
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
81d60b90addc793525740e9993e19bf6665bd401
|
f64d563def603c89cafafa61a3219ba97e1e344c
|
||||||
|
|||||||
Reference in New Issue
Block a user