From c8c411aebc3a0013e492afdb08ed7d68a5d2a493 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Sat, 10 Dec 2016 16:27:51 +0100 Subject: [PATCH] TestMethods.OuterLoop.Start/End UI changes, ver. 2.12.414 --- .../BenchControl/Elde/Common.cs | 31 ++--- .../BenchControl/Sequences/MainSeq.cs | 25 +++- .../TestMethods/OuterLoop/End/Component.cs | 5 +- .../TestMethods/OuterLoop/End/Factory.cs | 1 + .../OuterLoop/End/TestMethodCfg.cs | 47 ------- .../OuterLoop/End/TestMethodCfgCtrl.cs | 71 ----------- .../End/TestMethodCfgCtrl.designer.cs | 86 ------------- .../OuterLoop/End/TestMethodCfgCtrl.resx | 120 ------------------ .../TestMethods/OuterLoop/End/TestParams.cs | 112 ---------------- TestBenchFramework/ProcedureDlg.cs | 7 + TestBenchFramework/Properties/AssemblyInfo.cs | 4 +- TestBenchFramework/TBF.csproj | 11 -- TestBenchFramework/TestProgressControls.cs | 5 + 13 files changed, 52 insertions(+), 473 deletions(-) delete mode 100644 TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfg.cs delete mode 100644 TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfgCtrl.cs delete mode 100644 TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfgCtrl.designer.cs delete mode 100644 TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfgCtrl.resx delete mode 100644 TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestParams.cs diff --git a/TestBenchFramework/BenchControl/Elde/Common.cs b/TestBenchFramework/BenchControl/Elde/Common.cs index c880e8e9d..a078c7dc6 100644 --- a/TestBenchFramework/BenchControl/Elde/Common.cs +++ b/TestBenchFramework/BenchControl/Elde/Common.cs @@ -23,27 +23,28 @@ namespace TBF.BenchControl.Elde public enum StatusP : ulong { RefFlowMeterMask = 0x7, - TestCompleted = 0x10, - TestInProgress = 0x20, + TestCompleted = 0x10, /// bit 4 + TestInProgress = 0x20, /// bit 5 //DiverterError = 0x20, - MsrmntWithDivrtr = 0x80, + MsrmntWithDivrtr = 0x80, /// bit 7 RefPulsesMsrmnt = 0x100, /// bit 8 SynchroMethod = 0x800, /// bit 11 WaterMeterCalib = 0x1000, /// bit 12 - EmgcyStopActive = 0x2000, - MsrmntGateActive = 0x4000, - TimeMeasurement = 0x8000, + EmgcyStopActive = 0x2000, /// bit 13 + MsrmntGateActive = 0x4000, /// bit 14 + TimeMeasurement = 0x8000, /// bit 15 FrequencyMeasured = 0x80000, /// bit 19 CoaxRegValveBusy = 0x200000, /// bit 21 - ADCError = 0x80000000, - TimeoutOccured = 0x100000000, - MeretAddresses = 0x200000000, - SampleBuferFull = 0x400000000, - ErrorTempMeter = 0x10000000000, - ErrorPressMeter1 = 0x1000000000000, - ErrorPressMeter2 = 0x2000000000000, - ErrorPressMeter3 = 0x4000000000000, - ErrorPressMeter4 = 0x8000000000000, + ADCError = 0x80000000, /// bit 31 + TimeoutOccured = 0x100000000, /// bit 32 + MeretAddresses = 0x200000000, /// bit 33 + SampleBuferFull = 0x400000000, /// bit 34 + ErrorTempMeter = 0x10000000000, /// bit 40 + ErrorPressMeter1 = 0x1000000000000, /// bit 48 + ErrorPressMeter2 = 0x2000000000000, /// bit 49 + ErrorPressMeter3 = 0x4000000000000, /// bit 50 + ErrorPressMeter4 = 0x8000000000000, /// bit 51 + EndurCycleRunning = 0x200000000000000, /// bit 57 } #else // DN100 || MUNICH || FUZHOU150 || TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40 || FUZHOU_40 public enum StatusP : ulong diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index 7379176f5..0d52824a2 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -487,7 +487,10 @@ namespace TBF.BenchControl.Sequences /// Try to fetch all test paths and transitions /// to detect configuration errors as early as possible. string errorMsg; - if (!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter), + TBF.BenchControl.Generic.IComponent testMethod = TbfComponents.FindComponent(test.Method); + if (!(testMethod is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) && + !(testMethod is TBF.BenchControl.TestMethods.OuterLoop.End.Component) && + !StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter), out inPath, out benchPath, out outPath, out sensPath, out heatMetersPath, out transitionBefore, out transitionAfter, @@ -508,7 +511,10 @@ namespace TBF.BenchControl.Sequences /// Fetch the test paths and transitions string errorMsg; - if (!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter), + TBF.BenchControl.Generic.IComponent testMethod = TbfComponents.FindComponent(test.Method); + if (!(testMethod is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) && + !(testMethod is TBF.BenchControl.TestMethods.OuterLoop.End.Component) && + !StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter), out inPath, out benchPath, out outPath, out sensPath, out heatMetersPath, out transitionBefore, out transitionAfter, @@ -624,7 +630,10 @@ namespace TBF.BenchControl.Sequences /// Try to fetch all test paths and transitions /// to detect configuration errors as early as possible. string errorMsg; - if (!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter), + TBF.BenchControl.Generic.IComponent testMethod = TbfComponents.FindComponent(test.Method); + if (!(testMethod is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) && + !(testMethod is TBF.BenchControl.TestMethods.OuterLoop.End.Component) && + !StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter), out inPath, out benchPath, out outPath, out sensPath, out heatMetersPath, out transitionBefore, out transitionAfter, @@ -645,7 +654,10 @@ namespace TBF.BenchControl.Sequences /// Fetch the test paths and transitions string errorMsg; - if (!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter), + TBF.BenchControl.Generic.IComponent testMethod = TbfComponents.FindComponent(test.Method); + if (!(testMethod is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) && + !(testMethod is TBF.BenchControl.TestMethods.OuterLoop.End.Component) && + !StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter), out inPath, out benchPath, out outPath, out sensPath, out heatMetersPath, out transitionBefore, out transitionAfter, @@ -739,7 +751,10 @@ namespace TBF.BenchControl.Sequences /// Fetch the test paths and transitions string errorMsg; - if (!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter), + TBF.BenchControl.Generic.IComponent testMethod = TbfComponents.FindComponent(test.Method); + if (!(testMethod is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) && + !(testMethod is TBF.BenchControl.TestMethods.OuterLoop.End.Component) && + !StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter), out inPath, out benchPath, out outPath, out sensPath, out heatMetersPath, out transitionBefore, out transitionAfter, diff --git a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/Component.cs b/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/Component.cs index f152f388d..8a0cce7bd 100644 --- a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/Component.cs +++ b/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/Component.cs @@ -16,8 +16,6 @@ namespace TBF.BenchControl.TestMethods.OuterLoop.End return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1)); } - readonly TestMethodCfg testMethodCfg; - public bool Evaluate(Test test) { return true; } public bool Publish(Test test) { return true; } public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; } @@ -29,7 +27,6 @@ namespace TBF.BenchControl.TestMethods.OuterLoop.End public Component(Generic.IComponentCfg cfg) : base(cfg) { - testMethodCfg = cfg as TestMethodCfg; log.Debug(this.ToString()); } @@ -41,7 +38,7 @@ namespace TBF.BenchControl.TestMethods.OuterLoop.End { events.Add(Event.Error); /// Outer loops mode expected } - else if (outerLoopCounter < testMethodCfg.TestParams.Repeats) + else if (outerLoopCounter < test.Repeats) { events.Add(Event.OuterLoopNext); } diff --git a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/Factory.cs b/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/Factory.cs index 2c9984076..88042b2f6 100644 --- a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/Factory.cs +++ b/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/Factory.cs @@ -3,6 +3,7 @@ /// using System.Collections.Generic; using TBF.BenchControl.Generic; +using TBF.BenchControl.Configs.NameOnly; namespace TBF.BenchControl.TestMethods.OuterLoop.End { diff --git a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfg.cs b/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfg.cs deleted file mode 100644 index 04cd21db2..000000000 --- a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfg.cs +++ /dev/null @@ -1,47 +0,0 @@ -/// -/// Copyright (c) 2016 Sensus Metering Systems -/// -using System; -using System.Collections.Generic; -using System.IO; -using System.Xml.Serialization; -using Config.Entities; -using TBF.BenchControl.Generic; - -namespace TBF.BenchControl.TestMethods.OuterLoop.End -{ - public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg - { - public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); } - - /// Test parameters - [XmlIgnore] - public TestParams TestParams; - public override IParamsProvider GetTestParams() { return TestParams; } - public override IParamsProvider CreateTestParams(Test test) - { - TestParams testParams = new TestParams(); - testParams.UpdateTestParams(Name, test); - return testParams; - } - - /// Private parameterless constructor invoked by all other (public) constructors - TestMethodCfg() - { - TestParams = new TestParams(); - } - - public TestMethodCfg(string name, IComponentFactory factory) - : this() - { - Name = name; - ParentName = string.Empty; - Factory = factory; - } - - public string ToString(int i) - { - return string.Format("Name={0}", Name); - } - } -} diff --git a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfgCtrl.cs b/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfgCtrl.cs deleted file mode 100644 index f593b9bc0..000000000 --- a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfgCtrl.cs +++ /dev/null @@ -1,71 +0,0 @@ -/// -/// Copyright (c) 2016 Sensus Metering Systems -/// -using System; -using System.Windows.Forms; -using log4net; -using TBF.BenchControl.Generic; - -namespace TBF.BenchControl.TestMethods.OuterLoop.End -{ - public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl - { - static readonly ILog log = LogManager.GetLogger(typeof(TestMethodCfgCtrl)); - - public bool ShowMore { get { return false; } } - - TestMethodCfg config; - public IComponentCfg Config - { - get { return config as IComponentCfg; } - set - { - config = value as TestMethodCfg; - Redraw(); - } - } - - public TestMethodCfgCtrl() - { - InitializeComponent(); - } - - private void EntryFormCfgCtrl_Load(object sender, EventArgs e) - { - Redraw(); - } - - public void Closing() - { - } - - void Redraw() - { - if (config == null) return; /// Control was not loaded, settings were not changed - classNameLabel.Text = config.Factory.ClassName; - nameTextBox.Text = config.Name; - } - - public void Unlock() - { - nameTextBox.Enabled = true; - } - - public CfgUpdateFlags VerifyCfg(ref string message) - { - CfgUpdateFlags flags = CfgUpdateFlags.None; - return flags; - } - - public CfgUpdateFlags UpdateCfg() - { - CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd; - - if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed - - config.Name = nameTextBox.Text; - - return flags; - } - } -} diff --git a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfgCtrl.designer.cs b/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfgCtrl.designer.cs deleted file mode 100644 index 947377742..000000000 --- a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfgCtrl.designer.cs +++ /dev/null @@ -1,86 +0,0 @@ -/// -/// Copyright (c) 2016 Sensus Metering Systems -/// -namespace TBF.BenchControl.TestMethods.OuterLoop.End -{ - partial class TestMethodCfgCtrl - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.nameTextBox = new System.Windows.Forms.TextBox(); - this.nameLabel = new System.Windows.Forms.Label(); - this.classNameLabel = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // nameTextBox - // - this.nameTextBox.Enabled = false; - this.nameTextBox.Location = new System.Drawing.Point(137, 57); - this.nameTextBox.Name = "nameTextBox"; - this.nameTextBox.Size = new System.Drawing.Size(130, 20); - this.nameTextBox.TabIndex = 5; - // - // nameLabel - // - this.nameLabel.AutoSize = true; - this.nameLabel.Location = new System.Drawing.Point(27, 60); - this.nameLabel.Name = "nameLabel"; - this.nameLabel.Size = new System.Drawing.Size(35, 13); - this.nameLabel.TabIndex = 4; - this.nameLabel.Text = "Name"; - // - // classNameLabel - // - this.classNameLabel.AutoSize = true; - this.classNameLabel.Location = new System.Drawing.Point(134, 33); - this.classNameLabel.Name = "classNameLabel"; - this.classNameLabel.Size = new System.Drawing.Size(83, 13); - this.classNameLabel.TabIndex = 3; - this.classNameLabel.Text = "ComonentName"; - // - // BasicPrinterCfgCtrl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.nameTextBox); - this.Controls.Add(this.nameLabel); - this.Controls.Add(this.classNameLabel); - this.Name = "BasicPrinterCfgCtrl"; - this.Size = new System.Drawing.Size(300, 200); - this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TextBox nameTextBox; - private System.Windows.Forms.Label nameLabel; - private System.Windows.Forms.Label classNameLabel; - } -} diff --git a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfgCtrl.resx b/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfgCtrl.resx deleted file mode 100644 index 1af7de150..000000000 --- a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestMethodCfgCtrl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestParams.cs b/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestParams.cs deleted file mode 100644 index aa7f9df7e..000000000 --- a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/TestParams.cs +++ /dev/null @@ -1,112 +0,0 @@ -/// -/// Copyright (c) 2016 Sensus Metering Systems -/// -using System; -using System.IO; -using System.Xml.Serialization; -using Config.Entities; -using TBF.BenchControl.Generic; -using TBF.Resources; - -namespace TBF.BenchControl.TestMethods.OuterLoop.End -{ - public class TestParams : TestParamsBase, IParamsProvider, ITestParams - { - public int Repeats; /// Number of outer loop repeats - - public override void InitializeAll() - { - Repeats = 10; - } - - - string[] paramNames = new string[] - { - Strings.Repeats_nr_chdr, - }; - public override string ParamName(int i) { return paramNames[i]; } - public override int ParamsCount() { return paramNames.Length; } - - public override string ToString(int i) - { - switch (i) - { - case 0: return Repeats.ToString(); - default: return string.Empty; - } - } - - public void UpdateParam(int i, string strValue) - { - switch (i) - { - case 0: Repeats = int.Parse(strValue); return; - default: return; - } - } - - public bool ValidateParam(int i, string strValue, out string message) - { - message = string.Empty; - - int iDummy; - switch (i) - { - case 0: - if (int.TryParse(strValue, out iDummy)) return true; - break; - default: - message = "Invalid index"; - return false; - } - - message = ParamName(i) + " is invalid"; - return false; - } - - void CopyContentTo(TestParams prms) - { - prms.Repeats = this.Repeats; - } - - public IParamsProvider Clone() - { - TestParams pars = new TestParams(); - CopyContentTo(pars); - return pars; - } - - public override void UpdateTestParams(ComponentTest dbEntity) - { - if (dbEntity == null) return; - try - { - TestParams tmp = (TestParams)(new XmlSerializer(typeof(TestParams))) - .Deserialize(new StringReader(dbEntity.Parameters)); - - testParamsEntity = dbEntity; - componentName = dbEntity.CmpntName; - test = dbEntity.Test; - - tmp.CopyContentTo(this); - } - catch - { - } - } - - /// - /// Parameterless constructor initializes the parameters - /// - public TestParams() - { - } - - public TestParams(ComponentTest testParamsEntity, string componentName, Test test) - { - this.testParamsEntity = testParamsEntity; - this.componentName = componentName; - this.test = test; - } - } -} diff --git a/TestBenchFramework/ProcedureDlg.cs b/TestBenchFramework/ProcedureDlg.cs index 27baff265..8907c31a8 100644 --- a/TestBenchFramework/ProcedureDlg.cs +++ b/TestBenchFramework/ProcedureDlg.cs @@ -1664,6 +1664,13 @@ namespace TBF ITestMethod selectedMethod = TestMethods.FirstOrDefault(x => x.Name.Equals(test.Method)); + if (selectedMethod is TBF.BenchControl.TestMethods.OuterLoop.Start.Component + || selectedMethod is TBF.BenchControl.TestMethods.OuterLoop.End.Component) + { + test.Publish = (sbyte)Publish.Never; + test.Evaluate = false; + goto done; + } if (selectedMethod is BenchControl.TestMethods.PMaxTest.TestMethod) goto pressure_label; if (selectedMethod is BenchControl.TestMethods.LeakTest.TestMethod) goto pressure_label; #if HEAT_METERS_SUPPORT diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index d9c62d55e..05a07768a 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.12.413.1")] -[assembly: AssemblyFileVersion("2.12.413.1")] +[assembly: AssemblyVersion("2.12.414.1")] +[assembly: AssemblyFileVersion("2.12.414.1")] diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index 3ccf488d8..6435e3cb0 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -676,14 +676,6 @@ - - - - UserControl - - - TestMethodCfgCtrl.cs - @@ -1874,9 +1866,6 @@ TestMethodCfgCtrl.cs - - TestMethodCfgCtrl.cs - TestMethodCfgCtrl.cs diff --git a/TestBenchFramework/TestProgressControls.cs b/TestBenchFramework/TestProgressControls.cs index 0cc901811..79e2e6188 100644 --- a/TestBenchFramework/TestProgressControls.cs +++ b/TestBenchFramework/TestProgressControls.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Windows.Forms; using TBF.UiBridge; +using TBF.BenchControl; namespace TBF { @@ -74,6 +75,10 @@ namespace TBF progresses = new List(); foreach (var test in args.Procedure.Tests) { + TBF.BenchControl.Generic.IComponent testMethod = TbfComponents.FindComponent(test.Method); + if (testMethod is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) continue; + if (testMethod is TBF.BenchControl.TestMethods.OuterLoop.End.Component) continue; + for (int i = 1; i <= test.Repeats; i++) { UiControls.TestProgressCtrl prgrs =