diff --git a/TBF/BenchControl/TbfComponents.cs b/TBF/BenchControl/TbfComponents.cs index cde83bc0c..68f4ab691 100644 --- a/TBF/BenchControl/TbfComponents.cs +++ b/TBF/BenchControl/TbfComponents.cs @@ -74,6 +74,7 @@ namespace TBF.BenchControl Factories.Add(new TestMethods.OuterLoop.Start.Factory()); Factories.Add(new TestMethods.OuterLoop.End.Factory()); Factories.Add(new TestMethods.PMaxTest.TestMethodFactory()); + Factories.Add(new TestMethods.PulsesTest.Factory()); Factories.Add(new TestMethods.SensitivityTest.TestMethodFactory()); Factories.Add(new TestMethods.iPerlCommunication.TestMethodFactory()); /// iPerlCommunication Factories.Add(new TestMethods.RoiDetection.RoiDetectionFactory()); diff --git a/TBF/BenchControl/TestMethods/PulsesTest/Factory.cs b/TBF/BenchControl/TestMethods/PulsesTest/Factory.cs new file mode 100644 index 000000000..7816784cb --- /dev/null +++ b/TBF/BenchControl/TestMethods/PulsesTest/Factory.cs @@ -0,0 +1,30 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +using System.Collections.Generic; +using TBF.BenchControl.Generic; +using TBF.BenchControl.Configs.NameOnly; + +namespace TBF.BenchControl.TestMethods.PulsesTest +{ + public class Factory : IComponentFactory + { + public string ClassName { get { return this.GetType().Namespace.Substring(17); } } + + public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); } + + public IComponent DummyComponent() { return new TestMethod(); } + + public IComponent GetComponent(IComponentCfg cfg, IList components) { return new TestMethod(cfg); } + + public IComponentCfg DefaultConfig() + { + return new TestMethodCfg(this.GetType().Namespace.Substring(29), this); + } + + public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this); + } + } +} diff --git a/TBF/BenchControl/TestMethods/PulsesTest/PulsesTestSeq.cs b/TBF/BenchControl/TestMethods/PulsesTest/PulsesTestSeq.cs new file mode 100644 index 000000000..94806f6be --- /dev/null +++ b/TBF/BenchControl/TestMethods/PulsesTest/PulsesTestSeq.cs @@ -0,0 +1,498 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using System.Text; +using log4net; +using Config.Entities; +using TBF.BenchControl; +using TBF.Boxes; +using TBF.Resources; +using TBF.UiBridge; + +namespace TBF.BenchControl.TestMethods.PulsesTest +{ + public class PulseOutputsTestSeq : Sequences.SequenceBase + { + private static readonly ILog log = LogManager.GetLogger(typeof(PulseOutputsTestSeq)); + + const double PulsesLimitLo = 5; + + System.Windows.Forms.Form modelessDlg; + /// + delegate void ErrorsFormDlgt(PulseOutputsTestSeq myRef, IList waterMeters); + /// + void OpenWMErrorsForm(PulseOutputsTestSeq myRef, IList waterMeters) + { +#pragma warning disable 162 /// Disables 'Unreachable code detected' warning + + if (Config.Data.WMsCount > 12) + { + myRef.modelessDlg = new WMPulsesForm24(waterMeters); + } + else if (Config.Data.WMsCount > 6) + { + myRef.modelessDlg = new WMPulsesForm12(waterMeters); + } + else + { + myRef.modelessDlg = new WMPulsesForm(waterMeters); + } + +#pragma warning restore 162 /// Disables 'Unreachable code detected' warning + + modelessDlg.Show(); + } + + /// + /// Adjustment method sequence + /// + /// Test entity + /// + /// Event.Done . . . . . . . OK + /// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP + /// Event.OpArgumentError . Target flow is out of range + /// Event.Error . . . . . . Unspecified error + /// + public IList Execute(Test test, int repetitionNr, bool isLastRepetition, DebugMode mode) + { + float simulatedError = 4.5f; /// % + + Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; + + IList e = new List(); /// Events from currently running operations + Event retVal = Event.Done; + checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state + + LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h] + + /// Notes: + /// float timeHr = volumeLtr / (1000.0f * targetFlow); + /// float timeSec = 3600.0f * timeHr; + /// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow)); + int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); + + int rangeIx = 0; /// Default range, used for non-Elde flowmeters + if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) + { + Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.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); + retVal = Event.UiCmdStop; + goto stopTestWOStoppingDivGateEtc; + } + } + + processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false); + + /// 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; + + Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); + int flowSetTime0 = StateMachine.Time; + + //------------------------------------------------ + Bridge.OnActivity(this, Strings.Starting_the_pump); + //------------------------------------------------ + if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); + /// + State.Create("Adjustment : Starting the pump") + .AddOperation(checkUiOp) + .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) +// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) + .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); + Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); + + if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } + if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } + + } + while (e.Contains(Event.ValvesBusy) /* || !e.Contains(Event.AllPositionsReached)*/); + + + if (test.TimePump2StartV > 0) + { + State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) + .AddOperation(checkUiOp) + .AddOperation(new Operations.TimerOp(test.TimePump2StartV)) + .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); + Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); + + if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } + } + while (!e.Contains(Event.TimerExpired)); + } + + + if (benchPath.StopBFValve != null) + { + State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) + .AddOperation(checkUiOp) + .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) + .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } + if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } + } + while (!e.Contains(Event.ValvesSet)); + } + + + if (test.TimeBeforeFlow > 0) + { + State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) + .AddOperation(checkUiOp) + .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) + .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); + Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); + + if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } + } + while (!e.Contains(Event.TimerExpired)); + } + + + setting_flow: + + //------------------------------------------------ + Bridge.OnActivity(this, Strings.Setting_the_flow); + //------------------------------------------------ + State.Create("Adjustment : Setting the flow") + .AddOperation(checkUiOp) + .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, 600)) /// timeout = 10 min. + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); + Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); + + if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; } + if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } + if (e.Contains(Event.RegulValveTimeOut)) + { + Bridge.OnError(this, Strings.Flow_adjustment_failed); + retVal = Event.UiCmdStop; + goto stopTest; + } + if (e.Contains(Event.Next)) goto flow_set; + } + while (!e.Contains(Event.FlowReached)); + + flow_set: + + int flowSetTime = StateMachine.Time - flowSetTime0; + + if (test.DoControlWaterTemp && benchPath.TempMtrUp != null && benchPath.TempMtrDown != null) + { + //--------------------------------------------------- + Bridge.OnActivity(this, Strings.Setting_temperature); + //--------------------------------------------------- + + State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) + .AddOperation(checkUiOp) + .AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) + .AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } + if (e.Contains(Event.Next)) goto temperature_set; + + if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi && + TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi) + { + goto temperature_set; + } + } + while (true); + } + + temperature_set: + + /// Show the modeless dialog with error indication + Program.MainWnd.Invoke(new ErrorsFormDlgt(OpenWMErrorsForm), new object[] { this, WaterMeters }); + + loop: + int time = StateMachine.Time; + double currentFlow = RefFlow.Val; + + + /// + /// Prepare cameras, ROI-s and measurementOperations + /// + + /// Find ROI-s + IList rois = new List(); + foreach (var rr in sensPath.RegisterReaders) + { + GenericDevices.IRoi roi = rr as GenericDevices.IRoi; + if (roi != null && roi.Detected) + { + rois.Add(roi); + } + } + + /// Find cameras + IList cameras = new List(); + foreach (var roi in rois) + { + if (roi.Camera != null && !cameras.Contains(roi.Camera)) + { + roi.Camera.ClearRoiParams(); + cameras.Add(roi.Camera); + } + } + + /// Register ROI-parameters to cameras + foreach (var roi in rois) roi.RegisterRoiToCamera(); + + /// Prepare measurementOperations + IList measureOperations = new List(); + foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp()); + + + + //------------------------------------------------ + Bridge.OnActivity(this, Strings.Test_in_progress); + //------------------------------------------------ + if (mode == Config.Entities.DebugMode.Simulate) + { + /// TODO: Reimplement + //tstRslt = MakeSimulated(test, 1, simulatedError); + simulatedError *= 0.6f; + + State.Create("Adjustment : Simulating the test") + .AddOperation(checkUiOp) + .AddOperation(new Operations.TimerOp(5)) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } + if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } + } + while (!e.Contains(Event.TimerExpired)); + } + else + { + State.Create("Adjustment : Starting the test") + .AddOperation(checkUiOp) + .AddOperations(measureOperations) + .AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, + test.Qfrom, test.Qto, totalPulses, (float)test.TolerRed)) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } + if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } + } + while (!e.Contains(Event.MeasurementStarted)); + + /// Measurement loop - preparation + readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders); + queryEnd1 = cBrd.QueryMeasurementEndOp(); + queryEnd2 = cBrd.QueryMeasurementEndOp(); + + StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr); + + /// Measurement loop - begin + while (true) + { + //-------------------------------- + switch (ReadRegistersTempPressAmbient(measureOperations, true)) + { + case Event.Error: { retVal = Event.Error; goto stopTest; } + case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } + case Event.MeasurementCompleted: goto one_test_completed; + } + + RefFreq.Val = cBrd.ReferenceFreq; + RefFlow.Val = cBrd.ReferenceFlow; + UpdateAllStatistics(StateMachine.Time); + + Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); + Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); + } + /// Measurement loop - end + + one_test_completed: + + //------------------------------------------------ + Bridge.OnActivity(this, Strings.Adjustment_in_progress); + //------------------------------------------------ + + TestEndTime = DateTime.Now; + + /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest; + + /// + /// Populate TestResult data entity with data + /// + Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part); + + if (tstRslt != null) + { + UpdateTempPressDensAmb(tstRslt); + + /// Main results + tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName; + tstRslt.StartTime = TestStartTime; + tstRslt.EndTime = TestEndTime; + tstRslt.FlowSetTime = flowSetTime; + tstRslt.TestTime = cBrd.TTime; /// [s] measurement time + tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total) + tstRslt.MassStart = 0; + tstRslt.MassEnd = 0; + tstRslt.FlowMass = 0; /// [kg/h] + tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h] + tstRslt.Buoyancy = Config.Formulas.Buoyancy(); + 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.FlowMean = (float)RefFlowStat.Average; + tstRslt.FlowStart = (float)RefFlowStat.First; + tstRslt.FlowEnd = (float)RefFlowStat.Last; + tstRslt.FlowMin = (float)RefFlowStat.Min; + tstRslt.FlowMax = (float)RefFlowStat.Max; + + tstRslt.DiverterStart = 0; + tstRslt.DiverterEnd = 0; + tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; + tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, false, 0, 0) : 0; + + for (int i = 0; i < BatchRslts.WMPositionsCount; i++) + { + if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue; + + Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single); + GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i]; + + if (meterRslt != null && regReader != null) + { + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; + meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; + meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses); + meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses); + meterRslt.VolumeStart = 0; /// liter + meterRslt.VolumeEnd = 0; /// liter + meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter + meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter + meterRslt.TestTime = cBrd.ImpulseTime(i + 1); + meterRslt.Error = 0; + meterRslt.Passed = (meterRslt.PulsesMeter >= PulsesLimitLo); + meterRslt.TestDone = true; + tstRslt.TestDone = true; + } + } + + tstRslt.Components = Results.Entities.Components + .UpdateList(BatchRslts.ComponentsList, + new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1, + (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", + inPath.Pump != null ? inPath.Pump.Name : string.Empty, + outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, + outPath.Scale != null ? outPath.Scale.Name : string.Empty, + outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, + outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); + + /// Update water meter error flags + if (ErrorFlagsComp != null) + { + for (int i = 0; i < BatchRslts.WMPositionsCount; i++) + { + if (BatchRslts.WaterMeters[i] != null) + { + BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts); + } + } + } + + /// Update results + Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt)); + } + /// Add data - end + } + + + /// Update modeless dialog error information + Bridge.OnPulsesTestInProgress(this, new PulsesTestInProgressEventArgs(testName, PulsesLimitLo)); + + /// Test 'Quit' + if ((modelessDlg is GenericDevices.IHasCompleted) && !(modelessDlg as GenericDevices.IHasCompleted).Completed) + { + goto loop; /// Modeless dilaog not closed, keep looping + } + modelessDlg = null; /// Modeless dialog is closed now + + /// Append the results to the CSV-file + allResults.Info(TestResult2CsvLine(testName, test.Part)); + + stopTest: + + /// + /// Quit this sequence + /// + if (isLastRepetition || retVal == Event.UiCmdStop || retVal == Event.OpArgumentError + || retVal == Event.Error || retVal == Event.ConfigurationError) + { + State.Create("Adjustment : Stopping diverter, gate, etc.") + .AddOperation(checkUiOp) + .AddOperation(cBrd.StopPreviousOp()) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } + } + while (!e.Contains(Event.PreviousStopped)); + } + + stopTestWOStoppingDivGateEtc: + + /// Create a list with one item 'retVal' (default is Event.Done) and return it + IList retList = new List(1); + retList.Add(retVal); + return retList; + } + } +} diff --git a/TBF/BenchControl/TestMethods/PulsesTest/TestMethod.cs b/TBF/BenchControl/TestMethods/PulsesTest/TestMethod.cs new file mode 100644 index 000000000..adb859867 --- /dev/null +++ b/TBF/BenchControl/TestMethods/PulsesTest/TestMethod.cs @@ -0,0 +1,35 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using log4net; +using Config.Entities; +using TBF.BenchControl; + +namespace TBF.BenchControl.TestMethods.PulsesTest +{ + public class TestMethod : ComponentBase, GenericDevices.ITestMethod + { + private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); + public override string ToString() { return string.Format("TestMethods.PulsesTest({0})", Cfg.ToString(1)); } + + public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; } + public bool DoTransitions() { return true; } + + public TestMethod() + { + } + + public TestMethod(Generic.IComponentCfg cfg) + : base(cfg) + { + log.Debug(this.ToString()); + } + + public IList Execute(Test test, int repetNr, bool isLastRepetition) + { + return (new PulseOutputsTestSeq()).Execute(test, repetNr, isLastRepetition, DebugLevel); + } + } +} diff --git a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm.cs b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm.cs new file mode 100644 index 000000000..6204052f1 --- /dev/null +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm.cs @@ -0,0 +1,200 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Windows.Forms; +using log4net; +using Config.Entities; +using TBF.Resources; + +namespace TBF.BenchControl.TestMethods.PulsesTest +{ + public partial class WMPulsesForm : Form, GenericDevices.IHasCompleted + { + private static readonly ILog log = LogManager.GetLogger(typeof(WMPulsesForm)); + + /// + /// Updated in constructor + /// + readonly int waterMetersCount; /// Number of text boxes for serial numbers + readonly bool[] disabled; + Rectangle[] rects; + + /// + /// Updated in OnAdjustmentInProgress() + /// + double[] pulsesCount; /// Created in constructor + double limitLo; + + /// + /// Set to 'true' when the form closes + /// + public bool Completed { get { return completed; } } + bool completed; + + + /// + /// Constructor + /// + /// Number of text boxes for serial numbers + public WMPulsesForm(IList waterMeters) + : this() + { + waterMetersCount = waterMeters.Count; + + rects = new Rectangle[waterMetersCount]; + for (int i = 0; i < waterMetersCount; i++) rects[i] = new Rectangle(385, 30 + 90 * i, 324, 57); + + disabled = new bool[waterMetersCount]; + for (int i = 0; i < waterMetersCount; i++) disabled[i] = waterMeters[i].Disabled; + + pulsesCount = new double[waterMetersCount]; + } + + /// Parameterless constructor for 3 watermeters + public WMPulsesForm() + { + InitializeComponent(); + ControlBox = false; + + completed = false; + + /// Attach to 'AdjustmentInProgress' handler + UiBridge.Bridge.PulsesTestInProgressHandler += delegate(object sender, UiBridge.PulsesTestInProgressEventArgs args) + { + if (InvokeRequired) + { + Invoke(new EventHandler(OnPulsesTestInProgress), sender, args); + } + else OnPulsesTestInProgress(sender, args); + }; + } + + void Localize() + { + Text = Strings.Water_Meter_States; + groupBox1.Text = Strings.Water_Meter + " 1"; + groupBox2.Text = Strings.Water_Meter + " 2"; + groupBox3.Text = Strings.Water_Meter + " 3"; + groupBox4.Text = Strings.Water_Meter + " 4"; + groupBox5.Text = Strings.Water_Meter + " 5"; + groupBox6.Text = Strings.Water_Meter + " 6"; + wmPulsesCountLabel1.Text = Strings.Error_pct; + wmPulsesCountLabel2.Text = Strings.Error_pct; + wmPulsesCountLabel3.Text = Strings.Error_pct; + wmPulsesCountLabel4.Text = Strings.Error_pct; + wmPulsesCountLabel5.Text = Strings.Error_pct; + wmPulsesCountLabel6.Text = Strings.Error_pct; + okButton.Text = Strings.OkBtnText; + } + + private void WMPulsesForm_Load(object sender, EventArgs e) + { + Localize(); + + Height = 50 + 90 * waterMetersCount; + + if (waterMetersCount < 1 || disabled[0]) groupBox1.Visible = false; + if (waterMetersCount < 2 || disabled[1]) groupBox2.Visible = false; + if (waterMetersCount < 3 || disabled[2]) groupBox3.Visible = false; + if (waterMetersCount < 4 || disabled[3]) groupBox4.Visible = false; + if (waterMetersCount < 5 || disabled[4]) groupBox5.Visible = false; + if (waterMetersCount < 6 || disabled[5]) groupBox6.Visible = false; + + wmPulsesCountTextBox1.Text = "---"; + wmPulsesCountTextBox2.Text = "---"; + wmPulsesCountTextBox3.Text = "---"; + wmPulsesCountTextBox4.Text = "---"; + wmPulsesCountTextBox5.Text = "---"; + wmPulsesCountTextBox6.Text = "---"; + } + + private void okButton_Click(object sender, EventArgs e) + { + completed = true; + Close(); + } + + void OnPulsesTestInProgress(object sender, UiBridge.PulsesTestInProgressEventArgs args) + { + string testName = args.TestName; + limitLo = args.LimitLo; + + Results.Entities.TestRslt tr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetTestRslt(testName, 0); + + int count = Math.Min(waterMetersCount, TBF.BenchControl.Sequences.ProcessData.BatchRslts.WMPositionsCount); + for (int i = 0; i < count; i++) + { + Results.Entities.MeterTestRslt mtr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single); + if (mtr != null) pulsesCount[i] = mtr.PulsesMeter; + } + + Redraw(); + } + + void Redraw() + { + if (waterMetersCount > 0 && !disabled[0]) wmPulsesCountTextBox1.Text = pulsesCount[0].ToString("F0"); + if (waterMetersCount > 1 && !disabled[1]) wmPulsesCountTextBox2.Text = pulsesCount[1].ToString("F0"); + if (waterMetersCount > 2 && !disabled[2]) wmPulsesCountTextBox3.Text = pulsesCount[2].ToString("F0"); + if (waterMetersCount > 3 && !disabled[3]) wmPulsesCountTextBox4.Text = pulsesCount[3].ToString("F0"); + if (waterMetersCount > 4 && !disabled[4]) wmPulsesCountTextBox5.Text = pulsesCount[4].ToString("F0"); + if (waterMetersCount > 5 && !disabled[5]) wmPulsesCountTextBox6.Text = pulsesCount[5].ToString("F0"); + + for (int i = 0; i < waterMetersCount; i++) Invalidate(rects[i]); + } + + private void WMPulsesForm_Paint(object sender, PaintEventArgs e) + { + System.Drawing.Graphics graphics = this.CreateGraphics(); + + for (int i = 0; i < waterMetersCount; i++) + { + if (!disabled[i]) + { + PaintOne(graphics, rects[i], pulsesCount[i], limitLo); + } + } + } + + void PaintOne(System.Drawing.Graphics g, Rectangle r, double value, double limLo) + { + Rectangle rect1 = new Rectangle(r.Left, r.Top, r.Width / 3, r.Height); + Rectangle rect2 = new Rectangle(r.Left + r.Width / 3, r.Top, r.Width / 3, r.Height); + Rectangle rect3 = new Rectangle(r.Left + 2 * (r.Width / 3), r.Top, r.Width / 3, r.Height); + + Brush redBrush = new SolidBrush(Color.FromName("Salmon")); + Brush greenBrush = new SolidBrush(Color.FromName("LightGreen")); + Brush centBrush = new SolidBrush(Color.FromName("Green")); + if (value >= limLo) + { + g.FillRectangle(greenBrush, rect2); + } + else + { + g.FillRectangle(redBrush, rect2); + } + } + + #region Forced close handling + + public void StartForceCloseHandler() + { + UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args) + { + if (InvokeRequired) { Invoke(new EventHandler(OnForceClose), sender, args); } + else OnForceClose(sender, args); + }; + } + + void OnForceClose(object sender, EventArgs args) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + #endregion + } +} diff --git a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm.designer.cs b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm.designer.cs new file mode 100644 index 000000000..2645680b5 --- /dev/null +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm.designer.cs @@ -0,0 +1,312 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +namespace TBF.BenchControl.TestMethods.PulsesTest +{ + partial class WMPulsesForm + { + /// + /// 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 Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.wmPulsesCountTextBox2 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel2 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.wmPulsesCountTextBox1 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel1 = new System.Windows.Forms.Label(); + this.okButton = new System.Windows.Forms.Button(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.wmPulsesCountTextBox3 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel3 = new System.Windows.Forms.Label(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.wmPulsesCountTextBox4 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel4 = new System.Windows.Forms.Label(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.wmPulsesCountTextBox5 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel5 = new System.Windows.Forms.Label(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.wmPulsesCountTextBox6 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel6 = new System.Windows.Forms.Label(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox5.SuspendLayout(); + this.groupBox6.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.wmPulsesCountTextBox2); + this.groupBox2.Controls.Add(this.wmPulsesCountLabel2); + this.groupBox2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.groupBox2.ForeColor = System.Drawing.Color.Black; + this.groupBox2.Location = new System.Drawing.Point(25, 102); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(333, 81); + this.groupBox2.TabIndex = 2; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Water Meter 2"; + // + // wmErrorTextBox2 + // + this.wmPulsesCountTextBox2.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox2.Location = new System.Drawing.Point(183, 21); + this.wmPulsesCountTextBox2.Name = "wmErrorTextBox2"; + this.wmPulsesCountTextBox2.Size = new System.Drawing.Size(137, 52); + this.wmPulsesCountTextBox2.TabIndex = 1; + // + // wmErrorLabel2 + // + this.wmPulsesCountLabel2.AutoSize = true; + this.wmPulsesCountLabel2.Location = new System.Drawing.Point(18, 34); + this.wmPulsesCountLabel2.Name = "wmErrorLabel2"; + this.wmPulsesCountLabel2.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel2.TabIndex = 0; + this.wmPulsesCountLabel2.Text = "Error [%]"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.wmPulsesCountTextBox1); + this.groupBox1.Controls.Add(this.wmPulsesCountLabel1); + this.groupBox1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.groupBox1.ForeColor = System.Drawing.Color.Black; + this.groupBox1.Location = new System.Drawing.Point(25, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(333, 81); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Water Meter 1"; + // + // wmErrorTextBox1 + // + this.wmPulsesCountTextBox1.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox1.Location = new System.Drawing.Point(183, 21); + this.wmPulsesCountTextBox1.Name = "wmErrorTextBox1"; + this.wmPulsesCountTextBox1.Size = new System.Drawing.Size(137, 52); + this.wmPulsesCountTextBox1.TabIndex = 1; + // + // wmErrorLabel1 + // + this.wmPulsesCountLabel1.AutoSize = true; + this.wmPulsesCountLabel1.Location = new System.Drawing.Point(18, 34); + this.wmPulsesCountLabel1.Name = "wmErrorLabel1"; + this.wmPulsesCountLabel1.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel1.TabIndex = 0; + this.wmPulsesCountLabel1.Text = "Error [%]"; + // + // okButton + // + this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.okButton.ForeColor = System.Drawing.Color.Black; + this.okButton.Location = new System.Drawing.Point(739, 26); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(98, 63); + this.okButton.TabIndex = 7; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.wmPulsesCountTextBox3); + this.groupBox3.Controls.Add(this.wmPulsesCountLabel3); + this.groupBox3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.groupBox3.ForeColor = System.Drawing.Color.Black; + this.groupBox3.Location = new System.Drawing.Point(25, 192); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(333, 81); + this.groupBox3.TabIndex = 3; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Water Meter 3"; + // + // wmErrorTextBox3 + // + this.wmPulsesCountTextBox3.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox3.Location = new System.Drawing.Point(183, 21); + this.wmPulsesCountTextBox3.Name = "wmErrorTextBox3"; + this.wmPulsesCountTextBox3.Size = new System.Drawing.Size(137, 52); + this.wmPulsesCountTextBox3.TabIndex = 1; + // + // wmErrorLabel3 + // + this.wmPulsesCountLabel3.AutoSize = true; + this.wmPulsesCountLabel3.Location = new System.Drawing.Point(18, 34); + this.wmPulsesCountLabel3.Name = "wmErrorLabel3"; + this.wmPulsesCountLabel3.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel3.TabIndex = 0; + this.wmPulsesCountLabel3.Text = "Error [%]"; + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.wmPulsesCountTextBox4); + this.groupBox4.Controls.Add(this.wmPulsesCountLabel4); + this.groupBox4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.groupBox4.ForeColor = System.Drawing.Color.Black; + this.groupBox4.Location = new System.Drawing.Point(25, 282); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(333, 81); + this.groupBox4.TabIndex = 4; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Water Meter 4"; + // + // wmErrorTextBox4 + // + this.wmPulsesCountTextBox4.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox4.Location = new System.Drawing.Point(183, 21); + this.wmPulsesCountTextBox4.Name = "wmErrorTextBox4"; + this.wmPulsesCountTextBox4.Size = new System.Drawing.Size(137, 52); + this.wmPulsesCountTextBox4.TabIndex = 1; + // + // wmErrorLabel4 + // + this.wmPulsesCountLabel4.AutoSize = true; + this.wmPulsesCountLabel4.Location = new System.Drawing.Point(18, 34); + this.wmPulsesCountLabel4.Name = "wmErrorLabel4"; + this.wmPulsesCountLabel4.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel4.TabIndex = 0; + this.wmPulsesCountLabel4.Text = "Error [%]"; + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.wmPulsesCountTextBox5); + this.groupBox5.Controls.Add(this.wmPulsesCountLabel5); + this.groupBox5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.groupBox5.ForeColor = System.Drawing.Color.Black; + this.groupBox5.Location = new System.Drawing.Point(25, 372); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Size = new System.Drawing.Size(333, 81); + this.groupBox5.TabIndex = 5; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "Water Meter 5"; + // + // wmErrorTextBox5 + // + this.wmPulsesCountTextBox5.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox5.Location = new System.Drawing.Point(183, 21); + this.wmPulsesCountTextBox5.Name = "wmErrorTextBox5"; + this.wmPulsesCountTextBox5.Size = new System.Drawing.Size(137, 52); + this.wmPulsesCountTextBox5.TabIndex = 1; + // + // wmErrorLabel5 + // + this.wmPulsesCountLabel5.AutoSize = true; + this.wmPulsesCountLabel5.Location = new System.Drawing.Point(18, 34); + this.wmPulsesCountLabel5.Name = "wmErrorLabel5"; + this.wmPulsesCountLabel5.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel5.TabIndex = 0; + this.wmPulsesCountLabel5.Text = "Error [%]"; + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.wmPulsesCountTextBox6); + this.groupBox6.Controls.Add(this.wmPulsesCountLabel6); + this.groupBox6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.groupBox6.ForeColor = System.Drawing.Color.Black; + this.groupBox6.Location = new System.Drawing.Point(25, 462); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(333, 81); + this.groupBox6.TabIndex = 6; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "Water Meter 6"; + // + // wmErrorTextBox6 + // + this.wmPulsesCountTextBox6.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox6.Location = new System.Drawing.Point(183, 21); + this.wmPulsesCountTextBox6.Name = "wmErrorTextBox6"; + this.wmPulsesCountTextBox6.Size = new System.Drawing.Size(137, 52); + this.wmPulsesCountTextBox6.TabIndex = 1; + // + // wmErrorLabel6 + // + this.wmPulsesCountLabel6.AutoSize = true; + this.wmPulsesCountLabel6.Location = new System.Drawing.Point(18, 34); + this.wmPulsesCountLabel6.Name = "wmErrorLabel6"; + this.wmPulsesCountLabel6.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel6.TabIndex = 0; + this.wmPulsesCountLabel6.Text = "Error [%]"; + // + // WMErrorsForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.DarkGoldenrod; + this.ClientSize = new System.Drawing.Size(868, 565); + this.Controls.Add(this.groupBox6); + this.Controls.Add(this.groupBox5); + this.Controls.Add(this.groupBox4); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.okButton); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "WMErrorsForm"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Water Meter States"; + this.TopMost = true; + this.Load += new System.EventHandler(this.WMPulsesForm_Load); + this.Paint += new System.Windows.Forms.PaintEventHandler(this.WMPulsesForm_Paint); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + this.groupBox5.ResumeLayout(false); + this.groupBox5.PerformLayout(); + this.groupBox6.ResumeLayout(false); + this.groupBox6.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TextBox wmPulsesCountTextBox2; + private System.Windows.Forms.Label wmPulsesCountLabel2; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TextBox wmPulsesCountTextBox1; + private System.Windows.Forms.Label wmPulsesCountLabel1; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.TextBox wmPulsesCountTextBox3; + private System.Windows.Forms.Label wmPulsesCountLabel3; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.TextBox wmPulsesCountTextBox4; + private System.Windows.Forms.Label wmPulsesCountLabel4; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.TextBox wmPulsesCountTextBox5; + private System.Windows.Forms.Label wmPulsesCountLabel5; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.TextBox wmPulsesCountTextBox6; + private System.Windows.Forms.Label wmPulsesCountLabel6; + + } +} \ No newline at end of file diff --git a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm.resx b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm.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/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.cs b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.cs new file mode 100644 index 000000000..0c7c7c2ad --- /dev/null +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.cs @@ -0,0 +1,238 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Windows.Forms; +using log4net; +using Config.Entities; +using TBF.Resources; + +namespace TBF.BenchControl.TestMethods.PulsesTest +{ + public partial class WMPulsesForm12 : Form, GenericDevices.IHasCompleted + { + private static readonly ILog log = LogManager.GetLogger(typeof(WMPulsesForm12)); + + const int MaxWMsCount = 12; /// Implementation limit of this form + + /// + /// Updated in constructor + /// + readonly int waterMetersCount; /// Number of text boxes for serial numbers + readonly bool[] disabled; + int textBoxesCount; + Label[] labels; + TextBox[] pulsesCountTextBox; + Rectangle[] rects; + + /// + /// Updated in OnAdjustmentInProgress() + /// + double[] pulsesCount; /// Created in constructor + double limitLo; + + /// + /// Set to 'true' when the form closes + /// + public bool Completed { get { return completed; } } + bool completed; + + + /// Parameterless constructor for 3 watermeters + public WMPulsesForm12() + { + InitializeComponent(); + ControlBox = false; + + textBoxesCount = MaxWMsCount; + + labels = new Label[MaxWMsCount] + { + wmPulsesCountLabel1, wmPulsesCountLabel2, wmPulsesCountLabel3, wmPulsesCountLabel4, + wmPulsesCountLabel5, wmPulsesCountLabel6, wmPulsesCountLabel7, wmPulsesCountLabel8, + wmPulsesCountLabel9, wmPulsesCountLabel10, wmPulsesCountLabel11, wmPulsesCountLabel12, + }; + pulsesCountTextBox = new TextBox[MaxWMsCount] + { + wmPulsesCountTextBox1, wmPulsesCountTextBox2, wmPulsesCountTextBox3, wmPulsesCountTextBox4, + wmPulsesCountTextBox5, wmPulsesCountTextBox6, wmPulsesCountTextBox7, wmPulsesCountTextBox8, + wmPulsesCountTextBox9, wmPulsesCountTextBox10, wmPulsesCountTextBox11, wmPulsesCountTextBox12, + }; + + rects = new Rectangle[MaxWMsCount]; + for (int i = 0; i < MaxWMsCount; i++) + { + int row = i % 12; + int col = i / 12; + rects[i] = new Rectangle(350 + col * 557, 25 + row * 47, 230, 37); + } + + completed = false; + + /// Attach to 'AdjustmentInProgress' handler + UiBridge.Bridge.PulsesTestInProgressHandler += delegate(object sender, UiBridge.PulsesTestInProgressEventArgs args) + { + if (InvokeRequired) + { + Invoke(new EventHandler(OnPulsesTestInProgress), sender, args); + } + else OnPulsesTestInProgress(sender, args); + }; + } + + /// + /// Constructor + /// + /// Number of text boxes for serial numbers + public WMPulsesForm12(IList waterMeters) + : this() + { + waterMetersCount = waterMeters.Count; + + ShuffleTextBoxes(waterMetersCount, Config.Data.LineSize); + + disabled = new bool[waterMetersCount]; + for (int i = 0; i < waterMetersCount; i++) disabled[i] = waterMeters[i].Disabled; + + pulsesCount = new double[waterMetersCount]; + } + + + /// + /// Make sure the layout of labels/text boxes on the screen + /// corresponds to the layout of watermeters of the test bench. + /// + /// Number of watermeters + /// Number of watermeters in one line + void ShuffleTextBoxes(int wmsCount, int lineSize) + { + if (wmsCount < textBoxesCount && lineSize > 0) + { + int nrLines = (wmsCount + lineSize - 1) / lineSize; + int gap = (textBoxesCount - wmsCount) / nrLines; + + int dest = 0; + for (int l = 0; l < nrLines; l++) + { + for (int i = 0; i < lineSize; i++) + { + labels[dest] = labels[l * lineSize + l * gap + i]; + pulsesCountTextBox[dest] = pulsesCountTextBox[l * lineSize + l * gap + i]; + rects[dest] = rects[l * lineSize + l * gap + i]; + dest++; + } + } + textBoxesCount = wmsCount; + } + } + + + void Localize() + { + Text = Strings.Water_Meter_States; + for (int i = 0; i < textBoxesCount; i++) + { + labels[i].Text = string.Format("WM{0} {1}", i + 1, Strings.Error_pct); + } + okButton.Text = Strings.OkBtnText; + } + + private void WMPulsesForm12_Load(object sender, EventArgs e) + { + Localize(); + + //Height = 50 + 90 * WaterMetersCount; + + for (int i = 0; i < textBoxesCount; i++) + { + labels[i].Visible = pulsesCountTextBox[i].Visible = (disabled == null || i >= disabled.Length || !disabled[i]); + pulsesCountTextBox[i].Text = "---"; + } + } + + private void okButton_Click(object sender, EventArgs e) + { + completed = true; + Close(); + } + + void OnPulsesTestInProgress(object sender, UiBridge.PulsesTestInProgressEventArgs args) + { + string testName = args.TestName; + limitLo = args.LimitLo; + + Results.Entities.TestRslt tr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetTestRslt(testName, 0); + + int count = Math.Min(waterMetersCount, TBF.BenchControl.Sequences.ProcessData.BatchRslts.WMPositionsCount); + for (int i = 0; i < count; i++) + { + Results.Entities.MeterTestRslt mtr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single); + if (mtr != null) pulsesCount[i] = mtr.PulsesMeter; + } + + Redraw(); + } + + void Redraw() + { + for (int i = 0; i < textBoxesCount; i++) + { + pulsesCountTextBox[i].Text = pulsesCount[i].ToString("F0"); + Invalidate(rects[i]); + } + } + + private void WMPulsesForm12_Paint(object sender, PaintEventArgs e) + { + System.Drawing.Graphics graphics = this.CreateGraphics(); + + for (int i = 0; i < waterMetersCount; i++) + { + if (!disabled[i]) + { + PaintOne(graphics, rects[i], pulsesCount[i], limitLo); + } + } + } + + void PaintOne(System.Drawing.Graphics g, Rectangle r, double value, double limLo) + { + Rectangle rect1 = new Rectangle(r.Left, r.Top, r.Width / 3, r.Height); + Rectangle rect2 = new Rectangle(r.Left + r.Width / 3, r.Top, r.Width / 3, r.Height); + Rectangle rect3 = new Rectangle(r.Left + 2 * (r.Width / 3), r.Top, r.Width / 3, r.Height); + + Brush redBrush = new SolidBrush(Color.FromName("Salmon")); + Brush greenBrush = new SolidBrush(Color.FromName("LightGreen")); + Brush centBrush = new SolidBrush(Color.FromName("Green")); + if (value >= limLo) + { + g.FillRectangle(greenBrush, rect2); + } + else + { + g.FillRectangle(redBrush, rect2); + } + } + + #region Forced close handling + + public void StartForceCloseHandler() + { + UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args) + { + if (InvokeRequired) { Invoke(new EventHandler(OnForceClose), sender, args); } + else OnForceClose(sender, args); + }; + } + + void OnForceClose(object sender, EventArgs args) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + #endregion + } +} diff --git a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.designer.cs b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.designer.cs new file mode 100644 index 000000000..1ba2697d6 --- /dev/null +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.designer.cs @@ -0,0 +1,385 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +namespace TBF.BenchControl.TestMethods.PulsesTest +{ + partial class WMPulsesForm12 + { + /// + /// 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 Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.wmPulsesCountTextBox2 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel2 = new System.Windows.Forms.Label(); + this.wmPulsesCountLabel1 = new System.Windows.Forms.Label(); + this.okButton = new System.Windows.Forms.Button(); + this.wmPulsesCountTextBox3 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel3 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox4 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel4 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox5 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel5 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox6 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel6 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox1 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountTextBox7 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel7 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox8 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel8 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox9 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel9 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox10 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel10 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox12 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel12 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox11 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel11 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // wmErrorTextBox2 + // + this.wmPulsesCountTextBox2.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox2.Location = new System.Drawing.Point(198, 74); + this.wmPulsesCountTextBox2.Name = "wmErrorTextBox2"; + this.wmPulsesCountTextBox2.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox2.TabIndex = 1; + this.wmPulsesCountTextBox2.Visible = false; + // + // wmErrorLabel2 + // + this.wmPulsesCountLabel2.AutoSize = true; + this.wmPulsesCountLabel2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel2.Location = new System.Drawing.Point(33, 85); + this.wmPulsesCountLabel2.Name = "wmErrorLabel2"; + this.wmPulsesCountLabel2.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel2.TabIndex = 0; + this.wmPulsesCountLabel2.Text = "Error [%]"; + this.wmPulsesCountLabel2.Visible = false; + // + // wmErrorLabel1 + // + this.wmPulsesCountLabel1.AutoSize = true; + this.wmPulsesCountLabel1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel1.Location = new System.Drawing.Point(33, 39); + this.wmPulsesCountLabel1.Name = "wmErrorLabel1"; + this.wmPulsesCountLabel1.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel1.TabIndex = 0; + this.wmPulsesCountLabel1.Text = "Error [%]"; + this.wmPulsesCountLabel1.Visible = false; + // + // okButton + // + this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.okButton.ForeColor = System.Drawing.Color.Black; + this.okButton.Location = new System.Drawing.Point(601, 28); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(98, 63); + this.okButton.TabIndex = 7; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // wmErrorTextBox3 + // + this.wmPulsesCountTextBox3.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox3.Location = new System.Drawing.Point(198, 120); + this.wmPulsesCountTextBox3.Name = "wmErrorTextBox3"; + this.wmPulsesCountTextBox3.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox3.TabIndex = 1; + this.wmPulsesCountTextBox3.Visible = false; + // + // wmErrorLabel3 + // + this.wmPulsesCountLabel3.AutoSize = true; + this.wmPulsesCountLabel3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel3.Location = new System.Drawing.Point(33, 131); + this.wmPulsesCountLabel3.Name = "wmErrorLabel3"; + this.wmPulsesCountLabel3.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel3.TabIndex = 0; + this.wmPulsesCountLabel3.Text = "Error [%]"; + this.wmPulsesCountLabel3.Visible = false; + // + // wmErrorTextBox4 + // + this.wmPulsesCountTextBox4.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox4.Location = new System.Drawing.Point(198, 166); + this.wmPulsesCountTextBox4.Name = "wmErrorTextBox4"; + this.wmPulsesCountTextBox4.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox4.TabIndex = 1; + this.wmPulsesCountTextBox4.Visible = false; + // + // wmErrorLabel4 + // + this.wmPulsesCountLabel4.AutoSize = true; + this.wmPulsesCountLabel4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel4.Location = new System.Drawing.Point(33, 177); + this.wmPulsesCountLabel4.Name = "wmErrorLabel4"; + this.wmPulsesCountLabel4.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel4.TabIndex = 0; + this.wmPulsesCountLabel4.Text = "Error [%]"; + this.wmPulsesCountLabel4.Visible = false; + // + // wmErrorTextBox5 + // + this.wmPulsesCountTextBox5.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox5.Location = new System.Drawing.Point(198, 213); + this.wmPulsesCountTextBox5.Name = "wmErrorTextBox5"; + this.wmPulsesCountTextBox5.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox5.TabIndex = 1; + this.wmPulsesCountTextBox5.Visible = false; + // + // wmErrorLabel5 + // + this.wmPulsesCountLabel5.AutoSize = true; + this.wmPulsesCountLabel5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel5.Location = new System.Drawing.Point(33, 224); + this.wmPulsesCountLabel5.Name = "wmErrorLabel5"; + this.wmPulsesCountLabel5.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel5.TabIndex = 0; + this.wmPulsesCountLabel5.Text = "Error [%]"; + this.wmPulsesCountLabel5.Visible = false; + // + // wmErrorTextBox6 + // + this.wmPulsesCountTextBox6.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox6.Location = new System.Drawing.Point(198, 259); + this.wmPulsesCountTextBox6.Name = "wmErrorTextBox6"; + this.wmPulsesCountTextBox6.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox6.TabIndex = 1; + this.wmPulsesCountTextBox6.Visible = false; + // + // wmErrorLabel6 + // + this.wmPulsesCountLabel6.AutoSize = true; + this.wmPulsesCountLabel6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel6.Location = new System.Drawing.Point(33, 271); + this.wmPulsesCountLabel6.Name = "wmErrorLabel6"; + this.wmPulsesCountLabel6.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel6.TabIndex = 0; + this.wmPulsesCountLabel6.Text = "Error [%]"; + this.wmPulsesCountLabel6.Visible = false; + // + // wmErrorTextBox1 + // + this.wmPulsesCountTextBox1.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox1.Location = new System.Drawing.Point(198, 28); + this.wmPulsesCountTextBox1.Name = "wmErrorTextBox1"; + this.wmPulsesCountTextBox1.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox1.TabIndex = 1; + this.wmPulsesCountTextBox1.Visible = false; + // + // wmErrorTextBox7 + // + this.wmPulsesCountTextBox7.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox7.Location = new System.Drawing.Point(198, 305); + this.wmPulsesCountTextBox7.Name = "wmErrorTextBox7"; + this.wmPulsesCountTextBox7.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox7.TabIndex = 9; + this.wmPulsesCountTextBox7.Visible = false; + // + // wmErrorLabel7 + // + this.wmPulsesCountLabel7.AutoSize = true; + this.wmPulsesCountLabel7.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel7.Location = new System.Drawing.Point(33, 317); + this.wmPulsesCountLabel7.Name = "wmErrorLabel7"; + this.wmPulsesCountLabel7.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel7.TabIndex = 8; + this.wmPulsesCountLabel7.Text = "Error [%]"; + this.wmPulsesCountLabel7.Visible = false; + // + // wmErrorTextBox8 + // + this.wmPulsesCountTextBox8.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox8.Location = new System.Drawing.Point(198, 351); + this.wmPulsesCountTextBox8.Name = "wmErrorTextBox8"; + this.wmPulsesCountTextBox8.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox8.TabIndex = 11; + this.wmPulsesCountTextBox8.Visible = false; + // + // wmErrorLabel8 + // + this.wmPulsesCountLabel8.AutoSize = true; + this.wmPulsesCountLabel8.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel8.Location = new System.Drawing.Point(33, 363); + this.wmPulsesCountLabel8.Name = "wmErrorLabel8"; + this.wmPulsesCountLabel8.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel8.TabIndex = 10; + this.wmPulsesCountLabel8.Text = "Error [%]"; + this.wmPulsesCountLabel8.Visible = false; + // + // wmErrorTextBox9 + // + this.wmPulsesCountTextBox9.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox9.Location = new System.Drawing.Point(198, 397); + this.wmPulsesCountTextBox9.Name = "wmErrorTextBox9"; + this.wmPulsesCountTextBox9.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox9.TabIndex = 13; + this.wmPulsesCountTextBox9.Visible = false; + // + // wmErrorLabel9 + // + this.wmPulsesCountLabel9.AutoSize = true; + this.wmPulsesCountLabel9.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel9.Location = new System.Drawing.Point(33, 408); + this.wmPulsesCountLabel9.Name = "wmErrorLabel9"; + this.wmPulsesCountLabel9.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel9.TabIndex = 12; + this.wmPulsesCountLabel9.Text = "Error [%]"; + this.wmPulsesCountLabel9.Visible = false; + // + // wmErrorTextBox10 + // + this.wmPulsesCountTextBox10.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox10.Location = new System.Drawing.Point(198, 443); + this.wmPulsesCountTextBox10.Name = "wmErrorTextBox10"; + this.wmPulsesCountTextBox10.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox10.TabIndex = 15; + this.wmPulsesCountTextBox10.Visible = false; + // + // wmErrorLabel10 + // + this.wmPulsesCountLabel10.AutoSize = true; + this.wmPulsesCountLabel10.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel10.Location = new System.Drawing.Point(33, 454); + this.wmPulsesCountLabel10.Name = "wmErrorLabel10"; + this.wmPulsesCountLabel10.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel10.TabIndex = 14; + this.wmPulsesCountLabel10.Text = "Error [%]"; + this.wmPulsesCountLabel10.Visible = false; + // + // wmErrorTextBox12 + // + this.wmPulsesCountTextBox12.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox12.Location = new System.Drawing.Point(198, 535); + this.wmPulsesCountTextBox12.Name = "wmErrorTextBox12"; + this.wmPulsesCountTextBox12.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox12.TabIndex = 19; + this.wmPulsesCountTextBox12.Visible = false; + // + // wmErrorLabel12 + // + this.wmPulsesCountLabel12.AutoSize = true; + this.wmPulsesCountLabel12.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel12.Location = new System.Drawing.Point(33, 546); + this.wmPulsesCountLabel12.Name = "wmErrorLabel12"; + this.wmPulsesCountLabel12.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel12.TabIndex = 18; + this.wmPulsesCountLabel12.Text = "Error [%]"; + this.wmPulsesCountLabel12.Visible = false; + // + // wmErrorTextBox11 + // + this.wmPulsesCountTextBox11.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox11.Location = new System.Drawing.Point(198, 489); + this.wmPulsesCountTextBox11.Name = "wmErrorTextBox11"; + this.wmPulsesCountTextBox11.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox11.TabIndex = 17; + this.wmPulsesCountTextBox11.Visible = false; + // + // wmErrorLabel11 + // + this.wmPulsesCountLabel11.AutoSize = true; + this.wmPulsesCountLabel11.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel11.Location = new System.Drawing.Point(33, 500); + this.wmPulsesCountLabel11.Name = "wmErrorLabel11"; + this.wmPulsesCountLabel11.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel11.TabIndex = 16; + this.wmPulsesCountLabel11.Text = "Error [%]"; + this.wmPulsesCountLabel11.Visible = false; + // + // WMErrorsForm12 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.DarkGoldenrod; + this.ClientSize = new System.Drawing.Size(731, 592); + this.Controls.Add(this.wmPulsesCountTextBox12); + this.Controls.Add(this.wmPulsesCountLabel12); + this.Controls.Add(this.wmPulsesCountTextBox11); + this.Controls.Add(this.wmPulsesCountLabel11); + this.Controls.Add(this.wmPulsesCountTextBox10); + this.Controls.Add(this.wmPulsesCountLabel10); + this.Controls.Add(this.wmPulsesCountTextBox9); + this.Controls.Add(this.wmPulsesCountLabel9); + this.Controls.Add(this.wmPulsesCountTextBox8); + this.Controls.Add(this.wmPulsesCountLabel8); + this.Controls.Add(this.wmPulsesCountTextBox7); + this.Controls.Add(this.wmPulsesCountLabel7); + this.Controls.Add(this.wmPulsesCountTextBox6); + this.Controls.Add(this.wmPulsesCountLabel6); + this.Controls.Add(this.wmPulsesCountTextBox5); + this.Controls.Add(this.wmPulsesCountLabel5); + this.Controls.Add(this.wmPulsesCountTextBox4); + this.Controls.Add(this.wmPulsesCountLabel4); + this.Controls.Add(this.wmPulsesCountTextBox3); + this.Controls.Add(this.wmPulsesCountLabel3); + this.Controls.Add(this.wmPulsesCountTextBox2); + this.Controls.Add(this.wmPulsesCountLabel2); + this.Controls.Add(this.wmPulsesCountTextBox1); + this.Controls.Add(this.wmPulsesCountLabel1); + this.Controls.Add(this.okButton); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "WMErrorsForm12"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Water Meter States"; + this.TopMost = true; + this.Load += new System.EventHandler(this.WMPulsesForm12_Load); + this.Paint += new System.Windows.Forms.PaintEventHandler(this.WMPulsesForm12_Paint); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox wmPulsesCountTextBox2; + private System.Windows.Forms.Label wmPulsesCountLabel2; + private System.Windows.Forms.Label wmPulsesCountLabel1; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.TextBox wmPulsesCountTextBox3; + private System.Windows.Forms.Label wmPulsesCountLabel3; + private System.Windows.Forms.TextBox wmPulsesCountTextBox4; + private System.Windows.Forms.Label wmPulsesCountLabel4; + private System.Windows.Forms.TextBox wmPulsesCountTextBox5; + private System.Windows.Forms.Label wmPulsesCountLabel5; + private System.Windows.Forms.TextBox wmPulsesCountTextBox6; + private System.Windows.Forms.Label wmPulsesCountLabel6; + private System.Windows.Forms.TextBox wmPulsesCountTextBox1; + private System.Windows.Forms.TextBox wmPulsesCountTextBox7; + private System.Windows.Forms.Label wmPulsesCountLabel7; + private System.Windows.Forms.TextBox wmPulsesCountTextBox8; + private System.Windows.Forms.Label wmPulsesCountLabel8; + private System.Windows.Forms.TextBox wmPulsesCountTextBox9; + private System.Windows.Forms.Label wmPulsesCountLabel9; + private System.Windows.Forms.TextBox wmPulsesCountTextBox10; + private System.Windows.Forms.Label wmPulsesCountLabel10; + private System.Windows.Forms.TextBox wmPulsesCountTextBox12; + private System.Windows.Forms.Label wmPulsesCountLabel12; + private System.Windows.Forms.TextBox wmPulsesCountTextBox11; + private System.Windows.Forms.Label wmPulsesCountLabel11; + + } +} \ No newline at end of file diff --git a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.resx b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm12.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/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.cs b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.cs new file mode 100644 index 000000000..1efa6f3d2 --- /dev/null +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.cs @@ -0,0 +1,244 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Windows.Forms; +using log4net; +using Config.Entities; +using TBF.Resources; + +namespace TBF.BenchControl.TestMethods.PulsesTest +{ + public partial class WMPulsesForm24 : Form, GenericDevices.IHasCompleted + { + private static readonly ILog log = LogManager.GetLogger(typeof(WMPulsesForm24)); + + const int MaxWMsCount = 24; /// Implementation limit of this form + + /// + /// Updated in constructor + /// + readonly int waterMetersCount; /// Number of text boxes for serial numbers + readonly bool[] disabled; + int textBoxesCount; + Label[] labels; + TextBox[] pulsesCountTextBox; + Rectangle[] rects; + + /// + /// Updated in OnAdjustmentInProgress() + /// + double[] pulsesCount; /// Created in constructor + double limitLo; + + /// + /// Set to 'true' when the form closes + /// + public bool Completed { get { return completed; } } + bool completed; + + + /// Parameterless constructor for 3 watermeters + public WMPulsesForm24() + { + InitializeComponent(); + ControlBox = false; + + textBoxesCount = MaxWMsCount; + + labels = new Label[MaxWMsCount] + { + wmPulsesCountLabel1, wmPulsesCountLabel2, wmPulsesCountLabel3, wmPulsesCountLabel4, + wmPulsesCountLabel5, wmPulsesCountLabel6, wmPulsesCountLabel7, wmPulsesCountLabel8, + wmPulsesCountLabel9, wmPulsesCountLabel10, wmPulsesCountLabel11, wmPulsesCountLabel12, + wmPulsesCountLabel13, wmPulsesCountLabel14, wmPulsesCountLabel15, wmPulsesCountLabel16, + wmPulsesCountLabel17, wmPulsesCountLabel18, wmPulsesCountLabel19, wmPulsesCountLabel20, + wmPulsesCountLabel21, wmPulsesCountLabel22, wmPulsesCountLabel23, wmPulsesCountLabel24, + }; + pulsesCountTextBox = new TextBox[MaxWMsCount] + { + wmPulsesCountTextBox1, wmPulsesCountTextBox2, wmPulsesCountTextBox3, wmPulsesCountTextBox4, + wmPulsesCountTextBox5, wmPulsesCountTextBox6, wmPulsesCountTextBox7, wmPulsesCountTextBox8, + wmPulsesCountTextBox9, wmPulsesCountTextBox10, wmPulsesCountTextBox11, wmPulsesCountTextBox12, + wmPulsesCountTextBox13, wmPulsesCountTextBox14, wmPulsesCountTextBox15, wmPulsesCountTextBox16, + wmPulsesCountTextBox17, wmPulsesCountTextBox18, wmPulsesCountTextBox19, wmPulsesCountTextBox20, + wmPulsesCountTextBox21, wmPulsesCountTextBox22, wmPulsesCountTextBox23, wmPulsesCountTextBox24, + }; + + rects = new Rectangle[MaxWMsCount]; + for (int i = 0; i < MaxWMsCount; i++) + { + int row = i % 12; + int col = i / 12; + rects[i] = new Rectangle(350 + col * 557, 25 + row * 47, 230, 37); + } + + completed = false; + + /// Attach to 'AdjustmentInProgress' handler + UiBridge.Bridge.PulsesTestInProgressHandler += delegate(object sender, UiBridge.PulsesTestInProgressEventArgs args) + { + if (InvokeRequired) + { + Invoke(new EventHandler(OnPulsesTestInProgress), sender, args); + } + else OnPulsesTestInProgress(sender, args); + }; + } + + /// + /// Constructor + /// + /// Number of text boxes for serial numbers + public WMPulsesForm24(IList waterMeters) + : this() + { + waterMetersCount = waterMeters.Count; + + ShuffleTextBoxes(waterMetersCount, Config.Data.LineSize); + + disabled = new bool[waterMetersCount]; + for (int i = 0; i < waterMetersCount; i++) disabled[i] = waterMeters[i].Disabled; + + pulsesCount = new double[waterMetersCount]; + } + + + /// + /// Make sure the layout of labels/text boxes on the screen + /// corresponds to the layout of watermeters of the test bench. + /// + /// Number of watermeters + /// Number of watermeters in one line + void ShuffleTextBoxes(int wmsCount, int lineSize) + { + if (wmsCount < textBoxesCount && lineSize > 0) + { + int nrLines = (wmsCount + lineSize - 1) / lineSize; + int gap = (textBoxesCount - wmsCount) / nrLines; + + int dest = 0; + for (int l = 0; l < nrLines; l++) + { + for (int i = 0; i < lineSize; i++) + { + labels[dest] = labels[l * lineSize + l * gap + i]; + pulsesCountTextBox[dest] = pulsesCountTextBox[l * lineSize + l * gap + i]; + rects[dest] = rects[l * lineSize + l * gap + i]; + dest++; + } + } + textBoxesCount = wmsCount; + } + } + + + void Localize() + { + Text = Strings.Water_Meter_States; + for (int i = 0; i < textBoxesCount; i++) + { + labels[i].Text = string.Format("WM{0} {1}", i + 1, Strings.Error_pct); + } + okButton.Text = Strings.OkBtnText; + } + + private void WMPulsesForm24_Load(object sender, EventArgs e) + { + Localize(); + + //Height = 50 + 90 * WaterMetersCount; + + for (int i = 0; i < textBoxesCount; i++) + { + labels[i].Visible = pulsesCountTextBox[i].Visible = (disabled == null || i >= disabled.Length || !disabled[i]); + pulsesCountTextBox[i].Text = "---"; + } + } + + private void okButton_Click(object sender, EventArgs e) + { + completed = true; + Close(); + } + + void OnPulsesTestInProgress(object sender, UiBridge.PulsesTestInProgressEventArgs args) + { + string testName = args.TestName; + limitLo = args.LimitLo; + + Results.Entities.TestRslt tr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetTestRslt(testName, 0); + + int count = Math.Min(waterMetersCount, TBF.BenchControl.Sequences.ProcessData.BatchRslts.WMPositionsCount); + for (int i = 0; i < count; i++) + { + Results.Entities.MeterTestRslt mtr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single); + if (mtr != null) pulsesCount[i] = mtr.PulsesMeter; + } + + Redraw(); + } + + void Redraw() + { + for (int i = 0; i < textBoxesCount; i++) + { + pulsesCountTextBox[i].Text = pulsesCount[i].ToString("F0"); + Invalidate(rects[i]); + } + } + + private void WMPulsesForm24_Paint(object sender, PaintEventArgs e) + { + System.Drawing.Graphics graphics = this.CreateGraphics(); + + for (int i = 0; i < waterMetersCount; i++) + { + if (!disabled[i]) + { + PaintOne(graphics, rects[i], pulsesCount[i], limitLo); + } + } + } + + void PaintOne(System.Drawing.Graphics g, Rectangle r, double value, double limLo) + { + Rectangle rect1 = new Rectangle(r.Left, r.Top, r.Width / 3, r.Height); + Rectangle rect2 = new Rectangle(r.Left + r.Width / 3, r.Top, r.Width / 3, r.Height); + Rectangle rect3 = new Rectangle(r.Left + 2 * (r.Width / 3), r.Top, r.Width / 3, r.Height); + + Brush redBrush = new SolidBrush(Color.FromName("Salmon")); + Brush greenBrush = new SolidBrush(Color.FromName("LightGreen")); + Brush centBrush = new SolidBrush(Color.FromName("Green")); + if (value >= limLo) + { + g.FillRectangle(greenBrush, rect2); + } + else + { + g.FillRectangle(redBrush, rect2); + } + } + + #region Forced close handling + + public void StartForceCloseHandler() + { + UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args) + { + if (InvokeRequired) { Invoke(new EventHandler(OnForceClose), sender, args); } + else OnForceClose(sender, args); + }; + } + + void OnForceClose(object sender, EventArgs args) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + #endregion + } +} diff --git a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.designer.cs b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.designer.cs new file mode 100644 index 000000000..57b65d30b --- /dev/null +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.designer.cs @@ -0,0 +1,697 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +namespace TBF.BenchControl.TestMethods.PulsesTest +{ + partial class WMPulsesForm24 + { + /// + /// 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 Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.wmPulsesCountTextBox2 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel2 = new System.Windows.Forms.Label(); + this.wmPulsesCountLabel1 = new System.Windows.Forms.Label(); + this.okButton = new System.Windows.Forms.Button(); + this.wmPulsesCountTextBox3 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel3 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox4 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel4 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox5 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel5 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox6 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel6 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox1 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountTextBox7 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel7 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox8 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel8 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox9 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel9 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox10 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel10 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox12 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel12 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox11 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel11 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox24 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel24 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox23 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel23 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox22 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel22 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox21 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel21 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox20 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel20 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox19 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel19 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox18 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel18 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox17 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel17 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox16 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel16 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox15 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel15 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox14 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel14 = new System.Windows.Forms.Label(); + this.wmPulsesCountTextBox13 = new System.Windows.Forms.TextBox(); + this.wmPulsesCountLabel13 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // wmErrorTextBox2 + // + this.wmPulsesCountTextBox2.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox2.Location = new System.Drawing.Point(198, 74); + this.wmPulsesCountTextBox2.Name = "wmErrorTextBox2"; + this.wmPulsesCountTextBox2.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox2.TabIndex = 1; + this.wmPulsesCountTextBox2.Visible = false; + // + // wmErrorLabel2 + // + this.wmPulsesCountLabel2.AutoSize = true; + this.wmPulsesCountLabel2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel2.Location = new System.Drawing.Point(33, 85); + this.wmPulsesCountLabel2.Name = "wmErrorLabel2"; + this.wmPulsesCountLabel2.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel2.TabIndex = 0; + this.wmPulsesCountLabel2.Text = "Error [%]"; + this.wmPulsesCountLabel2.Visible = false; + // + // wmErrorLabel1 + // + this.wmPulsesCountLabel1.AutoSize = true; + this.wmPulsesCountLabel1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel1.Location = new System.Drawing.Point(33, 39); + this.wmPulsesCountLabel1.Name = "wmErrorLabel1"; + this.wmPulsesCountLabel1.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel1.TabIndex = 0; + this.wmPulsesCountLabel1.Text = "Error [%]"; + this.wmPulsesCountLabel1.Visible = false; + // + // okButton + // + this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.okButton.ForeColor = System.Drawing.Color.Black; + this.okButton.Location = new System.Drawing.Point(1157, 28); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(98, 63); + this.okButton.TabIndex = 7; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // wmErrorTextBox3 + // + this.wmPulsesCountTextBox3.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox3.Location = new System.Drawing.Point(198, 120); + this.wmPulsesCountTextBox3.Name = "wmErrorTextBox3"; + this.wmPulsesCountTextBox3.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox3.TabIndex = 1; + this.wmPulsesCountTextBox3.Visible = false; + // + // wmErrorLabel3 + // + this.wmPulsesCountLabel3.AutoSize = true; + this.wmPulsesCountLabel3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel3.Location = new System.Drawing.Point(33, 131); + this.wmPulsesCountLabel3.Name = "wmErrorLabel3"; + this.wmPulsesCountLabel3.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel3.TabIndex = 0; + this.wmPulsesCountLabel3.Text = "Error [%]"; + this.wmPulsesCountLabel3.Visible = false; + // + // wmErrorTextBox4 + // + this.wmPulsesCountTextBox4.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox4.Location = new System.Drawing.Point(198, 166); + this.wmPulsesCountTextBox4.Name = "wmErrorTextBox4"; + this.wmPulsesCountTextBox4.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox4.TabIndex = 1; + this.wmPulsesCountTextBox4.Visible = false; + // + // wmErrorLabel4 + // + this.wmPulsesCountLabel4.AutoSize = true; + this.wmPulsesCountLabel4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel4.Location = new System.Drawing.Point(33, 177); + this.wmPulsesCountLabel4.Name = "wmErrorLabel4"; + this.wmPulsesCountLabel4.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel4.TabIndex = 0; + this.wmPulsesCountLabel4.Text = "Error [%]"; + this.wmPulsesCountLabel4.Visible = false; + // + // wmErrorTextBox5 + // + this.wmPulsesCountTextBox5.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox5.Location = new System.Drawing.Point(198, 213); + this.wmPulsesCountTextBox5.Name = "wmErrorTextBox5"; + this.wmPulsesCountTextBox5.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox5.TabIndex = 1; + this.wmPulsesCountTextBox5.Visible = false; + // + // wmErrorLabel5 + // + this.wmPulsesCountLabel5.AutoSize = true; + this.wmPulsesCountLabel5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel5.Location = new System.Drawing.Point(33, 224); + this.wmPulsesCountLabel5.Name = "wmErrorLabel5"; + this.wmPulsesCountLabel5.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel5.TabIndex = 0; + this.wmPulsesCountLabel5.Text = "Error [%]"; + this.wmPulsesCountLabel5.Visible = false; + // + // wmErrorTextBox6 + // + this.wmPulsesCountTextBox6.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox6.Location = new System.Drawing.Point(198, 259); + this.wmPulsesCountTextBox6.Name = "wmErrorTextBox6"; + this.wmPulsesCountTextBox6.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox6.TabIndex = 1; + this.wmPulsesCountTextBox6.Visible = false; + // + // wmErrorLabel6 + // + this.wmPulsesCountLabel6.AutoSize = true; + this.wmPulsesCountLabel6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel6.Location = new System.Drawing.Point(33, 271); + this.wmPulsesCountLabel6.Name = "wmErrorLabel6"; + this.wmPulsesCountLabel6.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel6.TabIndex = 0; + this.wmPulsesCountLabel6.Text = "Error [%]"; + this.wmPulsesCountLabel6.Visible = false; + // + // wmErrorTextBox1 + // + this.wmPulsesCountTextBox1.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox1.Location = new System.Drawing.Point(198, 28); + this.wmPulsesCountTextBox1.Name = "wmErrorTextBox1"; + this.wmPulsesCountTextBox1.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox1.TabIndex = 1; + this.wmPulsesCountTextBox1.Visible = false; + // + // wmErrorTextBox7 + // + this.wmPulsesCountTextBox7.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox7.Location = new System.Drawing.Point(198, 305); + this.wmPulsesCountTextBox7.Name = "wmErrorTextBox7"; + this.wmPulsesCountTextBox7.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox7.TabIndex = 9; + this.wmPulsesCountTextBox7.Visible = false; + // + // wmErrorLabel7 + // + this.wmPulsesCountLabel7.AutoSize = true; + this.wmPulsesCountLabel7.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel7.Location = new System.Drawing.Point(33, 317); + this.wmPulsesCountLabel7.Name = "wmErrorLabel7"; + this.wmPulsesCountLabel7.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel7.TabIndex = 8; + this.wmPulsesCountLabel7.Text = "Error [%]"; + this.wmPulsesCountLabel7.Visible = false; + // + // wmErrorTextBox8 + // + this.wmPulsesCountTextBox8.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox8.Location = new System.Drawing.Point(198, 351); + this.wmPulsesCountTextBox8.Name = "wmErrorTextBox8"; + this.wmPulsesCountTextBox8.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox8.TabIndex = 11; + this.wmPulsesCountTextBox8.Visible = false; + // + // wmErrorLabel8 + // + this.wmPulsesCountLabel8.AutoSize = true; + this.wmPulsesCountLabel8.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel8.Location = new System.Drawing.Point(33, 363); + this.wmPulsesCountLabel8.Name = "wmErrorLabel8"; + this.wmPulsesCountLabel8.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel8.TabIndex = 10; + this.wmPulsesCountLabel8.Text = "Error [%]"; + this.wmPulsesCountLabel8.Visible = false; + // + // wmErrorTextBox9 + // + this.wmPulsesCountTextBox9.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox9.Location = new System.Drawing.Point(198, 397); + this.wmPulsesCountTextBox9.Name = "wmErrorTextBox9"; + this.wmPulsesCountTextBox9.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox9.TabIndex = 13; + this.wmPulsesCountTextBox9.Visible = false; + // + // wmErrorLabel9 + // + this.wmPulsesCountLabel9.AutoSize = true; + this.wmPulsesCountLabel9.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel9.Location = new System.Drawing.Point(33, 408); + this.wmPulsesCountLabel9.Name = "wmErrorLabel9"; + this.wmPulsesCountLabel9.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel9.TabIndex = 12; + this.wmPulsesCountLabel9.Text = "Error [%]"; + this.wmPulsesCountLabel9.Visible = false; + // + // wmErrorTextBox10 + // + this.wmPulsesCountTextBox10.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox10.Location = new System.Drawing.Point(198, 443); + this.wmPulsesCountTextBox10.Name = "wmErrorTextBox10"; + this.wmPulsesCountTextBox10.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox10.TabIndex = 15; + this.wmPulsesCountTextBox10.Visible = false; + // + // wmErrorLabel10 + // + this.wmPulsesCountLabel10.AutoSize = true; + this.wmPulsesCountLabel10.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel10.Location = new System.Drawing.Point(33, 454); + this.wmPulsesCountLabel10.Name = "wmErrorLabel10"; + this.wmPulsesCountLabel10.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel10.TabIndex = 14; + this.wmPulsesCountLabel10.Text = "Error [%]"; + this.wmPulsesCountLabel10.Visible = false; + // + // wmErrorTextBox12 + // + this.wmPulsesCountTextBox12.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox12.Location = new System.Drawing.Point(198, 535); + this.wmPulsesCountTextBox12.Name = "wmErrorTextBox12"; + this.wmPulsesCountTextBox12.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox12.TabIndex = 19; + this.wmPulsesCountTextBox12.Visible = false; + // + // wmErrorLabel12 + // + this.wmPulsesCountLabel12.AutoSize = true; + this.wmPulsesCountLabel12.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel12.Location = new System.Drawing.Point(33, 546); + this.wmPulsesCountLabel12.Name = "wmErrorLabel12"; + this.wmPulsesCountLabel12.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel12.TabIndex = 18; + this.wmPulsesCountLabel12.Text = "Error [%]"; + this.wmPulsesCountLabel12.Visible = false; + // + // wmErrorTextBox11 + // + this.wmPulsesCountTextBox11.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox11.Location = new System.Drawing.Point(198, 489); + this.wmPulsesCountTextBox11.Name = "wmErrorTextBox11"; + this.wmPulsesCountTextBox11.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox11.TabIndex = 17; + this.wmPulsesCountTextBox11.Visible = false; + // + // wmErrorLabel11 + // + this.wmPulsesCountLabel11.AutoSize = true; + this.wmPulsesCountLabel11.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel11.Location = new System.Drawing.Point(33, 500); + this.wmPulsesCountLabel11.Name = "wmErrorLabel11"; + this.wmPulsesCountLabel11.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel11.TabIndex = 16; + this.wmPulsesCountLabel11.Text = "Error [%]"; + this.wmPulsesCountLabel11.Visible = false; + // + // wmErrorTextBox24 + // + this.wmPulsesCountTextBox24.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox24.Location = new System.Drawing.Point(754, 535); + this.wmPulsesCountTextBox24.Name = "wmErrorTextBox24"; + this.wmPulsesCountTextBox24.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox24.TabIndex = 43; + this.wmPulsesCountTextBox24.Visible = false; + // + // wmErrorLabel24 + // + this.wmPulsesCountLabel24.AutoSize = true; + this.wmPulsesCountLabel24.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel24.Location = new System.Drawing.Point(589, 546); + this.wmPulsesCountLabel24.Name = "wmErrorLabel24"; + this.wmPulsesCountLabel24.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel24.TabIndex = 42; + this.wmPulsesCountLabel24.Text = "Error [%]"; + this.wmPulsesCountLabel24.Visible = false; + // + // wmErrorTextBox23 + // + this.wmPulsesCountTextBox23.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox23.Location = new System.Drawing.Point(754, 489); + this.wmPulsesCountTextBox23.Name = "wmErrorTextBox23"; + this.wmPulsesCountTextBox23.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox23.TabIndex = 41; + this.wmPulsesCountTextBox23.Visible = false; + // + // wmErrorLabel23 + // + this.wmPulsesCountLabel23.AutoSize = true; + this.wmPulsesCountLabel23.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel23.Location = new System.Drawing.Point(589, 500); + this.wmPulsesCountLabel23.Name = "wmErrorLabel23"; + this.wmPulsesCountLabel23.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel23.TabIndex = 40; + this.wmPulsesCountLabel23.Text = "Error [%]"; + this.wmPulsesCountLabel23.Visible = false; + // + // wmErrorTextBox22 + // + this.wmPulsesCountTextBox22.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox22.Location = new System.Drawing.Point(754, 443); + this.wmPulsesCountTextBox22.Name = "wmErrorTextBox22"; + this.wmPulsesCountTextBox22.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox22.TabIndex = 39; + this.wmPulsesCountTextBox22.Visible = false; + // + // wmErrorLabel22 + // + this.wmPulsesCountLabel22.AutoSize = true; + this.wmPulsesCountLabel22.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel22.Location = new System.Drawing.Point(589, 454); + this.wmPulsesCountLabel22.Name = "wmErrorLabel22"; + this.wmPulsesCountLabel22.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel22.TabIndex = 38; + this.wmPulsesCountLabel22.Text = "Error [%]"; + this.wmPulsesCountLabel22.Visible = false; + // + // wmErrorTextBox21 + // + this.wmPulsesCountTextBox21.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox21.Location = new System.Drawing.Point(754, 397); + this.wmPulsesCountTextBox21.Name = "wmErrorTextBox21"; + this.wmPulsesCountTextBox21.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox21.TabIndex = 37; + this.wmPulsesCountTextBox21.Visible = false; + // + // wmErrorLabel21 + // + this.wmPulsesCountLabel21.AutoSize = true; + this.wmPulsesCountLabel21.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel21.Location = new System.Drawing.Point(589, 408); + this.wmPulsesCountLabel21.Name = "wmErrorLabel21"; + this.wmPulsesCountLabel21.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel21.TabIndex = 36; + this.wmPulsesCountLabel21.Text = "Error [%]"; + this.wmPulsesCountLabel21.Visible = false; + // + // wmErrorTextBox20 + // + this.wmPulsesCountTextBox20.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox20.Location = new System.Drawing.Point(754, 351); + this.wmPulsesCountTextBox20.Name = "wmErrorTextBox20"; + this.wmPulsesCountTextBox20.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox20.TabIndex = 35; + this.wmPulsesCountTextBox20.Visible = false; + // + // wmErrorLabel20 + // + this.wmPulsesCountLabel20.AutoSize = true; + this.wmPulsesCountLabel20.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel20.Location = new System.Drawing.Point(589, 363); + this.wmPulsesCountLabel20.Name = "wmErrorLabel20"; + this.wmPulsesCountLabel20.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel20.TabIndex = 34; + this.wmPulsesCountLabel20.Text = "Error [%]"; + this.wmPulsesCountLabel20.Visible = false; + // + // wmErrorTextBox19 + // + this.wmPulsesCountTextBox19.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox19.Location = new System.Drawing.Point(754, 305); + this.wmPulsesCountTextBox19.Name = "wmErrorTextBox19"; + this.wmPulsesCountTextBox19.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox19.TabIndex = 33; + this.wmPulsesCountTextBox19.Visible = false; + // + // wmErrorLabel19 + // + this.wmPulsesCountLabel19.AutoSize = true; + this.wmPulsesCountLabel19.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel19.Location = new System.Drawing.Point(589, 317); + this.wmPulsesCountLabel19.Name = "wmErrorLabel19"; + this.wmPulsesCountLabel19.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel19.TabIndex = 32; + this.wmPulsesCountLabel19.Text = "Error [%]"; + this.wmPulsesCountLabel19.Visible = false; + // + // wmErrorTextBox18 + // + this.wmPulsesCountTextBox18.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox18.Location = new System.Drawing.Point(754, 259); + this.wmPulsesCountTextBox18.Name = "wmErrorTextBox18"; + this.wmPulsesCountTextBox18.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox18.TabIndex = 27; + this.wmPulsesCountTextBox18.Visible = false; + // + // wmErrorLabel18 + // + this.wmPulsesCountLabel18.AutoSize = true; + this.wmPulsesCountLabel18.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel18.Location = new System.Drawing.Point(589, 271); + this.wmPulsesCountLabel18.Name = "wmErrorLabel18"; + this.wmPulsesCountLabel18.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel18.TabIndex = 23; + this.wmPulsesCountLabel18.Text = "Error [%]"; + this.wmPulsesCountLabel18.Visible = false; + // + // wmErrorTextBox17 + // + this.wmPulsesCountTextBox17.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox17.Location = new System.Drawing.Point(754, 213); + this.wmPulsesCountTextBox17.Name = "wmErrorTextBox17"; + this.wmPulsesCountTextBox17.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox17.TabIndex = 26; + this.wmPulsesCountTextBox17.Visible = false; + // + // wmErrorLabel17 + // + this.wmPulsesCountLabel17.AutoSize = true; + this.wmPulsesCountLabel17.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel17.Location = new System.Drawing.Point(589, 224); + this.wmPulsesCountLabel17.Name = "wmErrorLabel17"; + this.wmPulsesCountLabel17.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel17.TabIndex = 22; + this.wmPulsesCountLabel17.Text = "Error [%]"; + this.wmPulsesCountLabel17.Visible = false; + // + // wmErrorTextBox16 + // + this.wmPulsesCountTextBox16.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox16.Location = new System.Drawing.Point(754, 166); + this.wmPulsesCountTextBox16.Name = "wmErrorTextBox16"; + this.wmPulsesCountTextBox16.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox16.TabIndex = 30; + this.wmPulsesCountTextBox16.Visible = false; + // + // wmErrorLabel16 + // + this.wmPulsesCountLabel16.AutoSize = true; + this.wmPulsesCountLabel16.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel16.Location = new System.Drawing.Point(589, 177); + this.wmPulsesCountLabel16.Name = "wmErrorLabel16"; + this.wmPulsesCountLabel16.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel16.TabIndex = 21; + this.wmPulsesCountLabel16.Text = "Error [%]"; + this.wmPulsesCountLabel16.Visible = false; + // + // wmErrorTextBox15 + // + this.wmPulsesCountTextBox15.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox15.Location = new System.Drawing.Point(754, 120); + this.wmPulsesCountTextBox15.Name = "wmErrorTextBox15"; + this.wmPulsesCountTextBox15.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox15.TabIndex = 31; + this.wmPulsesCountTextBox15.Visible = false; + // + // wmErrorLabel15 + // + this.wmPulsesCountLabel15.AutoSize = true; + this.wmPulsesCountLabel15.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel15.Location = new System.Drawing.Point(589, 131); + this.wmPulsesCountLabel15.Name = "wmErrorLabel15"; + this.wmPulsesCountLabel15.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel15.TabIndex = 20; + this.wmPulsesCountLabel15.Text = "Error [%]"; + this.wmPulsesCountLabel15.Visible = false; + // + // wmErrorTextBox14 + // + this.wmPulsesCountTextBox14.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox14.Location = new System.Drawing.Point(754, 74); + this.wmPulsesCountTextBox14.Name = "wmErrorTextBox14"; + this.wmPulsesCountTextBox14.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox14.TabIndex = 28; + this.wmPulsesCountTextBox14.Visible = false; + // + // wmErrorLabel14 + // + this.wmPulsesCountLabel14.AutoSize = true; + this.wmPulsesCountLabel14.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel14.Location = new System.Drawing.Point(589, 85); + this.wmPulsesCountLabel14.Name = "wmErrorLabel14"; + this.wmPulsesCountLabel14.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel14.TabIndex = 25; + this.wmPulsesCountLabel14.Text = "Error [%]"; + this.wmPulsesCountLabel14.Visible = false; + // + // wmErrorTextBox13 + // + this.wmPulsesCountTextBox13.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountTextBox13.Location = new System.Drawing.Point(754, 28); + this.wmPulsesCountTextBox13.Name = "wmErrorTextBox13"; + this.wmPulsesCountTextBox13.Size = new System.Drawing.Size(137, 40); + this.wmPulsesCountTextBox13.TabIndex = 29; + this.wmPulsesCountTextBox13.Visible = false; + // + // wmErrorLabel13 + // + this.wmPulsesCountLabel13.AutoSize = true; + this.wmPulsesCountLabel13.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.wmPulsesCountLabel13.Location = new System.Drawing.Point(589, 39); + this.wmPulsesCountLabel13.Name = "wmErrorLabel13"; + this.wmPulsesCountLabel13.Size = new System.Drawing.Size(103, 23); + this.wmPulsesCountLabel13.TabIndex = 24; + this.wmPulsesCountLabel13.Text = "Error [%]"; + this.wmPulsesCountLabel13.Visible = false; + // + // WMErrorsForm24 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.DarkGoldenrod; + this.ClientSize = new System.Drawing.Size(1267, 592); + this.Controls.Add(this.wmPulsesCountTextBox24); + this.Controls.Add(this.wmPulsesCountLabel24); + this.Controls.Add(this.wmPulsesCountTextBox23); + this.Controls.Add(this.wmPulsesCountLabel23); + this.Controls.Add(this.wmPulsesCountTextBox22); + this.Controls.Add(this.wmPulsesCountLabel22); + this.Controls.Add(this.wmPulsesCountTextBox21); + this.Controls.Add(this.wmPulsesCountLabel21); + this.Controls.Add(this.wmPulsesCountTextBox20); + this.Controls.Add(this.wmPulsesCountLabel20); + this.Controls.Add(this.wmPulsesCountTextBox19); + this.Controls.Add(this.wmPulsesCountLabel19); + this.Controls.Add(this.wmPulsesCountTextBox18); + this.Controls.Add(this.wmPulsesCountLabel18); + this.Controls.Add(this.wmPulsesCountTextBox17); + this.Controls.Add(this.wmPulsesCountLabel17); + this.Controls.Add(this.wmPulsesCountTextBox16); + this.Controls.Add(this.wmPulsesCountLabel16); + this.Controls.Add(this.wmPulsesCountTextBox15); + this.Controls.Add(this.wmPulsesCountLabel15); + this.Controls.Add(this.wmPulsesCountTextBox14); + this.Controls.Add(this.wmPulsesCountLabel14); + this.Controls.Add(this.wmPulsesCountTextBox13); + this.Controls.Add(this.wmPulsesCountLabel13); + this.Controls.Add(this.wmPulsesCountTextBox12); + this.Controls.Add(this.wmPulsesCountLabel12); + this.Controls.Add(this.wmPulsesCountTextBox11); + this.Controls.Add(this.wmPulsesCountLabel11); + this.Controls.Add(this.wmPulsesCountTextBox10); + this.Controls.Add(this.wmPulsesCountLabel10); + this.Controls.Add(this.wmPulsesCountTextBox9); + this.Controls.Add(this.wmPulsesCountLabel9); + this.Controls.Add(this.wmPulsesCountTextBox8); + this.Controls.Add(this.wmPulsesCountLabel8); + this.Controls.Add(this.wmPulsesCountTextBox7); + this.Controls.Add(this.wmPulsesCountLabel7); + this.Controls.Add(this.wmPulsesCountTextBox6); + this.Controls.Add(this.wmPulsesCountLabel6); + this.Controls.Add(this.wmPulsesCountTextBox5); + this.Controls.Add(this.wmPulsesCountLabel5); + this.Controls.Add(this.wmPulsesCountTextBox4); + this.Controls.Add(this.wmPulsesCountLabel4); + this.Controls.Add(this.wmPulsesCountTextBox3); + this.Controls.Add(this.wmPulsesCountLabel3); + this.Controls.Add(this.wmPulsesCountTextBox2); + this.Controls.Add(this.wmPulsesCountLabel2); + this.Controls.Add(this.wmPulsesCountTextBox1); + this.Controls.Add(this.wmPulsesCountLabel1); + this.Controls.Add(this.okButton); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "WMErrorsForm24"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Water Meter States"; + this.TopMost = true; + this.Load += new System.EventHandler(this.WMPulsesForm24_Load); + this.Paint += new System.Windows.Forms.PaintEventHandler(this.WMPulsesForm24_Paint); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox wmPulsesCountTextBox2; + private System.Windows.Forms.Label wmPulsesCountLabel2; + private System.Windows.Forms.Label wmPulsesCountLabel1; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.TextBox wmPulsesCountTextBox3; + private System.Windows.Forms.Label wmPulsesCountLabel3; + private System.Windows.Forms.TextBox wmPulsesCountTextBox4; + private System.Windows.Forms.Label wmPulsesCountLabel4; + private System.Windows.Forms.TextBox wmPulsesCountTextBox5; + private System.Windows.Forms.Label wmPulsesCountLabel5; + private System.Windows.Forms.TextBox wmPulsesCountTextBox6; + private System.Windows.Forms.Label wmPulsesCountLabel6; + private System.Windows.Forms.TextBox wmPulsesCountTextBox1; + private System.Windows.Forms.TextBox wmPulsesCountTextBox7; + private System.Windows.Forms.Label wmPulsesCountLabel7; + private System.Windows.Forms.TextBox wmPulsesCountTextBox8; + private System.Windows.Forms.Label wmPulsesCountLabel8; + private System.Windows.Forms.TextBox wmPulsesCountTextBox9; + private System.Windows.Forms.Label wmPulsesCountLabel9; + private System.Windows.Forms.TextBox wmPulsesCountTextBox10; + private System.Windows.Forms.Label wmPulsesCountLabel10; + private System.Windows.Forms.TextBox wmPulsesCountTextBox12; + private System.Windows.Forms.Label wmPulsesCountLabel12; + private System.Windows.Forms.TextBox wmPulsesCountTextBox11; + private System.Windows.Forms.Label wmPulsesCountLabel11; + private System.Windows.Forms.TextBox wmPulsesCountTextBox24; + private System.Windows.Forms.Label wmPulsesCountLabel24; + private System.Windows.Forms.TextBox wmPulsesCountTextBox23; + private System.Windows.Forms.Label wmPulsesCountLabel23; + private System.Windows.Forms.TextBox wmPulsesCountTextBox22; + private System.Windows.Forms.Label wmPulsesCountLabel22; + private System.Windows.Forms.TextBox wmPulsesCountTextBox21; + private System.Windows.Forms.Label wmPulsesCountLabel21; + private System.Windows.Forms.TextBox wmPulsesCountTextBox20; + private System.Windows.Forms.Label wmPulsesCountLabel20; + private System.Windows.Forms.TextBox wmPulsesCountTextBox19; + private System.Windows.Forms.Label wmPulsesCountLabel19; + private System.Windows.Forms.TextBox wmPulsesCountTextBox18; + private System.Windows.Forms.Label wmPulsesCountLabel18; + private System.Windows.Forms.TextBox wmPulsesCountTextBox17; + private System.Windows.Forms.Label wmPulsesCountLabel17; + private System.Windows.Forms.TextBox wmPulsesCountTextBox16; + private System.Windows.Forms.Label wmPulsesCountLabel16; + private System.Windows.Forms.TextBox wmPulsesCountTextBox15; + private System.Windows.Forms.Label wmPulsesCountLabel15; + private System.Windows.Forms.TextBox wmPulsesCountTextBox14; + private System.Windows.Forms.Label wmPulsesCountLabel14; + private System.Windows.Forms.TextBox wmPulsesCountTextBox13; + private System.Windows.Forms.Label wmPulsesCountLabel13; + + } +} \ No newline at end of file diff --git a/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.resx b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TBF/BenchControl/TestMethods/PulsesTest/WMPulsesForm24.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/TBF/TBF.csproj b/TBF/TBF.csproj index fc4015452..6f563ddef 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -1153,6 +1153,27 @@ + + + + + Form + + + WMPulsesForm.cs + + + Form + + + WMPulsesForm12.cs + + + Form + + + WMPulsesForm24.cs + @@ -1879,6 +1900,7 @@ + @@ -2443,6 +2465,15 @@ CfgCtrl.cs + + WMPulsesForm.cs + + + WMPulsesForm12.cs + + + WMPulsesForm24.cs + RoiDetectionCfgCtrl.cs diff --git a/TBF/UiBridge/Bridge.cs b/TBF/UiBridge/Bridge.cs index 6a3960e33..30206263a 100644 --- a/TBF/UiBridge/Bridge.cs +++ b/TBF/UiBridge/Bridge.cs @@ -113,6 +113,18 @@ namespace TBF.UiBridge public static event EventHandler AdjustmentInProgressHandler; + /// + /// Called from the state machine when one test of the pulses test process was completed and UI needs to be updated. + /// + public static void OnPulsesTestInProgress(object sender, PulsesTestInProgressEventArgs data) + { + if (PulsesTestInProgressHandler == null) return; + try { PulsesTestInProgressHandler(sender, data); } + catch (Exception e) { log.Error("PulsesTestInProgressHandler(...) failed", e); } + } + public static event EventHandler PulsesTestInProgressHandler; + + /// /// Called from the state machine when the test is completed and UI needs to be updated. /// diff --git a/TBF/UiBridge/PulsesTestInProgressEventArgs.cs b/TBF/UiBridge/PulsesTestInProgressEventArgs.cs new file mode 100644 index 000000000..9a48b0510 --- /dev/null +++ b/TBF/UiBridge/PulsesTestInProgressEventArgs.cs @@ -0,0 +1,20 @@ +/// +/// Copyright (c) 2018 Sensus Slovensko a.s. +/// +using System; +using Config.Entities; + +namespace TBF.UiBridge +{ + public class PulsesTestInProgressEventArgs : EventArgs + { + public string TestName; + public double LimitLo; + + public PulsesTestInProgressEventArgs(string testName, double limitLo) + { + this.TestName = testName; + this.LimitLo = limitLo; + } + } +}