MagFlux: - VolumeCm is calculated from forward- minus reverse-volume
This commit is contained in:
@@ -14,7 +14,12 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.DataPackages.MeasurementRecor
|
||||
/// <summary>
|
||||
/// Reverse volume in cubic meters
|
||||
/// </summary>
|
||||
public Double RevVolumeCm;
|
||||
public Double ForwardVolumeCm;
|
||||
|
||||
/// <summary>
|
||||
/// Reverse volume in cubic meters
|
||||
/// </summary>
|
||||
public Double ReverseVolumeCm;
|
||||
|
||||
/// <summary>
|
||||
/// Flow rate in cubic meters per hour
|
||||
@@ -49,7 +54,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.DataPackages.MeasurementRecor
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb = sb.Append($"Volume [m³]: {VolumeCm}").Append(StringDelimiter)
|
||||
.Append($"Reverse Volume [m³]: {RevVolumeCm}").Append(StringDelimiter)
|
||||
.Append($"Reverse Volume [m³]: {ReverseVolumeCm}").Append(StringDelimiter)
|
||||
.Append($"CPU Time [s]: {TimeS}").Append(StringDelimiter)
|
||||
.Append($"FlowRate [m³/h]: {FlowRateCmPh}").Append(StringDelimiter)
|
||||
.Append($"Status: 0x{StatusBits:X8}").Append(StringDelimiter)
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol
|
||||
private readonly MagFluxRecord _dataMagFluxDefault = new MagFluxRecord
|
||||
{
|
||||
VolumeCm = 0.0,
|
||||
RevVolumeCm = 0.0,
|
||||
ForwardVolumeCm = 0.0,
|
||||
ReverseVolumeCm = 0.0,
|
||||
TimeS = 0.0,
|
||||
FlowRateCmPh = 0.0,
|
||||
StatusBits = 0,
|
||||
@@ -174,6 +175,9 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol
|
||||
/// <remarks date="2023-Mar-09" author="T.Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
/// <remarks date="2023-Jun-06" author="T.Wiedebusch">
|
||||
/// - Calculated sum volume from forward- minus reverse-volume.
|
||||
/// </remarks>
|
||||
private static void DecodeProtocolL(ref MagFluxRecord dataMagFluxRec, IList<String> fields)
|
||||
{
|
||||
// time stamp attachment
|
||||
@@ -183,12 +187,13 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol
|
||||
dataMagFluxRec.Crc = UInt16.Parse(fields[(Int32)ProtLsubString.Crc], NumberStyles.HexNumber);
|
||||
|
||||
// build result values
|
||||
dataMagFluxRec.VolumeCm = UInt64.Parse(fields[(Int32)ProtLsubString.FwdVolume],
|
||||
dataMagFluxRec.ForwardVolumeCm = UInt64.Parse(fields[(Int32)ProtLsubString.FwdVolume],
|
||||
NumberStyles.AllowHexSpecifier) * MilliLitersToCmFactor;
|
||||
dataMagFluxRec.RevVolumeCm = UInt64.Parse(fields[(Int32)ProtLsubString.RevVolume],
|
||||
dataMagFluxRec.ReverseVolumeCm = UInt64.Parse(fields[(Int32)ProtLsubString.RevVolume],
|
||||
NumberStyles.AllowHexSpecifier) * MilliLitersToCmFactor;
|
||||
dataMagFluxRec.TimeS = UInt32.Parse(fields[(Int32)ProtLsubString.CpuTime],
|
||||
NumberStyles.AllowHexSpecifier) * CpuTimeToSecondsFactor;
|
||||
dataMagFluxRec.VolumeCm = dataMagFluxRec.ForwardVolumeCm - dataMagFluxRec.ReverseVolumeCm;
|
||||
|
||||
// parse the floating point value of the flow rate which is a string containing the hex value as 32 bit
|
||||
var hex = UInt32.Parse(fields[(Int32)ProtLsubString.FlowRate], NumberStyles.AllowHexSpecifier);
|
||||
|
||||
+40
-16
@@ -88,6 +88,8 @@
|
||||
this.cbxStatus2 = new System.Windows.Forms.CheckBox();
|
||||
this.cbxStatus1 = new System.Windows.Forms.CheckBox();
|
||||
this.cbxStatus0 = new System.Windows.Forms.CheckBox();
|
||||
this.tbxFwdVolume = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.grpSetup.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picLogo)).BeginInit();
|
||||
@@ -176,7 +178,7 @@
|
||||
this.tbxSensorNo.Name = "tbxSensorNo";
|
||||
this.tbxSensorNo.ReadOnly = true;
|
||||
this.tbxSensorNo.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.tbxSensorNo.Size = new System.Drawing.Size(107, 20);
|
||||
this.tbxSensorNo.Size = new System.Drawing.Size(112, 20);
|
||||
this.tbxSensorNo.TabIndex = 32;
|
||||
//
|
||||
// lblWaitingForMeterResponse
|
||||
@@ -287,6 +289,8 @@
|
||||
//
|
||||
// grpMeasurements
|
||||
//
|
||||
this.grpMeasurements.Controls.Add(this.tbxFwdVolume);
|
||||
this.grpMeasurements.Controls.Add(this.label4);
|
||||
this.grpMeasurements.Controls.Add(this.tbxTime);
|
||||
this.grpMeasurements.Controls.Add(this.label3);
|
||||
this.grpMeasurements.Controls.Add(this.tbxRevVolume);
|
||||
@@ -299,14 +303,14 @@
|
||||
this.grpMeasurements.Controls.Add(this.label11);
|
||||
this.grpMeasurements.Location = new System.Drawing.Point(6, 103);
|
||||
this.grpMeasurements.Name = "grpMeasurements";
|
||||
this.grpMeasurements.Size = new System.Drawing.Size(302, 149);
|
||||
this.grpMeasurements.Size = new System.Drawing.Size(302, 213);
|
||||
this.grpMeasurements.TabIndex = 37;
|
||||
this.grpMeasurements.TabStop = false;
|
||||
this.grpMeasurements.Text = "Measurements";
|
||||
//
|
||||
// tbxTime
|
||||
//
|
||||
this.tbxTime.Location = new System.Drawing.Point(112, 121);
|
||||
this.tbxTime.Location = new System.Drawing.Point(112, 147);
|
||||
this.tbxTime.Name = "tbxTime";
|
||||
this.tbxTime.ReadOnly = true;
|
||||
this.tbxTime.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
@@ -316,7 +320,7 @@
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(6, 124);
|
||||
this.label3.Location = new System.Drawing.Point(6, 150);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(47, 13);
|
||||
this.label3.TabIndex = 36;
|
||||
@@ -324,7 +328,7 @@
|
||||
//
|
||||
// tbxRevVolume
|
||||
//
|
||||
this.tbxRevVolume.Location = new System.Drawing.Point(112, 45);
|
||||
this.tbxRevVolume.Location = new System.Drawing.Point(112, 71);
|
||||
this.tbxRevVolume.Name = "tbxRevVolume";
|
||||
this.tbxRevVolume.ReadOnly = true;
|
||||
this.tbxRevVolume.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
@@ -334,7 +338,7 @@
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(6, 48);
|
||||
this.label1.Location = new System.Drawing.Point(6, 74);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(108, 13);
|
||||
this.label1.TabIndex = 34;
|
||||
@@ -342,7 +346,7 @@
|
||||
//
|
||||
// tbxStatus
|
||||
//
|
||||
this.tbxStatus.Location = new System.Drawing.Point(112, 95);
|
||||
this.tbxStatus.Location = new System.Drawing.Point(112, 121);
|
||||
this.tbxStatus.Name = "tbxStatus";
|
||||
this.tbxStatus.ReadOnly = true;
|
||||
this.tbxStatus.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
@@ -352,7 +356,7 @@
|
||||
// lblStatus
|
||||
//
|
||||
this.lblStatus.AutoSize = true;
|
||||
this.lblStatus.Location = new System.Drawing.Point(6, 98);
|
||||
this.lblStatus.Location = new System.Drawing.Point(6, 124);
|
||||
this.lblStatus.Name = "lblStatus";
|
||||
this.lblStatus.Size = new System.Drawing.Size(40, 13);
|
||||
this.lblStatus.TabIndex = 32;
|
||||
@@ -369,7 +373,7 @@
|
||||
//
|
||||
// tbxFlowRate
|
||||
//
|
||||
this.tbxFlowRate.Location = new System.Drawing.Point(112, 70);
|
||||
this.tbxFlowRate.Location = new System.Drawing.Point(112, 96);
|
||||
this.tbxFlowRate.Name = "tbxFlowRate";
|
||||
this.tbxFlowRate.ReadOnly = true;
|
||||
this.tbxFlowRate.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
@@ -379,7 +383,7 @@
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(6, 73);
|
||||
this.label7.Location = new System.Drawing.Point(6, 99);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(89, 13);
|
||||
this.label7.TabIndex = 27;
|
||||
@@ -425,9 +429,9 @@
|
||||
this.grpInfo.Controls.Add(this.tbxUniqueId);
|
||||
this.grpInfo.Controls.Add(this.tbxSensorNo);
|
||||
this.grpInfo.Controls.Add(this.lblUniqueId);
|
||||
this.grpInfo.Location = new System.Drawing.Point(6, 253);
|
||||
this.grpInfo.Location = new System.Drawing.Point(6, 316);
|
||||
this.grpInfo.Name = "grpInfo";
|
||||
this.grpInfo.Size = new System.Drawing.Size(302, 240);
|
||||
this.grpInfo.Size = new System.Drawing.Size(302, 176);
|
||||
this.grpInfo.TabIndex = 25;
|
||||
this.grpInfo.TabStop = false;
|
||||
this.grpInfo.Text = "Info";
|
||||
@@ -447,7 +451,7 @@
|
||||
this.tbxMeterSize.Name = "tbxMeterSize";
|
||||
this.tbxMeterSize.ReadOnly = true;
|
||||
this.tbxMeterSize.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.tbxMeterSize.Size = new System.Drawing.Size(107, 20);
|
||||
this.tbxMeterSize.Size = new System.Drawing.Size(112, 20);
|
||||
this.tbxMeterSize.TabIndex = 43;
|
||||
//
|
||||
// lblFwGitHash
|
||||
@@ -465,7 +469,7 @@
|
||||
this.tbxFwGitHash.Name = "tbxFwGitHash";
|
||||
this.tbxFwGitHash.ReadOnly = true;
|
||||
this.tbxFwGitHash.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.tbxFwGitHash.Size = new System.Drawing.Size(107, 20);
|
||||
this.tbxFwGitHash.Size = new System.Drawing.Size(112, 20);
|
||||
this.tbxFwGitHash.TabIndex = 41;
|
||||
//
|
||||
// lblFwBuildDate
|
||||
@@ -483,7 +487,7 @@
|
||||
this.tbxFwBuildDate.Name = "tbxFwBuildDate";
|
||||
this.tbxFwBuildDate.ReadOnly = true;
|
||||
this.tbxFwBuildDate.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.tbxFwBuildDate.Size = new System.Drawing.Size(107, 20);
|
||||
this.tbxFwBuildDate.Size = new System.Drawing.Size(112, 20);
|
||||
this.tbxFwBuildDate.TabIndex = 39;
|
||||
//
|
||||
// lblFwVersion
|
||||
@@ -501,7 +505,7 @@
|
||||
this.tbxFwVersion.Name = "tbxFwVersion";
|
||||
this.tbxFwVersion.ReadOnly = true;
|
||||
this.tbxFwVersion.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.tbxFwVersion.Size = new System.Drawing.Size(107, 20);
|
||||
this.tbxFwVersion.Size = new System.Drawing.Size(112, 20);
|
||||
this.tbxFwVersion.TabIndex = 37;
|
||||
//
|
||||
// lblSensorId
|
||||
@@ -711,6 +715,24 @@
|
||||
this.cbxStatus0.Text = "cbxStatus0";
|
||||
this.cbxStatus0.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tbxFwdVolume
|
||||
//
|
||||
this.tbxFwdVolume.Location = new System.Drawing.Point(112, 45);
|
||||
this.tbxFwdVolume.Name = "tbxFwdVolume";
|
||||
this.tbxFwdVolume.ReadOnly = true;
|
||||
this.tbxFwdVolume.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.tbxFwdVolume.Size = new System.Drawing.Size(80, 20);
|
||||
this.tbxFwdVolume.TabIndex = 39;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(6, 49);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(106, 13);
|
||||
this.label4.TabIndex = 38;
|
||||
this.label4.Text = "Forward Volume [m³]:";
|
||||
//
|
||||
// FrmTest
|
||||
//
|
||||
this.AccessibleRole = System.Windows.Forms.AccessibleRole.Sound;
|
||||
@@ -817,5 +839,7 @@
|
||||
private System.Windows.Forms.CheckBox cbxStatus2;
|
||||
private System.Windows.Forms.CheckBox cbxStatus1;
|
||||
private System.Windows.Forms.CheckBox cbxStatus9;
|
||||
private System.Windows.Forms.TextBox tbxFwdVolume;
|
||||
private System.Windows.Forms.Label label4;
|
||||
}
|
||||
}
|
||||
@@ -99,6 +99,7 @@ namespace Xylem.Common.Ui.MagFluxToolBox
|
||||
tbxFlowRate.Text = "";
|
||||
tbxStatus.Text = "";
|
||||
tbxVolume.Text = "";
|
||||
tbxFwdVolume.Text = "";
|
||||
tbxRevVolume.Text = "";
|
||||
|
||||
var errorStateInfos = StateDef.GetInfoOfAllErrorStates();
|
||||
@@ -283,7 +284,8 @@ namespace Xylem.Common.Ui.MagFluxToolBox
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
tbxVolume.Text = $@"{e.NewData.VolumeCm:F3}";
|
||||
tbxRevVolume.Text = $@"{e.NewData.RevVolumeCm:F3}";
|
||||
tbxFwdVolume.Text = $@"{e.NewData.ForwardVolumeCm:F3}";
|
||||
tbxRevVolume.Text = $@"{e.NewData.ReverseVolumeCm:F3}";
|
||||
tbxFlowRate.Text = $@"{e.NewData.FlowRateCmPh:F3}";
|
||||
tbxStatus.Text = $@"0x{e.NewData.StatusBits:X8}";
|
||||
tbxTime.Text = $@"{e.NewData.TimeS:F3}";
|
||||
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.6.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.6.0.0")]
|
||||
[assembly: AssemblyVersion("1.7.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.7.0.0")]
|
||||
|
||||
Reference in New Issue
Block a user