diff --git a/TestBenchFramework/BenchControl/Configs/ConfigCtrlUtils.cs b/TestBenchFramework/BenchControl/Configs/ConfigCtrlUtils.cs index 8c7a3ba21..8de35ae79 100644 --- a/TestBenchFramework/BenchControl/Configs/ConfigCtrlUtils.cs +++ b/TestBenchFramework/BenchControl/Configs/ConfigCtrlUtils.cs @@ -44,6 +44,34 @@ namespace TBF.BenchControl.Configs if (cfgVar != itmp) { cfgVar = itmp; return flagsWhenUpdated; } else return 0; } + /// + /// Updates destination variable when its value differes from the source value. + /// Returns appropriate flags + /// + /// Reference to destination variable + /// Source integer value is obtained by parsing this string + /// Flags returned when an update occurs + /// Flags or 0 + protected CfgUpdateFlags UpdateDifferent(ref float cfgVar, string toBeParsedString, CfgUpdateFlags flagsWhenUpdated) + { + float ftmp = Utils.ParseSFloat(toBeParsedString); + if (cfgVar != ftmp) { cfgVar = ftmp; return flagsWhenUpdated; } else return 0; + } + + /// + /// Updates destination variable when its value differes from the source value. + /// Returns appropriate flags + /// + /// Reference to destination variable + /// Source integer value is obtained by parsing this string + /// Flags returned when an update occurs + /// Flags or 0 + protected CfgUpdateFlags UpdateDifferent(ref double cfgVar, string toBeParsedString, CfgUpdateFlags flagsWhenUpdated) + { + double dtmp = Utils.ParseSDouble(toBeParsedString); + if (cfgVar != dtmp) { cfgVar = dtmp; return flagsWhenUpdated; } else return 0; + } + /// /// Updates destination variable when its value differes from the source value. /// Returns appropriate flags diff --git a/TestBenchFramework/BenchControl/Elde/Common.cs b/TestBenchFramework/BenchControl/Elde/Common.cs index 8caec06b3..0c551c571 100644 --- a/TestBenchFramework/BenchControl/Elde/Common.cs +++ b/TestBenchFramework/BenchControl/Elde/Common.cs @@ -22,7 +22,7 @@ namespace TBF.BenchControl.Elde #if FUZHOU300 || PT200IL || TORINO50 || BADGER_MALA_TRAT || TURA_IPERL || TURA_SPECIAL || BADGER_VELKA_TRAT || PUCHONG_PT200 || SLM_50 || GENESIS || MALTA_WSD25 || SLM_END || WARSAW_END || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 public enum StatusP : ulong { - RefFlowMeterMask = 0x7, + RefFlowMeterMask = 0x7, /// bits 0,1,2 TestCompleted = 0x10, /// bit 4 TestInProgress = 0x20, /// bit 5 //DiverterError = 0x20, diff --git a/TestBenchFramework/BenchControl/Elde/StartMeasurementOp.cs b/TestBenchFramework/BenchControl/Elde/StartMeasurementOp.cs index cc151cd75..31793047e 100644 --- a/TestBenchFramework/BenchControl/Elde/StartMeasurementOp.cs +++ b/TestBenchFramework/BenchControl/Elde/StartMeasurementOp.cs @@ -35,6 +35,7 @@ namespace TBF.BenchControl.Elde enum OpState { StartingTest, + ResendCommand, TestStarted, ValveMoveToFlow, OpCompleted, @@ -107,22 +108,27 @@ namespace TBF.BenchControl.Elde log.Debug(this.ToString()); } - /// Start this operation - public void Start() + void SendStartCommand() { - controlBoard.SyncRoute(); + controlBoard.SyncRoute(); #if TURA_IPERL || TURA_SPECIAL || BADGER_VELKA_TRAT || SLM_50 int flowMeterIdxAndDiv = flowMeterNr + 16 * diverterNr; #else int flowMeterIdxAndDiv = flowMeterNr; #endif - log.InfoFormat("Start() : SendCommand(Cmd.Start, {0}, route, {1}, {1}, {2}, {3}, {4}, 0, Stop.None)", - flowMeterIdxAndDiv, totalRefPulses, testMethod, filterConstant, (int)pidCoef); + log.InfoFormat("Start() : SendCommand(Cmd.Start, {0}, route, {1}, {1}, {2}, {3}, {4}, 0, Stop.None)", + flowMeterIdxAndDiv, totalRefPulses, testMethod, filterConstant, (int)pidCoef); - controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, controlBoard.Route, - totalRefPulses, massRefPulses, testMethod, + controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, controlBoard.Route, + totalRefPulses, massRefPulses, testMethod, filterConstant, (int)pidCoef, 0, StopDevs.None); + } + + /// Start this operation + public void Start() + { + SendStartCommand(); opState = OpState.StartingTest; } @@ -141,40 +147,50 @@ namespace TBF.BenchControl.Elde (((ulong)statusP >> 16) & 0xFFFF).ToString("X4"), ((ulong)statusP & 0xFFFF).ToString("X4")); - if (0 != (statusP & StatusP.TestInProgress)) - { - log.Info("Test started"); - opState = OpState.TestStarted; - } + if ((statusP & StatusP.TestInProgress) != 0) + { + log.Info("Test started"); + opState = OpState.TestStarted; + } + else + { + //opState = OpState.ResendCommand; + } return Event.None; } - else if (opState == OpState.TestStarted) - { - /// - /// Done once, issues an appropriate ValveMove(...) command - /// - if (reqFlowLo >= reqFlowHi || reqFlowLo > nominalFlow || reqFlowHi <= 0) - { - return Event.OpArgumentError; - } + else if (opState == OpState.ResendCommand) + { + SendStartCommand(); + opState = OpState.StartingTest; + return Event.None; + } + else if (opState == OpState.TestStarted) + { + /// + /// Done once, issues an appropriate ValveMove(...) command + /// + if (reqFlowLo >= reqFlowHi || reqFlowLo > nominalFlow || reqFlowHi <= 0) + { + return Event.OpArgumentError; + } - log.InfoFormat("Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}", - regulValveNr, flowMeterNr, reqFlowLo, reqFlowHi); + log.InfoFormat("Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}", + regulValveNr, flowMeterNr, reqFlowLo, reqFlowHi); - float freqLo = 2000.0f * reqFlowLo / nominalFlow; - float freqHi = 2000.0f * reqFlowHi / nominalFlow; - controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency, - new float[2] { freqLo, freqHi }, - regulValve.StableTime); + float freqLo = 2000.0f * reqFlowLo / nominalFlow; + float freqHi = 2000.0f * reqFlowHi / nominalFlow; + controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency, + new float[2] { freqLo, freqHi }, + regulValve.StableTime); - opState = OpState.OpCompleted; - return Event.None; - } - else if (opState == OpState.OpCompleted) - { - return Event.MeasurementStarted; - } + opState = OpState.OpCompleted; + return Event.None; + } + else if (opState == OpState.OpCompleted) + { + return Event.MeasurementStarted; + } return Event.None; } diff --git a/TestBenchFramework/BenchControl/Elde/StopPreviousOp.cs b/TestBenchFramework/BenchControl/Elde/StopPreviousOp.cs index ac6b7f122..0e0ca0184 100644 --- a/TestBenchFramework/BenchControl/Elde/StopPreviousOp.cs +++ b/TestBenchFramework/BenchControl/Elde/StopPreviousOp.cs @@ -21,8 +21,8 @@ namespace TBF.BenchControl.Elde { Idle = 0, CheckIfStopped, - Stopped, - SendCommandAgain, + ResendCommand, + Stopped, } OpState opState; @@ -40,10 +40,9 @@ namespace TBF.BenchControl.Elde } - /// Start this operation - public void Start() + void SendStopCommand() { - controlBoard.SyncRoute(); + controlBoard.SyncRoute(); controlBoard.SendCommand(Command.Stop, 0, /// ref. flowmeter number controlBoard.Route, /// route @@ -53,7 +52,13 @@ namespace TBF.BenchControl.Elde 20, 0, StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation); + } + + /// Start this operation + public void Start() + { + SendStopCommand(); opState = OpState.CheckIfStopped; } @@ -66,49 +71,27 @@ namespace TBF.BenchControl.Elde { if (opState == OpState.CheckIfStopped) { - if (0 == (controlBoard.StatusP & StatusP.TestCompleted)) + if ((controlBoard.StatusP & (StatusP.TestCompleted | StatusP.TestInProgress)) == 0) { opState = OpState.Stopped; return Event.PreviousStopped; } - else - { - //opState = OpState.SendCommandAgain; - - controlBoard.SyncRoute(); - controlBoard.SendCommand(Command.Stop, - 0, /// ref. flowmeter number - controlBoard.Route, /// route - 0, 0, /// ref. pulses - TestMethods.Diverter, - 0.0f, - 20, - 0, - StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation); - - return Event.None; - } + else + { + //opState = OpState.ResendCommand; + return Event.None; + } } - else if (opState == OpState.Stopped) + else if (opState == OpState.ResendCommand) + { + SendStopCommand(); + opState = OpState.CheckIfStopped; + return Event.None; + } + else if (opState == OpState.Stopped) { return Event.PreviousStopped; } - else if (opState == OpState.SendCommandAgain) - { - controlBoard.SyncRoute(); - controlBoard.SendCommand(Command.Stop, - 0, /// ref. flowmeter number - controlBoard.Route, /// route - 0, 0, /// ref. pulses - TestMethods.Diverter, - 0.0f, - 20, - 0, - StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation); - - opState = OpState.CheckIfStopped; - return Event.None; - } return Event.None; } diff --git a/TestBenchFramework/BenchControl/MettlerToledo/Multi/BalanceCfg.cs b/TestBenchFramework/BenchControl/MettlerToledo/Multi/BalanceCfg.cs index 18e213d3f..46e7bf176 100644 --- a/TestBenchFramework/BenchControl/MettlerToledo/Multi/BalanceCfg.cs +++ b/TestBenchFramework/BenchControl/MettlerToledo/Multi/BalanceCfg.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2015-2016 Sensus Metering Systems +/// Copyright (c) 2015-2018 Sensus Slovensko a.s. /// using System; using System.IO; @@ -10,7 +10,7 @@ using TBF.BenchControl.Generic; namespace TBF.BenchControl.MettlerToledo.Multi { - public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ICalibInfoCfg + public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg { public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(BalanceCfg) })[0]; protected override XmlSerializer GetSerializer() { return Serializer; } diff --git a/TestBenchFramework/BenchControl/MettlerToledo/Standard/BalanceCfg.cs b/TestBenchFramework/BenchControl/MettlerToledo/Standard/BalanceCfg.cs index e1dc5dce6..3e8875417 100644 --- a/TestBenchFramework/BenchControl/MettlerToledo/Standard/BalanceCfg.cs +++ b/TestBenchFramework/BenchControl/MettlerToledo/Standard/BalanceCfg.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2017 Sensus Metering Systems +/// Copyright (c) 2013-2018 Sensus Slovensko a.s. /// using System; using System.IO; @@ -10,7 +10,7 @@ using TBF.BenchControl.Generic; namespace TBF.BenchControl.MettlerToledo.Standard { - public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ICalibInfoCfg, GenericDevices.ITankDrainingCfg + public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ITankDrainingCfg { public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(BalanceCfg) })[0]; protected override XmlSerializer GetSerializer() { return Serializer; } diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/Compound/TestParams.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/Compound/TestParams.cs index 290a1c91c..e3f4bc3ef 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/Compound/TestParams.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/Compound/TestParams.cs @@ -28,7 +28,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged.Compound string[] paramNames = new string[] { - Strings.Volume_to_tank, + string.Format("{0} [l]", Strings.Volume_to_tank), Strings.SupressWMTrills, }; public override string ParamName(int i) { return paramNames[i]; } diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs index e70e0e0cf..1356d91b9 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs @@ -808,11 +808,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.DiverterStart = Math.Abs(switchTimeStartHi.Val - switchTimeStartLo.Val); + tstRslt.DiverterStart = switchTimeStart; /// Math.Abs(switchTimeStartHi.Val - switchTimeStartLo.Val); tstRslt.DivStart10 = switchTimeStartLo.Val; tstRslt.DivStart50 = switchTimeStart; tstRslt.DivStart90 = switchTimeStartHi.Val; - tstRslt.DiverterEnd = Math.Abs(switchTimeEndLo.Val - switchTimeEndHi.Val); + tstRslt.DiverterEnd = switchTimeEnd; /// Math.Abs(switchTimeEndLo.Val - switchTimeEndHi.Val); tstRslt.DivEnd90 = switchTimeEndHi.Val; tstRslt.DivEnd50 = switchTimeEnd; tstRslt.DivEnd10 = switchTimeEndLo.Val; @@ -1020,32 +1020,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged } meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); - -#if TEST_MODE - if (!BatchRslts.IsProduction() && - ((test.Name.ToLower().Contains("q2") && Math.Abs(meterRslt.Error) > 2.0 && Math.Abs(meterRslt.Error) <= 4.0) || - (test.Name.ToLower().Contains("q1") && Math.Abs(meterRslt.Error) > 5.0 && Math.Abs(meterRslt.Error) <= 10.0))) - { - meterRslt.KorrErrQ = meterRslt.Error; - meterRslt.Error /= 2.0; - meterRslt.VolumeMeter = (1.0 + meterRslt.Error / 100.0) * meterRslt.VolumeRef; - meterRslt.PulsesMeter = meterRslt.VolumeMeter * regReader.PulsesPerLtr; - - if (meterRslt.VolumeEnd > meterRslt.VolumeStart) - { - meterRslt.VolumeEnd = meterRslt.VolumeStart + meterRslt.VolumeMeter; - } - else if (meterRslt.VolumeEnd < meterRslt.VolumeStart) - { - meterRslt.VolumeEnd = meterRslt.VolumeStart - meterRslt.VolumeMeter; - } - } - else - { - meterRslt.KorrErrQ = 0; - } -#endif - meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/HeatMeters/TestParams.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/HeatMeters/TestParams.cs index 6699a0b8e..1b9ebc3ba 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/HeatMeters/TestParams.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/HeatMeters/TestParams.cs @@ -40,7 +40,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged.HeatMeters string[] paramNames = new string[] { - Strings.Volume_to_tank, + string.Format("{0} [l]", Strings.Volume_to_tank), Strings.Err_limit_neg_pct_chdr, Strings.Err_limit_pos_pct_chdr, Strings.Evaluate_volume, diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/Single/Factory.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/Single/Factory.cs index 3a7b5a52a..6a0bbadc7 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/Single/Factory.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/Single/Factory.cs @@ -3,7 +3,6 @@ /// using System.Collections.Generic; using TBF.BenchControl.Generic; -using TBF.BenchControl.Configs.NameOnly; namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged.Single { diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/Single/TestParams.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/Single/TestParams.cs index 990833425..c3a4641fc 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/Single/TestParams.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollProlonged/Single/TestParams.cs @@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged.Single string[] paramNames = new string[] { - Strings.Volume_to_tank, + string.Format("{0} [l]", Strings.Volume_to_tank), }; public override string ParamName(int i) { return paramNames[i]; } public override int ParamsCount() { return paramNames.Length; } diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs index 3f8dea039..26e332822 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2017 Sensus Metering Systems +/// Copyright (c) 2013-2018 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -792,11 +792,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.DiverterStart = Math.Abs(switchTimeStartHi.Val - switchTimeStartLo.Val); + tstRslt.DiverterStart = switchTimeStart; /// Math.Abs(switchTimeStartHi.Val - switchTimeStartLo.Val); tstRslt.DivStart10 = switchTimeStartLo.Val; tstRslt.DivStart50 = switchTimeStart; tstRslt.DivStart90 = switchTimeStartHi.Val; - tstRslt.DiverterEnd = Math.Abs(switchTimeEndLo.Val - switchTimeEndHi.Val); + tstRslt.DiverterEnd = switchTimeEnd; /// Math.Abs(switchTimeEndLo.Val - switchTimeEndHi.Val); tstRslt.DivEnd90 = switchTimeEndHi.Val; tstRslt.DivEnd50 = switchTimeEnd; tstRslt.DivEnd10 = switchTimeEndLo.Val; diff --git a/TestBenchFramework/Resources/Strings.Designer.cs b/TestBenchFramework/Resources/Strings.Designer.cs index 74328cbb9..a6596bf2b 100644 --- a/TestBenchFramework/Resources/Strings.Designer.cs +++ b/TestBenchFramework/Resources/Strings.Designer.cs @@ -1671,6 +1671,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Flow meter temperature range does not fit this test conditions. + /// + internal static string Flow_meter_temperature_range_does_not_fit_this_test_conditions { + get { + return ResourceManager.GetString("Flow_meter_temperature_range_does_not_fit_this_test_conditions", resourceCulture); + } + } + /// /// Looks up a localized string similar to Flow profile sensitivity class. /// @@ -1707,6 +1716,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to from. + /// + internal static string from { + get { + return ResourceManager.GetString("from", resourceCulture); + } + } + /// /// Looks up a localized string similar to Full name. /// @@ -2463,6 +2481,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Next test volume. + /// + internal static string Next_test_volume { + get { + return ResourceManager.GetString("Next_test_volume", resourceCulture); + } + } + /// /// Looks up a localized string similar to Next >. /// @@ -4761,6 +4788,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to to. + /// + internal static string to { + get { + return ResourceManager.GetString("to", resourceCulture); + } + } + /// /// Looks up a localized string similar to Toler. red. [%]. /// diff --git a/TestBenchFramework/Resources/Strings.cs.resx b/TestBenchFramework/Resources/Strings.cs.resx index 410abf0d7..d820eb2ef 100644 --- a/TestBenchFramework/Resources/Strings.cs.resx +++ b/TestBenchFramework/Resources/Strings.cs.resx @@ -1305,4 +1305,10 @@ Objem na váhu je větší než kapacita váhy + + od + + + do + \ No newline at end of file diff --git a/TestBenchFramework/Resources/Strings.de.resx b/TestBenchFramework/Resources/Strings.de.resx index 41a8b63d5..c730e96f3 100644 --- a/TestBenchFramework/Resources/Strings.de.resx +++ b/TestBenchFramework/Resources/Strings.de.resx @@ -1446,4 +1446,10 @@ Geschützte Prüfvorlage + + von + + + bis + \ No newline at end of file diff --git a/TestBenchFramework/Resources/Strings.resx b/TestBenchFramework/Resources/Strings.resx index 042e663b7..84402deb5 100644 --- a/TestBenchFramework/Resources/Strings.resx +++ b/TestBenchFramework/Resources/Strings.resx @@ -1825,4 +1825,16 @@ Volume to tank exceeds the scale capacity + + from + + + to + + + Flow meter temperature range does not fit this test conditions + + + Next test volume + \ No newline at end of file