DEWA300 double and tripple flowmeters, NominalFlow and LtrPerPulse are doubles, ver. 2.18.1191

This commit is contained in:
Milan Hanajik 2019-04-11 13:45:28 +02:00
parent e1e74e1588
commit 556290abf6
21 changed files with 75 additions and 53 deletions

View File

@ -15,13 +15,13 @@ namespace TBF.BenchControl.Dummy.FlowMeter
readonly FlowMeterCfg flowMeterCfg;
public float NominalFlow { get { return flowMeterCfg.NominalFlow; } }
public double NominalFlow { get { return flowMeterCfg.NominalFlow; } }
public float LtrPerPulse { get { return flowMeterCfg.NominalFlow / 7200.0f; } }
public double LtrPerPulse { get { return flowMeterCfg.NominalFlow / 7200.0f; } }
public float LtrPerPulseCorrected(double flow, int rangeIx)
public double LtrPerPulseCorrected(double flow, int rangeIx)
{
return (float)flow;
return flow;
}
public int Idx1 { get { return 1; } }

View File

@ -59,7 +59,7 @@ namespace TBF.BenchControl.Dummy.RegulValve
this.regulValve = regulValve as RegulValve;
if (this.regulValve == null) throw new ArgumentNullException("regValve is null or not Dummy.RegulValve");
nominalFlow = flowMeter.NominalFlow;
nominalFlow = (float)flowMeter.NominalFlow;
this.reqFlowLo = requiredFlowLo;
this.reqFlowHi = requiredFlowHi;

View File

@ -17,10 +17,30 @@ namespace TBF.BenchControl.Elde.FlowMeter
readonly ControlBoardDev controlBoard;
public int Idx1 { get { return flowMeterCfg.Idx1; } }
public float NominalFlow { get { return flowMeterCfg.NominalFlow; } }
public float LtrPerPulse { get { return flowMeterCfg.NominalFlow / 7200.0f; } } /// Nominal frequency is 2000 Hz
public double NominalFlow { get { return flowMeterCfg.NominalFlow; } }
public double LtrPerPulse
{
get
{
if (Idx1 == 48 || Idx1 == 80 || Idx1 == 96)
{
/// 2 flow meters, nominal frequency is 4000 Hz
return flowMeterCfg.NominalFlow / 14400.0f;
}
else if (Idx1 == 112)
{
/// 3 flow meters, nominal frequency is 6000 Hz
return flowMeterCfg.NominalFlow / 21600.0f;
}
else
{
/// Nominal frequency is 2000 Hz
return flowMeterCfg.NominalFlow / 7200.0f;
}
}
}
public float LtrPerPulseCorrected(double flow, int rangeIx)
public double LtrPerPulseCorrected(double flow, int rangeIx)
{
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
@ -31,7 +51,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
if (corr.RangeIx == rangeIx) rangeCorrections.Add(corr);
}
double correctedFlow = Config.Formulas.CorrectedValue(flow, rangeCorrections);
return (float)(LtrPerPulse * correctedFlow / flow);
return (LtrPerPulse * correctedFlow / flow);
}
@ -55,8 +75,10 @@ namespace TBF.BenchControl.Elde.FlowMeter
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
/// Prepare data for SendCalibData() control board component method
if (Idx1 >= controlBoard.EtCalib.Length) throw new Exception("Flowmeter " + Name + " parameter 'Idx1' is out of range");
controlBoard.EtCalib[Idx1] = flowMeterCfg.NominalFlow;
if (Idx1 < controlBoard.EtCalib.Length)
{
controlBoard.EtCalib[Idx1] = (float)flowMeterCfg.NominalFlow;
}
log.Debug(this.ToString());
}

View File

@ -19,8 +19,8 @@ namespace TBF.BenchControl.Elde.FlowMeter
///
/// Serialized parameters
///
public int Idx1; /// 1..7
public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz
public int Idx1; /// 1..7, (DEWA300 : I1+I2=48, I1+I3=80, I2_I3=96, I1+I2+I3=112)
public double NominalFlow; /// Nominal flow in m3/h at nominal output frequency (typ. 2000 Hz)
public double Temp1Lo; /// 4x zero means the range is disabled
public double Temp1Hi;

