diff --git a/TestBenchFramework/BenchControl/DataEntry/Munich/EntryForm.cs b/TestBenchFramework/BenchControl/DataEntry/Munich/EntryForm.cs index 511a6dc74..c88f70453 100644 --- a/TestBenchFramework/BenchControl/DataEntry/Munich/EntryForm.cs +++ b/TestBenchFramework/BenchControl/DataEntry/Munich/EntryForm.cs @@ -5,7 +5,7 @@ using TBF.BenchControl.GenericDevices; namespace TBF.BenchControl.DataEntry.Munich { - public class EntryForm : Generic.IComponent, IOperation, GenericDevices.IDataEntry, GenericDevices.IHasProtocolTitle + public class EntryForm : Generic.IComponent, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasProtocolTitle { readonly EntryFormCfg entryFormCfg; public Generic.IComponentCfg Cfg { get { return entryFormCfg; } } @@ -44,7 +44,7 @@ namespace TBF.BenchControl.DataEntry.Munich bool resultSaved; - IList waterMeters; + IList waterMeters; public enum CurrentOp { @@ -63,7 +63,7 @@ namespace TBF.BenchControl.DataEntry.Munich } /// Reference to the operation - public IOperation ShowCycleBeginFormOp(IList waterMeters) + public IOperation ShowCycleBeginFormOp(IList waterMeters) { if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); currentOp = CurrentOp.ShowFormAtCycleBeginning; @@ -72,7 +72,7 @@ namespace TBF.BenchControl.DataEntry.Munich } /// Reference to the operation - public IOperation ShowCycleEndFormOp(IList waterMeters) + public IOperation ShowCycleEndFormOp(IList waterMeters) { if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); currentOp = CurrentOp.ShowFormAtCycleEnd; @@ -129,7 +129,7 @@ namespace TBF.BenchControl.DataEntry.Munich /// Event.ResultsPrinted public Event Run() { - if (!(modelessDlg as GenericDevices.IHasCompleted).Completed) + if (!(modelessDlg as IHasCompleted).Completed) { return Event.None; /// Return 'None' when form was not closed yet } diff --git a/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryForm.cs b/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryForm.cs index a00321a00..d94b44f04 100644 --- a/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryForm.cs +++ b/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryForm.cs @@ -5,7 +5,7 @@ using TBF.BenchControl.GenericDevices; namespace TBF.BenchControl.DataEntry.Munich3 { - public class EntryForm : Generic.IComponent, IOperation, GenericDevices.IDataEntry, GenericDevices.IHasProtocolTitle + public class EntryForm : Generic.IComponent, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasProtocolTitle { readonly EntryFormCfg entryFormCfg; public Generic.IComponentCfg Cfg { get { return entryFormCfg; } } @@ -38,7 +38,7 @@ namespace TBF.BenchControl.DataEntry.Munich3 bool resultSaved; - IList waterMeters; + IList waterMeters; public enum CurrentOp { @@ -57,7 +57,7 @@ namespace TBF.BenchControl.DataEntry.Munich3 } /// Reference to the operation - public IOperation ShowCycleBeginFormOp(IList waterMeters) + public IOperation ShowCycleBeginFormOp(IList waterMeters) { if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); currentOp = CurrentOp.ShowFormAtCycleBeginning; @@ -66,7 +66,7 @@ namespace TBF.BenchControl.DataEntry.Munich3 } /// Reference to the operation - public IOperation ShowCycleEndFormOp(IList waterMeters) + public IOperation ShowCycleEndFormOp(IList waterMeters) { if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); currentOp = CurrentOp.ShowFormAtCycleEnd; @@ -123,7 +123,7 @@ namespace TBF.BenchControl.DataEntry.Munich3 /// Event.ResultsPrinted public Event Run() { - if (!(modelessDlg as GenericDevices.IHasCompleted).Completed) + if (!(modelessDlg as IHasCompleted).Completed) { return Event.None; /// Return 'None' when form was not closed yet } diff --git a/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryForm.cs b/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryForm.cs index cd9ea0531..a51cc3a16 100644 --- a/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryForm.cs +++ b/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryForm.cs @@ -5,7 +5,7 @@ using TBF.BenchControl.GenericDevices; namespace TBF.BenchControl.DataEntry.WMStates { - public class EntryForm : Generic.IComponent, IOperation, GenericDevices.IDataEntry + public class EntryForm : Generic.IComponent, IOperation, IDataEntry, IHasWMStatesForm { readonly EntryFormCfg entryFormCfg; public Generic.IComponentCfg Cfg { get { return entryFormCfg; } } @@ -66,13 +66,13 @@ namespace TBF.BenchControl.DataEntry.WMStates } /// Reference to the operation - public IOperation ShowCycleBeginFormOp(IList waterMeters) + public IOperation ShowCycleBeginFormOp(IList waterMeters) { return null; } /// Reference to the operation - public IOperation ShowCycleEndFormOp(IList waterMeters) + public IOperation ShowCycleEndFormOp(IList waterMeters) { return null; } @@ -126,7 +126,7 @@ namespace TBF.BenchControl.DataEntry.WMStates /// Event.ResultsPrinted public Event Run() { - if (!(modelessDlg as GenericDevices.IHasCompleted).Completed) + if (!(modelessDlg as IHasCompleted).Completed) { return Event.None; /// Return 'None' when form was not closed yet } diff --git a/TestBenchFramework/BenchControl/GenericDevices/IHasCycleBeginForm.cs b/TestBenchFramework/BenchControl/GenericDevices/IHasCycleBeginForm.cs new file mode 100644 index 000000000..fdc244cd1 --- /dev/null +++ b/TestBenchFramework/BenchControl/GenericDevices/IHasCycleBeginForm.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace TBF.BenchControl.GenericDevices +{ + public interface IHasCycleBeginForm + { + /// + /// Displays form at the beginning of the cycle (usually to enter S/N). + /// + /// Watermetes to be updated by the operation + /// Operation to be used in the sequence + IOperation ShowCycleBeginFormOp(IList waterMeters); + } +} diff --git a/TestBenchFramework/BenchControl/GenericDevices/IHasCycleEndForm.cs b/TestBenchFramework/BenchControl/GenericDevices/IHasCycleEndForm.cs new file mode 100644 index 000000000..92e47786f --- /dev/null +++ b/TestBenchFramework/BenchControl/GenericDevices/IHasCycleEndForm.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace TBF.BenchControl.GenericDevices +{ + public interface IHasCycleEndForm + { + /// + /// Displays form at the end of the cycle (usually to enter the end state). + /// + /// Watermetes to be updated by the operation + /// Operation to be used in the sequence + IOperation ShowCycleEndFormOp(IList waterMeters); + } +} diff --git a/TestBenchFramework/BenchControl/GenericDevices/IHasWMStatesForm.cs b/TestBenchFramework/BenchControl/GenericDevices/IHasWMStatesForm.cs new file mode 100644 index 000000000..2185a3108 --- /dev/null +++ b/TestBenchFramework/BenchControl/GenericDevices/IHasWMStatesForm.cs @@ -0,0 +1,13 @@ + +namespace TBF.BenchControl.GenericDevices +{ + public interface IHasWMStatesForm + { + /// + /// Displays form at the beginning of the cycle (usually to enter S/N). + /// + /// Watermetes to be updated by the operation + /// Operation to be used in the sequence + IOperation ShowWMStatesFormOp(); + } +} diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index 4d55ee0b8..af44bc5d6 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -139,11 +139,11 @@ namespace TBF.BenchControl.Sequences //-------------------------------- GenericDevices.IDataEntry dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry; - if (dataEntryCmpnt != null) + if (dataEntryCmpnt is IHasCycleBeginForm) { Bridge.OnActivity(this, "Enter the water meter data"); State.Create("MainSeq : Enter begin data") - .AddPermanentOperation(dataEntryCmpnt.ShowCycleBeginFormOp(WaterMeters)) + .AddPermanentOperation((dataEntryCmpnt as IHasCycleBeginForm).ShowCycleBeginFormOp(WaterMeters)) .AddOperation(checkUiOp) .EnterState(); e = StateMachine.WaitRunDevsRunOps(); @@ -272,40 +272,46 @@ namespace TBF.BenchControl.Sequences { Bridge.OnActivity(this, "Enter the protocol data"); - if (!State.LastEvents.Contains(Event.ModelessFormClosed)) - { - /// Wait until modeless dialg is closed - State.Create("MainSeq : Check whether the entry form is closed") - .AddOperation(checkUiOp) - .EnterState(); - do - { - e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) goto stop; - } - while (!e.Contains(Event.ModelessFormClosed)); - } + if (dataEntryCmpnt is IHasCycleBeginForm) + { + if (!State.LastEvents.Contains(Event.ModelessFormClosed)) + { + /// Wait until modeless dialg is closed + State.Create("MainSeq : Check whether the entry form is closed") + .AddOperation(checkUiOp) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + if (e.Contains(Event.UiCmdStop)) goto stop; + } + while (!e.Contains(Event.ModelessFormClosed)); + } - /// A state without any dataEntryCmpnt operation so that Stop() when entering - /// this state and Start() when entering the following state are executed. - State.Create("MainSeq : Nothing") - .AddOperation(checkUiOp) - .RemovePermanentOperation(dataEntryCmpnt as IOperation) - .EnterState(); - e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) goto stop; + /// A state without any dataEntryCmpnt operation so that Stop() when entering + /// this state and Start() when entering the following state are executed. + State.Create("MainSeq : Nothing") + .AddOperation(checkUiOp) + .RemovePermanentOperation(dataEntryCmpnt as IOperation) + .EnterState(); + e = StateMachine.WaitRunDevsRunOps(); + if (e.Contains(Event.UiCmdStop)) goto stop; + } - /// Open the modeless form for the end of the cycle - State.Create("MainSeq : Enter end data") - .AddOperation((dataEntryCmpnt as GenericDevices.IDataEntry).ShowCycleEndFormOp(WaterMeters)) - .AddOperation(checkUiOp) - .EnterState(); - do - { - e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) goto stop; - } - while (!e.Contains(Event.ModelessFormClosed)); + if (dataEntryCmpnt is IHasCycleEndForm) + { + /// Open the modeless form for the end of the cycle + State.Create("MainSeq : Enter end data") + .AddOperation((dataEntryCmpnt as GenericDevices.IHasCycleEndForm).ShowCycleEndFormOp(WaterMeters)) + .AddOperation(checkUiOp) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + if (e.Contains(Event.UiCmdStop)) goto stop; + } + while (!e.Contains(Event.ModelessFormClosed)); + } if (dataEntryCmpnt is IHasProtocolTitle) { diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs index dcc39da1a..2c30432b6 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs @@ -178,30 +178,27 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection /// GenericDevices.IDataEntry dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry; - if (dataEntryCmpnt != null) + if (dataEntryCmpnt is GenericDevices.IHasWMStatesForm) { - IOperation showFormOp = dataEntryCmpnt.ShowWMStatesFormOp(); - if (showFormOp != null) + Bridge.OnActivity(this, "Enter the water meter data"); + State.Create("FixedStartMassCollection : Enter begin-state") + .AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowWMStatesFormOp()) + .AddOperation(checkUiOp) + .EnterState(); + do { - Bridge.OnActivity(this, "Enter the water meter data"); - State.Create("FixedStartMassCollection : Enter begin-state") - .AddOperation(showFormOp) - .AddOperation(checkUiOp) - .EnterState(); - do - { - e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) { retVal = Event.Error; goto stopTest; } - } - while (!e.Contains(Event.ModelessFormClosed)); + e = StateMachine.WaitRunDevsRunOps(); + if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } + } + while (!e.Contains(Event.ModelessFormClosed)); - for (int i = 0; i < Program.WMsCount; i++) - { - BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader = - sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader; - registerReader.BeginWMState = dataEntryCmpnt.WMState(i); - registerReader.EndWMState = dataEntryCmpnt.WMState(i); - } + for (int i = 0; i < Program.WMsCount; i++) + { + BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader = + sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader; + registerReader.BeginWMState = dataEntryCmpnt.WMState(i); + registerReader.EndWMState = dataEntryCmpnt.WMState(i); + tstRslt.Meters[i].VolumeStart = dataEntryCmpnt.WMState(i) / registerReader.PulsesPerLtr; /// liter } } @@ -241,7 +238,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection State.Create("FixedStartMassCollection : Starting the test") .AddOperation(checkUiOp) .AddOperations(measureOperations) - .AddOperation(cBrd.StartMeasurementOp(outPath.FlowMeter, totalPulses, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, (float)test.TolerRed)) + .AddOperation(cBrd.StartMeasurementOp(outPath.FlowMeter, 2 * totalPulses, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, (float)test.TolerRed)) .EnterState(); do { @@ -275,20 +272,20 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection ResetAveragedData(); /// Measurement loop - begin - while (true) - { + do + { //-------------------------------- switch (ReadRegistersTempPressAmbient(measureOperations, true)) - { - case Event.Error: { retVal = Event.Error; goto stopTest; } - case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } - case Event.MeasurementCompleted: goto test_completed; - } + { + case Event.Error: { retVal = Event.Error; goto stopTest; } + case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } + case Event.MeasurementCompleted: goto test_completed; + } if (firstTime) { firstTime = false; /// Do the following only once - tstRslt.TempInStart = tempIn.Val; + tstRslt.TempInStart = tempIn.Val; tstRslt.TempOutStart = tempOut.Val; tstRslt.TempDivStart = tempDiv.Val; tstRslt.PressInStart = pressIn.Val; @@ -302,7 +299,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection tstRslt.PressOutEnd = pressOut.Val; tstRslt.MassEndRaw = mass.Val; - AccumulateAveragedData(); + AccumulateAveragedData(); refFreq.Val = cBrd.ReferenceFreq; refFlow.Val = cBrd.ReferenceFlow; @@ -310,25 +307,26 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection tstRslt.AmbientPressAve = airPressure.Val; tstRslt.AmbientHumiAve = airHumidity.Val; - string logstr = string.Format("E={0} f={1} q={2}", cBrd.EtPulses(0), cBrd.ReferenceFreq, - cBrd.ReferenceFlow * outPath.FlowMeter.NominalFlow); - for (int i = 0; i < Program.WMsCount; i++) - { - logstr += string.Format(" M{0}=({1},{2})", i + 1, WMRefPulses[i], WMPulses[i]); - } - log.Info(logstr); + string logstr = string.Format("E={0} f={1} q={2}", cBrd.EtPulses(0), cBrd.ReferenceFreq, + cBrd.ReferenceFlow * outPath.FlowMeter.NominalFlow); + for (int i = 0; i < Program.WMsCount; i++) + { + logstr += string.Format(" M{0}=({1},{2})", i + 1, WMRefPulses[i], WMPulses[i]); + } + log.Info(logstr); float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime); Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, cBrd.TTime, progress)); - } + } + while (cBrd.EtPulses(0) < totalPulses); /// Measurement loop - end test_completed: State.Create("FixedStartMassCollection : Closing the start/stop valve at the end of the fixed start test") .AddOperation(checkUiOp) - .AddOperation(StateMachine.ControlBoard.SetValvesOp(outPath.StartValve, null)) + .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve)) .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) .EnterState(); do @@ -339,6 +337,18 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection while (!e.Contains(Event.ValvesSet)); + State.Create("FixedStartMassCollection : Stopping diverter, gate, etc.") + .AddOperation(checkUiOp) + .AddOperation(cBrd.StopPreviousOp()) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } + } + while (!e.Contains(Event.PreviousStopped)); + + //------------------------------------------------ Bridge.OnActivity(this, Strings.Measuring_the_weight); //------------------------------------------------ @@ -370,30 +380,27 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection /// /// Enter watermeter end states here /// - if (dataEntryCmpnt != null) + if (dataEntryCmpnt is GenericDevices.IHasWMStatesForm) { - IOperation showFormOp = dataEntryCmpnt.ShowWMStatesFormOp(); - if (showFormOp != null) + Bridge.OnActivity(this, "Enter the water meter data"); + State.Create("FixedStartMassCollection : Enter end-state") + .AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowWMStatesFormOp()) + .AddOperation(checkUiOp) + .EnterState(); + do { - Bridge.OnActivity(this, "Enter the water meter data"); - State.Create("FixedStartMassCollection : Enter end-state") - .AddOperation(showFormOp) - .AddOperation(checkUiOp) - .EnterState(); - do - { - e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) { retVal = Event.Error; goto stopTest; } - } - while (!e.Contains(Event.ModelessFormClosed)); + e = StateMachine.WaitRunDevsRunOps(); + if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } + } + while (!e.Contains(Event.ModelessFormClosed)); - for (int i = 0; i < Program.WMsCount; i++) - { - BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader = - sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader; - registerReader.EndWMState = dataEntryCmpnt.WMState(i); - } + for (int i = 0; i < Program.WMsCount; i++) + { + BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader = + sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader; + registerReader.EndWMState = dataEntryCmpnt.WMState(i); + tstRslt.Meters[i].VolumeEnd = dataEntryCmpnt.WMState(i) / registerReader.PulsesPerLtr; /// liter } } @@ -443,29 +450,23 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection tstRslt.TimeDivEnd5 = 0; for (int i = 0; i < Program.WMsCount; i++) { - if (sensPath.RegisterReaders[i] != null) + tstRslt.Meters[i].SerialNr = "wm" + (i + 1).ToString(); + tstRslt.Meters[i].VolumeMeter = tstRslt.Meters[i].VolumeEnd - tstRslt.Meters[i].VolumeStart; + tstRslt.Meters[i].VolumeRef = tstRslt.VolumeCTV; /// liter + tstRslt.Meters[i].PulsesMeter = 0; + tstRslt.Meters[i].PulsesMaster = tstRslt.PulsesMaster; + tstRslt.Meters[i].Time = cBrd.TTime; + if (WMPulses[i] > 0 && tstRslt.Meters[i].VolumeRef > 0) { - tstRslt.Meters[i].SerialNr = "wm" + (i + 1).ToString(); - tstRslt.Meters[i].VolumeStart = 0; /// liter - tstRslt.Meters[i].VolumeEnd = 0; /// liter - if (sensPath.RegisterReaders[i].PulsesPerLtr <= float.Epsilon) tstRslt.Meters[i].VolumeMeter = 0; - else tstRslt.Meters[i].VolumeMeter = Convert.ToSingle(WMPulses[i]) / sensPath.RegisterReaders[i].PulsesPerLtr; - tstRslt.Meters[i].VolumeRef = tstRslt.ConstMaster * WMRefPulses[i]; /// liter - tstRslt.Meters[i].PulsesMeter = WMPulses[i]; - tstRslt.Meters[i].PulsesMaster = WMRefPulses[i]; - tstRslt.Meters[i].Time = cBrd.TTime; - if (WMPulses[i] > 0 && tstRslt.Meters[i].VolumeRef > 0) - { - tstRslt.Meters[i].VolumeErrorPct = - 100 * (tstRslt.Meters[i].VolumeMeter - tstRslt.Meters[i].VolumeRef) / tstRslt.Meters[i].VolumeRef; - /// % - } - else - { - tstRslt.Meters[i].VolumeErrorPct = -100; - } - tstRslt.Meters[i].Passed = (tstRslt.ErrLimLo <= tstRslt.Meters[i].VolumeErrorPct) && (tstRslt.Meters[i].VolumeErrorPct <= tstRslt.ErrLimHi); + tstRslt.Meters[i].VolumeErrorPct = + 100 * (tstRslt.Meters[i].VolumeMeter - tstRslt.Meters[i].VolumeRef) / tstRslt.Meters[i].VolumeRef; + /// % } + else + { + tstRslt.Meters[i].VolumeErrorPct = -100; + } + tstRslt.Meters[i].Passed = (tstRslt.ErrLimLo <= tstRslt.Meters[i].VolumeErrorPct) && (tstRslt.Meters[i].VolumeErrorPct <= tstRslt.ErrLimHi); } /// Add data - end diff --git a/TestBenchFramework/Boxes/DoubleBox.cs b/TestBenchFramework/Boxes/DoubleBox.cs new file mode 100644 index 000000000..cf4931f8b --- /dev/null +++ b/TestBenchFramework/Boxes/DoubleBox.cs @@ -0,0 +1,119 @@ +namespace TBF.Boxes +{ + public class DoubleBox + { + /// Box value + private double val; + public double Val + { + get { return (valid ? val : 0); } + set { val = value; valid = true; } + } + + /// Box name + string name; + public string Name + { + get { return name; } + set { name = value; } + } + + /// Validity flag: true = the box value is valid + private bool valid = false; + public bool Valid + { + get { return valid; } + } + + /// Parameterless constructor + public DoubleBox() + { + } + + /// Constructor that initializes the value + public DoubleBox(double val) + { + this.Val = val; + } + + /// + /// Clear the box value and the valid flag + /// + public void Clear() + { + val = 0; + valid = false; + } + + /// + /// Specifies a conversion to a string. + /// In the most complex case the conversion is: + /// string.Format(FormatEx, val.ToString(Format)) + /// If the value is invalid, the conversion result is 'FormatInvalid'. + /// + public string Format = null; + public string FormatEx = "{0}"; + public string FormatInvalid = "---"; + public double Factor = 1.0; + public double LimitLo = double.MinValue; + public double LimitHi = double.MaxValue; + + /// + /// Converts the box value to a string representation + /// + public override string ToString() + { + if (!valid) + { + return FormatInvalid; + } + else if (Format == null) + { + return string.Format(FormatEx, Val * Factor); + } + else + { + return string.Format(FormatEx, (Val * Factor).ToString(Format)); + } + } + + /// + /// Validate the string representation of the box value + /// + /// String representation of the parameter + /// true = string is OK, false = string is wrong (see 'message') + public bool ValidateParam(string strVal) + { + float dummy; + return Utils.TryParseSFloat(strVal, out dummy) && + ((dummy / Factor) >= LimitLo) && + ((dummy / Factor) <= LimitHi); + } + + /// + /// Update the parameter from a string + /// + /// String representation of the box value + public void UpdateParam(string strVal) + { + try + { + Val = (double)Utils.ParseSFloat(strVal) / Factor; + } + catch { }; + } + + public DoubleBox Clone() + { + DoubleBox newDoubleBox = new DoubleBox(); + newDoubleBox.name = name; + newDoubleBox.val = val; + newDoubleBox.valid = valid; + newDoubleBox.Format = Format; + newDoubleBox.FormatInvalid = FormatInvalid; + newDoubleBox.FormatEx = FormatEx; + newDoubleBox.Factor = Factor; + return newDoubleBox; + } + } +} diff --git a/TestBenchFramework/Mappings/OutputPathMap.cs b/TestBenchFramework/Mappings/OutputPathMap.cs index 5930b5eae..2cf6ea31e 100644 --- a/TestBenchFramework/Mappings/OutputPathMap.cs +++ b/TestBenchFramework/Mappings/OutputPathMap.cs @@ -14,7 +14,8 @@ namespace TBF.Mappings Map(x => x.Qto); Map(x => x.RegulValve); Map(x => x.FlowMeter); - Map(x => x.Diverter); + Map(x => x.StartValve); + Map(x => x.Diverter); Map(x => x.TempDiv); Map(x => x.Balance); Map(x => x.EmptyTankValve); diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index 2b52b6e8a..233d5c708 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -323,7 +323,10 @@ + + + @@ -492,6 +495,7 @@ WaterMeterCfgCtrl.cs + diff --git a/packages/ControlBoard/Fuzhou300/ControlComponent3U.dll b/packages/ControlBoard/Fuzhou300/ControlComponent3U.dll index 26247e63e..03c44800e 100644 Binary files a/packages/ControlBoard/Fuzhou300/ControlComponent3U.dll and b/packages/ControlBoard/Fuzhou300/ControlComponent3U.dll differ