diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Compound/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Compound/Component.cs index a8b528e1f..594b625fd 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Compound/Component.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Compound/Component.cs @@ -34,7 +34,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Compoun public IList Execute(Test test, int repetNr, bool isLastRepetition) { - return (new FlyingStartFirstRepetWithMassCollSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, null, DebugLevel); + return (new FlyingStartFirstRepetWithMassCollSeq()).Execute(test, repetNr, isLastRepetition, null, testMethodCfg.TestParams, null, DebugLevel); } } } diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Compound/TestParams.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Compound/TestParams.cs index e5754f6ef..7c952b18b 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Compound/TestParams.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Compound/TestParams.cs @@ -16,17 +16,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Compoun public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0]; protected override XmlSerializer GetSerializer() { return Serializer; } - public bool SupressTrills; /// Main meter readings are ignored during test (suitable for small flows) + public float NextTestVolume; + public bool SupressTrills; /// Main meter readings are ignored during test (suitable for small flows) public override void InitializeAll() { - SupressTrills = false; + NextTestVolume = 10; + SupressTrills = false; } string[] paramNames = new string[] { - Strings.SupressWMTrills, + string.Format("{0} [l]", Strings.Next_test_volume), + Strings.SupressWMTrills, }; public override string ParamName(int i) { return paramNames[i]; } public override int ParamsCount() { return paramNames.Length; } @@ -35,7 +38,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Compoun { switch (i) { - case 0: return (SupressTrills ? Strings.yes : Strings.no); + case 0: return NextTestVolume.ToString(); + case 1: return (SupressTrills ? Strings.yes : Strings.no); default: return string.Empty; } } @@ -44,7 +48,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Compoun { switch (i) { - case 0: SupressTrills = strValue.Equals(Strings.yes); return; + case 0: NextTestVolume = Utils.ParseUFloat(strValue); return; + case 1: SupressTrills = strValue.Equals(Strings.yes); return; default: return; } } @@ -52,10 +57,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Compoun public bool ValidateParam(int i, string strValue, out string message) { message = string.Empty; + float volume; - switch (i) - { - case 0: + switch (i) + { + case 0: + if (Utils.TryParseUFloat(strValue, out volume) && volume >= 0.1f) return true; + break; + case 1: if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true; break; default: @@ -69,7 +78,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Compoun void CopyContentTo(TestParams prms) { - prms.SupressTrills = this.SupressTrills; + prms.NextTestVolume = this.NextTestVolume; + prms.SupressTrills = this.SupressTrills; } public IParamsProvider Clone() diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs index ad6b71504..c17f53387 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs @@ -27,7 +27,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl /// Event.Error . . . . . . Unspecified error /// public IList Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition, - Compound.TestParams compoundTestParams, + Single.TestParams singleTestParams, + Compound.TestParams compoundTestParams, HeatMeters.TestParams heatMetersTestParams, Config.Entities.DebugMode debugLevel) { @@ -35,6 +36,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl Event retVal = Event.Done; checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state + float nextTestVolume = (singleTestParams != null) ? singleTestParams.NextTestVolume + : ((compoundTestParams != null) ? compoundTestParams.NextTestVolume + : heatMetersTestParams.NextTestVolume); float switchTimeStart = 0.001f; /// in seconds, initial value is 1 ms float switchTimeEnd = 0.001f; /// in seconds, initial value is 1 ms FloatBox switchTimeStartLo = new FloatBox(0.001f); @@ -106,9 +110,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null); - LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; - int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); - if (test.Volume > outPath.Scale.Capacity * Constants.TankFullFactor) { Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity); @@ -118,7 +119,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl //==================================== loop: - /// Start the test, initialize test results + + LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; + int totalPulses = (int)((repetitionNr == 1 ? test.Volume : nextTestVolume) / LtrPerRefPulse + 0.5f); + + /// Start the test, initialize test results Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); TestStartTime = DateTime.Now; @@ -576,7 +581,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders); queryEnd1 = cBrd.QueryMeasurementEndOp(); /// ??? - int estimtdEndTime = StateMachine.Time + (int)test.TstTime; + int estimtdEndTime = StateMachine.Time + (int)((repetitionNr == 1) ? test.TstTime : (test.TstTime * nextTestVolume / test.Volume)); ClearAllStatistics(StateMachine.Time); if (repetitionNr == 1) @@ -800,11 +805,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); - 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; @@ -1045,32 +1050,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl } 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/FlyingStartFirstRepetWithMassColl/HeatMeters/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/HeatMeters/Component.cs index 8ba9537ba..7fe422590 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/HeatMeters/Component.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/HeatMeters/Component.cs @@ -34,7 +34,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.HeatMet public IList Execute(Test test, int repetNr, bool isLastRepetition) { - return (new FlyingStartFirstRepetWithMassCollSeq()).Execute(test, repetNr, isLastRepetition, null, testMethodCfg.TestParams, DebugLevel); + return (new FlyingStartFirstRepetWithMassCollSeq()).Execute(test, repetNr, isLastRepetition, null, null, testMethodCfg.TestParams, DebugLevel); } } } diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/HeatMeters/TestParams.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/HeatMeters/TestParams.cs index b6488e73a..2805bfda4 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/HeatMeters/TestParams.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/HeatMeters/TestParams.cs @@ -16,7 +16,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.HeatMet public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0]; protected override XmlSerializer GetSerializer() { return Serializer; } - public float ErrorLimitLo; /// [%] + public float NextTestVolume; /// [l] + public float ErrorLimitLo; /// [%] public float ErrorLimitHi; /// [%] public bool EvaluateVolume; /// true = evaluate also the volume, false = evaluate only energy public float TempWarmLo; /// Low limit for warm temperature [°C] @@ -32,12 +33,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.HeatMet public override void InitializeAll() { + NextTestVolume = 10; FlowMeasuredAtHiTempPipe = false; } string[] paramNames = new string[] { + string.Format("{0} [l]", Strings.Next_test_volume), Strings.Err_limit_neg_pct_chdr, Strings.Err_limit_pos_pct_chdr, Strings.Evaluate_volume, @@ -59,19 +62,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.HeatMet { switch (i) { - case 0: return ErrorLimitLo.ToString(); - case 1: return ErrorLimitHi.ToString(); - case 2: return (EvaluateVolume ? Strings.yes : Strings.no); - case 3: return TempWarmLo.ToString(); - case 4: return TempWarmHi.ToString(); - case 5: return TempColdLo.ToString(); - case 6: return TempColdHi.ToString(); - case 7: return (FlowMeasuredAtHiTempPipe ? Strings.yes : Strings.no); - case 8: return DeltaTempWarm.ToString(); - case 9: return DeltaTempCold.ToString(); - case 10: return ChangeInTimeWarm.ToString(); - case 11: return ChangeInTimeCold.ToString(); - case 12: return Prompt; + case 0: return NextTestVolume.ToString(); + case 1: return ErrorLimitLo.ToString(); + case 2: return ErrorLimitHi.ToString(); + case 3: return (EvaluateVolume ? Strings.yes : Strings.no); + case 4: return TempWarmLo.ToString(); + case 5: return TempWarmHi.ToString(); + case 6: return TempColdLo.ToString(); + case 7: return TempColdHi.ToString(); + case 8: return (FlowMeasuredAtHiTempPipe ? Strings.yes : Strings.no); + case 9: return DeltaTempWarm.ToString(); + case 10: return DeltaTempCold.ToString(); + case 11: return ChangeInTimeWarm.ToString(); + case 12: return ChangeInTimeCold.ToString(); + case 13: return Prompt; default: return string.Empty; } } @@ -80,19 +84,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.HeatMet { switch (i) { - case 0: ErrorLimitLo = Utils.ParseSFloat(strValue); return; - case 1: ErrorLimitHi = Utils.ParseSFloat(strValue); return; - case 2: EvaluateVolume = strValue.Equals(Strings.yes); return; - case 3: TempWarmLo = Utils.ParseSFloat(strValue); return; - case 4: TempWarmHi = Utils.ParseSFloat(strValue); return; - case 5: TempColdLo = Utils.ParseSFloat(strValue); return; - case 6: TempColdHi = Utils.ParseSFloat(strValue); return; - case 7: FlowMeasuredAtHiTempPipe = strValue.Equals(Strings.yes); return; - case 8: DeltaTempWarm = Utils.ParseUFloat(strValue); return; - case 9: DeltaTempCold = Utils.ParseUFloat(strValue); return; - case 10: ChangeInTimeWarm = Utils.ParseUFloat(strValue); return; - case 11: ChangeInTimeCold = Utils.ParseUFloat(strValue); return; - case 12: Prompt = strValue; return; + case 0: NextTestVolume = Utils.ParseUFloat(strValue); return; + case 1: ErrorLimitLo = Utils.ParseSFloat(strValue); return; + case 2: ErrorLimitHi = Utils.ParseSFloat(strValue); return; + case 3: EvaluateVolume = strValue.Equals(Strings.yes); return; + case 4: TempWarmLo = Utils.ParseSFloat(strValue); return; + case 5: TempWarmHi = Utils.ParseSFloat(strValue); return; + case 6: TempColdLo = Utils.ParseSFloat(strValue); return; + case 7: TempColdHi = Utils.ParseSFloat(strValue); return; + case 8: FlowMeasuredAtHiTempPipe = strValue.Equals(Strings.yes); return; + case 9: DeltaTempWarm = Utils.ParseUFloat(strValue); return; + case 10: DeltaTempCold = Utils.ParseUFloat(strValue); return; + case 11: ChangeInTimeWarm = Utils.ParseUFloat(strValue); return; + case 12: ChangeInTimeCold = Utils.ParseUFloat(strValue); return; + case 13: Prompt = strValue; return; default: return; } } @@ -104,25 +109,28 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.HeatMet switch (i) { - case 0: - case 1: - case 3: + case 0: + if (Utils.TryParseUFloat(strValue, out dummy) && dummy >= 0.1f) return true; + break; + case 1: + case 2: case 4: case 5: case 6: + case 7: if (Utils.TryParseSFloat(strValue, out dummy)) return true; break; - case 2: - case 7: + case 3: + case 8: if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true; break; - case 8: case 9: case 10: case 11: + case 12: if (Utils.TryParseUFloat(strValue, out dummy)) return true; break; - case 12: + case 13: return true; default: message = "Invalid index"; @@ -135,7 +143,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.HeatMet void CopyContentTo(TestParams prms) { - prms.ErrorLimitLo = ErrorLimitLo; + prms.NextTestVolume = this.NextTestVolume; + prms.ErrorLimitLo = ErrorLimitLo; prms.ErrorLimitHi = ErrorLimitHi; prms.EvaluateVolume = EvaluateVolume; prms.TempWarmLo = TempWarmLo; diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/Component.cs index e2245a5ef..5743f4006 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/Component.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/Component.cs @@ -19,6 +19,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Single public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; } public bool DoTransitions() { return true; } + readonly TestMethodCfg testMethodCfg; + public Component() { } @@ -26,12 +28,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Single public Component(Generic.IComponentCfg cfg) : base(cfg) { - log.Debug(this.ToString()); + testMethodCfg = cfg as TestMethodCfg; + log.Debug(this.ToString()); } public IList Execute(Test test, int repetNr, bool isLastRepetition) { - return (new FlyingStartFirstRepetWithMassCollSeq()).Execute(test, repetNr, isLastRepetition, null, null, DebugLevel); + return (new FlyingStartFirstRepetWithMassCollSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, null, null, DebugLevel); } } } diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/Factory.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/Factory.cs index e5e80834f..3dd54076e 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/Factory.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/Factory.cs @@ -3,7 +3,6 @@ /// using System.Collections.Generic; using TBF.BenchControl.Generic; -using TBF.BenchControl.Configs.NameOnly; namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Single { diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestMethodCfg.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestMethodCfg.cs new file mode 100644 index 000000000..156ad5d91 --- /dev/null +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestMethodCfg.cs @@ -0,0 +1,50 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml.Serialization; +using Config.Entities; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Single +{ + public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg + { + public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0]; + protected override XmlSerializer GetSerializer() { return Serializer; } + + public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); } + + /// Test parameters + [XmlIgnore] + public TestParams TestParams; + public override IParamsProvider GetTestParams() { return TestParams; } + public override IParamsProvider CreateTestParams(Test test) + { + TestParams testParams = new TestParams(true); + testParams.UpdateTestParams(Name, test); + return testParams; + } + + /// Private parameterless constructor invoked by all other (public) constructors + TestMethodCfg() + { + TestParams = new TestParams(true); + } + + public TestMethodCfg(string name, IComponentFactory factory) + : this() + { + Name = name; + Factory = factory; + ParentName = string.Empty; + } + + public string ToString(int i) + { + return string.Format("Name={0}", Name); + } + } +} diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestMethodCfgCtrl.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestMethodCfgCtrl.cs new file mode 100644 index 000000000..a90719a9a --- /dev/null +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestMethodCfgCtrl.cs @@ -0,0 +1,71 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +using System; +using System.Windows.Forms; +using log4net; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Single +{ + public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl + { + static readonly ILog log = LogManager.GetLogger(typeof(TestMethodCfgCtrl)); + + public bool ShowMore { get { return false; } } + + TestMethodCfg config; + public IComponentCfg Config + { + get { return config as IComponentCfg; } + set + { + config = value as TestMethodCfg; + Redraw(); + } + } + + public TestMethodCfgCtrl() + { + InitializeComponent(); + } + + private void EntryFormCfgCtrl_Load(object sender, EventArgs e) + { + Redraw(); + } + + public void Closing() + { + } + + void Redraw() + { + if (config == null) return; /// Control was not loaded, settings were not changed + classNameLabel.Text = config.Factory.ClassName; + nameTextBox.Text = config.Name; + } + + public void Unlock() + { + nameTextBox.Enabled = true; + } + + public CfgUpdateFlags VerifyCfg(ref string message) + { + CfgUpdateFlags flags = CfgUpdateFlags.None; + return flags; + } + + public CfgUpdateFlags UpdateCfg() + { + CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd; + + if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed + + config.Name = nameTextBox.Text; + + return flags; + } + } +} diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestMethodCfgCtrl.designer.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestMethodCfgCtrl.designer.cs new file mode 100644 index 000000000..ab324b1cf --- /dev/null +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestMethodCfgCtrl.designer.cs @@ -0,0 +1,86 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Single +{ + partial class TestMethodCfgCtrl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.nameTextBox = new System.Windows.Forms.TextBox(); + this.nameLabel = new System.Windows.Forms.Label(); + this.classNameLabel = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // nameTextBox + // + this.nameTextBox.Enabled = false; + this.nameTextBox.Location = new System.Drawing.Point(137, 57); + this.nameTextBox.Name = "nameTextBox"; + this.nameTextBox.Size = new System.Drawing.Size(130, 20); + this.nameTextBox.TabIndex = 5; + // + // nameLabel + // + this.nameLabel.AutoSize = true; + this.nameLabel.Location = new System.Drawing.Point(27, 60); + this.nameLabel.Name = "nameLabel"; + this.nameLabel.Size = new System.Drawing.Size(35, 13); + this.nameLabel.TabIndex = 4; + this.nameLabel.Text = "Name"; + // + // classNameLabel + // + this.classNameLabel.AutoSize = true; + this.classNameLabel.Location = new System.Drawing.Point(134, 33); + this.classNameLabel.Name = "classNameLabel"; + this.classNameLabel.Size = new System.Drawing.Size(83, 13); + this.classNameLabel.TabIndex = 3; + this.classNameLabel.Text = "ComonentName"; + // + // BasicPrinterCfgCtrl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.nameTextBox); + this.Controls.Add(this.nameLabel); + this.Controls.Add(this.classNameLabel); + this.Name = "BasicPrinterCfgCtrl"; + this.Size = new System.Drawing.Size(300, 200); + this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox nameTextBox; + private System.Windows.Forms.Label nameLabel; + private System.Windows.Forms.Label classNameLabel; + } +} diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestMethodCfgCtrl.resx b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestMethodCfgCtrl.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestMethodCfgCtrl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestParams.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestParams.cs new file mode 100644 index 000000000..421e236ae --- /dev/null +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/TestParams.cs @@ -0,0 +1,120 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +using System; +using System.IO; +using System.Text; +using System.Xml.Serialization; +using Config.Entities; +using TBF.BenchControl.Generic; +using TBF.Resources; + +namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Single +{ + public class TestParams : TestParamsBase, IParamsProvider, ITestParams + { + public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0]; + protected override XmlSerializer GetSerializer() { return Serializer; } + + public float NextTestVolume; /// [l] + + public override void InitializeAll() + { + NextTestVolume = 10; + } + + + string[] paramNames = new string[] + { + string.Format("{0} [l]", Strings.Next_test_volume), + }; + public override string ParamName(int i) { return paramNames[i]; } + public override int ParamsCount() { return paramNames.Length; } + + public override string ToString(int i) + { + switch (i) + { + case 0: return NextTestVolume.ToString(); + default: return string.Empty; + } + } + + public void UpdateParam(int i, string strValue) + { + switch (i) + { + case 0: NextTestVolume = Utils.ParseUFloat(strValue); return; + default: return; + } + } + + public bool ValidateParam(int i, string strValue, out string message) + { + message = string.Empty; + float volumeToTank; + + switch (i) + { + case 0: + if (Utils.TryParseUFloat(strValue, out volumeToTank) && volumeToTank >= 0.1f) return true; + break; + default: + message = "Invalid index"; + return false; + } + + message = ParamName(i) + " is invalid"; + return false; + } + + void CopyContentTo(TestParams prms) + { + prms.NextTestVolume = this.NextTestVolume; + } + + public IParamsProvider Clone() + { + TestParams pars = new TestParams(); + CopyContentTo(pars); + return pars; + } + + public override void UpdateTestParams(ComponentTest dbEntity) + { + if (dbEntity == null) return; + try + { + TestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as TestParams; + + testParamsEntity = dbEntity; + componentName = dbEntity.CmpntName; + test = dbEntity.Test; + + if (tmp != null) tmp.CopyContentTo(this); + } + catch + { + } + } + + /// + /// Parameterless constructor initializes the parameters + /// + public TestParams() + { + } + + public TestParams(bool initialize) + { + if (initialize) InitializeAll(); + } + + public TestParams(ComponentTest testParamsEntity, string componentName, Test test) + { + this.testParamsEntity = testParamsEntity; + this.componentName = componentName; + this.test = test; + } + } +} diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index 8e9e7e051..7e3b6f400 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -936,6 +936,14 @@ + + + UserControl + + + TestMethodCfgCtrl.cs + + @@ -2336,6 +2344,9 @@ TestMethodCfgCtrl.cs + + TestMethodCfgCtrl.cs + TestMethodCfgCtrl.cs