View File

@ -152,20 +152,20 @@ namespace TBF.BenchControl.Elde.FlowMeter
message += Environment.NewLine + "'Idx1' should be between 0 and 8";
}
#else
if (!int.TryParse(positionTextBox.Text, out dummy) || dummy < 1 || dummy > 7)
if (!int.TryParse(positionTextBox.Text, out dummy) || (dummy < 1)
|| ((dummy > 7) && (dummy != 48) && (dummy != 80) && (dummy != 96) && (dummy != 112)))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Idx1' should be between 1 and 7";
}
#endif
float fdummy;
if (!Utils.TryParseUFloat(nominalFlowTextBox.Text, out fdummy) || fdummy < 0.01 || fdummy > 1600)
double ddummy;
if (!Utils.TryParseUDouble(nominalFlowTextBox.Text, out ddummy) || (ddummy < 0.01) || (ddummy > 1600))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Nominal flow' should be between 0.01 and 1600";
}
double ddummy;
if (rangeCheckBox1.Checked)
{
if (!Utils.TryParseUDouble(tempLo1TextBox.Text, out ddummy) || !Utils.TryParseUDouble(tempHi1TextBox.Text, out ddummy) ||

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
/// Copyright (c) 2017-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -17,16 +17,16 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
readonly ControlBoardDev controlBoard;
public int Idx1 { get { return flowMeterCfg.Idx1; } }
public float NominalFlow { get { return flowMeterCfg.NominalFlow; } }
public float LtrPerPulse { get { return flowMeterCfg.NominalFlow / 21600.0f; } } /// Nominal frequency is 6000 Hz
public double NominalFlow { get { return flowMeterCfg.NominalFlow; } }
public double LtrPerPulse { get { return flowMeterCfg.NominalFlow / 21600.0f; } } /// Nominal frequency is 6000 Hz
public float LtrPerPulseCorrected(double flow, int rangeIx)
public double LtrPerPulseCorrected(double flow, int rangeIx)
{
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
/// Apply correction
double correctedFlow = Config.Formulas.CorrectedValue(flow, Corrections);
return (float)(LtrPerPulse * correctedFlow / flow);
return (LtrPerPulse * correctedFlow / flow);
}
public FlowMeter()
@ -43,7 +43,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
/// Prepare data for SendCalibData() control board component method
if (Idx1 >= controlBoard.EtCalib.Length) throw new Exception("Flowmeter " + Name + " parameter 'Idx1' is out of range");
controlBoard.EtCalib[Idx1] = flowMeterCfg.NominalFlow;
controlBoard.EtCalib[Idx1] = (float)flowMeterCfg.NominalFlow;
log.Debug(this.ToString());
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
/// Copyright (c) 2017-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
/// Serialized parameters
///
public int Idx1; /// 1..7
public float NominalFlow; /// Nominal flow in m3/h at output frequency 6000 Hz (= 3 * 2000 Hz)
public double NominalFlow; /// Nominal flow in m3/h at output frequency 6000 Hz (= 3 * 2000 Hz)
/// Private parameterless constructor invoked by all other (public) constructors

View File

@ -96,8 +96,8 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
message += Environment.NewLine + "'Idx1' should be between 1 and 7";
}
#endif
float fdummy;
if (!Utils.TryParseUFloat(nominalFlowTextBox.Text, out fdummy) || fdummy < 0.01 || fdummy > 1600)
double ddummy;
if (!Utils.TryParseUDouble(nominalFlowTextBox.Text, out ddummy) || ddummy < 0.01 || ddummy > 1600)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Nominal flow' should be between 0.01 and 1600";
@ -114,7 +114,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.Idx1 = int.Parse(positionTextBox.Text);
Utils.TryParseUFloat(nominalFlowTextBox.Text, out config.NominalFlow);
Utils.TryParseUDouble(nominalFlowTextBox.Text, out config.NominalFlow);
return flags;
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -19,13 +19,13 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
public readonly TBF.BenchControl.Elde.FlowMeter.FlowMeter FlowMeter2;
public int Idx1 { get { return 0; } }
public float NominalFlow { get { return flowMeterCfg.NominalFlow; } }
public double NominalFlow { get { return flowMeterCfg.NominalFlow; } }
/// The nominal flowed of a pair of flow meters is reached at 4000Hz
public float LtrPerPulse { get { return flowMeterCfg.NominalFlow / 14400.0f; } }
public double LtrPerPulse { get { return flowMeterCfg.NominalFlow / 14400.0f; } }
/// Calculates the average of values of two flowmeters. Assumes the flow is divided evenly.
public float LtrPerPulseCorrected(double flow, int rangeIx)
public double LtrPerPulseCorrected(double flow, int rangeIx)
{
double flow2 = flow / 2.0;
return (FlowMeter1.LtrPerPulseCorrected(flow2, rangeIx) + FlowMeter2.LtrPerPulseCorrected(flow2, rangeIx)) / 2;
@ -50,7 +50,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
FlowMeter2 = (TBF.BenchControl.Elde.FlowMeter.FlowMeter)TbfComponents.FindComponent(flowMeterCfg.FlowMeter2, components);
if (FlowMeter2 == null) throw new Exception("Cannot find FlowMeter2 component");
controlBoard.EtCalib[Idx1] = flowMeterCfg.NominalFlow; /// Idx1==0 for FlowMeterTwins
controlBoard.EtCalib[Idx1] = (float)flowMeterCfg.NominalFlow; /// Idx1==0 for FlowMeterTwins
/// Prepare data for SendCalibData() control board component method

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
///
/// Serialized parameters
///
public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz
public double NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz
public string FlowMeter1; /// Name of the flow meter 1 component
public string FlowMeter2; /// Name of the flow meter 2 component

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
@ -99,8 +99,8 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Flow Meter 2'";
}
float fdummy;
if (!Utils.TryParseUFloat(nominalFlowTextBox.Text, out fdummy) || fdummy < 0.2 || fdummy > 1600)
double ddummy;
if (!Utils.TryParseUDouble(nominalFlowTextBox.Text, out ddummy) || ddummy < 0.2 || ddummy > 1600)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Nominal flow' should be between 0.2 and 1600";
@ -118,7 +118,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.FlowMeter1 = flowMeter1ComboBox.Text.Equals("---") ? string.Empty : flowMeter1ComboBox.Text;
config.FlowMeter2 = flowMeter2ComboBox.Text.Equals("---") ? string.Empty : flowMeter2ComboBox.Text;
Utils.TryParseUFloat(nominalFlowTextBox.Text, out config.NominalFlow);
Utils.TryParseUDouble(nominalFlowTextBox.Text, out config.NominalFlow);
return flags;
}

