Compare commits

...
31 changed files with 375 additions and 591 deletions
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.1.1899.0")]
[assembly: AssemblyFileVersion("3.1.1899.0")]
[assembly: AssemblyVersion("3.1.1900.0")]
[assembly: AssemblyFileVersion("3.1.1900.0")]
@@ -146,6 +146,9 @@ namespace TBF.Rig.DataEntry.Double24
if (Program.LocalSettings.LastSNTextsCount == textBoxesCount)
{
comboBoxes[i].Items.Add((Program.LocalSettings.LastSNTexts[i] == null) ? string.Empty : Program.LocalSettings.LastSNTexts[i]);
}
if (Program.LocalSettings.LastAuxSNTextsCount == textBoxesCount)
{
column2ComboBoxes[i].Items.Add((Program.LocalSettings.LastAuxSNTexts[i] == null) ? string.Empty : Program.LocalSettings.LastAuxSNTexts[i]);
}
+1 -1
View File
@@ -22,7 +22,7 @@ namespace TBF.Rig.Dummy.FlowMeter
public IDrawingItem DrawingItem { get { return flowMeterCfg as IDrawingItem; } }
public double LtrPerPulseCorrected(double flow, int rangeIx)
public double LtrPerPulseCorrected(double flow, float temperature)
{
return flow;
}
+14 -13
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.Rig.Generic;
@@ -13,15 +13,9 @@ namespace TBF.Rig.GenericDevices
public interface IFlowMeter : IComponent
{
/// <summary>
/// Nominal flow in m3/h at the nominal output frequency (see below).
/// In case of a flowmeter couple, the sum of two nominal flows (reached at sum of nominal freq.).
/// Reference flow meter communicated to the board: 1-based index, 0 for parallel flow meters
/// </summary>
double NominalFlow { get; }
/// <summary>
/// Nominal frequency in Hz.
/// </summary>
double NominalFreq { get; }
int Idx1 { get; }
/// <summary>
/// Nominal (uncorrected) volume per flowmeter pulse in [l].
@@ -32,12 +26,19 @@ namespace TBF.Rig.GenericDevices
/// Corrected volume per flowmeter pulse in [l].
/// </summary>
/// <param name="flow">Water flow in [m3/h]</param>
double LtrPerPulseCorrected(double flow, int rangeIx);
/// <param name="temperature">Water temperature in [°C]</param>
double LtrPerPulseCorrected(double flow, float temperature);
/// <summary>
/// Reference flow meter communicated to the board: 1-based index, 0 for flow meter twins
/// Nominal flow in m3/h at the nominal output frequency (see below).
/// In case of a flowmeter couple, the sum of two nominal flows (reached at sum of nominal freq.).
/// </summary>
int Idx1 { get; }
double NominalFlow { get; }
/// <summary>
/// Nominal frequency in Hz.
/// </summary>
double NominalFreq { get; }
/// <summary>
/// Returns current flow value in [m3/h]
@@ -51,7 +52,7 @@ namespace TBF.Rig.GenericDevices
/// <returns>Frequency in Hz</returns>
double ReadFrequency();
/// <summary>
/// <summary>
/// Events: FlowDone, Error
/// </summary>
/// <param name="flow">Reference to a variable for the measured flow in xxx</param>
@@ -0,0 +1,25 @@
///
/// Copyright (c) 2022 Sensus Slovensko a.s.
///
namespace TBF.Rig.GenericDevices
{
public interface IFlowMeterSingle : IFlowMeter
{
/// <summary>
/// Determine flow meter range
/// </summary>
/// <param name="tempRngLo">Lower boundary of temperature</param>
/// <param name="tempRngHi">Upper boundary of temperature</param>
/// <returns>flow meter range (0..5) or -1 if no range fits the specified temperature range</returns>
int GetRange(float tempRngLo, float tempRngHi);
/// <summary>
/// Apply flow measurement correction
/// </summary>
/// <param name="flow">Measured flow in [m3/h]</param>
/// <param name="rng">Tange 0..5</param>
/// <returns>Corrected flow in [m3/h]</returns>
double CorrectedFlow(double flow, int rng);
}
}
+8 -6
View File
@@ -1387,7 +1387,7 @@ namespace TBF.Rig.Sequences
tstRslt.MassOfEvapWater = 0;
tstRslt.VolumeCTV = 1000 * tstRslt.Batch.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume
tstRslt.VolumeMaster = outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, 0); /// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (outPath.FlowMeter.LtrPerPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
@@ -1500,11 +1500,13 @@ namespace TBF.Rig.Sequences
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime;
tstRslt.FlowVolume = 3.6 * outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster / tstRslt.TestTime;
tstRslt.MassOfEvapWater = 0;
tstRslt.VolumeCTV = 1000 * tstRslt.Batch.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume
tstRslt.VolumeMaster = outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, 0); /// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (outPath.FlowMeter.LtrPerPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
tstRslt.VolumeCTV = 1000 * tstRslt.Batch.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine;
/// [l] commercially true volume
tstRslt.VolumeMaster = outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (outPath.FlowMeter.LtrPerPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
+13 -25
View File
@@ -97,28 +97,15 @@ namespace TBF.Rig.TestMethods.Adjustment
float simulatedError = 4.5f; /// %
bool stopCycle = false;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
int rangeIx = (outPath.FlowMeter is IFlowMeterSingle)
? (outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi)
: 0; /// Default range, used for non-Elde and parallel flowmeters
if (rangeIx == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
TBF.Rig.ControlBoard.Uni.UniCB cBrd = StateMachine.ControlBoard as TBF.Rig.ControlBoard.Uni.UniCB;
@@ -430,12 +417,13 @@ namespace TBF.Rig.TestMethods.Adjustment
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.MassOfEvapWater = 0;
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0f; /// Cannot be determined without the collected water mass measurement
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0f; /// Not available without mass measurement
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
@@ -76,25 +76,11 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
return Simulate(test, repetitionNr, isLastRepetition, testParams);
}
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IScale scale = outPath.Scale as IScale;
@@ -699,11 +685,12 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection;
tstRslt.VolumeCTV /= tstRslt.TestTime;
}
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
/// Calculated master pulses per liter
/// Calculated master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
tstRslt.FlowMean = (float)RefFlowStat.Average;
@@ -88,27 +88,12 @@ namespace TBF.Rig.TestMethods.DiverterTest
TBF.Rig.ControlBoard.Uni.UniCB cBrd = StateMachine.ControlBoard as TBF.Rig.ControlBoard.Uni.UniCB;
IScale scale = cBrd.Devices.Scale as IScale;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
@@ -672,11 +657,12 @@ namespace TBF.Rig.TestMethods.DiverterTest
tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection;
tstRslt.VolumeCTV /= tstRslt.TestTime;
}
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
/// Calculated master pulses per liter
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
/// Calculated master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
tstRslt.FlowMean = (float)RefFlowStat.Average;
+13 -27
View File
@@ -68,28 +68,13 @@ namespace TBF.Rig.TestMethods.Endurance
ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
ControlBoard.Uni.UniCB eldeCB = cBrd as ControlBoard.Uni.UniCB;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
@@ -392,14 +377,15 @@ namespace TBF.Rig.TestMethods.Endurance
tstRslt.MassEndRaw = 0;
tstRslt.MassEnd = 0;
tstRslt.MassOfEvapWater = 0;
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0; /// Cannot be determined without a mass measurement
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0; /// Not available without a mass measurement
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
@@ -64,27 +64,12 @@ namespace TBF.Rig.TestMethods.FixedStart
HeatMeters.TestParams heatMetersTestParams,
DebugMode debugLevel)
{
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
TBF.Rig.ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
@@ -654,7 +639,7 @@ namespace TBF.Rig.TestMethods.FixedStart
cBrd.StopAll(false);
double flowVolume = 3.6 * LtrPerRefPulse * Convert.ToDouble(endPulses - startPulses) / cBrd.TestTime;
double constMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flowVolume, rangeIx);
double constMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flowVolume, (float)TempDownStat.Average);
double volumeCTV = constMasterCorr * Convert.ToDouble(endPulses - startPulses);
double refEnergy = Energy.Sum * volumeCTV / VolumeForEnergy.Sum; /// [J]=[J]*[l]/[l]
@@ -71,27 +71,12 @@ namespace TBF.Rig.TestMethods.FixedStartAdvanced
return new List<Event> { Event.ConfigurationError };
}
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
TBF.Rig.ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
@@ -564,7 +549,8 @@ namespace TBF.Rig.TestMethods.FixedStartAdvanced
tstRslt.VolumeCTV = volumeCTV; /// [kg] calculated before displaying 'End state' dialog
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
/// Calculated master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
@@ -75,26 +75,12 @@ namespace TBF.Rig.TestMethods.FixedStartDeferredEval
TestPart = test.Part,
};
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
GenericDevices.IHasWMStatesForm dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
if (!(dataEntryCmpnt is GenericDevices.IDataEntryForCamera))
@@ -694,7 +680,7 @@ namespace TBF.Rig.TestMethods.FixedStartDeferredEval
cBrd.StopAll(false);
double flowVolume = 3.6 * LtrPerRefPulse * Convert.ToDouble(endPulses - startPulses) / cBrd.TestTime;
double constMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flowVolume, rangeIx);
double constMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flowVolume, (float)TempDownStat.Average);
double volumeCTV = constMasterCorr * Convert.ToDouble(endPulses - startPulses);
if (debugLevel == Common.DebugMode.Simulate) volumeCTV = test.Volume;
double refEnergy = Energy.Sum * volumeCTV / VolumeForEnergy.Sum; /// [J]=[J]*[l]/[l]
@@ -84,25 +84,12 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollAdvanced
IScale scale = cBrd.Devices.Scale as IScale;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
else if (outPath.FlowMeter is TBF.Rig.Dummy.FlowMeter.FlowMeter)
{
var flowm = outPath.FlowMeter as TBF.Rig.Dummy.FlowMeter.FlowMeter;
@@ -98,26 +98,12 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollDeferredEval
return new List<Event> { Event.ConfigurationError };
}
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
GenericDevices.IHasWMStatesForm dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
if (!(dataEntryCmpnt is GenericDevices.IDataEntryForCamera))
@@ -914,19 +900,21 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollDeferredEval
double flow = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.FlowVolume = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime;
tstRslt.FlowMean = Convert.ToSingle(RefFlowStat.Average);
tstRslt.FlowStart = Convert.ToSingle(RefFlowStat.First);
tstRslt.FlowEnd = Convert.ToSingle(RefFlowStat.Last);
tstRslt.FlowMin = Convert.ToSingle(RefFlowStat.Min);
tstRslt.FlowMax = Convert.ToSingle(RefFlowStat.Max);
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flow, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
/// Calculated master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
tstRslt.FlowVolume = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime;
tstRslt.FlowMean = Convert.ToSingle(RefFlowStat.Average);
tstRslt.FlowStart = Convert.ToSingle(RefFlowStat.First);
tstRslt.FlowEnd = Convert.ToSingle(RefFlowStat.Last);
tstRslt.FlowMin = Convert.ToSingle(RefFlowStat.Min);
tstRslt.FlowMax = Convert.ToSingle(RefFlowStat.Max);
tstRslt.DiverterStart = switchTimeStart;
tstRslt.DiverterEnd = switchTimeEnd;
long infoFlags = 0;
@@ -87,27 +87,12 @@ namespace TBF.Rig.TestMethods.FixedStartTankCollection
IVolumeMeter tank = outPath.Scale as IVolumeMeter;
bool manualLevelMsrmnt = (singleTestParams != null) ? singleTestParams.ManualLevelMsrmnt : compoundTestParams.ManualLevelMsrmnt;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
new List<Event> { Event.ConfigurationError };
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
TBF.Rig.ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
@@ -746,13 +731,14 @@ namespace TBF.Rig.TestMethods.FixedStartTankCollection
double flow = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.FlowVolume = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime;
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flow, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster != 0) ? (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster) : tstRslt.ConstMasterCorr;
/// Calculated master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
tstRslt.FlowVolume = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime;
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
tstRslt.FlowEnd = (float)RefFlowStat.Last;
@@ -70,28 +70,13 @@ namespace TBF.Rig.TestMethods.FlowAdjustment
ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
@@ -307,9 +292,10 @@ namespace TBF.Rig.TestMethods.FlowAdjustment
tstRslt.MassOfEvapWater = 0;
tstRslt.FlowMass = 0;
tstRslt.FlowVolume = 0;
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = tstRslt.ConstMasterCorr;
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0; /// Cannot be determined without a mass measurement
@@ -72,28 +72,13 @@ namespace TBF.Rig.TestMethods.FlyingStart
ControlBoard.Uni.UniCB cBrd = StateMachine.ControlBoard as ControlBoard.Uni.UniCB;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
@@ -479,13 +464,14 @@ namespace TBF.Rig.TestMethods.FlyingStart
double flow = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flow, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMaster = tstRslt.ConstMasterCorr;
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0; /// Cannot be determined without a mass measurement
tstRslt.FlowVolume = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime;
tstRslt.FlowMean = Convert.ToSingle(RefFlowStat.Average);
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.FlowMean = Convert.ToSingle(RefFlowStat.Average);
tstRslt.FlowStart = Convert.ToSingle(RefFlowStat.First);
tstRslt.FlowEnd = Convert.ToSingle(RefFlowStat.Last);
tstRslt.FlowMin = Convert.ToSingle(RefFlowStat.Min);
@@ -102,27 +102,12 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
new List<Event> { Event.ConfigurationError };
}
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
new List<Event> { Event.ConfigurationError };
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
@@ -713,13 +698,21 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection;
tstRslt.VolumeCTV /= tstRslt.TestTime;
}
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flow, rangeIx); /// Corrected master pulses per liter
tstRslt.FlowVolume = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime; /// TODO: ???
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster != 0) ? (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster) : tstRslt.ConstMasterCorr;
/// Calculated master pulses per liter
/// Calculated master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
tstRslt.FlowMean = Convert.ToSingle(RefFlowStat.Average);
tstRslt.FlowStart = Convert.ToSingle(RefFlowStat.First);
tstRslt.FlowEnd = Convert.ToSingle(RefFlowStat.Last);
tstRslt.FlowMin = Convert.ToSingle(RefFlowStat.Min);
tstRslt.FlowMax = Convert.ToSingle(RefFlowStat.Max);
tstRslt.DiverterStart = outPath.Diverter.SwitchTimeStart.Val;
tstRslt.DivStart10 = 0;
tstRslt.DivStart50 = 0;
@@ -747,10 +740,12 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
tstRslt.MassEnd = 0;
tstRslt.FlowMass = 0;
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flow, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMaster = tstResRepet1.ConstMaster; /// Master constant ( pulses per liter) from the first repetition (=against the scale)
tstRslt.ConstMaster = tstResRepet1.ConstMaster; /// From the first repetition (=from mass measurement)
tstRslt.VolumeMaster = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.VolumeCTV = tstRslt.VolumeMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.FlowVolume = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime;
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ErrorMaster = tstResRepet1.ErrorMaster; /// Cannot be determined without a mass measurement
tstRslt.DiverterStart = 0;
@@ -767,7 +762,6 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
tstRslt.InfoFlags = infoFlags;
}
tstRslt.FlowVolume = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime;
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
tstRslt.FlowEnd = (float)RefFlowStat.Last;
@@ -96,26 +96,12 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
TBF.Rig.ControlBoard.Uni.UniCB cBrd = StateMachine.ControlBoard as TBF.Rig.ControlBoard.Uni.UniCB;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
string vlvNames = (singleTestParams != null) ? singleTestParams.ValveName
: ((compoundTestParams != null) ? compoundTestParams.ValveName
@@ -796,11 +782,12 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection;
tstRslt.VolumeCTV /= tstRslt.TestTime;
}
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flow, rangeIx); /// Corrected master pulses per liter
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flow, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster != 0) ? (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster) : tstRslt.ConstMasterCorr;
/// Calculated master pulses per liter
/// Calculated master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
tstRslt.FlowVolume = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime;
@@ -86,26 +86,12 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
ControlBoard.Uni.UniCB cBrd = StateMachine.ControlBoard as ControlBoard.Uni.UniCB;
IScale scale = outPath.Scale as IScale;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
new List<Event> { Event.ConfigurationError };
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
float volumeToTank = (singleTestParams != null) ? singleTestParams.VolumeToTank
: ((compoundTestParams != null) ? compoundTestParams.VolumeToTank : heatMetersTestParams.VolumeToTank);
@@ -678,14 +664,15 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection;
tstRslt.VolumeCTV /= tstRslt.TestTime;
}
tstRslt.FlowVolume = 3.6 * totalPulses * tstRslt.VolumeCTV / (massPulses * tstRslt.TestTime);
tstRslt.VolumeMaster = LtrPerRefPulse * massPulses; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flow, rangeIx); /// Master pulses per liter from a correction table and a flow
tstRslt.ConstMaster = (massPulses != 0) ? (tstRslt.VolumeCTV / massPulses) : tstRslt.ConstMasterCorr;
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = (massPulses != 0) ? (tstRslt.VolumeCTV / massPulses) : tstRslt.ConstMasterCorr;
/// Master pulses per liter from the measured mass
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
tstRslt.FlowVolume = 3.6 * totalPulses * tstRslt.VolumeCTV / (massPulses * tstRslt.TestTime);
tstRslt.FlowMean = Convert.ToSingle(RefFlowStat.Average);
tstRslt.FlowStart = Convert.ToSingle(RefFlowStat.First);
tstRslt.FlowEnd = Convert.ToSingle(RefFlowStat.Last);
@@ -99,26 +99,12 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
ControlBoard.Uni.UniCB cBrd = StateMachine.ControlBoard as ControlBoard.Uni.UniCB;
IScale scale = cBrd.Devices.Scale as IScale;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
@@ -719,12 +705,13 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
}
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flow, rangeIx); /// Master pulses per liter from a correction table and a flow
tstRslt.ConstMaster = (tstRslt.PulsesMaster != 0) ? (tstRslt.VolumeCTV / tstRslt.PulsesMaster) : tstRslt.ConstMasterCorr;
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flow, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.PulsesMaster != 0) ? (tstRslt.VolumeCTV / tstRslt.PulsesMaster) : tstRslt.ConstMasterCorr;
/// Master pulses per liter from the measured mass
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
tstRslt.FlowVolume = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime;
tstRslt.FlowVolume = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime; /// TODO: ???
tstRslt.FlowMean = Convert.ToSingle(RefFlowStat.Average);
tstRslt.FlowStart = Convert.ToSingle(RefFlowStat.First);
tstRslt.FlowEnd = Convert.ToSingle(RefFlowStat.Last);
@@ -100,26 +100,12 @@ namespace TBF.Rig.TestMethods.FlyingStartTankCollection
bool manualLevelMsrmnt = (singleTestParams != null) ? singleTestParams.ManualLevelMsrmnt : compoundTestParams.ManualLevelMsrmnt;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
if (test.Volume > outPath.Scale.Capacity * Constants.TankFullFactor)
{
@@ -512,14 +498,15 @@ namespace TBF.Rig.TestMethods.FlyingStartTankCollection
tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection;
tstRslt.VolumeCTV /= tstRslt.TestTime;
}
tstRslt.FlowVolume = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime;
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flow, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster != 0) ? (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster) : tstRslt.ConstMasterCorr;
/// Calculated master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
tstRslt.FlowVolume = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime;
tstRslt.FlowMean = Convert.ToSingle(RefFlowStat.Average);
tstRslt.FlowStart = Convert.ToSingle(RefFlowStat.First);
tstRslt.FlowEnd = Convert.ToSingle(RefFlowStat.Last);
+13 -26
View File
@@ -59,25 +59,11 @@ namespace TBF.Rig.TestMethods.PulsesTest
{
float simulatedError = 4.5f; /// %
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
@@ -400,14 +386,15 @@ namespace TBF.Rig.TestMethods.PulsesTest
tstRslt.MassEndRaw = 0;
tstRslt.MassEnd = 0;
tstRslt.MassOfEvapWater = 0;
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0f; /// Cannot be determined without the collected water mass measurement
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0f; /// Not available without mass measurement
tstRslt.FlowMean = Convert.ToSingle(RefFlowStat.Average);
tstRslt.FlowStart = Convert.ToSingle(RefFlowStat.First);
@@ -59,28 +59,13 @@ namespace TBF.Rig.TestMethods.PulsesTestManual
{
float simulatedError = 4.5f; /// %
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
TBF.Rig.ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
@@ -402,14 +387,15 @@ namespace TBF.Rig.TestMethods.PulsesTestManual
tstRslt.MassEndRaw = 0;
tstRslt.MassEnd = 0;
tstRslt.MassOfEvapWater = 0;
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.RefPulses / tstRslt.TestTime; /// [m3/h]
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0f; /// Cannot be determined without the collected water mass measurement
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.RefPulses / tstRslt.TestTime; /// [m3/h]
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0f; /// Cannot be determined without the collected water mass measurement
tstRslt.FlowMean = Convert.ToSingle(RefFlowStat.Average);
tstRslt.FlowStart = Convert.ToSingle(RefFlowStat.First);
@@ -38,28 +38,13 @@ namespace TBF.Rig.TestMethods.SensitivityTest
return new List<Event> { Event.Done }; /// TODO: Test method simulation
}
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
TBF.Rig.ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
@@ -66,28 +66,13 @@ namespace TBF.Rig.TestMethods.StandingStart
DebugMode debugLevel)
{
ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo && eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
break;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
int waterMetersCount = Math.Min(BenchInfo.WaterMetersCount, sensPath.RegisterReaders.Length);
@@ -660,7 +645,7 @@ namespace TBF.Rig.TestMethods.StandingStart
int endPulses = cBrd.RefPulses;
double flowVolume = 3.6 * LtrPerRefPulse * Convert.ToDouble(endPulses - startPulses) / cBrd.TestTime;
double constMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flowVolume, rangeIx);
double constMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flowVolume, (float)TempDownStat.Average);
double volumeCTV = constMasterCorr * Convert.ToDouble(endPulses - startPulses);
double refEnergy = Energy.Sum * volumeCTV / VolumeForEnergy.Sum; /// [J]=[J]*[l]/[l]
@@ -84,26 +84,12 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
IScale scale = cBrd.Devices.Scale as IScale;
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Uni.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Uni.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo && eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
break;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
}
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
int waterMetersCount = Math.Min(BenchInfo.WaterMetersCount, sensPath.RegisterReaders.Length);
@@ -947,9 +933,10 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
if (cBrd is ControlBoard.Uni.UniCB)
{
/// Test bench with Uni control board and q reference flow meter
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, tstRslt.TempDownMean);
/// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster != 0) ? (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster) : tstRslt.ConstMasterCorr;
}
else
+43 -9
View File
@@ -13,12 +13,13 @@ using TBF.Resources;
namespace TBF.Rig.Uni.FlowMeter
{
public class FlowMeter : ComponentBase, GenericDevices.IFlowMeter, GenericDevices.IHasCalendarEvents, IDrawingItCmpntWithMeasuredVal
public class FlowMeter : ComponentBase, GenericDevices.IFlowMeterSingle, GenericDevices.IHasCalendarEvents, IDrawingItCmpntWithMeasuredVal
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly FlowMeterCfg flowMeterCfg;
public int Idx1 { get { return (flowMeterCfg != null) ? flowMeterCfg.Idx1 : 0; } }
public double NominalFlow { get { return (flowMeterCfg != null) ? flowMeterCfg.NominalFlow : 0; } }
public double NominalFreq { get { return (flowMeterCfg != null) ? flowMeterCfg.NominalFreq : 2000; } }
@@ -28,7 +29,7 @@ namespace TBF.Rig.Uni.FlowMeter
public double GetTempHi(int ix) { return flowMeterCfg.GetTempHi(ix); }
public double GetPressLo(int ix) { return flowMeterCfg.GetPressLo(ix); }
public double GetPressHi(int ix) { return flowMeterCfg.GetPressHi(ix); }
public SchematicDrawing.IDrawingItem DrawingItem { get { return flowMeterCfg as SchematicDrawing.IDrawingItem; } }
public string MsrdFormat { get { return flowMeterCfg.MsrdFormat; } }
@@ -82,20 +83,46 @@ namespace TBF.Rig.Uni.FlowMeter
}
public double LtrPerPulseCorrected(double flow, int rangeIx)
/// <summary>
/// Determine flow meter range
/// </summary>
/// <param name="tempRngLo">Lower boundary of temperature</param>
/// <param name="tempRngHi">Upper boundary of temperature</param>
/// <returns>flow meter range (0..5) or -1 if no range fits the specified temperature range</returns>
public int GetRange(float tempRngLo, float tempRngHi)
{
for (int rng = 0; rng <= 5; rng++)
{
if (RangeEnabled(rng) && GetTempLo(rng) <= tempRngLo && tempRngHi <= GetTempHi(rng))
{
return rng;
}
}
return -1;
}
public double LtrPerPulseCorrected(double flow, float temperature)
{
/// Apply correction
var rangeCorrections = new List<MeasurementCorrection>();
foreach (var corr in Corrections)
{
if (corr.RangeIx == rangeIx) rangeCorrections.Add(corr);
}
double correctedFlow = MeasurementCorrection.CorrectedValue(flow, rangeCorrections);
int rng = GetRange(temperature, temperature);
double correctedFlow = (measurementCorrections == null || rng < 0) ? flow : CorrectedFlow(flow, rng);
return (LtrPerPulse * correctedFlow / flow);
}
/// <summary>
/// Apply flow measurement correction
/// </summary>
/// <param name="flow">Measured flow in [m3/h]</param>
/// <param name="rng">Tange 0..5</param>
/// <returns>Corrected flow in [m3/h]</returns>
public double CorrectedFlow(double flow, int rng)
{
return MeasurementCorrection.CorrectedValue(flow, measurementCorrections[rng]);
}
readonly UniCB uniCB;
IList<MeasurementCorrection>[] measurementCorrections;
public FlowMeter() { }
@@ -108,6 +135,13 @@ namespace TBF.Rig.Uni.FlowMeter
uniCB = TbfComponents.FindComponent(cfg.ParentName, components) as UniCB;
if (uniCB == null) throw new Exception(string.Format("Cannot find {0} (a parent of {1})", cfg.ParentName, Name));
measurementCorrections = new IList<MeasurementCorrection>[6];
for (int i = 0; i < measurementCorrections.Length; i++) measurementCorrections[i] = new List<MeasurementCorrection>();
foreach (var corr in Corrections)
{
if (corr.RangeIx >= 0 && corr.RangeIx < measurementCorrections.Length) measurementCorrections[corr.RangeIx].Add(corr);
}
log.Warn(this.ToString());
}
+66 -57
View File
@@ -19,9 +19,9 @@ namespace TBF.Rig.Uni.FlowMetersInParallel
readonly FlowMeterCfg flowMeterCfg;
UniCB uniCB;
IFlowMeter flowMeter1;
IFlowMeter flowMeter2;
IFlowMeter flowMeter3;
IFlowMeterSingle flowMeter1;
IFlowMeterSingle flowMeter2;
IFlowMeterSingle flowMeter3;
double nominalFlow;
double nominalFreq;
double ltrPerPulse;
@@ -42,67 +42,76 @@ namespace TBF.Rig.Uni.FlowMetersInParallel
double[] refFreq; /// 0..sum, 1..I11, 2..I12, 3..I13
int[] refPulses;
public double LtrPerPulseCorrected(double flow, int rangeIx)
public double LtrPerPulseCorrected(double flow, float temperature)
{
log.DebugFormat("LtrPerPulseCorrected({0}, {1}) started", flow, rangeIx);
return LtrPerPulse;
refFreq[0] = uniCB.RefFrequency;
refFreq[1] = uniCB.RefFrequency1;
refFreq[2] = uniCB.RefFrequency2;
refFreq[3] = uniCB.RefFrequency3;
log.DebugFormat("refFreq[] = ({0}, {1}, {2}, {3})", refFreq[0], refFreq[1], refFreq[2], refFreq[3]);
//log.DebugFormat("LtrPerPulseCorrected({0}, {1}) started", flow, rangeIx);
refPulses[0] = uniCB.RefPulses;
refPulses[1] = uniCB.RefPulses1;
refPulses[2] = uniCB.RefPulses2;
refPulses[3] = uniCB.RefPulses3;
log.DebugFormat("refPulses[] = ({0}, {1}, {2}, {3})", refPulses[0], refPulses[1], refPulses[2], refPulses[3]);
//refFreq[0] = uniCB.RefFrequency;
//refFreq[1] = uniCB.RefFrequency1;
//refFreq[2] = uniCB.RefFrequency2;
//refFreq[3] = uniCB.RefFrequency3;
//log.DebugFormat("refFreq[] = ({0}, {1}, {2}, {3})", refFreq[0], refFreq[1], refFreq[2], refFreq[3]);
double flow1, flow2, flow3;
double contribution1, contribution2, contribution3;
if (refPulses[0] != 0)
{
/// Division by zero prevented inside this 'if'
double ltrPerPulseCorrected = 0;
if (flowMeter1 != null)
{
double ratio = (double)refPulses[flowMeter1.Idx1] / (double)refPulses[0];
flow1 = flow * ratio;
contribution1 = flowMeter1.LtrPerPulseCorrected(flow1, rangeIx) * ratio;
ltrPerPulseCorrected += contribution1;
log.DebugFormat("flowmeter1 = {0}, flow1 = {1}, contribution1 = {2}", flowMeter1.Name, flow1, contribution1);
}
if (flowMeter2 != null)
{
double ratio = (double)refPulses[flowMeter2.Idx1] / (double)refPulses[0];
flow2 = flow * ratio;
contribution2 = flowMeter2.LtrPerPulseCorrected(flow2, rangeIx) * ratio;
ltrPerPulseCorrected += contribution2;
log.DebugFormat("flowmeter2 = {0}, flow2 = {1}, contribution2 = {2}", flowMeter2.Name, flow2, contribution2);
}
if (flowMeter3 != null)
{
double ratio = (double)refPulses[flowMeter3.Idx1] / (double)refPulses[0];
flow3 = flow * ratio;
contribution3 = flowMeter3.LtrPerPulseCorrected(flow3, rangeIx) * ratio;
ltrPerPulseCorrected += contribution3;
log.DebugFormat("flowmeter3 = {0}, flow3 = {1}, contribution3 = {2}", flowMeter3.Name, flow3, contribution3);
}
//refPulses[0] = uniCB.RefPulses;
//refPulses[1] = uniCB.RefPulses1;
//refPulses[2] = uniCB.RefPulses2;
//refPulses[3] = uniCB.RefPulses3;
//log.DebugFormat("refPulses[] = ({0}, {1}, {2}, {3})", refPulses[0], refPulses[1], refPulses[2], refPulses[3]);
log.DebugFormat("LtrPerPulseCorrected() returns {0}", ltrPerPulseCorrected);
return ltrPerPulseCorrected;
}
else
{
log.DebugFormat("LtrPerPulseCorrected() returns 1");
return 1;
}
//double flow1, flow2, flow3;
//double contribution1, contribution2, contribution3;
//if (refPulses[0] != 0)
//{
// /// Division by zero prevented inside this 'if'
// double ltrPerPulseCorrected = 0;
// if (flowMeter1 != null)
// {
// double ratio = (double)refPulses[flowMeter1.Idx1] / (double)refPulses[0];
// flow1 = flow * ratio;
// contribution1 = flowMeter1.LtrPerPulseCorrected(flow1, rangeIx) * ratio;
// ltrPerPulseCorrected += contribution1;
// log.DebugFormat("flowmeter1 = {0}, flow1 = {1}, contribution1 = {2}", flowMeter1.Name, flow1, contribution1);
// }
// if (flowMeter2 != null)
// {
// double ratio = (double)refPulses[flowMeter2.Idx1] / (double)refPulses[0];
// flow2 = flow * ratio;
// contribution2 = flowMeter2.LtrPerPulseCorrected(flow2, rangeIx) * ratio;
// ltrPerPulseCorrected += contribution2;
// log.DebugFormat("flowmeter2 = {0}, flow2 = {1}, contribution2 = {2}", flowMeter2.Name, flow2, contribution2);
// }
// if (flowMeter3 != null)
// {
// double ratio = (double)refPulses[flowMeter3.Idx1] / (double)refPulses[0];
// flow3 = flow * ratio;
// contribution3 = flowMeter3.LtrPerPulseCorrected(flow3, rangeIx) * ratio;
// ltrPerPulseCorrected += contribution3;
// log.DebugFormat("flowmeter3 = {0}, flow3 = {1}, contribution3 = {2}", flowMeter3.Name, flow3, contribution3);
// }
// log.DebugFormat("LtrPerPulseCorrected() returns {0}", ltrPerPulseCorrected);
// return ltrPerPulseCorrected;
//}
//else
//{
// log.DebugFormat("LtrPerPulseCorrected() returns 1");
// return 1;
//}
}
public bool MsrmntAvailable
{
get { return true; }
get
{
bool result = true;
if (flowMeter1 != null) result = result && flowMeter1.MsrmntAvailable;
if (flowMeter2 != null) result = result && flowMeter2.MsrmntAvailable;
if (flowMeter3 != null) result = result && flowMeter3.MsrmntAvailable;
return result;
}
}
public double MeasuredVal
@@ -130,9 +139,9 @@ namespace TBF.Rig.Uni.FlowMetersInParallel
uniCB = TbfComponents.FindComponent(flowMeterCfg.ParentName) as UniCB;
if (uniCB == null) throw new Exception("Cannot find " + Name + " parent");
if (!string.IsNullOrEmpty(flowMeterCfg.Flowmeter1)) flowMeter1 = TbfComponents.FindComponent(flowMeterCfg.Flowmeter1) as IFlowMeter;
if (!string.IsNullOrEmpty(flowMeterCfg.Flowmeter2)) flowMeter2 = TbfComponents.FindComponent(flowMeterCfg.Flowmeter2) as IFlowMeter;
if (!string.IsNullOrEmpty(flowMeterCfg.Flowmeter3)) flowMeter3 = TbfComponents.FindComponent(flowMeterCfg.Flowmeter3) as IFlowMeter;
if (!string.IsNullOrEmpty(flowMeterCfg.Flowmeter1)) flowMeter1 = TbfComponents.FindComponent(flowMeterCfg.Flowmeter1) as IFlowMeterSingle;
if (!string.IsNullOrEmpty(flowMeterCfg.Flowmeter2)) flowMeter2 = TbfComponents.FindComponent(flowMeterCfg.Flowmeter2) as IFlowMeterSingle;
if (!string.IsNullOrEmpty(flowMeterCfg.Flowmeter3)) flowMeter3 = TbfComponents.FindComponent(flowMeterCfg.Flowmeter3) as IFlowMeterSingle;
nominalFlow = 0;
flowMetersCount = 0;
+1
View File
@@ -608,6 +608,7 @@
<Compile Include="Rig\GenericDevices\ICalibInfoCfg.cs" />
<Compile Include="Rig\GenericDevices\IEvaporation.cs" />
<Compile Include="Rig\GenericDevices\IEventTrigger.cs" />
<Compile Include="Rig\GenericDevices\IFlowMeterSingle.cs" />
<Compile Include="Rig\GenericDevices\IHasCalendarEvents.cs" />
<Compile Include="Rig\GenericDevices\IParallelOutput.cs" />
<Compile Include="Rig\GenericDevices\IReceivesDataFromRadio.cs" />