From 7e7ae86f657af6579b2214abe74178df887bde58 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Wed, 19 Sep 2018 11:14:10 +0200 Subject: [PATCH] iPerlHead : 'LogType' procedure parameter added and used when creating 'optoDataLogFileName'. --- .../iPerlCommunication/iPerlHead/IperlHead.cs | 19 ++++++---- .../iPerlHead/ProcParams.cs | 36 ++++++++++++++----- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs index 7ef40e2dd..8acad489e 100644 --- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs +++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs @@ -11,6 +11,7 @@ using log4net; using Config.Entities; using TBF.BenchControl; using TBF.BenchControl.Generic; +using TBF.BenchControl.Output; using TBF.Resources; namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead @@ -41,6 +42,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead public float CalibTarget { get { return (ushort)iperlHeadCfg.ProcParams.CalibTarget; } } public ushort FactorLimitLo { get { return (ushort)iperlHeadCfg.ProcParams.FactorLimitLo; } } public ushort FactorLimitHi { get { return (ushort)iperlHeadCfg.ProcParams.FactorLimitHi; } } + public LogType LogType { get { return iperlHeadCfg.ProcParams.LogType; } } /// Properties set by the Begin and the End form public string SerialNr @@ -527,12 +529,17 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead string wmPosition = Name.Substring(5); if (wmPosition.Length == 1) wmPosition = "0" + wmPosition; - string flowNr; - if (testName != null && testName.ToLower().Contains("q1")) flowNr = "01"; - else if (testName != null && testName.ToLower().Contains("q2")) flowNr = "02"; - else if (testName != null && testName.ToLower().Contains("q3")) flowNr = "03"; - else if (testName != null && testName.ToLower().Contains("adj")) flowNr = "0-1"; - else flowNr = "99"; + SensusTestInfo[] testInfos = SensusCommon.GetTestInfos(LogType); + string flowNr = null; + foreach (var ti in testInfos) + { + if ((testName != null) && (testName == ti.TestName)) + { + flowNr = ti.PruefungsNrStr; + break; + } + } + if (flowNr == null) flowNr = "99"; optoDataLogFileName = string.Format("{0}_{1}_{2}_{3}.txt", (ConfigStruct != null) ? ConfigStruct.GetPcbNrString() : "UnknownPcbNr", diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/ProcParams.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/ProcParams.cs index bcbe62982..4e91817df 100644 --- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/ProcParams.cs +++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/ProcParams.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2015-2017 Sensus Metering Systems +/// Copyright (c) 2015-2018 Sensus Slovensko a.s. /// using System; using System.IO; @@ -7,6 +7,7 @@ using System.Text; using System.Xml.Serialization; using Config.Entities; using TBF.BenchControl.Generic; +using TBF.BenchControl.Output; using TBF.Resources; using System.Collections.Generic; @@ -21,6 +22,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead public float CalibTarget; /// Target error after calibration in [%] public int FactorLimitLo; /// Lower limit for the calibration factor public int FactorLimitHi; /// Upper limit for the calibration factor + public LogType LogType; #if ORACLE_DB public int WMType_ID; /// Required for Oracle DB: ID_WZTyp in table VT_PRUEFPUNKT_SOLL_SD public int WMType_Rev; /// Required for Oracle DB: Rev_WZTyp in table VT_PRUEFPUNKT_SOLL_SD @@ -33,6 +35,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead CalibTarget = 0; FactorLimitLo = 1000; FactorLimitHi = 8000; + LogType = LogType.Just_Q1Q2Q3; #if ORACLE_DB WMType_ID = 2; /// Value for iPerl DN15 WMType_Rev = 1; /// Value for iPerl DN15 @@ -45,6 +48,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead "Calib. target [%]", "Calib. factor Lo", "Calib. factor Hi", + "Log type", #if ORACLE_DB "WMType ID", "WMType Rev.", @@ -61,7 +65,12 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead for (MeterType mt = 0; mt < MeterType.Count; mt++) retVal.Add(mt.ToString()); return retVal; } - + else if (i == 4) + { + IList retVal = new List(); + for (LogType lt = 0; lt < LogType.Count; lt++) retVal.Add(lt.ToString()); + return retVal; + } return null; } @@ -73,9 +82,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead case 1: return CalibTarget.ToString(); case 2: return FactorLimitLo.ToString(); case 3: return FactorLimitHi.ToString(); + case 4: return LogType.ToString(); #if ORACLE_DB - case 4: return WMType_ID.ToString(); - case 5: return WMType_Rev.ToString(); + case 5: return WMType_ID.ToString(); + case 6: return WMType_Rev.ToString(); #endif default: return string.Empty; } @@ -94,9 +104,15 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead case 1: CalibTarget = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None; case 2: FactorLimitLo = int.Parse(strValue); return CfgUpdateFlags.None; case 3: FactorLimitHi = int.Parse(strValue); return CfgUpdateFlags.None; + case 4: + for (LogType lt = 0; lt < LogType.Count; lt++) + { + if (lt.ToString().Equals(strValue)) { LogType = lt; return CfgUpdateFlags.None; } + } + break; #if ORACLE_DB - case 4: WMType_ID = int.Parse(strValue); return CfgUpdateFlags.None; - case 5: WMType_Rev = int.Parse(strValue); return CfgUpdateFlags.None; + case 5: WMType_ID = int.Parse(strValue); return CfgUpdateFlags.None; + case 6: WMType_Rev = int.Parse(strValue); return CfgUpdateFlags.None; #endif default: return CfgUpdateFlags.None; } @@ -123,10 +139,13 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead case 3: if (int.TryParse(strValue, out iDummy) && iDummy >= 1000 && iDummy <= 8000) return true; break; + case 4: + for (LogType lt = 0; lt < LogType.Count; lt++) if (lt.ToString().Equals(strValue)) return true; + break; #if ORACLE_DB - case 4: /// WMType_ID - case 5: /// WMType_Rev + case 5: /// WMType_ID + case 6: /// WMType_Rev if (int.TryParse(strValue, out iDummy)) return true; break; #endif @@ -145,6 +164,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead prms.CalibTarget = this.CalibTarget; prms.FactorLimitLo = this.FactorLimitLo; prms.FactorLimitHi = this.FactorLimitHi; + prms.LogType = this.LogType; #if ORACLE_DB prms.WMType_ID = this.WMType_ID; prms.WMType_Rev = this.WMType_Rev;