View File

@ -91,7 +91,7 @@ namespace TBF.BenchControl.Elde.RegulValve
if (flowMeter == null) throw new ArgumentNullException("flowMeter");
this.flowMeter = flowMeter;
nominalFlow = flowMeter.NominalFlow;
nominalFlow = (float)flowMeter.NominalFlow;
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
this.requiredFlowLo = (0.7F * requiredFlowLo) + (0.3F * this.reqFlowAve); /// Move the lower limit 15% of the range up

View File

@ -100,7 +100,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
throw new ArgumentNullException("flowMeter is null or not Elde");
}
nominalFlow = flowMeter.NominalFlow;
nominalFlow = (float)flowMeter.NominalFlow;
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2;
this.finalReqFlowLo = (0.7F * requiredFlowLo) + (0.3F * this.reqFlowAve); /// Move the lower limit 15% of the range up

View File

@ -106,7 +106,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
throw new ArgumentNullException("flowMeter is null or not Elde");
}
nominalFlow = flowMeter.NominalFlow;
nominalFlow = (float)flowMeter.NominalFlow;
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
this.finalReqFlowLo = (0.7F * requiredFlowLo) + (0.3F * this.reqFlowAve); /// Move the lower limit 15% of the range up

View File

@ -102,7 +102,7 @@ namespace TBF.BenchControl.Elde
diverterNr = (outputPath.Diverter as Elde.Diverter.Diverter).DiverterNr;
}
nominalFlow = outputPath.FlowMeter.NominalFlow;
nominalFlow = (float)outputPath.FlowMeter.NominalFlow;
this.reqFlowLo = requiredFlowLo;
this.reqFlowHi = requiredFlowHi;

View File

@ -16,18 +16,18 @@ namespace TBF.BenchControl.GenericDevices
/// Nominal flow in m3/h at the maximum (2kHz) output frequency.
/// In case of a flowmeter couple, the sum of two nominal flows (reached at 4kHz of summed pulses).
/// </summary>
float NominalFlow { get; }
double NominalFlow { get; }
/// <summary>
/// Nominal (uncorrected) volume per flowmeter pulse in [l].
/// </summary>
float LtrPerPulse { get; }
double LtrPerPulse { get; }
/// <summary>
/// Corrected volume per flowmeter pulse in [l].
/// </summary>
/// <param name="flow">Water flow in [m3/h]</param>
float LtrPerPulseCorrected(double flow, int rangeIx);
double LtrPerPulseCorrected(double flow, int rangeIx);
/// <summary>
/// Reference flow meter communicated to the board: 1-based index, 0 for flow meter twins

View File

@ -77,7 +77,7 @@ namespace TBF.BenchControl.Operations
lastRefPulses = newRefPulses;
/// Calculate volume [l]
float deltaVolume = (float)deltaPulses * BenchControl.Sequences.ProcessData.LtrPerRefPulse;
double deltaVolume = deltaPulses * BenchControl.Sequences.ProcessData.LtrPerRefPulse;
for (int i = 0; i < enthalpy.Length; i++)
{

View File

@ -23,7 +23,7 @@ namespace TBF.BenchControl.Sequences
public static FloatBox PressDown = new FloatBox() { Name = "Pressure Dn", Format = "F2" }; /// [bar]
public static FloatBox PressDelta = new FloatBox() { Name = "Pressure Delta", Format = "F2" }; /// [bar]
public static float LtrPerRefPulse; /// to calculate the ref.volume
public static double LtrPerRefPulse; /// to calculate the ref.volume
public static int RefPulses;
public static int RefPulsesDelta;
public static DoubleBox RefFreq = new DoubleBox() { Name = "RefFreq", Format = "F2" };

View File

@ -46,7 +46,7 @@ namespace TBF.BenchControl.Sequences
/// They are re-initialized when LoadProcedure() is called
///------------------------------------------------------------
public static int ReferenceFlowmetersCount;
public static float[] CalibratedLtrPerRefPulse; /// Reference flowmeter coefficients
public static double[] CalibratedLtrPerRefPulse; /// Reference flowmeter coefficients
public static double Qrise;
public static double Qfall;

View File

@ -765,13 +765,13 @@ namespace TBF.BenchControl
foreach (var device in devices) device.RunDeviceBefore();
SequenceBase.ReferenceFlowmetersCount = SequenceBase.FlowMeters.Count;
SequenceBase.CalibratedLtrPerRefPulse = new float[SequenceBase.ReferenceFlowmetersCount];
SequenceBase.CalibratedLtrPerRefPulse = new double[SequenceBase.ReferenceFlowmetersCount];
foreach (var flowmtr in SequenceBase.FlowMeters)
{
int ix = flowmtr.Idx1;
if (ix > 0 && ix <= SequenceBase.ReferenceFlowmetersCount)
{
SequenceBase.CalibratedLtrPerRefPulse[ix - 1] = flowmtr.NominalFlow / 7200.0f;
SequenceBase.CalibratedLtrPerRefPulse[ix - 1] = flowmtr.NominalFlow / 7200.0;
}
}

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.18.1189.0")]
[assembly: AssemblyFileVersion("2.18.1189.0")]
[assembly: AssemblyVersion("2.18.1191.0")]
[assembly: AssemblyFileVersion("2.18.1191.0")]