refactor - completisation Smart Meter <= iPerl

This commit is contained in:
Michal Buzik 2025-09-24 11:57:47 +02:00
parent ab4025e55f
commit 8a0ae8080f
33 changed files with 3362 additions and 9559 deletions

View File

@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AICollection_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3020f90f960f433086d545c4e07afdfd531820_003F15_003F3de7cd37_003FICollection_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMethodInfoExtensions_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4472e9d6a19b4c92bcc9a80bd60ca17d26da8_003F63_003F30e5e5fa_003FMethodInfoExtensions_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATask_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3020f90f960f433086d545c4e07afdfd531820_003F34_003F74019b66_003FTask_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:Boolean x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/ShowAdvancedOptions/@EntryValue">True</s:Boolean>
@ -38,6 +39,8 @@
&lt;/SessionState&gt;</s:String>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=Config_002FResources_002FStrings/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=DeviceTest_002FDeviceTestDlg/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=Miscellaneous_0020Files_002FKirizar/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=Miscellaneous_0020Files_002FKirizar/@EntryIndexRemoved">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=Miscellaneous_0020Files_002FWyqupug/@EntryIndexedValue">False</s:Boolean>
@ -58,7 +61,8 @@
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FRegisterReaders_002FiPerlReaderUNI_002FIperlHeadTestCtrl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FRegisterReaders_002FiPerlReaderUNI_002Ftest_002FiPerlCommunicationForm/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FRegisterReaders_002FiPerlReaderUNI_002Ftest_002FiPerlCommunicationForm/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FRegisterReaders_002FiPerlReaderUNI_002Ftest_002FiPerlCommunicationForm/@EntryIndexRemoved">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FUni_002FSharedDialogs_002FiPerlCommunication_002FiPerlCommunicationForm/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FUI_002FBench_002FComponents_002FComponentsManagerDlg/@EntryIndexedValue">False</s:Boolean>

View File

@ -22,7 +22,7 @@ using MeterType = TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication.MeterType
namespace TBF.Rig.RegisterReaders.iPerlReaderUNI
{
/// <summary>
/// based on IperlHead class
/// based on IPerlReader class
/// </summary>
public class IPerlReader : ComponentBase, IDevice,IRegReaderDatastream, ISessionDataMngmnt, IOperation
{
@ -491,13 +491,13 @@ namespace TBF.Rig.RegisterReaders.iPerlReaderUNI
extraDataPath = Path.Combine(relativeDirectory, fileName);
}
log.WarnFormat("IperlHead.Stop() startIx={0} endIx={1} len={2} raw data file = {3}",
log.WarnFormat("IPerlReader.Stop() startIx={0} endIx={1} len={2} raw data file = {3}",
startIx, endIx, optoData.Length, fileName);
}
else
#endif
{
log.WarnFormat("IperlHead.Stop() startIx={0} endIx={1} len={2} no raw data file", startIx, endIx, optoData.Length);
log.WarnFormat("IPerlReader.Stop() startIx={0} endIx={1} len={2} no raw data file", startIx, endIx, optoData.Length);
}
if (TestStartTelegramIx == 0 || optoDataCount < 100)
@ -1287,13 +1287,13 @@ namespace TBF.Rig.RegisterReaders.iPerlReaderUNI
/// <returns>Index to the buffer</returns>
public static int BufferIdx(int index)
{
if (index < IperlHead.OptoDataBufferSize)
if (index < IPerlReader.OptoDataBufferSize)
{
return index;
}
else
{
return IperlHead.StartOptoDataCount + (index - IperlHead.OptoDataBufferSize) % IperlHead.EndOptoDataCount;
return IPerlReader.StartOptoDataCount + (index - IPerlReader.OptoDataBufferSize) % IPerlReader.EndOptoDataCount;
}
}

View File

@ -3,8 +3,8 @@ using System.Threading;
using System.Web.UI.WebControls;
using System.Windows.Forms;
using TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication;
using TBF.Rig.RegisterReaders.iPerlReaderUNI.test;
using TBF.Rig.Sequences;
using TBF.Rig.TestMethods.iPerlCommunication;
namespace TBF.Rig.RegisterReaders.iPerlReaderUNI
{
@ -26,7 +26,7 @@ namespace TBF.Rig.RegisterReaders.iPerlReaderUNI
//TODO fix possibility set test method in config
//iPerlCommunicationForm.cfg = new TestMethodCfg(null); // default values for iPerlCommunication
foreach(var head in ProcessData.IperlHeads)
foreach(var head in ProcessData.IperlHeadsUni)
{
if (head != null && head.Name == config.Name) { _iPerlReader = head; }
}

View File

@ -0,0 +1,100 @@
///
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using System.IO.Ports;
using System.Xml.Serialization;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Rig.TestMethods.SmartTest;
using TBF.Rig.Uni.SharedDialogs.iPerlCommunication;
namespace TBF.Rig.RegisterReaders.iPerlReaderUNI
{
public class TestMethodCfg : ComponentCfgBase, IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new TestMethodCfgCtrl(); }
///
/// Serialized parameters
///
public int CommTimeout; /// Communication timeout in ms (500 .. 5000)
public int DelayBetweenRetries; /// Delay between communication retries in ms (0 .. 5000)
public int MaxCommRetries; /// Max. number of retries (1 .. 10)
public int WaitTimeAfterFailure; /// Wait time after communication failure in ms
public int PassThroughWaitTime; /// Pass Through wait time for radio parameters in ms
public int NrThreads; /// Numbwr of parallel threads (1, 2 or 4)
public int IperlCheckErrorsToStop;
///
/// NFC S4.5 Combihead params
///
public int MciTimeoutMs;
public int BaudRate;
public int DataBits;
public Parity ParityBit;
public StopBits StopBits;
public int DfltQ2c_15_rl;
public int DfltQ2c_15_lr;
public int DfltQ2c_20_rl;
public int DfltQ2c_20_lr;
public int DfltQ2c_25_63_rl;
public int DfltQ2c_25_63_lr;
public int DfltQ2c_25_10_rl;
public int DfltQ2c_25_10_lr;
public int DfltQ2c_32_rl;
public int DfltQ2c_32_lr;
public int DfltQ2c_40_rl;
public int DfltQ2c_40_lr;
public bool UseWebService;
public string BaseUrl;
public string RelativeUrl;
/// <summary> Test parameters </summary>
[XmlIgnore]
public iPerlCommunicationParams TestParams;
public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; }
public override IParamsProvider CreateTestParamsProvider() { return new iPerlCommunicationParams(true); }
public override IParamsProvider GetUITestParamsProvider(Test test)
{
return (test.Method == Name) ? base.GetUITestParamsProvider(test) : null;
}
/// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg()
{
Name = "iPerlCommunication";
ParentName = string.Empty;
CommTimeout = 1800; /// ms
MaxCommRetries = 4;
WaitTimeAfterFailure = 2200;
PassThroughWaitTime = 1500;
NrThreads = 2; /// 1, 2 or 4 threads
IperlCheckErrorsToStop = 10;
MciTimeoutMs = 4000; // ms, NFC interface
BaudRate = 57600; // NFC Interface
DataBits = 8; // NFC Interface
ParityBit = Parity.None; // NFC Interface
StopBits = StopBits.Two; // NFC Interface
TestParams = CreateTestParamsProvider() as iPerlCommunicationParams;
}
public TestMethodCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}, CommTimeout={1}, MaxRetries={2}, NrThreads={3}", Name, CommTimeout, MaxCommRetries, NrThreads);
}
}
}

View File

@ -0,0 +1,40 @@
///
/// Copyright (c) 2015-2019 Sensus Metering Systems
/// Author: Milan Hanajík
///
using System;
using TBF.Rig.Uni.SharedDialogs.iPerlCommunication;
namespace TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication
{
public class CommCompletedEventArgs : EventArgs
{
public int ThreadId;
public int WMNr0; /// 0-based water meter position
public IPerlReader Ihead;
public Results.Entities.WaterMeter Wm;
public string CommMessage;
public CommErr CommErr;
public CommCompletedEventArgs(int threadId, int wmNr0, IPerlReader ihead, Results.Entities.WaterMeter wm, string commMessage, CommErr commErr)
{
this.ThreadId = threadId;
this.WMNr0 = wmNr0;
this.Ihead = ihead;
this.Wm = wm;
this.CommMessage = commMessage;
this.CommErr = commErr;
}
public override string ToString()
{
return string.Format("Thread={0} WMNr0={1} IHead={2} WM={3} CommMsg={4} CommErr={5}",
ThreadId,
WMNr0,
(Ihead != null) ? Ihead.Name : "null",
Wm.WMPosition,
(CommMessage != null) ? CommMessage : "null",
CommErr);
}
}
}

View File

@ -0,0 +1,316 @@
using log4net;
using Sensus.iPerl.NfcHandler;
using Sensus.iPerl.RfidCom.Exceptions;
using System;
using System.Globalization;
using System.Text;
using System.Threading;
using TBF.Rig.RegisterReaders.iPerlReaderUNI;
using static Sensus.iPerl.NfcHandler.MCI_Protocol;
namespace TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication
{
internal class NfcServices
{
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
internal static int ReadRequest(TestMethodCfg cfg, IPerlReader iperlHead, MCI_Protocol.StructName structName, int offset, int length, out byte[] buffer)
{
for (int i = 0; i < cfg.MaxCommRetries; i++)
{
NfcDataHandler _nfcDataHandler = new NfcDataHandler();
MessageEventHandlers(_nfcDataHandler);
CR95HF_MessageEventHandlers(_nfcDataHandler._CR95HF_Reader);
ST25DV_MessageEventHandlers(_nfcDataHandler._ST25DV_Device);
MCI_MessageEventHandlers(_nfcDataHandler._MCI_Protocol);
NFCHeadConfig_MessageEventHandlers(_nfcDataHandler._NFCHead_Config);
try
{
rfidDataLogger.Info($"NFC COM{iperlHead.RfidComPortNr} ReadRequest : {structName}, {offset}, {length}");
OpenConnection(_nfcDataHandler, cfg, iperlHead);
buffer = MciRead(_nfcDataHandler, cfg, structName, (ushort)offset, length);
_nfcDataHandler.RFProtocolOFF(); // turn off rf antenna due to possible interference
CloseComPort(_nfcDataHandler);
rfidDataLogger.Info($"NFC COM{iperlHead.RfidComPortNr} ReadRequest : {structName}, {offset}, {length} ; Response= {ByteArrayToHexString(buffer)} ; Error: {_nfcDataHandler.LastErrorMessage}");
if (_nfcDataHandler.LastErrorCode != 0)
{
throw new RfidValidationException(_nfcDataHandler.LastErrorMessage);
}
return Convert.ToInt32(_nfcDataHandler.LastErrorCode); //return 0;
}
catch (RfidValidationException)
{
Thread.Sleep(cfg.WaitTimeAfterFailure);
}
catch (Exception ex)
{
rfidDataLogger.Error($"NFC COM{iperlHead.RfidComPortNr} ReadRequest Error: {ex.Message}");
buffer = new byte[length];
return 3;
}
}
buffer = new byte[length];
return 3;
}
internal static int WriteRequest(TestMethodCfg cfg, IPerlReader iperlHead, MCI_Protocol.StructName structName, int offset, int length, byte[] buffer)
{
NfcDataHandler _nfcDataHandler = new NfcDataHandler();
MessageEventHandlers(_nfcDataHandler);
CR95HF_MessageEventHandlers(_nfcDataHandler._CR95HF_Reader);
ST25DV_MessageEventHandlers(_nfcDataHandler._ST25DV_Device);
MCI_MessageEventHandlers(_nfcDataHandler._MCI_Protocol);
NFCHeadConfig_MessageEventHandlers(_nfcDataHandler._NFCHead_Config);
try
{
rfidDataLogger.Info($"NFC COM{iperlHead.RfidComPortNr} WriteRequest : {structName}, {offset}, {length}, {ByteArrayToHexString(buffer)}");
OpenConnection(_nfcDataHandler, cfg, iperlHead);
MciWrite(_nfcDataHandler, cfg, structName, (ushort)offset, length, buffer);
_nfcDataHandler.RFProtocolOFF(); // turn off rf antenna due to possible interference
CloseComPort(_nfcDataHandler);
return 0;
}
catch (Exception ex)
{
rfidDataLogger.Error($"NFC COM{iperlHead.RfidComPortNr} WriteRequest Error: {ex.Message}");
return 3;
}
}
private static void OpenConnection(NfcDataHandler nfcDataHandler, TestMethodCfg cfg, IPerlReader iperlHead)
{
string comPort = $"COM{iperlHead.RfidComPortNr}";
int retryCount = 0 ;
Open:
nfcDataHandler.Close();
Thread.Sleep(100);
if (nfcDataHandler.OpenConnection(comPort, cfg.BaudRate, cfg.DataBits, cfg.ParityBit, cfg.StopBits))
{
rfidDataLogger.Info($"NFC COM{iperlHead.RfidComPortNr} Port Open");
if (nfcDataHandler.ConnectReader())
{
rfidDataLogger.Info($"NFC COM{iperlHead.RfidComPortNr} Reader connected");
if (!nfcDataHandler.ConnectDevice())
{
rfidDataLogger.Error($"NFC COM{iperlHead.RfidComPortNr} Error connect device.");
for (int i = 0; i < cfg.MaxCommRetries; i++)
{
if (nfcDataHandler.Echo()) break;
}
}
}
else
{
retryCount++;
rfidDataLogger.Error($"NFC COM{iperlHead.RfidComPortNr} Error connect reader. Reconnect comport {retryCount}");
if (retryCount < cfg.MaxCommRetries)
{
nfcDataHandler.Close();
iperlHead.ResetNfcInterface(); // reset NFC head via optoport - switch to RFID and back to NFC interface
goto Open;
}
}
}
else
rfidDataLogger.Error($"Open NFC COM{iperlHead.RfidComPortNr} Port Failed");
}
private static void CloseComPort(NfcDataHandler nfcDataHandler)
{
nfcDataHandler.Close();
}
private static byte[] MciRead(NfcDataHandler nfcDataHandler, TestMethodCfg cfg, StructName structName, ushort offset, int length)
{
bool isReadValues = false;
int retryCount = 0;
Read:
try
{
isReadValues = false;
long num1 = (long)length;
int timeoutMs = 4000;
byte payloadlength = Convert.ToByte(num1.ToString("X2"), 16);
if (nfcDataHandler.MCI_Read(structName, offset, payloadlength, timeoutMs))
{
byte[] lastData = nfcDataHandler.LastData;
if ((long)lastData.Length >= num1)
{
rfidDataLogger.Info($"COM: MciRead ({structName},{offset},{length}) = {ByteArrayToHexString(lastData)}");
return lastData;
}
else
rfidDataLogger.Info($"COM: MciRead ({structName},{offset},{length}) = {ByteArrayToHexString(lastData)}");
}
else if (nfcDataHandler.LastErrorCode == (byte)0)
{
rfidDataLogger.Info($"MCI Error: Unidentified");
retryCount++;
if (retryCount < cfg.MaxCommRetries)
goto Read;
}
else
{
rfidDataLogger.Info("Last error message: " + nfcDataHandler.LastErrorMessage);
retryCount++;
if (retryCount < cfg.MaxCommRetries)
goto Read;
}
}
catch (Exception ex)
{
rfidDataLogger.Error("MciRead Last error message: " + ex.Message);
retryCount++;
if (retryCount < cfg.MaxCommRetries)
goto Read;
}
return new byte[length];
}
private static void MciWrite(NfcDataHandler nfcDataHandler, TestMethodCfg cfg, MCI_Protocol.StructName structName, ushort offset, int length, byte[] payload)
{
int retryCount = 0;
Write:
try
{
long num1 = (long)length;
int timeoutMs = 4000;
byte payloadlength = Convert.ToByte(num1);
if ((int)payloadlength != payload.Length)
rfidDataLogger.Error("Insufficient Payload -- Payload lenth : " + (object)payload.Length);
else if (nfcDataHandler.MCI_Write(structName, offset, payloadlength, payload, timeoutMs))
{
// OK
}
else if (nfcDataHandler.LastErrorCode > (byte)0)
{
rfidDataLogger.Error("Last error message: " + nfcDataHandler.LastErrorMessage);
//int num2 = (int)MessageBox.Show(this._nfcDataHandler.LastErrorMessage);
}
}
catch (Exception ex)
{
rfidDataLogger.Error("MciWrite error message: " + ex.Message);
retryCount++;
if (retryCount < cfg.MaxCommRetries)
goto Write;
}
}
private static void MciWriteCommand(NfcDataHandler nfcDataHandler, byte commandcode)
{
try
{
ushort offset = 0;
int timeoutMs = 4000;
byte payloadlength = 1;
byte[] payload = new byte[1] { commandcode };
if (nfcDataHandler.MCI_Write(MCI_Protocol.StructName.Command, offset, payloadlength, payload, timeoutMs) || nfcDataHandler.LastErrorCode <= (byte)0)
return;
rfidDataLogger.Error("MciWriteCommand Last error message: " + nfcDataHandler.LastErrorMessage);
}
catch (Exception ex)
{
rfidDataLogger.Error("MciWriteCommand Last error message: " + ex.Message);
}
}
public static string ByteArrayToHexString(byte[] data)
{
StringBuilder stringBuilder = new StringBuilder();
foreach (byte num in data)
stringBuilder.Append(num.ToString("X2"));
return stringBuilder.ToString();
}
private static byte[] BuildPayLoad(string strPayLoad, int length)
{
byte[] collection;
if (strPayLoad.Split(':').Length > 1)
{
uint timestamp = ConvertDateTimeToTimestamp(Convert.ToDateTime(DateTime.ParseExact(strPayLoad, "HH:mm:ss dd/MM/yyyy", (IFormatProvider)CultureInfo.InvariantCulture)));
byte[] bytes = BitConverter.GetBytes(timestamp);
return bytes;
}
else if (strPayLoad.Split(',').Length > 1)
{
string[] strArray = strPayLoad.Split(',');
collection = new byte[strArray.Length];
for (int index3 = 0; index3 < strArray.Length; ++index3)
collection[index3] = Convert.ToByte(strArray[index3], 16);
return collection;
}
else
{
//int num = strPayLoad.Split(',').Length;
collection = HexStringToByteArray(strPayLoad.Substring(strPayLoad.Length - length * 2).ToUpper());
Array.Reverse((Array)collection);
return collection;
}
}
public static byte[] HexStringToByteArray(string hexString)
{
int length = hexString.Length;
byte[] byteArray = new byte[length / 2];
for (int startIndex = 0; startIndex < length; startIndex += 2)
byteArray[startIndex / 2] = Convert.ToByte(hexString.Substring(startIndex, 2), 16);
return byteArray;
}
private static uint ConvertDateTimeToTimestamp(DateTime datetime)
{
TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
return (uint)((datetime - new DateTime(2000, 1, 1, 0, 0, 0).ToLocalTime()).TotalSeconds + utcOffset.TotalSeconds);
}
#region EventHandlers
public static void MCI_MessageEventHandlers(MCI_Protocol e)
{
DelNfc_MCI_MessageHandler mciMessageHandler = new DelNfc_MCI_MessageHandler(OnHandler);
e.MessageEvent += mciMessageHandler;
}
public static void ST25DV_MessageEventHandlers(ST25DV_Device e)
{
DelNfc_ST25DV_MessageHandler dvMessageHandler = new DelNfc_ST25DV_MessageHandler(OnHandler);
e.MessageEvent += dvMessageHandler;
}
public static void CR95HF_MessageEventHandlers(CR95HF_Reader e)
{
DelNfc_CR95HF_MessageHandler hfMessageHandler = new DelNfc_CR95HF_MessageHandler(OnHandler);
e.MessageEvent += hfMessageHandler;
}
public static void NFCHeadConfig_MessageEventHandlers(NFCHeadConfig e)
{
DelNfc_NFCHeadConfig_MessageHandler configMessageHandler = new DelNfc_NFCHeadConfig_MessageHandler(OnHandler);
e.MessageEvent += configMessageHandler;
}
public static void MessageEventHandlers(NfcDataHandler e)
{
DelNfcMessageHandler nfcMessageHandler = new DelNfcMessageHandler(OnHandler);
e.MessageEvent += nfcMessageHandler;
}
public static void OnHandler(object sender, NfcMessageEventArgs e)
{
if (e.Message == null)
return;
string message = e.Message.Replace("\n", " ").Replace("\r", "");
rfidDataLogger.Debug(message);
}
#endregion
}
}

View File

@ -0,0 +1,126 @@
using Sensus.iPerl.RfidCom.Exceptions;
using Sensus.iPerl.RfidCom.Helper;
using Sensus.iPerl.RfidCom;
using System;
using System.Text.RegularExpressions;
using System.Threading;
using log4net;
using TBF.Rig.Uni.SharedDialogs.iPerlCommunication;
using static TBF.Rig.Uni.SharedDialogs.iPerlCommunication.iPerlCommunicationForm;
namespace TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication
{
internal class RfidServices
{
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
private static readonly ILog log = LogManager.GetLogger(typeof(iPerlCommunicationForm));
internal static int ReadRequest(TestMethodCfg cfg, IPerlReader iperlHead, MessageID messageID, int offset, int length, out byte[] buffer)
{
for (int i = 0; i < cfg.MaxCommRetries; i++)
{
rfidDataLogger.Error($"{iperlHead.CommInterface} Start {i} reading: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},{offset}, {length}... timeout {cfg.CommTimeout})");
using (RfidLogic writer = new RfidLogic($"COM{iperlHead.RfidComPortNr}"))
{
try
{
byte[] response = writer.ReadRequest((byte)messageID, offset, length, cfg.CommTimeout);
string hexString = RfidHelper.ConvertByteArrayToHexString(response);
string swapHexString = RfidHelper.SwapHexcode(hexString);
string decString = RfidHelper.HexLiteral2Unsigned(RfidHelper.SwapHexcode(hexString)).ToString();
if (length > 10)
{
//if the result only contains "00"s we are working on the wrong COM port
// or the module just isn't connected
if (Regex.IsMatch(hexString, @"^(00)\1+$"))
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) <- Error: No RFID signal.");
throw new RfidValidationException("Error_Rfid_NoSignal");
}
//if the result only contains "03"s the meter did not answer.
// Might be due to the module being positioned incorrectly.
if (Regex.IsMatch(hexString, @"^(03)\1+$"))
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) <- Error: No meter signal.");
throw new RfidValidationException("Error_Rfid_NoAnswerFromMeter");
}
}
writer.ClosePort();
buffer = response;
rfidDataLogger.Info($"{iperlHead.Name} ({iperlHead.SerialNr}): ReadRequestPort(COM{iperlHead.RfidComPortNr},...) returned HEX: {hexString}; SwapHexCodeToDecimal: {decString}");
return 0;
}
catch (RfidDataNotAvailableException)
{
if (/*RfidHelper.IsPassThrough(messageID)*/ messageID == MessageID.ASICRegisterReadTest || messageID == MessageID.RadioPassthrough)
{
rfidDataLogger.Info($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) {(i > 0 ? "<- Error: Invalid Pass-Through data." : "<- Info: Wait for Pass-Through data.")}");
Thread.Sleep(cfg.PassThroughWaitTime);
}
else
{
Thread.Sleep(cfg.WaitTimeAfterFailure);
}
}
catch (RfidValidationException)
{
Thread.Sleep(cfg.WaitTimeAfterFailure);
}
catch (Exception ex)
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) {ex.Message}");
Thread.Sleep(cfg.WaitTimeAfterFailure);
}
}
}
rfidDataLogger.Error($"{iperlHead.CommInterface} reading failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...)");
log.Error($"{iperlHead.CommInterface} reading failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...)");
buffer = new byte[length];
return 3;
}
internal static int WriteRequest(TestMethodCfg cfg, IPerlReader iperlHead, MessageID messageID, int offset, int length, byte[] buffer)
{
RfidLogic writer = new RfidLogic($"COM{iperlHead.RfidComPortNr}");
string payload = RfidHelper.ConvertByteArrayToHexString(buffer);
for (var i = 0; i < cfg.MaxCommRetries; i++)
{
rfidDataLogger.Error($"{iperlHead.CommInterface} Start {i} writting: COM{iperlHead.RfidComPortNr}: WriteRequest ({messageID},{offset}, {length}, {payload}... timeout {cfg.CommTimeout})");
try
{
if (writer.ClosePort()) writer.OpenPort();
writer.WriteRequest((byte)messageID, offset, length, buffer, cfg.CommTimeout, false);
writer.ClosePort();
rfidDataLogger.InfoFormat($"{iperlHead.Name}({iperlHead.SerialNr},COM{iperlHead.RfidComPortNr}): WriteRequestPort({messageID}, {offset}, {length}, {payload})");
return 0;
}
catch (Exception ex)
{
if (messageID == MessageID.RadioPassthrough || messageID == MessageID.ASICRegisterReadTest)
{
Thread.Sleep(1500);
}
else
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: Error: {ex.Message}");
Thread.Sleep(cfg.WaitTimeAfterFailure);
if (i > 1)
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: Reopen the com port.");
writer.ClosePort();
}
}
}
}
writer.ClosePort();
rfidDataLogger.Error($"RFID writing failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: WriteRequestPort ({messageID},...) {System.Text.Encoding.UTF8.GetString(buffer)}");
log.Error($"RFID writing failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: WriteRequestPort ({messageID},...) {System.Text.Encoding.UTF8.GetString(buffer)}");
return 2;
}
}
}

View File

@ -0,0 +1,62 @@
using System;
using System.Linq;
namespace TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication
{
internal class SimulationServices
{
const int Q2CorrFactorsAddr = Uni.SharedDialogs.iPerlCommunication.iPerlCommunicationConstants.Q2CorrFactorsAddr;
internal static int ReadRequest(IPerlReader iperlHead, MessageID messageID, int offset, int length, out byte[] buffer)
{
byte[] configurationBuffer = new byte[ConfigStruct.Length] { 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
byte[] calibrationBuffer = new byte[CalibrationStructV4.Length] { 3, 0, 150, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0, 150, 10 };
buffer = new byte[length];
if (messageID == MessageID.Configuration)
{
Array.Copy(GetPCB(iperlHead), 0, configurationBuffer, 16, 5); // set PCB Number according to iPerlHead configuration
Array.Copy(configurationBuffer,offset,buffer,0,length);
}
else if (messageID == MessageID.Calibration)
{
Array.Copy(calibrationBuffer, offset, buffer, 0, length);
}
else if ((messageID == MessageID.MetrologyMemory) && (offset == Q2CorrFactorsAddr) && (length == 2))
{
buffer = new byte[2] { 0, 0 };
}
else
{
buffer = new byte[length];
}
return iperlHead.Name.Equals("iPerl13") ? 2 : 0; /// Simulates an error on position 13
}
internal static int WriteRequest(TestMethodCfg cfg, IPerlReader iperlHead, MessageID messageID, int offset,
int length, byte[] buffer)
{
return 0;
}
private static Array GetPCB(IPerlReader iperlHead)
{
string pcbStr = iperlHead.RfidComPortNr.ToString().PadRight(10,'0') + iperlHead.Position.ToString("D2");
long decVal = Convert.ToInt64(pcbStr);
string nHexStr = decVal.ToString("X4");
string hexStr = "";
for (int a = nHexStr.Length; a >= 1; a = a - 2)
{
hexStr = hexStr + nHexStr.Substring(a - 2, 2);
}
return Enumerable.Range(0, hexStr.Length)
.Where(x => x % 2 == 0)
.Select(x => Convert.ToByte(hexStr.Substring(x, 2), 16))
.ToArray();
}
}
}

View File

@ -1,27 +1,25 @@
using Config.Resources;
using log4net;
using Sensus.iPerl.RfidCom.Helper;
using Sensus.iPerl.RfidCom.Services;
using Sensus.iPerl.RfidCom.Structures;
using System;
using System.Threading;
using TBF.Rig.Hart.Common;
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
using TBF.Rig.Uni.SharedDialogs.iPerlCommunication;
using static Sensus.iPerl.NfcHandler.MCI_Protocol;
using TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication;
namespace TBF.Rig.RegisterReaders.iPerlReaderUNI.test
{
internal class OpticalHeadTest
{
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
internal static string OpenSealing(IperlHead iHead)
internal static string OpenSealing(IPerlReader iHead)
{
if (RfidCommands.OpenSealing($"COM{iHead.RfidComPortNr}")) return "OK";
return "Error Open Sealing";
}
internal static string ReadRequest_PCB(IperlHead iHead)
internal static string ReadRequest_PCB(IPerlReader iHead)
{
try
{
@ -40,7 +38,7 @@ namespace TBF.Rig.RegisterReaders.iPerlReaderUNI.test
}
}
internal static string SetActiveMode(IperlHead iHead)
internal static string SetActiveMode(IPerlReader iHead)
{
byte[] cmd = new byte[1] { (byte)Command.SetActiveMode };
if (0 == iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.Command, StructName.Command, 0, 1, cmd))
@ -53,7 +51,7 @@ namespace TBF.Rig.RegisterReaders.iPerlReaderUNI.test
}
}
internal static string SetTestMode(IperlHead iHead)
internal static string SetTestMode(IPerlReader iHead)
{
byte[] cmd = new byte[1] { (byte)Command.SetTestMode };
if (0 == iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.Command, StructName.Command, 0, 1, cmd))
@ -67,7 +65,7 @@ namespace TBF.Rig.RegisterReaders.iPerlReaderUNI.test
}
#if IPERL
internal static string TurnOffRadio(IperlHead iHead)
internal static string TurnOffRadio(IPerlReader iHead)
{
try
{
@ -80,7 +78,7 @@ namespace TBF.Rig.RegisterReaders.iPerlReaderUNI.test
}
}
internal static string SetProductionMode(IperlHead iHead)
internal static string SetProductionMode(IPerlReader iHead)
{
try
{
@ -93,7 +91,7 @@ namespace TBF.Rig.RegisterReaders.iPerlReaderUNI.test
}
}
internal static string WriteRequestPort_u8_Customer_Text(IperlHead iHead)
internal static string WriteRequestPort_u8_Customer_Text(IPerlReader iHead)
{
string custText = "FF0123456789ABCDEF"; // Sample text to test write function
/*try
@ -113,14 +111,14 @@ namespace TBF.Rig.RegisterReaders.iPerlReaderUNI.test
return $"Error COM{iHead.RfidComPortNr}";
}
internal static string SetRfidMode(IperlHead iHead)
internal static string SetRfidMode(IPerlReader iHead)
{
iHead.SetRfidInterface();
iHead.SetCommunicationInterface(CommunicationInterface.RFID);
return ($"OK - {Strings.Program_restart_is_required_to_apply_some_settings}");
}
internal static string SetNfcMode(IperlHead iHead)
internal static string SetNfcMode(IPerlReader iHead)
{
iHead.SetNfcInterface();
iHead.SetCommunicationInterface(CommunicationInterface.NFC);

File diff suppressed because it is too large Load Diff

View File

@ -110,6 +110,7 @@ namespace TBF.Rig.Sequences
/// iPERL related state variables to be saved after each completed test
///
public static IList<TestMethods.iPerlCommunication.iPerlHead.IperlHead> IperlHeads;
public static IList<RegisterReaders.iPerlReaderUNI.IPerlReader> IperlHeadsUni;
public static bool IsQ2PreCorrectionCalculated;
public static int CalculatedQ2PreCorrectionLR;
public static int CalculatedQ2PreCorrectionRL;
@ -154,6 +155,7 @@ namespace TBF.Rig.Sequences
{
IperlHeads[i].WriteBinary(writer);
}
writer.Write(IsQ2PreCorrectionCalculated);
writer.Write(CalculatedQ2PreCorrectionLR);
@ -173,6 +175,12 @@ namespace TBF.Rig.Sequences
for (int i = 0; i < CompleteTestInfos.Length; i++) CompleteTestInfos[i].WriteBinary(writer);
}
#endif
/////// IperlHeadsUni - added for support of smart meters
writer.Write(IperlHeadsUni.Count);
for (int i = 0; i < IperlHeadsUni.Count; i++)
{
IperlHeadsUni[i].WriteBinary(writer);
}
log.WarnFormat("Process data succesfully saved to file {0}", PDataFileName);
}
}
@ -246,6 +254,26 @@ namespace TBF.Rig.Sequences
CompleteTestInfos[i] = ti;
}
#endif
try
{
int iPerlHeadsCountUni = reader.ReadInt32();
for (int i = 0; i < iPerlHeadsCountUni; i++)
{
if (IperlHeadsUni != null && i < IperlHeadsUni.Count)
{
IperlHeadsUni[i].ReadBinary(reader);
}
else
{
new TestMethods.iPerlCommunication.iPerlHead.IperlHead().ReadBinary(reader);
}
}
}
catch (Exception exc)
{
}
log.WarnFormat("Process data succesfully loaded from file {0}", PDataFileName);
return true;
}

View File

@ -0,0 +1,948 @@
///
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing; /// Point definition
using log4net;
using Common;
using Config.Entities;
using RestClient;
using TBF.Rig.Sequences;
using TBF.Resources;
using TBF.UiBridge;
using Results;
using Results.Entities;
using TBF.Rig.RegisterReaders.iPerlReaderUNI;
using TBF.Rig.Uni.SharedDialogs.iPerlCommunication;
namespace TBF.Rig.Sequences
{
public class iPerlCommunicationSeq : SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(iPerlCommunicationSeq));
System.Windows.Forms.Form modelessDlg;
///
delegate void iPerlCommFormDlgt(iPerlCommunicationSeq myRef, SmartComponentBase smartComponentBase, Test test, iPerlCommunicationParams testParams);
///
void OpenIPerlCommForm(iPerlCommunicationSeq myRef, SmartComponentBase method, Test test, iPerlCommunicationParams testParams)
{
myRef.modelessDlg = new iPerlCommunicationForm(method, test, testParams);
myRef.modelessDlg.Show();
}
void CloseIPerlCommForm()
{
UiBridge.Bridge.OnCloseModelessForm(this, null);
modelessDlg = null;
}
/// <summary>
/// Flying start mass collection method sequence
/// </summary>
/// <param name="test">Test entity</param>
/// <returns>
/// 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
/// </returns>
public IList<Event> Execute(Test test, int repetitionNr, SmartComponentBase method, iPerlCommunicationParams testParams)
{
TestMethodCfg cfg = method.Cfg as TestMethodCfg;
IList<Event> e; /// Events from currently running operations
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
modelessDlg = null;
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
string cmd;
if (testParams.Activity.ToLower().Equals(cmd = iPerlCommunicationConstants.GetDefaultQ2CorrectionsStr.ToLower()))
{
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.FlowSetting));
/// Get 'wmType' from IperlHead procedure parameters
int wmType = 0;
#if IPERL
/*foreach (var wm in ProcessData.BatchRslts.Batch.WaterMeters)
{
if (wm != null && !wm.Disabled && wm.WMTypeId() > 0)
{
wmType = wm.WMTypeId();
break;
}
}*/
#endif
if (cfg.UseWebService)
{
IsQ2PreCorrectionCalculated = GetQ2PreCorrectionsOrBackups(cfg, wmType, out CalculatedQ2PreCorrectionLR, out CalculatedQ2PreCorrectionRL);
}
/// Generate test results
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(test.Name, 0);
if (tstRslt != null)
{
tstRslt.StartTime = DateTime.Now;
tstRslt.TestDone = true;
foreach (var wm in BatchRslts.Batch.WaterMeters)
{
if (!wm.Disabled)
{
foreach(var mtr in wm.MeterTestRslts)
{
if (mtr.TestRslt == tstRslt)
{
mtr.Passed = !cfg.UseWebService || IsQ2PreCorrectionCalculated;
mtr.TestDone = true;
break;
}
}
}
}
}
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(test.Name, 0)));
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
return new List<Event> { Event.Done };
}
else if (testParams.Activity.ToLower().Contains(cmd = iPerlCommunicationConstants.Q2correctedFromCmd.ToLower()))
{
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.FlowSetting));
string[] args = testParams.Activity.Substring(cmd.Length).Split(new char[] { ' ' });
string fromTestName = (args.Length >= 1) ? args[0] : string.Empty;
bool isPlus = (args.Length >= 2) ? args[1].ToLower().Contains("plus") : false;
MakeQ2CorrectedFrom(test.Name, fromTestName, isPlus);
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(test.Name, 0)));
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
return new List<Event> { Event.Done };
}
else if (testParams.Activity.ToLower().Contains(cmd = iPerlCommunicationConstants.StrictQ2ErrorCheckStr.ToLower()))
{
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.FlowSetting));
string fromTestName = testParams.Activity.Substring(cmd.Length);
StrictQ2ErrorCheck(test.Name, fromTestName);
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(test.Name, 0)));
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
return new List<Event> { Event.Done };
}
else if (testParams.Activity.ToLower().Contains(cmd = iPerlCommunicationConstants.Q2correctionCheckCmd.ToLower()))
{
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.FlowSetting));
string[] testNames = testParams.Activity.Substring(cmd.Length).Split(new char[] { ' ' });
if (testNames.Length >= 2)
{
CheckQ2Correction(test.Name, testNames[0], testNames[1]);
}
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(test.Name, 0)));
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
return new List<Event> { Event.Done };
}
else if (testParams.Activity.ToLower().Contains(cmd = iPerlCommunicationConstants.IperlCheckCmd.ToLower()))
{
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.FlowSetting));
string[] args = testParams.Activity.Substring(cmd.Length).Split(new char[] { ' ' });
//int maxTestIndex = (ProcessData.BenchInfo is TBF.Rig.DataContainer.BenchInfo.Component)
// ? (ProcessData.BenchInfo as TBF.Rig.DataContainer.BenchInfo.Component).MaxTestIndex
// : int.MaxValue;
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(test.Name, 0);
if (tstRslt != null)
{
tstRslt.StartTime = DateTime.Now;
int wrongMetersCount = 0;
string message = string.Empty;
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
Results.Entities.WaterMeter wm = BatchRslts.Batch.WaterMeters[i];
Results.Entities.MeterTestRslt mtr = ProcessData.BatchRslts.GetMeterTestRslt(test.Name, i, CompoundMeterId.Single);
///// Reference to iPerl water meter or null:
//TestMethods.iPerlCommunication.iPerlHead.IperlHead iPerlHead = ((sensPath.RegisterReaders != null) && (i < sensPath.RegisterReaders.Length))
// ? (sensPath.RegisterReaders[i] as TestMethods.iPerlCommunication.iPerlHead.IperlHead)
// : null;
if ((wm != null) && (mtr != null))
{
int errorIndicators = 0;
bool anyErrorOfThisMeter = false;
foreach (var arg in args)
{
#if TURA_SPECIAL
if (arg.ToLower() == "q2factors")
{
if ((wm.ProdQ2CorrRL != wm.Q2CorrRL) || (wm.ProdQ2CorrLR != wm.Q2CorrLR))
{
anyErrorOfThisMeter = true;
message += string.Format("Q2 korekčné faktory vodomera {0} nesedia{1}", wm.WMPosition, Environment.NewLine);
errorIndicators |= (int)ErrorFlagMask.E26; /// Q2 correction factors not valid
}
}
#endif
if (arg.ToLower() == "direction")
{
//if (wm.Pruefindex > maxTestIndex)
//{
// anyErrorOfThisMeter = true;
// message += string.Format("Príliš veľa opakovaní testu vodomera {0}{1}", wm.WMPosition, Environment.NewLine);
// errorIndicators |= (int)ErrorFlagMask.E27; /// Wrong direction (positive/negative counting)
//}
}
if (arg.ToLower() == "prevworkstep")
{
if (wm.LastRecordIsNok)
{
wm.ErrorFlags |= (int)ErrorFlagMask.E28; /// Set E28
}
if ((wm.ErrorFlags & (int)ErrorFlagMask.E28) != 0)
{
anyErrorOfThisMeter = true;
message += string.Format("iPerl{0} : Predchádzajúci krok nebol zaznamenaný{1}", wm.WMPosition, Environment.NewLine);
errorIndicators |= (int)ErrorFlagMask.E28; /// Previous workstep missing or NOK (production tracing)
}
}
}
mtr.TestDone = true;
mtr.ErrorIndicators = errorIndicators;
///
if (anyErrorOfThisMeter)
{
/// This iPerl check did not pass
mtr.Passed = false;
wrongMetersCount++;
}
else
{
/// Check passed OK
mtr.Passed = true;
}
}
}
tstRslt.EndTime = DateTime.Now;
tstRslt.TestDone = true;
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, tstRslt));
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
if (wrongMetersCount >= cfg.IperlCheckErrorsToStop)
{
State.Create("iPerlCommunicationSeq : Show check result")
.AddOperation(new Operations.LargeMessageBoxOp(message))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
}
while (!e.Contains(Event.Continue) && !e.Contains(Event.Abort));
if (e.Contains(Event.Abort))
{
Bridge.OnError(this, string.Format("Niečo nie je v poriadku !"));
return new List<Event> { Event.UiCmdStop };
}
}
}
return new List<Event> { Event.Done };
}
else if (testParams.Activity.ToLower().Contains(cmd = iPerlCommunicationConstants.SimulateCmd))
{
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.FlowSetting));
if (testParams.Activity.ToLower().Contains("q3")) MakeSimulated(test, 1, 0, -0.5f);
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "q2") MakeSimulated(test, 1, 0, 0.5f);
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "q1") MakeSimulated(test, 1, 0, -5.1f);
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "compound ok") MakeSimulatedCompound(test, 1, 0, 0.7f, 1.0f);
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "compound nok") MakeSimulatedCompound(test, 1, 0, 4.7f, 0.9f);
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "compound rise") MakeSimulatedCompound(test, 1, 0, 0.7f, 0.0f);
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "compound fall") MakeSimulatedCompound(test, 1, 0, 0.7f, 0.9f);
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "iperls")
{
string[] pcbNrs = new string[] { "831232435539", "831232435562", "831232435587",
"831232432141", "831232432497", "831232763641" };
TestRslt tstRslt = BatchRslts.GetTestRslt(test.Name, test.Part);
if (tstRslt != null)
{
Results.Utils.GetCounterStates(tstRslt, Program.LocalSettings.Counters);
/// Auxiliary results ... not required
/// Main results
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
tstRslt.TestDone = true;
tstRslt.StartTime = tstRslt.Batch.StartTime;
tstRslt.EndTime = DateTime.Now;
tstRslt.FlowSetTime = 0;
tstRslt.MassOfEvapWater = 0;
tstRslt.TestTime = 1;
for (int i = 0; i < BatchRslts.Batch.WaterMeters.Count; i++)
{
MeterTestRslt meterRslt =
BatchRslts.GetMeterTestRslt(test.Name, i, CompoundMeterId.Single);
if (meterRslt != null)
{
meterRslt.WaterMeter.SerialNr = pcbNrs[i % pcbNrs.Length];
meterRslt.Passed = true;
meterRslt.TestDone = true;
}
//if (iperlHeads[i] != null)
//{
// iperlHeads[i].CommFailed = iperlHeads[i].Disabled = false;
// iperlHeads[i].SerialNr = pcbNrs[i % pcbNrs.Length];
//}
}
}
}
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Common.Utils.GetTestName(test.Name, 1, 1), 0)));
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
//------------------------------------------------
Bridge.OnActivity(this, testParams.Activity);
//------------------------------------------------
State.Create(string.Format("iPerlCommunicationSeq : {0}", testParams.Activity))
.AddOperation(checkUiOp)
.EnterState();
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e))
{
return new List<Event> { Event.UiCmdStop };
}
}
else
{
///
/// Show the modeless dialog with error indication
///
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, method, test, testParams });
//------------------------------------------------
Bridge.OnActivity(this, Strings.iPerl_Communication_in_progress);
//------------------------------------------------
bool stopPressed = false; /// true when STOP button pressed
bool completed = false;
State.Create("iPerlCommunicationSeq : Wait until the entry form is closed")
.AddOperation(checkUiOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
stopPressed = TestAndLogUiCmdStop(test, e);
completed = (modelessDlg is GenericDevices.IHasCompleted)
&& (modelessDlg as GenericDevices.IHasCompleted).Completed;
}
while (!stopPressed && !completed);
if (stopPressed)
{
CloseIPerlCommForm();
return new List<Event> { Event.UiCmdStop };
}
else
{
TBF.UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(test.Name, Progress.Completed));
}
/// Test 'Quit'
modelessDlg = null; /// Modeless dialog is closed now
}
return new List<Event> { Event.Done };
}
/// <summary>
/// Read default Q2 correction factors from a REST service (= Web service).
/// </summary>
/// <param name="cfg">iPerlCommunication component configuration</param>
/// <param name="wmType">Water meter type (WZ Typ)</param>
/// <param name="q2PreCorrectionLR">Default Q2 correction LR</param>
/// <param name="q2PreCorrectionRL">Default Q2 correction RL</param>
/// <returns>true when successful</returns>
static bool ReadCorrectionsFromWebService(TestMethodCfg cfg, int wmType, out int q2PreCorrectionLR, out int q2PreCorrectionRL)
{
if (wmType == 0)
{
/// No REST service call when wmType == 0, factors are 0
q2PreCorrectionLR = 0;
q2PreCorrectionRL = 0;
return true;
}
try
{
GetQ2PreCorrectionClient client = new GetQ2PreCorrectionClient(cfg.BaseUrl);
client.GetToken("ReadUser", "sensus", "https://deluh1web03.world.fluidtechnology.net/SensusCore/api/v1/Locations/1/Login2").Wait();
Q2PreCorrection response = client.GetQ2Correction(string.Format(cfg.RelativeUrl, wmType)).Result;
if (response != null && response.AreDataCalculated)
{
q2PreCorrectionLR = response.CorrLR;
q2PreCorrectionRL = response.CorrRL;
log.WarnFormat("Q2 corrections from a REST client for WM Type = {0} are: LR = {1}, RL = {2}", wmType, q2PreCorrectionLR, q2PreCorrectionRL);
return true;
}
else
{
log.ErrorFormat("Failed to obtain Q2 corrections from a REST client for WM Type = {0}", wmType);
q2PreCorrectionLR = 0;
q2PreCorrectionRL = 0;
return false;
}
}
catch (Exception exc)
{
log.ErrorFormat("Failed to obtain Q2 corrections from a REST client for WM Type = {0}: {1}", wmType, exc.Message);
q2PreCorrectionLR = 0;
q2PreCorrectionRL = 0;
return false;
}
}
/// <summary>
/// Obtain Q2 correction factors from a REST service or from local settings (stored backup values)
/// </summary>
/// <param name="cfg">iPerlCommunication component configuration</param>
/// <param name="wmType">Water meter type (WZ Typ)</param>
/// <param name="q2PreCorrectionLR">Default Q2 correction LR</param>
/// <param name="q2PreCorrectionRL">Default Q2 correction RL</param>
/// <returns>true when successful</returns>
public static bool GetQ2PreCorrectionsOrBackups(TestMethodCfg cfg, int wmType, out int q2PreCorrectionLR, out int q2PreCorrectionRL)
{
/// Get Q2 pre-correction values from REST service
bool restOK = ReadCorrectionsFromWebService(cfg, wmType, out q2PreCorrectionLR, out q2PreCorrectionRL);
/// Store / load Q2 pre-correction values
Point storedValue;
if (restOK)
{
/// Q2 pre-correction values were successfully obtained from a REST service for the specified wmType
if (!Program.LocalSettings.Q2PreCorrections.TryGetValue(wmType, out storedValue))
{
/// No Q2 pre-correction values in the dictionary for the specified wmType => save them
Program.LocalSettings.Q2PreCorrections.Add(wmType, new Point(q2PreCorrectionLR, q2PreCorrectionRL));
log.WarnFormat("Q2 corrections added to dictionary for WM Type = {0}: LR = {1}, RL = {2}", wmType, q2PreCorrectionLR, q2PreCorrectionRL);
}
else if (storedValue.X != q2PreCorrectionLR || storedValue.Y != q2PreCorrectionRL)
{
/// Different Q2 pre-correction values in the dictionary for the specified wmType => overwrite them with ones from the REST service
Program.LocalSettings.Q2PreCorrections[wmType] = new Point(q2PreCorrectionLR, q2PreCorrectionRL);
log.WarnFormat("Q2 corrections modified in dictionary for WM Type = {0}: LR = {1}, RL = {2}", wmType, q2PreCorrectionLR, q2PreCorrectionRL);
}
else
{
/// Q2 pre-correction values in the dictionary are the same and were not changed
log.WarnFormat("Q2 corrections in dictionary for WM Type = {0} are the same and were not changed", wmType, q2PreCorrectionLR, q2PreCorrectionRL);
}
}
else
{
/// No Q2 pre-correction values from a REST service => read the dictionary
if (Program.LocalSettings.Q2PreCorrections.TryGetValue(wmType, out storedValue))
{
/// Q2 pre-correction values successfully read from the dictionary
q2PreCorrectionLR = storedValue.X;
q2PreCorrectionRL = storedValue.Y;
log.WarnFormat("Q2 corrections loaded from dictionary for WM Type = {0}: LR = {1}, RL = {2}", wmType, q2PreCorrectionLR, q2PreCorrectionRL);
}
else
{
/// Q2 pre-correction values not found in the dictionary => use zeros
q2PreCorrectionLR = 0;
q2PreCorrectionRL = 0;
log.ErrorFormat("Q2 corrections not found in the dictionary for WM Type = {0}, using zeros", wmType, q2PreCorrectionLR, q2PreCorrectionRL);
/// Everything failed => using zero values
return false;
}
}
/// Q2 pre-corections were obtained from REST service or stored backup values were used
return true;
}
/// <summary>
/// Virtually apply Q2 correction to a test used for the correction calculation.
/// </summary>
/// <param name="testName">This test name</param>
/// <param name="oriTestRslt">Name of Q2 test done before Q2 correction (Q2adj)</param>
/// <remarks>Assuming this test does not have multiple parts (part = 0)</remarks>
void MakeQ2CorrectedFrom(string testName, string oriTestName, bool isPlus = false)
{
Results.Entities.TestRslt oriTestRslt = ProcessData.BatchRslts.GetTestRslt(oriTestName, 0);
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(testName, 0);
if (oriTestRslt == null || tstRslt == null) return;
tstRslt.Components = oriTestRslt.Components;
/// Auxiliary results, as in SequenceBase.UpdateTemoPressDensAmb()
tstRslt.AmbTempMean = oriTestRslt.AmbTempMean;
tstRslt.AmbTempStart = oriTestRslt.AmbTempStart;
tstRslt.AmbTempEnd = oriTestRslt.AmbTempEnd;
tstRslt.AmbTempMin = oriTestRslt.AmbTempMin;
tstRslt.AmbTempMax = oriTestRslt.AmbTempMax;
tstRslt.AmbPressMean = oriTestRslt.AmbPressMean;
tstRslt.AmbPressStart = oriTestRslt.AmbPressStart;
tstRslt.AmbPressEnd = oriTestRslt.AmbPressEnd;
tstRslt.AmbPressMin = oriTestRslt.AmbPressMin;
tstRslt.AmbPressMax = oriTestRslt.AmbPressMax;
tstRslt.AmbHumiMean = oriTestRslt.AmbHumiMean;
tstRslt.AmbHumiStart = oriTestRslt.AmbHumiStart;
tstRslt.AmbHumiEnd = oriTestRslt.AmbHumiEnd;
tstRslt.AmbHumiMin = oriTestRslt.AmbHumiMin;
tstRslt.AmbHumiMax = oriTestRslt.AmbHumiMax;
tstRslt.PressUpMean = oriTestRslt.PressUpMean;
tstRslt.PressUpStart = oriTestRslt.PressUpStart;
tstRslt.PressUpEnd = oriTestRslt.PressUpEnd;
tstRslt.PressUpMin = oriTestRslt.PressUpMin;
tstRslt.PressUpMax = oriTestRslt.PressUpMax;
tstRslt.PressDownMean = oriTestRslt.PressDownMean;
tstRslt.PressDownStart = oriTestRslt.PressDownStart;
tstRslt.PressDownEnd = oriTestRslt.PressDownEnd;
tstRslt.PressDownMin = oriTestRslt.PressDownMin;
tstRslt.PressDownMax = oriTestRslt.PressDownMax;
tstRslt.PressDeltaMean = oriTestRslt.PressDeltaMean;
tstRslt.PressDeltaStart = oriTestRslt.PressDeltaStart;
tstRslt.PressDeltaEnd = oriTestRslt.PressDeltaEnd;
tstRslt.PressDeltaMin = oriTestRslt.PressDeltaMin;
tstRslt.PressDeltaMax = oriTestRslt.PressDeltaMax;
tstRslt.ConductMean = oriTestRslt.ConductMean;
tstRslt.ConductStart = oriTestRslt.ConductStart;
tstRslt.ConductEnd = oriTestRslt.ConductEnd;
tstRslt.ConductMin = oriTestRslt.ConductMin;
tstRslt.ConductMax = oriTestRslt.ConductMax;
tstRslt.TempUpMean = oriTestRslt.TempUpMean;
tstRslt.TempUpStart = oriTestRslt.TempUpStart;
tstRslt.TempUpEnd = oriTestRslt.TempUpEnd;
tstRslt.TempUpMin = oriTestRslt.TempUpMin;
tstRslt.TempUpMax = oriTestRslt.TempUpMax;
tstRslt.TempDownMean = oriTestRslt.TempDownMean;
tstRslt.TempDownStart = oriTestRslt.TempDownStart;
tstRslt.TempDownEnd = oriTestRslt.TempDownEnd;
tstRslt.TempDownMin = oriTestRslt.TempDownMin;
tstRslt.TempDownMax = oriTestRslt.TempDownMax;
tstRslt.TempDivMean = oriTestRslt.TempDivMean;
tstRslt.TempDivStart = oriTestRslt.TempDivStart;
tstRslt.TempDivEnd = oriTestRslt.TempDivEnd;
tstRslt.TempDivMin = oriTestRslt.TempDivMin;
tstRslt.TempDivMax = oriTestRslt.TempDivMax;
tstRslt.DensityIn = oriTestRslt.DensityIn;
tstRslt.DensityLine = oriTestRslt.DensityLine;
tstRslt.DensityDiv = oriTestRslt.DensityDiv;
tstRslt.StartTime = oriTestRslt.StartTime;
tstRslt.EndTime = oriTestRslt.EndTime;
tstRslt.FlowSetTime = oriTestRslt.FlowSetTime;
tstRslt.TestTime = oriTestRslt.TestTime;
tstRslt.PulsesMaster = oriTestRslt.PulsesMaster;
tstRslt.ConstMasterRaw = oriTestRslt.ConstMasterRaw;
tstRslt.ConstMaster = oriTestRslt.ConstMaster;
tstRslt.MassStartRaw = oriTestRslt.MassStartRaw;
tstRslt.MassStart = oriTestRslt.MassStart;
tstRslt.MassEndRaw = oriTestRslt.MassEndRaw;
tstRslt.MassEnd = oriTestRslt.MassEnd;
tstRslt.MassOfEvapWater = oriTestRslt.MassOfEvapWater;
//tstRslt.FlowMass = oriTestRslt.FlowMass;
//tstRslt.FlowVolume = oriTestRslt.FlowVolume;
tstRslt.VolumeCTV = oriTestRslt.VolumeCTV;
tstRslt.VolumeMaster = oriTestRslt.VolumeMaster;
tstRslt.ErrorMaster = oriTestRslt.ErrorMaster;
tstRslt.FlowMean = oriTestRslt.FlowMean;
tstRslt.FlowMin = oriTestRslt.FlowMin;
tstRslt.FlowMax = oriTestRslt.FlowMax;
tstRslt.Custom1 = oriTestRslt.Custom1;
tstRslt.Custom2 = oriTestRslt.Custom2;
tstRslt.Custom3 = oriTestRslt.Custom3;
tstRslt.Custom4 = oriTestRslt.Custom4;
tstRslt.Custom5 = oriTestRslt.Custom5;
tstRslt.Custom6 = oriTestRslt.Custom6;
tstRslt.Custom7 = oriTestRslt.Custom7;
tstRslt.Custom8 = oriTestRslt.Custom8;
for (int i = 0; i < ProcessData.BatchRslts.WMPositionsCount; i++)
{
// Fix for CS7036: Added the missing 'meterId' argument to the GetMeterTestRslt method call.
var q3mtr = ProcessData.BatchRslts.GetMeterTestRslt("Q3", i, CompoundMeterId.SingleOrCompound);
double q3error = (q3mtr != null) ? q3mtr.Error : 0;
Results.Entities.MeterTestRslt oriMeterRslt = ProcessData.BatchRslts.GetMeterTestRslt(oriTestName, i, CompoundMeterId.SingleOrCompound);
Results.Entities.MeterTestRslt meterRslt = ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.SingleOrCompound);
/// Reference to iPerl water meter or null:
TestMethods.iPerlCommunication.iPerlHead.IperlHead iPerl = ((sensPath != null) && (sensPath.RegisterReaders != null) && (i < sensPath.RegisterReaders.Length))
? (sensPath.RegisterReaders[i] as TestMethods.iPerlCommunication.iPerlHead.IperlHead)
: null;
if (iPerl != null && meterRslt != null && oriMeterRslt != null)
{
#if ORACLE_DB
meterRslt.ErrorBC = oriMeterRslt.Error;
#endif
meterRslt.PulsesMeter = oriMeterRslt.PulsesMeter;
meterRslt.PulsesMaster = oriMeterRslt.PulsesMaster;
meterRslt.PulsesPerLiter = oriMeterRslt.PulsesPerLiter;
meterRslt.VolumeRef = oriMeterRslt.VolumeRef;
meterRslt.TestTime = oriMeterRslt.TestTime;
if (q3error * oriMeterRslt.Error < 0)
{
/// iPerl with Q2 correction => generate an artificial error equal to +1/10 of the original one (relative to Q2 target error)
meterRslt.Error = 0.1 * oriMeterRslt.Error;
}
else
{
/// iPerl with Q2 correction => generate an artificial error equal to -1/10 of the original one (relative to Q2 target error)
meterRslt.Error = - 0.1 * oriMeterRslt.Error;
}
meterRslt.VolumeMeter = meterRslt.VolumeRef * (100.0 + meterRslt.Error) / 100.0;
double signature = (oriMeterRslt.VolumeEnd > oriMeterRslt.VolumeStart) ? (+1) : (-1);
meterRslt.VolumeStart = oriMeterRslt.VolumeStart;
meterRslt.VolumeEnd = meterRslt.VolumeStart + signature * meterRslt.VolumeMeter;
meterRslt.Passed = (meterRslt.Error >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin()
&& meterRslt.Error <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
meterRslt.TestDone = true;
tstRslt.TestDone = true;
}
}
}
/// <summary>
/// Evaluate a given Q2 test result agains stricter error limits when Oruefindex == 1.
/// </summary>
/// <param name="testName">This test name</param>
/// <param name="oriTestRslt">Name of Q2 test done before Q2 correction (Q2adj)</param>
/// <remarks>Assuming this test does not have multiple parts (part = 0)</remarks>
void StrictQ2ErrorCheck(string testName, string oriTestName)
{
Results.Entities.TestRslt oriTestRslt = ProcessData.BatchRslts.GetTestRslt(oriTestName, 0);
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(testName, 0);
if (oriTestRslt == null || tstRslt == null) return;
tstRslt.Components = oriTestRslt.Components;
/// Auxiliary results, as in SequenceBase.UpdateTemoPressDensAmb()
tstRslt.AmbTempMean = oriTestRslt.AmbTempMean;
tstRslt.AmbTempStart = oriTestRslt.AmbTempStart;
tstRslt.AmbTempEnd = oriTestRslt.AmbTempEnd;
tstRslt.AmbTempMin = oriTestRslt.AmbTempMin;
tstRslt.AmbTempMax = oriTestRslt.AmbTempMax;
tstRslt.AmbPressMean = oriTestRslt.AmbPressMean;
tstRslt.AmbPressStart = oriTestRslt.AmbPressStart;
tstRslt.AmbPressEnd = oriTestRslt.AmbPressEnd;
tstRslt.AmbPressMin = oriTestRslt.AmbPressMin;
tstRslt.AmbPressMax = oriTestRslt.AmbPressMax;
tstRslt.AmbHumiMean = oriTestRslt.AmbHumiMean;
tstRslt.AmbHumiStart = oriTestRslt.AmbHumiStart;
tstRslt.AmbHumiEnd = oriTestRslt.AmbHumiEnd;
tstRslt.AmbHumiMin = oriTestRslt.AmbHumiMin;
tstRslt.AmbHumiMax = oriTestRslt.AmbHumiMax;
tstRslt.PressUpMean = oriTestRslt.PressUpMean;
tstRslt.PressUpStart = oriTestRslt.PressUpStart;
tstRslt.PressUpEnd = oriTestRslt.PressUpEnd;
tstRslt.PressUpMin = oriTestRslt.PressUpMin;
tstRslt.PressUpMax = oriTestRslt.PressUpMax;
tstRslt.PressDownMean = oriTestRslt.PressDownMean;
tstRslt.PressDownStart = oriTestRslt.PressDownStart;
tstRslt.PressDownEnd = oriTestRslt.PressDownEnd;
tstRslt.PressDownMin = oriTestRslt.PressDownMin;
tstRslt.PressDownMax = oriTestRslt.PressDownMax;
tstRslt.PressDeltaMean = oriTestRslt.PressDeltaMean;
tstRslt.PressDeltaStart = oriTestRslt.PressDeltaStart;
tstRslt.PressDeltaEnd = oriTestRslt.PressDeltaEnd;
tstRslt.PressDeltaMin = oriTestRslt.PressDeltaMin;
tstRslt.PressDeltaMax = oriTestRslt.PressDeltaMax;
tstRslt.ConductMean = oriTestRslt.ConductMean;
tstRslt.ConductStart = oriTestRslt.ConductStart;
tstRslt.ConductEnd = oriTestRslt.ConductEnd;
tstRslt.ConductMin = oriTestRslt.ConductMin;
tstRslt.ConductMax = oriTestRslt.ConductMax;
tstRslt.TempUpMean = oriTestRslt.TempUpMean;
tstRslt.TempUpStart = oriTestRslt.TempUpStart;
tstRslt.TempUpEnd = oriTestRslt.TempUpEnd;
tstRslt.TempUpMin = oriTestRslt.TempUpMin;
tstRslt.TempUpMax = oriTestRslt.TempUpMax;
tstRslt.TempDownMean = oriTestRslt.TempDownMean;
tstRslt.TempDownStart = oriTestRslt.TempDownStart;
tstRslt.TempDownEnd = oriTestRslt.TempDownEnd;
tstRslt.TempDownMin = oriTestRslt.TempDownMin;
tstRslt.TempDownMax = oriTestRslt.TempDownMax;
tstRslt.TempDivMean = oriTestRslt.TempDivMean;
tstRslt.TempDivStart = oriTestRslt.TempDivStart;
tstRslt.TempDivEnd = oriTestRslt.TempDivEnd;
tstRslt.TempDivMin = oriTestRslt.TempDivMin;
tstRslt.TempDivMax = oriTestRslt.TempDivMax;
tstRslt.DensityIn = oriTestRslt.DensityIn;
tstRslt.DensityLine = oriTestRslt.DensityLine;
tstRslt.DensityDiv = oriTestRslt.DensityDiv;
tstRslt.StartTime = oriTestRslt.StartTime;
tstRslt.EndTime = oriTestRslt.EndTime;
tstRslt.FlowSetTime = oriTestRslt.FlowSetTime;
tstRslt.TestTime = oriTestRslt.TestTime;
tstRslt.PulsesMaster = oriTestRslt.PulsesMaster;
tstRslt.ConstMasterRaw = oriTestRslt.ConstMasterRaw;
tstRslt.ConstMaster = oriTestRslt.ConstMaster;
tstRslt.MassStartRaw = oriTestRslt.MassStartRaw;
tstRslt.MassStart = oriTestRslt.MassStart;
tstRslt.MassEndRaw = oriTestRslt.MassEndRaw;
tstRslt.MassEnd = oriTestRslt.MassEnd;
tstRslt.MassOfEvapWater = oriTestRslt.MassOfEvapWater;
//tstRslt.FlowMass = oriTestRslt.FlowMass;
//tstRslt.FlowVolume = oriTestRslt.FlowVolume;
tstRslt.VolumeCTV = oriTestRslt.VolumeCTV;
tstRslt.VolumeMaster = oriTestRslt.VolumeMaster;
tstRslt.ErrorMaster = oriTestRslt.ErrorMaster;
tstRslt.FlowMean = oriTestRslt.FlowMean;
tstRslt.FlowMin = oriTestRslt.FlowMin;
tstRslt.FlowMax = oriTestRslt.FlowMax;
tstRslt.Custom1 = oriTestRslt.Custom1;
tstRslt.Custom2 = oriTestRslt.Custom2;
tstRslt.Custom3 = oriTestRslt.Custom3;
tstRslt.Custom4 = oriTestRslt.Custom4;
tstRslt.Custom5 = oriTestRslt.Custom5;
tstRslt.Custom6 = oriTestRslt.Custom6;
tstRslt.Custom7 = oriTestRslt.Custom7;
tstRslt.Custom8 = oriTestRslt.Custom8;
for (int i = 0; i < ProcessData.BatchRslts.WMPositionsCount; i++)
{
Results.Entities.MeterTestRslt oriMeterRslt = ProcessData.BatchRslts.GetMeterTestRslt(oriTestName, i, CompoundMeterId.Single);
Results.Entities.MeterTestRslt meterRslt = ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
/// Reference to iPerl water meter or null:
TestMethods.iPerlCommunication.iPerlHead.IperlHead iPerl = ((sensPath != null) && (sensPath.RegisterReaders != null) && (i < sensPath.RegisterReaders.Length))
? (sensPath.RegisterReaders[i] as TestMethods.iPerlCommunication.iPerlHead.IperlHead)
: null;
if (meterRslt != null && oriMeterRslt != null)
{
#if ORACLE_DB
meterRslt.ErrorBC = oriMeterRslt.Error;
#endif
meterRslt.PulsesMeter = oriMeterRslt.PulsesMeter;
meterRslt.PulsesMaster = oriMeterRslt.PulsesMaster;
meterRslt.PulsesPerLiter = oriMeterRslt.PulsesPerLiter;
meterRslt.VolumeRef = oriMeterRslt.VolumeRef;
meterRslt.TestTime = oriMeterRslt.TestTime;
if (iPerl != null && ProcessData.BatchRslts.Batch.WaterMeters[i] != null &&
!ProcessData.BatchRslts.Batch.WaterMeters[i].Disabled)
{
/// Either no iPerl head or no Q2 correction
meterRslt.Error = oriMeterRslt.Error;
meterRslt.VolumeMeter = oriMeterRslt.VolumeMeter;
meterRslt.VolumeStart = oriMeterRslt.VolumeStart;
meterRslt.VolumeEnd = oriMeterRslt.VolumeEnd;
#if ORACLE_DB
if ((ProcessData.BatchRslts.Batch.WaterMeters[i].Pruefindex % 100) == 1)
{
meterRslt.Passed = (oriMeterRslt.Error >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin()
&& oriMeterRslt.Error <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
}
else
#endif
{
meterRslt.Passed = oriMeterRslt.Passed;
}
meterRslt.TestDone = true;
tstRslt.TestDone = true;
}
}
}
}
/// <summary>
/// Check results of 2 tests: before Q2 correction and after Q2 correction.
/// Evaluate whether Q2 correction works OK.
/// </summary>
/// <param name="testName">This test name</param>
/// <param name="testNameQ2bc">Name of Q2 test done before correction</param>
/// <param name="testNameQ2ac">Name of Q2 test done after correction</param>
/// <remarks>Assuming these tests do not have multiple parts (part = 0)</remarks>
void CheckQ2Correction(string testName, string testNameQ2bc, string testNameQ2ac)
{
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(testName, 0);
Results.Entities.TestRslt testRsltQ2bc = ProcessData.BatchRslts.GetTestRslt(testNameQ2bc, 0);
Results.Entities.TestRslt testRsltQ2ac = ProcessData.BatchRslts.GetTestRslt(testNameQ2ac, 0);
if ((tstRslt == null) || (testRsltQ2bc == null) || (testRsltQ2ac == null)) return;
tstRslt.Components = testRsltQ2ac.Components;
/// Auxiliary results, as in SequenceBase.UpdateTemoPressDensAmb()
tstRslt.AmbTempMean = testRsltQ2ac.AmbTempMean;
tstRslt.AmbTempStart = testRsltQ2ac.AmbTempStart;
tstRslt.AmbTempEnd = testRsltQ2ac.AmbTempEnd;
tstRslt.AmbTempMin = testRsltQ2ac.AmbTempMin;
tstRslt.AmbTempMax = testRsltQ2ac.AmbTempMax;
tstRslt.AmbPressMean = testRsltQ2ac.AmbPressMean;
tstRslt.AmbPressStart = testRsltQ2ac.AmbPressStart;
tstRslt.AmbPressEnd = testRsltQ2ac.AmbPressEnd;
tstRslt.AmbPressMin = testRsltQ2ac.AmbPressMin;
tstRslt.AmbPressMax = testRsltQ2ac.AmbPressMax;
tstRslt.AmbHumiMean = testRsltQ2ac.AmbHumiMean;
tstRslt.AmbHumiStart = testRsltQ2ac.AmbHumiStart;
tstRslt.AmbHumiEnd = testRsltQ2ac.AmbHumiEnd;
tstRslt.AmbHumiMin = testRsltQ2ac.AmbHumiMin;
tstRslt.AmbHumiMax = testRsltQ2ac.AmbHumiMax;
tstRslt.PressUpMean = testRsltQ2ac.PressUpMean;
tstRslt.PressUpStart = testRsltQ2ac.PressUpStart;
tstRslt.PressUpEnd = testRsltQ2ac.PressUpEnd;
tstRslt.PressUpMin = testRsltQ2ac.PressUpMin;
tstRslt.PressUpMax = testRsltQ2ac.PressUpMax;
tstRslt.PressDownMean = testRsltQ2ac.PressDownMean;
tstRslt.PressDownStart = testRsltQ2ac.PressDownStart;
tstRslt.PressDownEnd = testRsltQ2ac.PressDownEnd;
tstRslt.PressDownMin = testRsltQ2ac.PressDownMin;
tstRslt.PressDownMax = testRsltQ2ac.PressDownMax;
tstRslt.PressDeltaMean = testRsltQ2ac.PressDeltaMean;
tstRslt.PressDeltaStart = testRsltQ2ac.PressDeltaStart;
tstRslt.PressDeltaEnd = testRsltQ2ac.PressDeltaEnd;
tstRslt.PressDeltaMin = testRsltQ2ac.PressDeltaMin;
tstRslt.PressDeltaMax = testRsltQ2ac.PressDeltaMax;
tstRslt.ConductMean = testRsltQ2ac.ConductMean;
tstRslt.ConductStart = testRsltQ2ac.ConductStart;
tstRslt.ConductEnd = testRsltQ2ac.ConductEnd;
tstRslt.ConductMin = testRsltQ2ac.ConductMin;
tstRslt.ConductMax = testRsltQ2ac.ConductMax;
tstRslt.TempUpMean = testRsltQ2ac.TempUpMean;
tstRslt.TempUpStart = testRsltQ2ac.TempUpStart;
tstRslt.TempUpEnd = testRsltQ2ac.TempUpEnd;
tstRslt.TempUpMin = testRsltQ2ac.TempUpMin;
tstRslt.TempUpMax = testRsltQ2ac.TempUpMax;
tstRslt.TempDownMean = testRsltQ2ac.TempDownMean;
tstRslt.TempDownStart = testRsltQ2ac.TempDownStart;
tstRslt.TempDownEnd = testRsltQ2ac.TempDownEnd;
tstRslt.TempDownMin = testRsltQ2ac.TempDownMin;
tstRslt.TempDownMax = testRsltQ2ac.TempDownMax;
tstRslt.TempDivMean = testRsltQ2ac.TempDivMean;
tstRslt.TempDivStart = testRsltQ2ac.TempDivStart;
tstRslt.TempDivEnd = testRsltQ2ac.TempDivEnd;
tstRslt.TempDivMin = testRsltQ2ac.TempDivMin;
tstRslt.TempDivMax = testRsltQ2ac.TempDivMax;
tstRslt.DensityIn = testRsltQ2ac.DensityIn;
tstRslt.DensityLine = testRsltQ2ac.DensityLine;
tstRslt.DensityDiv = testRsltQ2ac.DensityDiv;
tstRslt.StartTime = testRsltQ2ac.StartTime;
tstRslt.EndTime = testRsltQ2ac.EndTime;
tstRslt.FlowSetTime = testRsltQ2ac.FlowSetTime;
tstRslt.TestTime = testRsltQ2ac.TestTime;
tstRslt.PulsesMaster = testRsltQ2ac.PulsesMaster;
tstRslt.ConstMasterRaw = testRsltQ2ac.ConstMasterRaw;
tstRslt.ConstMaster = testRsltQ2ac.ConstMaster;
tstRslt.MassStartRaw = testRsltQ2ac.MassStartRaw;
tstRslt.MassStart = testRsltQ2ac.MassStart;
tstRslt.MassEndRaw = testRsltQ2ac.MassEndRaw;
tstRslt.MassEnd = testRsltQ2ac.MassEnd;
tstRslt.MassOfEvapWater = testRsltQ2ac.MassOfEvapWater;
//tstRslt.FlowMass = testRsltQ2ac.FlowMass;
//tstRslt.FlowVolume = testRsltQ2ac.FlowVolume;
tstRslt.VolumeCTV = testRsltQ2ac.VolumeCTV;
tstRslt.VolumeMaster = testRsltQ2ac.VolumeMaster;
tstRslt.ErrorMaster = testRsltQ2ac.ErrorMaster;
tstRslt.FlowMean = testRsltQ2ac.FlowMean;
tstRslt.FlowMin = testRsltQ2ac.FlowMin;
tstRslt.FlowMax = testRsltQ2ac.FlowMax;
tstRslt.Custom1 = testRsltQ2ac.Custom1;
tstRslt.Custom2 = testRsltQ2ac.Custom2;
tstRslt.Custom3 = testRsltQ2ac.Custom3;
tstRslt.Custom4 = testRsltQ2ac.Custom4;
tstRslt.Custom5 = testRsltQ2ac.Custom5;
tstRslt.Custom6 = testRsltQ2ac.Custom6;
tstRslt.Custom7 = testRsltQ2ac.Custom7;
tstRslt.Custom8 = testRsltQ2ac.Custom8;
for (int i = 0; i < ProcessData.BatchRslts.WMPositionsCount; i++)
{
Results.Entities.MeterTestRslt meterRslt = ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
Results.Entities.MeterTestRslt meterRsltQ2bc = ProcessData.BatchRslts.GetMeterTestRslt(testNameQ2bc, i, CompoundMeterId.Single);
Results.Entities.MeterTestRslt meterRsltQ2ac = ProcessData.BatchRslts.GetMeterTestRslt(testNameQ2ac, i, CompoundMeterId.Single);
if ((meterRslt != null) && (meterRsltQ2bc != null) && (meterRsltQ2ac != null))
{
meterRslt.PulsesMeter = meterRsltQ2ac.PulsesMeter;
meterRslt.PulsesMaster = meterRsltQ2ac.PulsesMaster;
meterRslt.PulsesPerLiter = meterRsltQ2ac.PulsesPerLiter;
meterRslt.VolumeRef = meterRsltQ2ac.VolumeRef;
meterRslt.TestTime = meterRsltQ2ac.TestTime;
meterRslt.VolumeStart = meterRsltQ2ac.VolumeStart;
meterRslt.VolumeEnd = meterRsltQ2ac.VolumeEnd;
meterRslt.VolumeMeter = meterRsltQ2ac.VolumeMeter;
meterRslt.Error = meterRsltQ2ac.Error;
meterRslt.TestDone = meterRsltQ2ac.TestDone;
tstRslt.TestDone = true;
if (((meterRsltQ2bc.Error < -0.51) && (meterRsltQ2ac.Error < meterRsltQ2bc.Error)) ||
((meterRsltQ2bc.Error > +0.51) && (meterRsltQ2ac.Error > meterRsltQ2bc.Error)))
{
meterRslt.Passed = false; /// Q2 correction check failed
}
else
{
meterRslt.Passed = true; /// Q2 correction check passed
}
}
}
}
}
}

View File

@ -14,6 +14,7 @@ using TBF.Rig.GenericDevices;
using TBF.Rig.Sequences;
using Dirichlet.Numerics;
using TBF.Resources;
using TBF.Rig.RegisterReaders.iPerlReaderUNI;
namespace TBF.Rig
{
@ -154,6 +155,7 @@ namespace TBF.Rig
TestMethod2Class = new Dictionary<string, string>();
ProcessData.IperlHeads = new List<TestMethods.iPerlCommunication.iPerlHead.IperlHead>();
ProcessData.IperlHeadsUni = new List<IPerlReader>();
SequenceBase.FlowMeters = new List<IFlowMeter>();
SequenceBase.RegVPositions = new List<RegValvePosition>();
SequenceBase.PumpsWithFM = new List<IPumpFM>();

View File

@ -0,0 +1,32 @@
///
/// Copyright (c) 2022 Sensus Slovensko a.s.
///
using TBF.Resources;
using TBF.Rig.Uni.SharedDialogs.iPerlCommunication;
namespace TBF.Rig.TestMethods.SmartTest
{
public class SequenceConditionOp : ISequenceConditionOp, IOperation
{
public SequenceConditionOp(TestMethod testMethodComponent, ConditionID id)
: base(testMethodComponent, id)
{
}
public void Start() { }
public Event Run()
{
bool conditionMet = testMethodComponent.IsMeterCommMilestone((int)id);// IperlCommMilestone[(int)id];
return conditionMet ? Event.ConditionMet : Event.ConditionNotMet;
}
public void Stop() { }
public override string ToString()
{
return GetConditionNameFmt(id);
}
}
}

View File

@ -0,0 +1,181 @@
///
/// Copyright (c) 2015-2022 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Common;
using Config.Entities;
using TBF.Rig.GenericDevices;
using TBF.Rig.Sequences;
using TBF.Rig.Uni.SharedDialogs.iPerlCommunication;
using TBF.UiBridge;
using ConditionID = TBF.Rig.Uni.SharedDialogs.iPerlCommunication.ConditionID;
using iPerlCommunicationSeq = TBF.Rig.Sequences.iPerlCommunicationSeq;
using TestMethodCfg = TBF.Rig.RegisterReaders.iPerlReaderUNI.TestMethodCfg;
namespace TBF.Rig.TestMethods.SmartTest
{
public class TestMethod : SmartComponentBase, ISimultTestMethod, ISequenceCondition, ISessionDataMngmnt, ISmartTestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return false; }
public bool SimultWithPrevious { get { return testMethodCfg.TestParams.SimultWithPrevious; } }
public bool SimultWithNext { get { return testMethodCfg.TestParams.SimultWithNext; } }
#region Configuration Change Handling
public static void OnCfgChange(object sender, CfgChangeArgs args)
{
if (CfgChangeHandler == null) return;
try { CfgChangeHandler(sender, args); }
catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
}
public static event EventHandler<CfgChangeArgs> CfgChangeHandler;
public override void StartChangeHandler()
{
CfgChangeHandler += delegate(object sender, CfgChangeArgs args)
{
TestMethodCfg tmpCfg = args.Cfg as TestMethodCfg;
if (tmpCfg != null && tmpCfg.Name.Equals(Name))
{
if (args.Command == CfgChangeCmd.CfgChange)
{
testMethodCfg.CommTimeout = tmpCfg.CommTimeout;
testMethodCfg.DelayBetweenRetries = tmpCfg.DelayBetweenRetries;
testMethodCfg.MaxCommRetries = tmpCfg.MaxCommRetries;
testMethodCfg.IperlCheckErrorsToStop = tmpCfg.IperlCheckErrorsToStop;
testMethodCfg.UseWebService = tmpCfg.UseWebService;
testMethodCfg.BaseUrl = tmpCfg.BaseUrl;
testMethodCfg.RelativeUrl = tmpCfg.RelativeUrl;
}
}
};
}
public override void MeterCommMilestone(int iItem, bool bValue)
{
IperlCommMilestone[iItem] = bValue;
}
public override bool IsMeterCommMilestone(int iItem)
{
return IperlCommMilestone[iItem];
}
#endregion Configuration Change Handling
readonly TestMethodCfg testMethodCfg;
public bool[] IperlCommMilestone;
IList<IOperation> sequenceConditionOps;
public TestMethod()
{
CreateMilestonesAndConditions();
}
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
CreateMilestonesAndConditions();
}
void CreateMilestonesAndConditions()
{
IperlCommMilestone = new bool[(int)ConditionID.Count];
sequenceConditionOps = new List<IOperation>();
for (ConditionID id = ConditionID.A; id < ConditionID.Count; id++)
{
sequenceConditionOps.Add(new SequenceConditionOp(this, id));
}
}
/// IDevice interface - only Initialize() is used
public override void Initialize()
{
if (DebugLevel == DebugMode.Normal)
{
rfidDataLogger.Fatal("------------------------------------------------------------------------");
rfidDataLogger.FatalFormat("Test Bench Framework ver. {0}", Program.Version);
log.FatalFormat("{0} initialized: {1}", Name, this);
}
else
{
log.FatalFormat("{0} simulated: {1}", Name, this);
}
}
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
if (DebugLevel == DebugMode.Normal)
{
return (new iPerlCommunicationSeq()).Execute(test, repetNr, this, testMethodCfg.TestParams);
}
else
{
/// DebugLevel == DebugMode.Simulate
(new iPerlCommunicationSeq()).MakeSimulatedTrivial(test, repetNr, test.Part);
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Progress.Completed));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Common.Utils.GetTestName(test.Name, 1, 1), 0)));
return new List<Event> { Event.Done };
}
}
public int ConditionsCount { get { return (int)ConditionID.Count; } }
public string ConditionName(int i)
{
return (i >= 0 && i < (int)ConditionID.Count) ? ConditionOp(i).ToString() : string.Empty;
}
public IOperation ConditionOp(int i)
{
return (i >= 0 && i < (int)ConditionID.Count) ? sequenceConditionOps[i] : null;
}
public void StartSession()
{
/// Clear milestones
if (IperlCommMilestone != null)
{
for (int i = 0; i < IperlCommMilestone.Length; i++)
{
IperlCommMilestone[i] = false;
}
}
}
public void SaveMark(object o)
{
/// No marks
}
public void EndSession()
{
/// Nothing at the end of session
}
public bool CheckDeviceCaps(Test test, OutputPath devices, out string message)
{
// Implement the method to satisfy the ITestMethod interface.
// For now, provide a basic implementation.
message = "Device capabilities check not implemented.";
return true;
}
}
}

View File

@ -0,0 +1,257 @@
///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Resources;
using TBF.Rig.RegisterReaders.iPerlReaderUNI;
namespace TBF.Rig.TestMethods.SmartTest
{
public partial class TestMethodCfgCtrl : Configs.ConfigCtrlUtils, IComponentCfgCtrl
{
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;
commTimeoutTextBox.Text = config.CommTimeout.ToString();
maxCommRetriesTextBox.Text = config.MaxCommRetries.ToString();
delayBetweenRetriesTextBox.Text = config.DelayBetweenRetries.ToString();
nrThreadsTextBox.Text = config.NrThreads.ToString();
iperlCheckErrorsToStopTextBox.Text = config.IperlCheckErrorsToStop.ToString();
textBox15rl.Text = config.DfltQ2c_15_rl.ToString();
textBox15lr.Text = config.DfltQ2c_15_lr.ToString();
textBox20rl.Text = config.DfltQ2c_20_rl.ToString();
textBox20lr.Text = config.DfltQ2c_20_lr.ToString();
textBox25_63rl.Text = config.DfltQ2c_25_63_rl.ToString();
textBox25_63lr.Text = config.DfltQ2c_25_63_lr.ToString();
textBox25_10rl.Text = config.DfltQ2c_25_10_rl.ToString();
textBox25_10lr.Text = config.DfltQ2c_25_10_lr.ToString();
textBox32rl.Text = config.DfltQ2c_32_rl.ToString();
textBox32lr.Text = config.DfltQ2c_32_lr.ToString();
textBox40rl.Text = config.DfltQ2c_40_rl.ToString();
textBox40lr.Text = config.DfltQ2c_40_lr.ToString();
useWebServiceCheckBox.Checked = config.UseWebService;
baseUrlTextBox.Text = config.BaseUrl;
relativeUrlTextBox.Text = config.RelativeUrl;
}
public void Unlock()
{
nameTextBox.Enabled = true;
commTimeoutTextBox.Enabled = true;
maxCommRetriesTextBox.Enabled = true;
delayBetweenRetriesTextBox.Enabled = true;
nrThreadsTextBox.Enabled = true;
iperlCheckErrorsToStopTextBox.Enabled = true;
textBox15rl.Enabled = true;
textBox15lr.Enabled = true;
textBox20rl.Enabled = true;
textBox20lr.Enabled = true;
textBox25_63rl.Enabled = true;
textBox25_63lr.Enabled = true;
textBox25_10rl.Enabled = true;
textBox25_10lr.Enabled = true;
textBox32rl.Enabled = true;
textBox32lr.Enabled = true;
textBox40rl.Enabled = true;
textBox40lr.Enabled = true;
useWebServiceCheckBox.Enabled = true;
ManageCheckGroupBox(useWebServiceCheckBox, useWebServiceGroupBox);
baseUrlTextBox.Enabled = useWebServiceCheckBox.Enabled;
relativeUrlTextBox.Enabled = useWebServiceCheckBox.Enabled;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!int.TryParse(commTimeoutTextBox.Text, out dummy) || dummy < 500 || dummy > 5000)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Comm. timeout' should be in range 500 .. 5000";
}
if (!int.TryParse(maxCommRetriesTextBox.Text, out dummy) || dummy < 1 || dummy > 10)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Max. retries' should be in range 1 .. 10";
}
if (!int.TryParse(delayBetweenRetriesTextBox.Text, out dummy) || dummy < 0 || dummy > 5000)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Comm. timeout' should be in range 0 .. 5000";
}
if (!int.TryParse(nrThreadsTextBox.Text, out dummy) || (dummy != 1 && dummy != 2 && dummy != 4))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Nr. threads' should be 1, 2 or 4";
}
if (!int.TryParse(iperlCheckErrorsToStopTextBox.Text, out dummy) || ((dummy < 1) && (dummy > 40)))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + string.Format(Strings.Invalid_0, iperlCheckErrorsToStopLabel.Text);
}
if (!int.TryParse(textBox15rl.Text, out dummy) || dummy < -50 || dummy > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Default Q2 correction factor DN15 RL should be in range -50 .. 50";
}
if (!int.TryParse(textBox15lr.Text, out dummy) || dummy < -50 || dummy > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Default Q2 correction factor DN15 LR should be in range -50 .. 50";
}
if (!int.TryParse(textBox20rl.Text, out dummy) || dummy < -50 || dummy > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Default Q2 correction factor DN20 RL should be in range -50 .. 50";
}
if (!int.TryParse(textBox20lr.Text, out dummy) || dummy < -50 || dummy > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Default Q2 correction factor DN20 LR should be in range -50 .. 50";
}
if (!int.TryParse(textBox25_63rl.Text, out dummy) || dummy < -50 || dummy > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Default Q2 correction factor DN25 Q3 6.3 RL should be in range -50 .. 50";
}
if (!int.TryParse(textBox25_63lr.Text, out dummy) || dummy < -50 || dummy > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Default Q2 correction factor DN25 Q3 6.3 LR should be in range -50 .. 50";
}
if (!int.TryParse(textBox25_10rl.Text, out dummy) || dummy < -50 || dummy > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Default Q2 correction factor DN25 Q3 10 RL should be in range -50 .. 50";
}
if (!int.TryParse(textBox25_10lr.Text, out dummy) || dummy < -50 || dummy > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Default Q2 correction factor DN25 Q3 10 LR should be in range -50 .. 50";
}
if (!int.TryParse(textBox32rl.Text, out dummy) || dummy < -50 || dummy > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Default Q2 correction factor DN32 RL should be in range -50 .. 50";
}
if (!int.TryParse(textBox32lr.Text, out dummy) || dummy < -50 || dummy > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Default Q2 correction factor DN32 LR should be in range -50 .. 50";
}
if (!int.TryParse(textBox40rl.Text, out dummy) || dummy < -50 || dummy > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Default Q2 correction factor DN40 RL should be in range -50 .. 50";
}
if (!int.TryParse(textBox40lr.Text, out dummy) || dummy < -50 || dummy > 50)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Default Q2 correction factor DN40 LR should be in range -50 .. 50";
}
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
if (config.Name != nameTextBox.Text)
{
config.Name = nameTextBox.Text;
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
}
flags |= UpdateDifferent(ref config.CommTimeout, commTimeoutTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.MaxCommRetries, maxCommRetriesTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DelayBetweenRetries, delayBetweenRetriesTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.NrThreads, nrThreadsTextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.IperlCheckErrorsToStop, iperlCheckErrorsToStopTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DfltQ2c_15_rl, textBox15rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DfltQ2c_15_lr, textBox15lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DfltQ2c_20_rl, textBox20rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DfltQ2c_20_lr, textBox20lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DfltQ2c_25_63_rl, textBox25_63rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DfltQ2c_25_63_lr, textBox25_63lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DfltQ2c_25_10_rl, textBox25_10rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DfltQ2c_25_10_lr, textBox25_10lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DfltQ2c_32_rl, textBox32rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DfltQ2c_32_lr, textBox32lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DfltQ2c_40_rl, textBox40rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DfltQ2c_40_lr, textBox40lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.UseWebService, useWebServiceCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.BaseUrl, baseUrlTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.RelativeUrl, relativeUrlTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
{
TestMethod.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
}
return flags;
}
private void ManageCheckGroupBox(CheckBox chk, GroupBox grp)
{
/// Make sure the CheckBox isn't in the GroupBox. This will only happen the first time.
if (chk.Parent == grp)
{
grp.Parent.Controls.Add(chk); /// Reparent the CheckBox so it's not in the GroupBox.
chk.Location = new System.Drawing.Point(chk.Left + grp.Left, chk.Top + grp.Top); /// Adjust the CheckBox's location.
chk.BringToFront(); /// Move the CheckBox to the top of the stacking order.
}
/// Enable or disable the GroupBox.
grp.Enabled = chk.Checked;
}
private void useWebServiceCheckBox_CheckedChanged(object sender, EventArgs e)
{
useWebServiceGroupBox.Enabled = useWebServiceCheckBox.Checked;
}
}
}

View File

@ -0,0 +1,520 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Author: Milan Hanajík
///
namespace TBF.Rig.TestMethods.SmartTest
{
partial class TestMethodCfgCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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.commTimeoutTextBox = new System.Windows.Forms.TextBox();
this.commTimeoutLabel = new System.Windows.Forms.Label();
this.maxCommRetriesTextBox = new System.Windows.Forms.TextBox();
this.maxNrRetriesLabel = new System.Windows.Forms.Label();
this.nrThreadsTextBox = new System.Windows.Forms.TextBox();
this.nrThreadsLabel = new System.Windows.Forms.Label();
this.iperlCheckErrorsToStopTextBox = new System.Windows.Forms.TextBox();
this.iperlCheckErrorsToStopLabel = new System.Windows.Forms.Label();
this.delayBetweenRetriesTextBox = new System.Windows.Forms.TextBox();
this.delayBetweenRetriesLabel = new System.Windows.Forms.Label();
this.relativeUrlTextBox = new System.Windows.Forms.TextBox();
this.relativeUrlLabel = new System.Windows.Forms.Label();
this.baseUrlTextBox = new System.Windows.Forms.TextBox();
this.baseUrlLabel = new System.Windows.Forms.Label();
this.useWebServiceCheckBox = new System.Windows.Forms.CheckBox();
this.useWebServiceGroupBox = new System.Windows.Forms.GroupBox();
this.dfltQ2corrFactorsGroupBox = new System.Windows.Forms.GroupBox();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.textBox40lr = new System.Windows.Forms.TextBox();
this.textBox32lr = new System.Windows.Forms.TextBox();
this.textBox25_10lr = new System.Windows.Forms.TextBox();
this.textBox25_63lr = new System.Windows.Forms.TextBox();
this.textBox20lr = new System.Windows.Forms.TextBox();
this.textBox15lr = new System.Windows.Forms.TextBox();
this.textBox40rl = new System.Windows.Forms.TextBox();
this.textBox32rl = new System.Windows.Forms.TextBox();
this.textBox25_10rl = new System.Windows.Forms.TextBox();
this.textBox25_63rl = new System.Windows.Forms.TextBox();
this.textBox20rl = new System.Windows.Forms.TextBox();
this.textBox15rl = new System.Windows.Forms.TextBox();
this.useWebServiceGroupBox.SuspendLayout();
this.dfltQ2corrFactorsGroupBox.SuspendLayout();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(237, 31);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(23, 34);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(234, 11);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// commTimeoutTextBox
//
this.commTimeoutTextBox.Enabled = false;
this.commTimeoutTextBox.Location = new System.Drawing.Point(237, 53);
this.commTimeoutTextBox.Name = "commTimeoutTextBox";
this.commTimeoutTextBox.Size = new System.Drawing.Size(45, 20);
this.commTimeoutTextBox.TabIndex = 4;
//
// commTimeoutLabel
//
this.commTimeoutLabel.AutoSize = true;
this.commTimeoutLabel.Location = new System.Drawing.Point(23, 56);
this.commTimeoutLabel.Name = "commTimeoutLabel";
this.commTimeoutLabel.Size = new System.Drawing.Size(98, 13);
this.commTimeoutLabel.TabIndex = 3;
this.commTimeoutLabel.Text = "Comm. timeout [ms]";
//
// maxCommRetriesTextBox
//
this.maxCommRetriesTextBox.Enabled = false;
this.maxCommRetriesTextBox.Location = new System.Drawing.Point(237, 75);
this.maxCommRetriesTextBox.Name = "maxCommRetriesTextBox";
this.maxCommRetriesTextBox.Size = new System.Drawing.Size(45, 20);
this.maxCommRetriesTextBox.TabIndex = 6;
//
// maxNrRetriesLabel
//
this.maxNrRetriesLabel.AutoSize = true;
this.maxNrRetriesLabel.Location = new System.Drawing.Point(23, 78);
this.maxNrRetriesLabel.Name = "maxNrRetriesLabel";
this.maxNrRetriesLabel.Size = new System.Drawing.Size(61, 13);
this.maxNrRetriesLabel.TabIndex = 5;
this.maxNrRetriesLabel.Text = "Max. retries";
//
// nrThreadsTextBox
//
this.nrThreadsTextBox.Enabled = false;
this.nrThreadsTextBox.Location = new System.Drawing.Point(237, 119);
this.nrThreadsTextBox.Name = "nrThreadsTextBox";
this.nrThreadsTextBox.Size = new System.Drawing.Size(45, 20);
this.nrThreadsTextBox.TabIndex = 10;
//
// nrThreadsLabel
//
this.nrThreadsLabel.AutoSize = true;
this.nrThreadsLabel.Location = new System.Drawing.Point(23, 122);
this.nrThreadsLabel.Name = "nrThreadsLabel";
this.nrThreadsLabel.Size = new System.Drawing.Size(59, 13);
this.nrThreadsLabel.TabIndex = 9;
this.nrThreadsLabel.Text = "Nr. threads";
//
// iperlCheckErrorsToStopTextBox
//
this.iperlCheckErrorsToStopTextBox.Enabled = false;
this.iperlCheckErrorsToStopTextBox.Location = new System.Drawing.Point(237, 141);
this.iperlCheckErrorsToStopTextBox.Name = "iperlCheckErrorsToStopTextBox";
this.iperlCheckErrorsToStopTextBox.Size = new System.Drawing.Size(45, 20);
this.iperlCheckErrorsToStopTextBox.TabIndex = 13;
//
// iperlCheckErrorsToStopLabel
//
this.iperlCheckErrorsToStopLabel.AutoSize = true;
this.iperlCheckErrorsToStopLabel.Location = new System.Drawing.Point(23, 144);
this.iperlCheckErrorsToStopLabel.Name = "iperlCheckErrorsToStopLabel";
this.iperlCheckErrorsToStopLabel.Size = new System.Drawing.Size(202, 13);
this.iperlCheckErrorsToStopLabel.TabIndex = 12;
this.iperlCheckErrorsToStopLabel.Text = "iperl_check errors count to stop the cycle";
//
// delayBetweenRetriesTextBox
//
this.delayBetweenRetriesTextBox.Enabled = false;
this.delayBetweenRetriesTextBox.Location = new System.Drawing.Point(237, 97);
this.delayBetweenRetriesTextBox.Name = "delayBetweenRetriesTextBox";
this.delayBetweenRetriesTextBox.Size = new System.Drawing.Size(45, 20);
this.delayBetweenRetriesTextBox.TabIndex = 8;
//
// delayBetweenRetriesLabel
//
this.delayBetweenRetriesLabel.AutoSize = true;
this.delayBetweenRetriesLabel.Location = new System.Drawing.Point(23, 100);
this.delayBetweenRetriesLabel.Name = "delayBetweenRetriesLabel";
this.delayBetweenRetriesLabel.Size = new System.Drawing.Size(131, 13);
this.delayBetweenRetriesLabel.TabIndex = 7;
this.delayBetweenRetriesLabel.Text = "Delay between retries [ms]";
//
// relativeUrlTextBox
//
this.relativeUrlTextBox.Enabled = false;
this.relativeUrlTextBox.Location = new System.Drawing.Point(89, 50);
this.relativeUrlTextBox.Name = "relativeUrlTextBox";
this.relativeUrlTextBox.Size = new System.Drawing.Size(298, 20);
this.relativeUrlTextBox.TabIndex = 18;
//
// relativeUrlLabel
//
this.relativeUrlLabel.AutoSize = true;
this.relativeUrlLabel.Location = new System.Drawing.Point(13, 53);
this.relativeUrlLabel.Name = "relativeUrlLabel";
this.relativeUrlLabel.Size = new System.Drawing.Size(71, 13);
this.relativeUrlLabel.TabIndex = 17;
this.relativeUrlLabel.Text = "Relative URL";
//
// baseUrlTextBox
//
this.baseUrlTextBox.Enabled = false;
this.baseUrlTextBox.Location = new System.Drawing.Point(89, 24);
this.baseUrlTextBox.Name = "baseUrlTextBox";
this.baseUrlTextBox.Size = new System.Drawing.Size(298, 20);
this.baseUrlTextBox.TabIndex = 16;
//
// baseUrlLabel
//
this.baseUrlLabel.AutoSize = true;
this.baseUrlLabel.Location = new System.Drawing.Point(13, 27);
this.baseUrlLabel.Name = "baseUrlLabel";
this.baseUrlLabel.Size = new System.Drawing.Size(56, 13);
this.baseUrlLabel.TabIndex = 15;
this.baseUrlLabel.Text = "Base URL";
//
// useWebServiceCheckBox
//
this.useWebServiceCheckBox.AutoSize = true;
this.useWebServiceCheckBox.Enabled = false;
this.useWebServiceCheckBox.Location = new System.Drawing.Point(15, 0);
this.useWebServiceCheckBox.Name = "useWebServiceCheckBox";
this.useWebServiceCheckBox.Size = new System.Drawing.Size(189, 17);
this.useWebServiceCheckBox.TabIndex = 14;
this.useWebServiceCheckBox.Text = "Use web service for default values";
this.useWebServiceCheckBox.UseVisualStyleBackColor = true;
this.useWebServiceCheckBox.CheckedChanged += new System.EventHandler(this.useWebServiceCheckBox_CheckedChanged);
//
// useWebServiceGroupBox
//
this.useWebServiceGroupBox.Controls.Add(this.baseUrlTextBox);
this.useWebServiceGroupBox.Controls.Add(this.useWebServiceCheckBox);
this.useWebServiceGroupBox.Controls.Add(this.relativeUrlTextBox);
this.useWebServiceGroupBox.Controls.Add(this.relativeUrlLabel);
this.useWebServiceGroupBox.Controls.Add(this.baseUrlLabel);
this.useWebServiceGroupBox.Location = new System.Drawing.Point(11, 266);
this.useWebServiceGroupBox.Name = "useWebServiceGroupBox";
this.useWebServiceGroupBox.Size = new System.Drawing.Size(404, 83);
this.useWebServiceGroupBox.TabIndex = 0;
this.useWebServiceGroupBox.TabStop = false;
//
// dfltQ2corrFactorsGroupBox
//
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.label8);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.label7);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.label6);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.label5);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.label4);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.label3);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.label2);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.label1);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.textBox40lr);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.textBox32lr);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.textBox25_10lr);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.textBox25_63lr);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.textBox20lr);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.textBox15lr);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.textBox40rl);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.textBox32rl);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.textBox25_10rl);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.textBox25_63rl);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.textBox20rl);
this.dfltQ2corrFactorsGroupBox.Controls.Add(this.textBox15rl);
this.dfltQ2corrFactorsGroupBox.Location = new System.Drawing.Point(11, 175);
this.dfltQ2corrFactorsGroupBox.Name = "dfltQ2corrFactorsGroupBox";
this.dfltQ2corrFactorsGroupBox.Size = new System.Drawing.Size(404, 85);
this.dfltQ2corrFactorsGroupBox.TabIndex = 14;
this.dfltQ2corrFactorsGroupBox.TabStop = false;
this.dfltQ2corrFactorsGroupBox.Text = "Default Q2 correction factors";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(344, 17);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(35, 13);
this.label8.TabIndex = 19;
this.label8.Text = "DN40";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(289, 17);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(35, 13);
this.label7.TabIndex = 18;
this.label7.Text = "DN32";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(233, 17);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(45, 13);
this.label6.TabIndex = 17;
this.label6.Text = "...Q3 10";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(163, 17);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(70, 13);
this.label5.TabIndex = 16;
this.label5.Text = "DN25 Q3 6.3";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(121, 17);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(35, 13);
this.label4.TabIndex = 15;
this.label4.Text = "DN20";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(65, 17);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(35, 13);
this.label3.TabIndex = 14;
this.label3.Text = "DN15";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(22, 57);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(24, 13);
this.label2.TabIndex = 13;
this.label2.Text = "L-R";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(22, 34);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(24, 13);
this.label1.TabIndex = 12;
this.label1.Text = "R-L";
//
// textBox40lr
//
this.textBox40lr.Enabled = false;
this.textBox40lr.Location = new System.Drawing.Point(337, 54);
this.textBox40lr.Name = "textBox40lr";
this.textBox40lr.Size = new System.Drawing.Size(50, 20);
this.textBox40lr.TabIndex = 11;
//
// textBox32lr
//
this.textBox32lr.Enabled = false;
this.textBox32lr.Location = new System.Drawing.Point(281, 54);
this.textBox32lr.Name = "textBox32lr";
this.textBox32lr.Size = new System.Drawing.Size(50, 20);
this.textBox32lr.TabIndex = 10;
//
// textBox25_10lr
//
this.textBox25_10lr.Enabled = false;
this.textBox25_10lr.Location = new System.Drawing.Point(225, 54);
this.textBox25_10lr.Name = "textBox25_10lr";
this.textBox25_10lr.Size = new System.Drawing.Size(50, 20);
this.textBox25_10lr.TabIndex = 9;
//
// textBox25_63lr
//
this.textBox25_63lr.Enabled = false;
this.textBox25_63lr.Location = new System.Drawing.Point(169, 54);
this.textBox25_63lr.Name = "textBox25_63lr";
this.textBox25_63lr.Size = new System.Drawing.Size(50, 20);
this.textBox25_63lr.TabIndex = 8;
//
// textBox20lr
//
this.textBox20lr.Enabled = false;
this.textBox20lr.Location = new System.Drawing.Point(113, 54);
this.textBox20lr.Name = "textBox20lr";
this.textBox20lr.Size = new System.Drawing.Size(50, 20);
this.textBox20lr.TabIndex = 7;
//
// textBox15lr
//
this.textBox15lr.Enabled = false;
this.textBox15lr.Location = new System.Drawing.Point(57, 54);
this.textBox15lr.Name = "textBox15lr";
this.textBox15lr.Size = new System.Drawing.Size(50, 20);
this.textBox15lr.TabIndex = 6;
//
// textBox40rl
//
this.textBox40rl.Enabled = false;
this.textBox40rl.Location = new System.Drawing.Point(337, 31);
this.textBox40rl.Name = "textBox40rl";
this.textBox40rl.Size = new System.Drawing.Size(50, 20);
this.textBox40rl.TabIndex = 5;
//
// textBox32rl
//
this.textBox32rl.Enabled = false;
this.textBox32rl.Location = new System.Drawing.Point(281, 31);
this.textBox32rl.Name = "textBox32rl";
this.textBox32rl.Size = new System.Drawing.Size(50, 20);
this.textBox32rl.TabIndex = 4;
//
// textBox25_10rl
//
this.textBox25_10rl.Enabled = false;
this.textBox25_10rl.Location = new System.Drawing.Point(225, 31);
this.textBox25_10rl.Name = "textBox25_10rl";
this.textBox25_10rl.Size = new System.Drawing.Size(50, 20);
this.textBox25_10rl.TabIndex = 3;
//
// textBox25_63rl
//
this.textBox25_63rl.Enabled = false;
this.textBox25_63rl.Location = new System.Drawing.Point(169, 31);
this.textBox25_63rl.Name = "textBox25_63rl";
this.textBox25_63rl.Size = new System.Drawing.Size(50, 20);
this.textBox25_63rl.TabIndex = 2;
//
// textBox20rl
//
this.textBox20rl.Enabled = false;
this.textBox20rl.Location = new System.Drawing.Point(113, 31);
this.textBox20rl.Name = "textBox20rl";
this.textBox20rl.Size = new System.Drawing.Size(50, 20);
this.textBox20rl.TabIndex = 1;
//
// textBox15rl
//
this.textBox15rl.Enabled = false;
this.textBox15rl.Location = new System.Drawing.Point(57, 31);
this.textBox15rl.Name = "textBox15rl";
this.textBox15rl.Size = new System.Drawing.Size(50, 20);
this.textBox15rl.TabIndex = 0;
//
// TestMethodCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.dfltQ2corrFactorsGroupBox);
this.Controls.Add(this.useWebServiceGroupBox);
this.Controls.Add(this.delayBetweenRetriesTextBox);
this.Controls.Add(this.delayBetweenRetriesLabel);
this.Controls.Add(this.iperlCheckErrorsToStopTextBox);
this.Controls.Add(this.iperlCheckErrorsToStopLabel);
this.Controls.Add(this.nrThreadsTextBox);
this.Controls.Add(this.nrThreadsLabel);
this.Controls.Add(this.maxCommRetriesTextBox);
this.Controls.Add(this.maxNrRetriesLabel);
this.Controls.Add(this.commTimeoutTextBox);
this.Controls.Add(this.commTimeoutLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "TestMethodCfgCtrl";
this.Size = new System.Drawing.Size(427, 363);
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
this.useWebServiceGroupBox.ResumeLayout(false);
this.useWebServiceGroupBox.PerformLayout();
this.dfltQ2corrFactorsGroupBox.ResumeLayout(false);
this.dfltQ2corrFactorsGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.TextBox commTimeoutTextBox;
private System.Windows.Forms.Label commTimeoutLabel;
private System.Windows.Forms.TextBox maxCommRetriesTextBox;
private System.Windows.Forms.Label maxNrRetriesLabel;
private System.Windows.Forms.TextBox nrThreadsTextBox;
private System.Windows.Forms.Label nrThreadsLabel;
private System.Windows.Forms.TextBox iperlCheckErrorsToStopTextBox;
private System.Windows.Forms.Label iperlCheckErrorsToStopLabel;
private System.Windows.Forms.TextBox delayBetweenRetriesTextBox;
private System.Windows.Forms.Label delayBetweenRetriesLabel;
private System.Windows.Forms.TextBox relativeUrlTextBox;
private System.Windows.Forms.Label relativeUrlLabel;
private System.Windows.Forms.TextBox baseUrlTextBox;
private System.Windows.Forms.Label baseUrlLabel;
private System.Windows.Forms.CheckBox useWebServiceCheckBox;
private System.Windows.Forms.GroupBox useWebServiceGroupBox;
private System.Windows.Forms.GroupBox dfltQ2corrFactorsGroupBox;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox40lr;
private System.Windows.Forms.TextBox textBox32lr;
private System.Windows.Forms.TextBox textBox25_10lr;
private System.Windows.Forms.TextBox textBox25_63lr;
private System.Windows.Forms.TextBox textBox20lr;
private System.Windows.Forms.TextBox textBox15lr;
private System.Windows.Forms.TextBox textBox40rl;
private System.Windows.Forms.TextBox textBox32rl;
private System.Windows.Forms.TextBox textBox25_10rl;
private System.Windows.Forms.TextBox textBox25_63rl;
private System.Windows.Forms.TextBox textBox20rl;
private System.Windows.Forms.TextBox textBox15rl;
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,25 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.Rig.Generic;
using TBF.Rig.RegisterReaders.iPerlReaderUNI;
namespace TBF.Rig.TestMethods.SmartTest
{
public class TestMethodFactory : IComponentFactory
{
public string ClassName { get { return GetType().Namespace.Substring(8); } }
public IComponent DummyComponent() { return new TestMethod(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new TestMethod(cfg); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}

View File

@ -0,0 +1,18 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Author: Milan Hanajík
///
using System;
namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
{
public class AllCompletedEventArgs : EventArgs
{
public string CommMessage;
public AllCompletedEventArgs(string commMessage)
{
this.CommMessage = commMessage;
}
}
}

View File

@ -0,0 +1,41 @@
///
/// Copyright (c) 2015-2019 Sensus Metering Systems
/// Author: Milan Hanajík
///
using System;
using TBF.Rig.RegisterReaders.iPerlReaderUNI;
using TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication;
namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
{
public class CommCompletedEventArgs : EventArgs
{
public int ThreadId;
public int WMNr0; /// 0-based water meter position
public IPerlReader Ihead;
public Results.Entities.WaterMeter Wm;
public string CommMessage;
public CommErr CommErr;
public CommCompletedEventArgs(int threadId, int wmNr0, IPerlReader ihead, Results.Entities.WaterMeter wm, string commMessage, CommErr commErr)
{
this.ThreadId = threadId;
this.WMNr0 = wmNr0;
this.Ihead = ihead;
this.Wm = wm;
this.CommMessage = commMessage;
this.CommErr = commErr;
}
public override string ToString()
{
return string.Format("Thread={0} WMNr0={1} IHead={2} WM={3} CommMsg={4} CommErr={5}",
ThreadId,
WMNr0,
(Ihead != null) ? Ihead.Name : "null",
Wm.WMPosition,
(CommMessage != null) ? CommMessage : "null",
CommErr);
}
}
}

View File

@ -11,13 +11,13 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
public abstract class ISequenceConditionOp
{
const string ConditionNameFmt = "iPERL communication milestone {0}";
public static string GetConditionNameFmt(int id)
public static string GetConditionNameFmt(ConditionID id)
{
return string.Format(ConditionNameFmt, id);
}
private ConditionID id;
private ISmartTestMethod testMethodComponent;
public ConditionID id;
public ISmartTestMethod testMethodComponent;
public ISequenceConditionOp(ISmartTestMethod testMethodComponent, ConditionID id)
{

View File

@ -1,9 +1,12 @@
using TBF.Rig.RegisterReaders.iPerlReaderUNI;
namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
{
public interface ISmartTestMethod
{
void MeterCommMilestone(int iItem, bool bValue);
public void MeterCommMilestone(int iItem, bool bValue);
public bool IsMeterCommMilestone(int iItem);
}
}

View File

@ -1,8 +1,11 @@
using TBF.Rig.RegisterReaders.iPerlReaderUNI;
using Results.Entities;
namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
{
public interface ISmartWrapper
{
CommErr ResetQ2Correction(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
CommErr WriteDefaultQ2Corrections(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr);
CommErr ResetQ2Correction(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr);
CommErr WriteDefaultQ2Corrections(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr);
}
}

View File

@ -0,0 +1,21 @@
using TBF.Rig.Generic;
namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
{
public abstract class SmartComponentBase : ComponentBase, ISmartTestMethod
{
public abstract void MeterCommMilestone(int iItem, bool bValue);
public abstract bool IsMeterCommMilestone(int iItem);
public SmartComponentBase()
: base()
{
}
public SmartComponentBase(IComponentCfg cfg)
: base(cfg)
{
}
}
}

View File

@ -0,0 +1,63 @@
using System.Drawing;
namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
{
public static class iPerlCommunicationConstants
{
public const int Hz2CorrFactorsAddr = 0x1875; /// Used by Reset2HzCorrection(...) and Write2HzCorrection(...)
public const int Q2CorrFactorsAddr = 0x1878; /// Used by ResetQ2Correction(...) and WriteQ2Correction(...)
public const int Q2CorrFactorsAddrLR = 0x1878;
public const int Q2CorrFactorsAddrRL = 0x1879;
public const string ReadConfigurationStr = "Read configuration"; /// Example: "Read configuration" or "Read configuration if enabled"
public const string SetTestModeStr = "Set Test mode"; /// Example: "Set Test mode" or "Set Test mode A0" (hexadecimal number is the required 'testModeConfig'
public const string SetActiveModeStr = "Set Active mode";
public const string ReadCalibrationStr = "Read calibration";
public const string ReadCalibrationV4Str = "Read calibration_V4";
public const string WriteCalibrationFactorStr = "Write calibration factor";
public const string WriteCalibrationV4FactorsStr = "Write calibration_V4";
public const string NormalizeCalibrationFactorStr = "Normalize calibration factor";
public const string NormalizeCalibrationV4FactorsStr = "Normalize calibration_V4";
public const string GetDefaultQ2CorrectionsStr = "Get default Q2 corrections";
public const string ReadQ2CorrectionStr = "Read Q2 corrections";
public const string ResetQ2CorrectionStr = "Reset Q2 correction";
public const string WriteDefaultQ2CorrectionsStr = "Write default Q2 corrections";
public const string InitOrReadQ2CorrectionsStr = "Init or read Q2 corrections";
public const string WriteQ2CorrectionStr = "Write Q2 correction"; /// No arguments
public const string WriteQ2CorrectionAltStr = "Write Q2 correction Alt"; /// No arguments
public const string WriteQ2CorrectionGreeceStr = "Write Q2 correction Greece"; /// Arguments: test_name
public const string WriteQ2CorrectionRLStr = "Write Q2 correction R-L"; /// Arguments: test_name
public const string WriteQ2CorrectionLRStr = "Write Q2 correction L-R"; /// Arguments: test_name
public const string WriteQ2CorrectionIncl05Str = "Write_Q2_correction_incl.-0,5..0,5%"; /// No arguments
public const string WriteQ2CorrectionAltIncl05Str = "Write_Q2_correction_Alt_incl.-0,5..0,5%"; /// No arguments
public const string WriteQ2CorrectionPlusIncl05Str = "Write_Q2_correction_plus_incl.-0,5..0,5%"; /// No arguments
public const string WriteQ2CorrectionPlusAltIncl05Str = "Write_Q2_correction_plus_Alt_incl.-0,5..0,5%"; /// No arguments
public const string WriteQ2CorrectionGreeceIncl05Str = "Write_Q2_correction_Greece_incl.-0,5..0,5%"; /// Arguments: test_name
public const string WriteQ2CorrectionRLIncl05Str = "Write_Q2_correction_R-L_incl.-0,5..0,5%"; /// Arguments: test_name
public const string WriteQ2CorrectionLRIncl05Str = "Write_Q2_correction_L-R_incl.-0,5..0,5%"; /// Arguments: test_name
public const string UpdateBothQ2FactorsTestRLOnlyStr = "Update_both_Q2_factors_Test_RL_only"; /// No arguments
public const string UpdateBothQ2FactorsTestLROnlyStr = "Update_both_Q2_factors_Test_LR_only"; /// No arguments
public const string UpdateQ2CorrectionsStr = "Update Q2 corrections"; /// Arguments: R-L_test_name L-R_test_name
public const string ConditnlUpdateQ2CorrectionsStr = "Conditional update of Q2 corrections"; /// Arguments: R-L_test_name L-R_test_name
public const string ConditnlUpdateQ2CorrRLStr = "Conditional update of Q2 correction R-L"; /// Arguments: R-L_test_name
public const string ConditnlUpdateQ2CorrLRStr = "Conditional update of Q2 correction L-R"; /// Arguments: L-R_test_name
public const string Reset2HzCorrectionStr = "Reset 2Hz correction";
public const string Write2HzCorrectionStr = "Write 2Hz correction";
public const string DewaReworkRLStr = "DEWA rework R-L";
public const string DewaReworkLRStr = "DEWA rework L-R";
public const string StartTestingSealedMetersStr = "Start testing sealed meters";
public const string EndTestingSealedMetersStr = "End testing sealed meters";
public const string SimulateCmd = "simulate ";
public static Color DisabledColor = Color.DarkGray;
public static Color OptoAndDirOKColor = Color.Green;
public static Color OptoNokColor = Color.Orange;
public static Color DirNokColor = Color.Red;
public const string Q2correctedFromCmd = "Q2 corrected from ";
public const string StrictQ2ErrorCheckStr = "Strict Q2 error check ";
public const string Q2correctionCheckCmd = "Q2 correction check ";
public const string IperlCheckCmd = "iPERL_check ";
}
}

View File

@ -16,11 +16,24 @@ using Common;
using Config.Entities;
using TBF.Resources;
using TBF.Rig.Sequences;
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
using Results.Entities;
using static Sensus.iPerl.NfcHandler.MCI_Protocol;
using System.Threading.Tasks;
using TBF.Boxes;
using TBF.Rig.RegisterReaders.iPerlReaderUNI;
using TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication;
using TBF.Rig.RegisterReaders.iPerlReaderUNI.test;
using CalibrationStruct = TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication.CalibrationStruct;
using CalibrationStructV4 = TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication.CalibrationStructV4;
using CheckBoxImage = TBF.Boxes.CheckBoxImage;
using Command = TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication.Command;
using CommunicationInterface = TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication.CommunicationInterface;
using ConfigStruct = TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication.ConfigStruct;
using MessageID = TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication.MessageID;
using MeterState = TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication.MeterState;
using MeterType = TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication.MeterType;
using RfidServices = TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication.RfidServices;
using SimulationServices = TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication.SimulationServices;
//using TestMethodCfg = TBF.Rig.RegisterReaders.iPerlReaderUNI.TestMethodCfg;
namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
{
@ -54,55 +67,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
private static readonly ILog log = LogManager.GetLogger(typeof(iPerlCommunicationForm));
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
const int Hz2CorrFactorsAddr = 0x1875; /// Used by Reset2HzCorrection(...) and Write2HzCorrection(...)
const int Q2CorrFactorsAddr = 0x1878; /// Used by ResetQ2Correction(...) and WriteQ2Correction(...)
const int Q2CorrFactorsAddrLR = 0x1878;
const int Q2CorrFactorsAddrRL = 0x1879;
public const string ReadConfigurationStr = "Read configuration"; /// Example: "Read configuration" or "Read configuration if enabled"
public const string SetTestModeStr = "Set Test mode"; /// Example: "Set Test mode" or "Set Test mode A0" (hexadecimal number is the required 'testModeConfig'
public const string SetActiveModeStr = "Set Active mode";
public const string ReadCalibrationStr = "Read calibration";
public const string ReadCalibrationV4Str = "Read calibration_V4";
public const string WriteCalibrationFactorStr = "Write calibration factor";
public const string WriteCalibrationV4FactorsStr = "Write calibration_V4";
public const string NormalizeCalibrationFactorStr = "Normalize calibration factor";
public const string NormalizeCalibrationV4FactorsStr = "Normalize calibration_V4";
public const string GetDefaultQ2CorrectionsStr = "Get default Q2 corrections";
public const string ReadQ2CorrectionStr = "Read Q2 corrections";
public const string ResetQ2CorrectionStr = "Reset Q2 correction";
public const string WriteDefaultQ2CorrectionsStr = "Write default Q2 corrections";
public const string InitOrReadQ2CorrectionsStr = "Init or read Q2 corrections";
public const string WriteQ2CorrectionStr = "Write Q2 correction"; /// No arguments
public const string WriteQ2CorrectionAltStr = "Write Q2 correction Alt"; /// No arguments
public const string WriteQ2CorrectionGreeceStr = "Write Q2 correction Greece"; /// Arguments: test_name
public const string WriteQ2CorrectionRLStr = "Write Q2 correction R-L"; /// Arguments: test_name
public const string WriteQ2CorrectionLRStr = "Write Q2 correction L-R"; /// Arguments: test_name
public const string WriteQ2CorrectionIncl05Str = "Write_Q2_correction_incl.-0,5..0,5%"; /// No arguments
public const string WriteQ2CorrectionAltIncl05Str = "Write_Q2_correction_Alt_incl.-0,5..0,5%"; /// No arguments
public const string WriteQ2CorrectionPlusIncl05Str = "Write_Q2_correction_plus_incl.-0,5..0,5%"; /// No arguments
public const string WriteQ2CorrectionPlusAltIncl05Str = "Write_Q2_correction_plus_Alt_incl.-0,5..0,5%"; /// No arguments
public const string WriteQ2CorrectionGreeceIncl05Str = "Write_Q2_correction_Greece_incl.-0,5..0,5%"; /// Arguments: test_name
public const string WriteQ2CorrectionRLIncl05Str = "Write_Q2_correction_R-L_incl.-0,5..0,5%"; /// Arguments: test_name
public const string WriteQ2CorrectionLRIncl05Str = "Write_Q2_correction_L-R_incl.-0,5..0,5%"; /// Arguments: test_name
public const string UpdateBothQ2FactorsTestRLOnlyStr = "Update_both_Q2_factors_Test_RL_only"; /// No arguments
public const string UpdateBothQ2FactorsTestLROnlyStr = "Update_both_Q2_factors_Test_LR_only"; /// No arguments
public const string UpdateQ2CorrectionsStr = "Update Q2 corrections"; /// Arguments: R-L_test_name L-R_test_name
public const string ConditnlUpdateQ2CorrectionsStr = "Conditional update of Q2 corrections"; /// Arguments: R-L_test_name L-R_test_name
public const string ConditnlUpdateQ2CorrRLStr = "Conditional update of Q2 correction R-L"; /// Arguments: R-L_test_name
public const string ConditnlUpdateQ2CorrLRStr = "Conditional update of Q2 correction L-R"; /// Arguments: L-R_test_name
public const string Reset2HzCorrectionStr = "Reset 2Hz correction";
public const string Write2HzCorrectionStr = "Write 2Hz correction";
public const string DewaReworkRLStr = "DEWA rework R-L";
public const string DewaReworkLRStr = "DEWA rework L-R";
public const string StartTestingSealedMetersStr = "Start testing sealed meters";
public const string EndTestingSealedMetersStr = "End testing sealed meters";
public const string SimulateCmd = "simulate ";
public static Color DisabledColor = Color.DarkGray;
public static Color OptoAndDirOKColor = Color.Green;
public static Color OptoNokColor = Color.Orange;
public static Color DirNokColor = Color.Red;
#region Simulation / RFID / NFC Interface: ReadRequestPort, WriteRequestPort
@ -111,14 +76,14 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// </summary>
/// <param name="iperlHead">Water meter (iPerlHead) object</param>
/// <returns>Value returned by readRequestPort(...)</returns>
public static int ReadRequestPort(IperlHead iperlHead, MessageID messageID, StructName structName, int offset, int length, out byte[] buffer)
public static int ReadRequestPort(IPerlReader iperlHead, MessageID messageID, StructName structName, int offset, int length, out byte[] buffer)
{
Thread.Sleep(Math.Max(250, cfg.DelayBetweenRetries));
if (iperlHead.DebugLevel == DebugMode.FailureDuringOperation) iperlHead.DebugLevel = DebugMode.Normal;
if (iperlHead.DebugLevel != DebugMode.Normal) // Simulation
{
return SimulationServices.ReadRequest(cfg, iperlHead, messageID, offset, length, out buffer);
return SimulationServices.ReadRequest(iperlHead, messageID, offset, length, out buffer);
}
if (iperlHead.CommInterface == CommunicationInterface.NFC) // NFC Interface
@ -136,7 +101,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// </summary>
/// <param name="iperlHead">Water meter (iPerlHead) object</param>
/// <returns>Value returned by writeRequestPort(...)</returns>
public static int WriteRequestPort(IperlHead iperlHead, MessageID messageID, StructName structName, int offset, int length, byte[] buffer)
public static int WriteRequestPort(IPerlReader iperlHead, MessageID messageID, StructName structName, int offset, int length, byte[] buffer)
{
Thread.Sleep(Math.Max(250, cfg.DelayBetweenRetries));
if (iperlHead.DebugLevel == DebugMode.FailureDuringOperation) iperlHead.DebugLevel = DebugMode.Normal;
@ -184,7 +149,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
static int[] ckbIndex;
static bool[] ckbState;
static IList<IperlHead> iperlHeads;
static IList<IPerlReader> iperlHeads;
static IList<int> waterMeterPositions0; /// keeps original 0-based indices in RegisterReaders list
static int commonWMType;
@ -253,8 +218,8 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// Constructor for one iPerlCommunication 'test'
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public iPerlCommunicationForm(TestMethod testMethod, Test test, iPerlCommunicationParams testParams)
: this(testMethod, new List<Test> { test }, new List<iPerlCommunicationParams> { testParams })
public iPerlCommunicationForm(SmartComponentBase componentBase, Test test, iPerlCommunicationParams testParams)
: this(componentBase, new List<Test> { test }, new List<iPerlCommunicationParams> { testParams })
{
}
@ -262,13 +227,13 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// Constructor for multiple iPerlCommunication 'tests'
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public iPerlCommunicationForm(TestMethod testMethod, IList<Test> tests, IList<iPerlCommunicationParams> multiTestParams)
public iPerlCommunicationForm(SmartComponentBase componentBase, IList<Test> tests, IList<iPerlCommunicationParams> multiTestParams)
: this()
{
checkBoxesEditMode = false;
iPerlCommunicationForm.testMethod = testMethod;
iPerlCommunicationForm.cfg = testMethod.Cfg as TestMethodCfg;
iPerlCommunicationForm.testMethod = componentBase;
iPerlCommunicationForm.cfg = componentBase.Cfg as TestMethodCfg;
iPerlCommunicationForm.tests = tests;
iPerlCommunicationForm.multiTestParams = multiTestParams;
@ -278,7 +243,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
activityLabel.Text = multiTestParams[0].Activity;
foreach (var p in multiTestParams)
{
if (p.Activity.ToLower() == GetDefaultQ2CorrectionsStr.ToLower())
if (p.Activity.ToLower() == iPerlCommunicationConstants.GetDefaultQ2CorrectionsStr.ToLower())
{
/// Reset IsQ2PreCorrectionCalculated that is used for synchronization/to prevent double REST call
ProcessData.IsQ2PreCorrectionCalculated = false;
@ -321,12 +286,12 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
StartForceCloseHandler();
iperlHeads = new List<IperlHead>();
iperlHeads = new List<IPerlReader>();
waterMeterPositions0 = new List<int>();
///
for (int wmPos = 0; wmPos < ProcessData.RegisterReaders.Length; wmPos++)
{
IperlHead iperlHead = ProcessData.RegisterReaders[wmPos] as IperlHead;
IPerlReader iperlHead = ProcessData.RegisterReaders[wmPos] as IPerlReader;
if (iperlHead != null)
{
@ -477,9 +442,9 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
sampleLabel2.Text = Strings.There_are_no_opto_pulses;
sampleLabel3.Text = Strings.Direction_is_NOK;
samplePictureBox1.BackColor = OptoAndDirOKColor;
samplePictureBox2.BackColor = OptoNokColor;
samplePictureBox3.BackColor = DirNokColor;
samplePictureBox1.BackColor = iPerlCommunicationConstants.OptoAndDirOKColor;
samplePictureBox2.BackColor = iPerlCommunicationConstants.OptoNokColor;
samplePictureBox3.BackColor = iPerlCommunicationConstants.DirNokColor;
}
@ -509,7 +474,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
{
/// iPerl position i+1 is disabled
checkBoxes[i].Enabled = checkBoxes[i].Checked = ckbState[i] = false;
counters[i].BackColor = DisabledColor;
counters[i].BackColor = iPerlCommunicationConstants.DisabledColor;
messages[i].Text = Strings.Head_was_disabled_by_the_user;
}
else
@ -535,7 +500,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// Reset opto-data indication
for (int i = 0; i < iperlHeads.Count; i++)
{
counters[i].BackColor = OptoNokColor;
counters[i].BackColor = iPerlCommunicationConstants.OptoNokColor;
}
/// Start communication process by incrementing 'currentGroup'.
@ -630,7 +595,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
if (threadID == 0)
{
/// Check whether previous activity was 'Set test mode A0' or 'A4'
if (i > 0 && multiTestParams[i - 1].Activity.ToLower().Contains(SetTestModeStr.ToLower()) && !multiTestParams[i - 1].Activity.Contains("80"))
if (i > 0 && multiTestParams[i - 1].Activity.ToLower().Contains(iPerlCommunicationConstants.SetTestModeStr.ToLower()) && !multiTestParams[i - 1].Activity.Contains("80"))
{
/// Start processing of opto-datastreams from all iPERL-s
int count = 0;
@ -639,7 +604,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
WaterMeter wm = (ProcessData.BatchRslts.Batch.WaterMeters != null && ProcessData.BatchRslts.Batch.WaterMeters.Count > wmNr0)
? ProcessData.BatchRslts.Batch.WaterMeters[wmNr0] : null;
IperlHead ihead = iperlHeads[wmNr0];
IPerlReader ihead = iperlHeads[wmNr0];
if (ihead != null && wm != null && !wm.Disabled)
{
@ -679,7 +644,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
for (int wmNr0 = 0; wmNr0 < iperlHeads.Count; wmNr0++)
{
IperlHead ihead = iperlHeads[wmNr0];
IPerlReader ihead = iperlHeads[wmNr0];
if ((ihead.Group == group) && (threadIx < muxBrdOrGroup14Nrs.Count) && (ihead.MuxBoardNrOrGroup14 == muxBrdOrGroup14Nrs[threadIx]))
{
wmFound = true;
@ -705,49 +670,49 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
///
if ((ihead == null) || ihead.Disabled || !ckbState[wmNr0]) error = CommErr.HeadDisabledByUser;
#if IPERL
else if (currentActivity.ToLower().Contains(SetTestModeStr.ToLower())) error = SetTestMode(threadID, ihead, ref resultStr);
else if (currentActivity.ToLower().Equals(SetActiveModeStr.ToLower())) error = SetActiveMode(threadID, ihead, ref resultStr);
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.SetTestModeStr.ToLower())) error = SetTestMode(threadID, ihead, ref resultStr);
else if (currentActivity.ToLower().Equals(iPerlCommunicationConstants.SetActiveModeStr.ToLower())) error = SetActiveMode(threadID, ihead, ref resultStr);
///
/// RFID communication functions below require a reference to water meter entity (wm != null)
///
else if (wm == null) error = CommErr.CommFailed;
else if (currentActivity.ToLower().Contains(ReadConfigurationStr.ToLower())) error = ReadConfiguration(ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == ReadCalibrationStr.ToLower()) error = ReadCalibration(ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == ReadCalibrationV4Str.ToLower()) error = ReadCalibrationV4(ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Contains(WriteCalibrationFactorStr.ToLower())) error = WriteCalibrationFactor(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Contains(WriteCalibrationV4FactorsStr.ToLower())) error = WriteCalibrationV4Factors(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == NormalizeCalibrationFactorStr.ToLower()) error = NormalizeCalibrationFactor(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == NormalizeCalibrationV4FactorsStr.ToLower()) error = NormalizeCalibrationV4Factors(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == ReadQ2CorrectionStr.ToLower()) error = ReadQ2Correction(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == ResetQ2CorrectionStr.ToLower()) error = ResetQ2Correction(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == WriteDefaultQ2CorrectionsStr.ToLower()) error = WriteDefaultQ2Corrections(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == InitOrReadQ2CorrectionsStr.ToLower()) error = InitOrReadQ2Corrections(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == WriteQ2CorrectionStr.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Standard, null);
else if (currentActivity.ToLower() == WriteQ2CorrectionAltStr.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Dewa, null);
else if (currentActivity.ToLower().Contains(WriteQ2CorrectionGreeceStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Greece, currentActivity.Substring(WriteQ2CorrectionGreeceStr.Length).Trim());
else if (currentActivity.ToLower().Contains(WriteQ2CorrectionRLStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.RL, currentActivity.Substring(WriteQ2CorrectionRLStr.Length).Trim());
else if (currentActivity.ToLower().Contains(WriteQ2CorrectionLRStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.LR, currentActivity.Substring(WriteQ2CorrectionLRStr.Length).Trim());
else if (currentActivity.ToLower() == WriteQ2CorrectionIncl05Str.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Standard_incl_05, null);
else if (currentActivity.ToLower() == WriteQ2CorrectionPlusIncl05Str.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Standard_plus_incl_05, null);
else if (currentActivity.ToLower() == WriteQ2CorrectionAltIncl05Str.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Dewa_incl_05, null);
else if (currentActivity.ToLower() == WriteQ2CorrectionPlusAltIncl05Str.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Dewa_plus_incl_05, null);
else if (currentActivity.ToLower().Contains(WriteQ2CorrectionGreeceIncl05Str.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Greece_incl_05, currentActivity.Substring(WriteQ2CorrectionGreeceIncl05Str.Length).Trim());
else if (currentActivity.ToLower().Contains(WriteQ2CorrectionRLIncl05Str.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.RL_incl_05, currentActivity.Substring(WriteQ2CorrectionRLIncl05Str.Length).Trim());
else if (currentActivity.ToLower().Contains(WriteQ2CorrectionLRIncl05Str.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.LR_incl_05, currentActivity.Substring(WriteQ2CorrectionLRIncl05Str.Length).Trim());
else if (currentActivity.ToLower().Contains(UpdateBothQ2FactorsTestRLOnlyStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.UpdateBothQ2FactorsTestRLDir, null);
else if (currentActivity.ToLower().Contains(UpdateBothQ2FactorsTestLROnlyStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.UpdateBothQ2FactorsTestLRDir, null);
else if (currentActivity.ToLower().Contains(UpdateQ2CorrectionsStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Update, currentActivity.Substring(UpdateQ2CorrectionsStr.Length).Trim());
else if (currentActivity.ToLower().Contains(ConditnlUpdateQ2CorrectionsStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.ConditionalUpdate, currentActivity.Substring(ConditnlUpdateQ2CorrectionsStr.Length).Trim());
else if (currentActivity.ToLower().Contains(ConditnlUpdateQ2CorrRLStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.ConditionalUpdateRL, currentActivity.Substring(ConditnlUpdateQ2CorrRLStr.Length).Trim());
else if (currentActivity.ToLower().Contains(ConditnlUpdateQ2CorrLRStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.ConditionalUpdateLR, currentActivity.Substring(ConditnlUpdateQ2CorrLRStr.Length).Trim());
else if (currentActivity.ToLower() == Reset2HzCorrectionStr.ToLower()) error = Reset2HzCorrection(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == Write2HzCorrectionStr.ToLower()) error = Write2HzCorrection(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == GetDefaultQ2CorrectionsStr.ToLower()) error = GetQ2PreCorrectionsFormRest(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == DewaReworkRLStr.ToLower()) error = DewaRework(ihead, wm, FlowDir.R_L, ref resultStr);
else if (currentActivity.ToLower() == DewaReworkLRStr.ToLower()) error = DewaRework(ihead, wm, FlowDir.L_R, ref resultStr);
else if (currentActivity.ToLower().Contains(StartTestingSealedMetersStr.ToLower())) error = StartTestingSealedMeter(ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Contains(EndTestingSealedMetersStr.ToLower())) error = EndTestingSealedMeter(ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Contains(SimulateCmd.ToLower())) error = Simulate(ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.ReadConfigurationStr.ToLower())) error = ReadConfiguration(ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.ReadCalibrationStr.ToLower()) error = ReadCalibration(ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.ReadCalibrationV4Str.ToLower()) error = ReadCalibrationV4(ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.WriteCalibrationFactorStr.ToLower())) error = WriteCalibrationFactor(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.WriteCalibrationV4FactorsStr.ToLower())) error = WriteCalibrationV4Factors(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.NormalizeCalibrationFactorStr.ToLower()) error = NormalizeCalibrationFactor(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.NormalizeCalibrationV4FactorsStr.ToLower()) error = NormalizeCalibrationV4Factors(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.ReadQ2CorrectionStr.ToLower()) error = ReadQ2Correction(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.ResetQ2CorrectionStr.ToLower()) error = ResetQ2Correction(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.WriteDefaultQ2CorrectionsStr.ToLower()) error = WriteDefaultQ2Corrections(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.InitOrReadQ2CorrectionsStr.ToLower()) error = InitOrReadQ2Corrections(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.WriteQ2CorrectionStr.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Standard, null);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.WriteQ2CorrectionAltStr.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Dewa, null);
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.WriteQ2CorrectionGreeceStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Greece, currentActivity.Substring(iPerlCommunicationConstants.WriteQ2CorrectionGreeceStr.Length).Trim());
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.WriteQ2CorrectionRLStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.RL, currentActivity.Substring(iPerlCommunicationConstants.WriteQ2CorrectionRLStr.Length).Trim());
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.WriteQ2CorrectionLRStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.LR, currentActivity.Substring(iPerlCommunicationConstants.WriteQ2CorrectionLRStr.Length).Trim());
else if (currentActivity.ToLower() == iPerlCommunicationConstants.WriteQ2CorrectionIncl05Str.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Standard_incl_05, null);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.WriteQ2CorrectionPlusIncl05Str.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Standard_plus_incl_05, null);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.WriteQ2CorrectionAltIncl05Str.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Dewa_incl_05, null);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.WriteQ2CorrectionPlusAltIncl05Str.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Dewa_plus_incl_05, null);
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.WriteQ2CorrectionGreeceIncl05Str.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Greece_incl_05, currentActivity.Substring(iPerlCommunicationConstants.WriteQ2CorrectionGreeceIncl05Str.Length).Trim());
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.WriteQ2CorrectionRLIncl05Str.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.RL_incl_05, currentActivity.Substring(iPerlCommunicationConstants.WriteQ2CorrectionRLIncl05Str.Length).Trim());
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.WriteQ2CorrectionLRIncl05Str.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.LR_incl_05, currentActivity.Substring(iPerlCommunicationConstants.WriteQ2CorrectionLRIncl05Str.Length).Trim());
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.UpdateBothQ2FactorsTestRLOnlyStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.UpdateBothQ2FactorsTestRLDir, null);
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.UpdateBothQ2FactorsTestLROnlyStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.UpdateBothQ2FactorsTestLRDir, null);
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.UpdateQ2CorrectionsStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Update, currentActivity.Substring(iPerlCommunicationConstants.UpdateQ2CorrectionsStr.Length).Trim());
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.ConditnlUpdateQ2CorrectionsStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.ConditionalUpdate, currentActivity.Substring(iPerlCommunicationConstants.ConditnlUpdateQ2CorrectionsStr.Length).Trim());
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.ConditnlUpdateQ2CorrRLStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.ConditionalUpdateRL, currentActivity.Substring(iPerlCommunicationConstants.ConditnlUpdateQ2CorrRLStr.Length).Trim());
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.ConditnlUpdateQ2CorrLRStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.ConditionalUpdateLR, currentActivity.Substring(iPerlCommunicationConstants.ConditnlUpdateQ2CorrLRStr.Length).Trim());
else if (currentActivity.ToLower() == iPerlCommunicationConstants.Reset2HzCorrectionStr.ToLower()) error = Reset2HzCorrection(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.Write2HzCorrectionStr.ToLower()) error = Write2HzCorrection(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.GetDefaultQ2CorrectionsStr.ToLower()) error = GetQ2PreCorrectionsFormRest(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.DewaReworkRLStr.ToLower()) error = DewaRework(ihead, wm, FlowDir.R_L, ref resultStr);
else if (currentActivity.ToLower() == iPerlCommunicationConstants.DewaReworkLRStr.ToLower()) error = DewaRework(ihead, wm, FlowDir.L_R, ref resultStr);
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.StartTestingSealedMetersStr.ToLower())) error = StartTestingSealedMeter(ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.EndTestingSealedMetersStr.ToLower())) error = EndTestingSealedMeter(ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Contains(iPerlCommunicationConstants.SimulateCmd.ToLower())) error = Simulate(ihead, wm, ref resultStr);
#endif
else
{
@ -757,7 +722,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
#if IPERL
for (id = ConditionID.A; id < ConditionID.Count; id++)
{
if (currentActivity.ToLower() == string.Format(SequenceConditionOp.ConditionNameFmt, id).ToLower())
if (currentActivity.ToLower() == ISequenceConditionOp.GetConditionNameFmt(id).ToLower())
{
error = SetIperlCommMilestoneReached(testMethod, id, ref resultStr);
break;
@ -846,7 +811,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="wm">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr ReadConfiguration(IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr ReadConfiguration(IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
///
/// The activity is "Read configuration" (this enables the watermeter, resets error flag)
@ -888,15 +853,15 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="ihead">iPERL head object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr SetTestMode(int threadId, IperlHead ihead, ref string resultStr)
static CommErr SetTestMode(int threadId, IPerlReader ihead, ref string resultStr)
{
if (ihead.CommFailed || ihead.ConfigStruct == null) return CommErr.CommFailed;
Byte testModeConfig = 0xA0; /// Default value
///
if (multiTestParams[currentActivityStep].Activity.Length > SetTestModeStr.Length)
if (multiTestParams[currentActivityStep].Activity.Length > iPerlCommunicationConstants.SetTestModeStr.Length)
{
string testModeConfigStr = multiTestParams[currentActivityStep].Activity.Substring(SetTestModeStr.Length + 1);
string testModeConfigStr = multiTestParams[currentActivityStep].Activity.Substring(iPerlCommunicationConstants.SetTestModeStr.Length + 1);
UInt16 byteVal;
if (UInt16.TryParse(testModeConfigStr, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out byteVal) && byteVal <= 255)
{
@ -987,7 +952,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="ihead">iPERL head object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr SetActiveMode(int threadId, IperlHead ihead, ref string resultStr)
static CommErr SetActiveMode(int threadId, IPerlReader ihead, ref string resultStr)
{
CommErr error = CommErr.CmdActive;
@ -1038,7 +1003,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr ReadCalibration(IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr ReadCalibration(IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@ -1072,7 +1037,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr ReadCalibrationV4(IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr ReadCalibrationV4(IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@ -1106,11 +1071,11 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// Read a part of CalibrationStruct afterwards to verify factor was written correctly.
/// </summary>
/// <param name="threadId">Thread ID</param>
/// <param name="ihead">IperlHead object</param>
/// <param name="ihead">IPerlReader object</param>
/// <param name="wm">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr WriteCalibrationFactor(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr WriteCalibrationFactor(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed || (ihead.CalibrationStruct == null)) return CommErr.CommFailed;
@ -1118,13 +1083,13 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// Parse calibration factor (1 argument) or calibration factor limits (2 arguments)
///
UInt16 newCalibFactor = 0;
if (multiTestParams[currentActivityStep].Activity.Length > WriteCalibrationFactorStr.Length)
if (multiTestParams[currentActivityStep].Activity.Length > iPerlCommunicationConstants.WriteCalibrationFactorStr.Length)
{
UInt16 factorLimitLo;
UInt16 factorLimitHi;
UInt16 val;
string calibFactrorStr = multiTestParams[currentActivityStep].Activity.Substring(WriteCalibrationFactorStr.Length + 1);
string calibFactrorStr = multiTestParams[currentActivityStep].Activity.Substring(iPerlCommunicationConstants.WriteCalibrationFactorStr.Length + 1);
string[] arguments = calibFactrorStr.Split(new char[] { ' ' });
if (arguments.Length >= 2 &&
@ -1241,11 +1206,11 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// Read a part of CalibrationStruct afterwards to verify factor was written correctly.
/// </summary>
/// <param name="threadId">Thread ID</param>
/// <param name="ihead">IperlHead object</param>
/// <param name="ihead">IPerlReader object</param>
/// <param name="wm">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr WriteCalibrationV4Factors(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr WriteCalibrationV4Factors(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed || (ihead.CalibrationStructV4 == null)) return CommErr.CommFailed;
@ -1254,7 +1219,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
///
UInt16 newCalibFactor = 0;
UInt16 newCalibFactorLNA = 0;
if (multiTestParams[currentActivityStep].Activity.Length > WriteCalibrationV4FactorsStr.Length)
if (multiTestParams[currentActivityStep].Activity.Length > iPerlCommunicationConstants.WriteCalibrationV4FactorsStr.Length)
{
UInt16 factorLimitLo = 0;
UInt16 factorLimitHi = 0;
@ -1265,7 +1230,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
Results.Entities.MeterTestRslt adjustTestRslt = null;
Results.Entities.MeterTestRslt lnaAdjustTestRslt = null;
string calibFactrorStr = multiTestParams[currentActivityStep].Activity.Substring(WriteCalibrationV4FactorsStr.Length + 1);
string calibFactrorStr = multiTestParams[currentActivityStep].Activity.Substring(iPerlCommunicationConstants.WriteCalibrationV4FactorsStr.Length + 1);
string[] arguments = calibFactrorStr.Split(new char[] { ' ' });
if (arguments.Length == 6)
@ -1438,7 +1403,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr NormalizeCalibrationFactor(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr NormalizeCalibrationFactor(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed || (ihead.CalibrationStruct == null)) return CommErr.CommFailed;
@ -1507,7 +1472,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr NormalizeCalibrationV4Factors(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr NormalizeCalibrationV4Factors(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed || (ihead.CalibrationStructV4 == null)) return CommErr.CommFailed;
@ -1577,7 +1542,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr ReadQ2Correction(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr ReadQ2Correction(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@ -1586,7 +1551,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// Write zero Q2 correction
byte[] rdData = null;
///
if (0 == ReadRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Q2CorrFactorsAddr, 2, out rdData))
if (0 == ReadRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, iPerlCommunicationConstants.Q2CorrFactorsAddr, 2, out rdData))
{
error = CommErr.None;
}
@ -1608,7 +1573,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr ResetQ2Correction(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr ResetQ2Correction(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
return WriteQ2Corrections(threadId, ihead, wm, ref resultStr, 0, 0);
}
@ -1620,7 +1585,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr WriteDefaultQ2Corrections(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr WriteDefaultQ2Corrections(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@ -1676,7 +1641,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr WriteQ2Corrections(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr, int factorLR, int factorRL)
static CommErr WriteQ2Corrections(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr, int factorLR, int factorRL)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@ -1685,7 +1650,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// Write zero Q2 correction
byte[] wrData = new byte[2] { (byte)factorLR, (byte)factorRL };
///
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Q2CorrFactorsAddr, wrData.Length, wrData))
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, iPerlCommunicationConstants.Q2CorrFactorsAddr, wrData.Length, wrData))
{
wm.Q2CorrRL = ihead.Q2CorrRL = factorRL;
wm.Q2CorrLR = ihead.Q2CorrLR = factorLR;
@ -1721,7 +1686,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
}
static CommErr InitOrReadQ2Corrections(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr InitOrReadQ2Corrections(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
if (wm.Pruefindex == 0) return CommErr.CommFailed; /// Unknown pruefindex
@ -1785,7 +1750,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr Reset2HzCorrection(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr Reset2HzCorrection(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@ -1794,7 +1759,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// Write zero Q2 correction
byte[] wrData = new byte[1] { 0 };
///
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Hz2CorrFactorsAddr, wrData.Length, wrData))
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, iPerlCommunicationConstants.Hz2CorrFactorsAddr, wrData.Length, wrData))
{
error = CommErr.None;
}
@ -1843,7 +1808,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr CalculateAndWriteQ2Corrections(int threadId, IperlHead ihead, WaterMeter wm,
static CommErr CalculateAndWriteQ2Corrections(int threadId, IPerlReader ihead, WaterMeter wm,
Test test, ref string resultStr, Q2CorrType q2CorrType, string restOfLine)
{
var args = string.IsNullOrEmpty(restOfLine) ? new string[0] : restOfLine.Split(new char[] { ' ' });
@ -2075,7 +2040,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// Write R-L Q2 correction factor only
///
byte[] wrData = new byte[1] { (byte)q2CorrRL };
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Q2CorrFactorsAddrRL, wrData.Length, wrData))
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, iPerlCommunicationConstants.Q2CorrFactorsAddrRL, wrData.Length, wrData))
{
wm.Q2CorrRL = ihead.Q2CorrRL = q2CorrRL;
resultStr = string.Format("Q2 correction: RL={0}", q2CorrRL);
@ -2093,7 +2058,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// Write L-R Q2 correction factor only
///
byte[] wrData = new byte[1] { (byte)q2CorrLR };
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Q2CorrFactorsAddrLR, wrData.Length, wrData))
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, iPerlCommunicationConstants.Q2CorrFactorsAddrLR, wrData.Length, wrData))
{
wm.Q2CorrLR = ihead.Q2CorrLR = q2CorrLR;
resultStr = string.Format("Q2 correction: LR={0}", q2CorrLR);
@ -2106,7 +2071,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// Write both Q2 correction factors
///
byte[] wrData = new byte[2] { (byte)q2CorrLR, (byte)q2CorrRL };
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Q2CorrFactorsAddr, wrData.Length, wrData))
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, iPerlCommunicationConstants.Q2CorrFactorsAddr, wrData.Length, wrData))
{
wm.Q2CorrRL = ihead.Q2CorrRL = q2CorrRL;
wm.Q2CorrLR = ihead.Q2CorrLR = q2CorrLR;
@ -2176,7 +2141,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
}
///
/// Update WaterMeter entity and IperlHead
/// Update WaterMeter entity and IPerlReader
///
if (error == CommErr.None)
{
@ -2194,7 +2159,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr Write2HzCorrection(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr Write2HzCorrection(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@ -2214,7 +2179,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
Byte hz2CorrectionByte = (byte)(hz2CorrectionFactor & 0x000000FF);
byte[] wrData = new byte[1] { hz2CorrectionByte };
///
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Hz2CorrFactorsAddr, wrData.Length, wrData))
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, iPerlCommunicationConstants.Hz2CorrFactorsAddr, wrData.Length, wrData))
{
error = CommErr.None;
wm.Hz2Correction = ihead.Hz2Correction = hz2CorrectionFactor;
@ -2264,7 +2229,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="flowDir">Arrow direction</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr DewaRework(IperlHead ihead, WaterMeter wm, FlowDir flowDir, ref string resultStr)
static CommErr DewaRework(IPerlReader ihead, WaterMeter wm, FlowDir flowDir, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@ -2346,15 +2311,15 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="wm">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr StartTestingSealedMeter(IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr StartTestingSealedMeter(IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
Byte testModeConfig = 0xA0; /// Default value
///
if (multiTestParams[currentActivityStep].Activity.Length > StartTestingSealedMetersStr.Length)
if (multiTestParams[currentActivityStep].Activity.Length > iPerlCommunicationConstants.StartTestingSealedMetersStr.Length)
{
string testModeConfigStr = multiTestParams[currentActivityStep].Activity.Substring(StartTestingSealedMetersStr.Length + 1);
string testModeConfigStr = multiTestParams[currentActivityStep].Activity.Substring(iPerlCommunicationConstants.StartTestingSealedMetersStr.Length + 1);
UInt16 byteVal;
if (UInt16.TryParse(testModeConfigStr, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out byteVal) && byteVal <= 255)
{
@ -2416,7 +2381,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
/// <param name="wm">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr EndTestingSealedMeter(IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr EndTestingSealedMeter(IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@ -2467,7 +2432,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
}
}
static CommErr GetQ2PreCorrectionsFormRest(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr GetQ2PreCorrectionsFormRest(int threadId, IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
if (!ProcessData.IsQ2PreCorrectionCalculated)
{
@ -2490,11 +2455,11 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
}
testMethod.MeterCommMilestone((int)id,true);
resultStr = ISequenceConditionOp.GetConditionNameFmt((int)id);
resultStr = ISequenceConditionOp.GetConditionNameFmt(id);
return CommErr.None;
}
static CommErr Simulate(IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr Simulate(IPerlReader ihead, WaterMeter wm, ref string resultStr)
{
string[] arguments = multiTestParams[currentActivityStep].Activity.Split(new char[] { ' ' });
@ -2566,23 +2531,23 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
{
if (iperlHeads[i] == null || iperlHeads[i].Disabled)
{
counters[i].BackColor = DisabledColor;
counters[i].BackColor = iPerlCommunicationConstants.DisabledColor;
}
else
{
switch (iperlHeads[i].CheckFlowDirection())
{
case OptoHeadState.OptoAndDirOK:
counters[i].BackColor = OptoAndDirOKColor;
counters[i].BackColor = iPerlCommunicationConstants.OptoAndDirOKColor;
break;
case OptoHeadState.DirNok:
counters[i].BackColor = DirNokColor;
counters[i].BackColor = iPerlCommunicationConstants.DirNokColor;
break;
default:
case OptoHeadState.OptoNok:
counters[i].BackColor = OptoNokColor;
counters[i].BackColor = iPerlCommunicationConstants.OptoNokColor;
break;
}
}
@ -2705,7 +2670,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
MenuItem menuItem = (MenuItem)sender;
activityLabel.Text = menuItem.Text;
List<Task> tasks = new List<Task>();
foreach (var iHead in ProcessData.IperlHeads)
foreach (var iHead in ProcessData.IperlHeadsUni)
{
if (!checkBoxes[iHead.Position - 1].Checked)
{
@ -2729,7 +2694,7 @@ namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
await Task.WhenAll(tasks);
}
private async Task<string> ProcessTask(IperlHead iHead, object tag)
private async Task<string> ProcessTask(IPerlReader iHead, object tag)
{
string txt = "";
switch (tag)

View File

@ -0,0 +1,203 @@
///
/// Copyright (c) 2015-2022 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Resources;
using System.Collections.Generic;
namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
{
public class iPerlCommunicationParams : TestParamsBase, IParamsProvider, ITestParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(iPerlCommunicationParams) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public string Activity; /// Communication activity
public bool SimultWithPrevious;
public bool SimultWithNext;
public override void InitializeAll()
{
Activity = "Read Configuration";
SimultWithPrevious = false;
SimultWithNext = false;
}
string[] paramNames = new string[]
{
Strings.Activity,
Strings.Simultaneous_with_previous_step,
Strings.Simultaneous_with_next_step,
};
public override string ParamName(int i) { return paramNames[i]; }
public override int ParamsCount() { return paramNames.Length; }
public override ICollection<string> ParamValues(int i)
{
if (i == 0)
{
var retVal = new List<string>();
retVal.Add(iPerlCommunicationConstants.ReadConfigurationStr);
retVal.Add(string.Format("{0} A0", iPerlCommunicationConstants.SetTestModeStr));
retVal.Add(string.Format("{0} A4", iPerlCommunicationConstants.SetTestModeStr));
retVal.Add(iPerlCommunicationConstants.ReadCalibrationStr);
retVal.Add(iPerlCommunicationConstants.ReadCalibrationV4Str);
retVal.Add(iPerlCommunicationConstants.NormalizeCalibrationFactorStr);
retVal.Add(iPerlCommunicationConstants.NormalizeCalibrationV4FactorsStr);
retVal.Add(iPerlCommunicationConstants.GetDefaultQ2CorrectionsStr);
retVal.Add(iPerlCommunicationConstants.ReadQ2CorrectionStr);
retVal.Add(iPerlCommunicationConstants.ResetQ2CorrectionStr);
retVal.Add(iPerlCommunicationConstants.WriteDefaultQ2CorrectionsStr);
retVal.Add(iPerlCommunicationConstants.InitOrReadQ2CorrectionsStr);
retVal.Add(iPerlCommunicationConstants.WriteCalibrationFactorStr);
retVal.Add(iPerlCommunicationConstants.WriteCalibrationV4FactorsStr);
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionStr);
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionAltStr);
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionGreeceStr);
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionRLStr);
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionLRStr);
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionIncl05Str);
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionAltIncl05Str);
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionPlusIncl05Str);
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionPlusAltIncl05Str);
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionGreeceIncl05Str);
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionRLIncl05Str);
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionLRIncl05Str);
retVal.Add(iPerlCommunicationConstants.Q2correctedFromCmd + "Qx");
retVal.Add(iPerlCommunicationConstants.StrictQ2ErrorCheckStr + "Qx");
retVal.Add(iPerlCommunicationConstants.Q2correctionCheckCmd);
retVal.Add(iPerlCommunicationConstants.IperlCheckCmd);
retVal.Add(iPerlCommunicationConstants.UpdateBothQ2FactorsTestRLOnlyStr);
retVal.Add(iPerlCommunicationConstants.UpdateBothQ2FactorsTestLROnlyStr);
retVal.Add(iPerlCommunicationConstants.UpdateQ2CorrectionsStr);
retVal.Add(iPerlCommunicationConstants.ConditnlUpdateQ2CorrectionsStr);
retVal.Add(iPerlCommunicationConstants.ConditnlUpdateQ2CorrRLStr);
retVal.Add(iPerlCommunicationConstants.ConditnlUpdateQ2CorrLRStr);
retVal.Add("Q2 corrected from Q2adj");
retVal.Add("Q2 correction check Q2bc Q2ac");
retVal.Add(iPerlCommunicationConstants.SetActiveModeStr);
retVal.Add("---");
retVal.Add(iPerlCommunicationConstants.Reset2HzCorrectionStr);
retVal.Add(iPerlCommunicationConstants.Write2HzCorrectionStr);
retVal.Add(iPerlCommunicationConstants.DewaReworkRLStr);
retVal.Add(iPerlCommunicationConstants.DewaReworkLRStr);
retVal.Add(iPerlCommunicationConstants.StartTestingSealedMetersStr);
retVal.Add(iPerlCommunicationConstants.EndTestingSealedMetersStr);
retVal.Add(string.Format("{0} if enabled", iPerlCommunicationConstants.ReadConfigurationStr));
retVal.Add(string.Format("{0} 80", iPerlCommunicationConstants.SetTestModeStr));
retVal.Add("iPerl_check prevWorkStep direction q2factors");
for (ConditionID id = ConditionID.A; id < ConditionID.Count; id++)
{
retVal.Add(ISequenceConditionOp.GetConditionNameFmt(id));
}
return retVal;
}
else
{
return new string[] { Strings.yes, Strings.no };
}
}
public override string ToString(int i)
{
switch (i)
{
case 0: return Activity;
case 1: return (SimultWithPrevious ? Strings.yes : Strings.no);
case 2: return (SimultWithNext ? Strings.yes : Strings.no);
default: return string.Empty;
}
}
public CfgUpdateFlags UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: Activity = strValue; return CfgUpdateFlags.None;
case 1: SimultWithPrevious = strValue.ToLower().Equals(Strings.yes.ToLower()); return CfgUpdateFlags.None;
case 2: SimultWithNext = strValue.ToLower().Equals(Strings.yes.ToLower()); return CfgUpdateFlags.None;
default: return CfgUpdateFlags.None;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
switch (i)
{
case 0:
return true;
case 1:
case 2:
if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
void CopyContentTo(iPerlCommunicationParams prms)
{
prms.Activity = this.Activity;
prms.SimultWithPrevious = this.SimultWithPrevious;
prms.SimultWithNext = this.SimultWithNext;
}
public IParamsProvider Clone()
{
iPerlCommunicationParams pars = new iPerlCommunicationParams();
CopyContentTo(pars);
return pars;
}
public override void UpdateFromDbEntity(ComponentTest dbEntity)
{
if (dbEntity == null) return;
try
{
iPerlCommunicationParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as iPerlCommunicationParams;
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
}
}
/// <summary>
/// Parameterless constructor initializes the parameters
/// </summary>
public iPerlCommunicationParams()
{
}
public iPerlCommunicationParams(bool initialize)
{
if (initialize) InitializeAll();
}
public iPerlCommunicationParams(ComponentTest testParamsEntity, string componentName, Test test)
{
this.testParamsEntity = testParamsEntity;
this.componentName = componentName;
this.test = test;
}
}
}

View File

@ -0,0 +1,26 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using TBF.Rig.RegisterReaders.iPerlReaderUNI.comminication;
using static Sensus.iPerl.NfcHandler.MCI_Protocol;
namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
{
public class iPerlDataWrite
{
public MessageID MessageID;
public StructName StructName;
public int Offset;
public byte[] Data;
public string Description;
public iPerlDataWrite(MessageID mesageID, StructName structName, int offset, byte[] data, string description)
{
MessageID = mesageID;
StructName = structName;
Offset = offset;
Data = data;
Description = description;
}
}
}

View File

@ -0,0 +1,34 @@
///
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TBF.Rig.Uni.SharedDialogs.iPerlCommunication
{
public enum Q2CorrType
{
None,
Standard,
Dewa,
Greece,
RL,
LR,
Standard_incl_05,
Standard_plus_incl_05,
Dewa_incl_05,
Dewa_plus_incl_05,
Greece_incl_05,
RL_incl_05,
LR_incl_05,
Update,
ConditionalUpdate,
ConditionalUpdateRL,
ConditionalUpdateLR,
UpdateBothQ2FactorsTestRLDir,
UpdateBothQ2FactorsTestLRDir,
Count,
}
}

View File

@ -33,6 +33,7 @@
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
<LangVersion>8</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -1176,9 +1177,13 @@
<Compile Include="Rig\RegisterReaders\DataStream\Reader\ReaderCfg.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\comminication\CalibrationStruct.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\comminication\CalibrationStructV4.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\comminication\CommCompletedEventArgs.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\comminication\ConfigStruct.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\comminication\Enums.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\comminication\NfcServices.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\comminication\OptoReceivedEventArgs.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\comminication\RfidServices.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\comminication\SimulationServices.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\Factory.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\IPerlCfgCtrl.cs">
<SubType>UserControl</SubType>
@ -1195,12 +1200,7 @@
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\IPerlReader.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\IPerlCfg.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\ProcParams.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\test\iPerlCommunicationForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\test\iPerlCommunicationForm.designer.cs">
<DependentUpon>iPerlCommunicationForm.cs</DependentUpon>
</Compile>
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\TestMethodCfg.cs" />
<Compile Include="Rig\RegisterReaders\iPerlReaderUNI\test\OpticalHeadTest.cs" />
<Compile Include="Rig\RegisterReaders\KPackE\DataEntryForRadio\CycleBeginningForm.cs">
<SubType>Form</SubType>
@ -1291,6 +1291,7 @@
<Compile Include="Rig\Scales\WaitTankContainsMoreThenOp.cs" />
<Compile Include="Rig\Scales\WaitTankEmptyOp.cs" />
<Compile Include="Rig\Sequences\DeferredTestEvaluationData.cs" />
<Compile Include="Rig\Sequences\iPerlCommunicationSeq.cs" />
<Compile Include="Rig\Sequences\IProcedureCameraCollect.cs" />
<Compile Include="Rig\Sequences\IProcedureCameraShowAfter.cs" />
<Compile Include="Rig\Sequences\ISequence.cs" />
@ -1477,6 +1478,15 @@
<Compile Include="Rig\TestMethods\S640Communication\S640Start.cs" />
<Compile Include="Rig\TestMethods\S640Communication\S640StartCfg.cs" />
<Compile Include="Rig\TestMethods\S640Communication\S640StartFactory.cs" />
<Compile Include="Rig\TestMethods\SmartTest\SequenceConditionOp.cs" />
<Compile Include="Rig\TestMethods\SmartTest\TestMethod.cs" />
<Compile Include="Rig\TestMethods\SmartTest\TestMethodCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Rig\TestMethods\SmartTest\TestMethodCfgCtrl.designer.cs">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Rig\TestMethods\SmartTest\TestMethodFactory.cs" />
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvanceCollect\Single\Component.cs" />
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvanceCollect\Single\Factory.cs" />
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvanceCollect\StandingStartMassCollectionAdvanceCollectSeq.cs" />
@ -1897,6 +1907,22 @@
<Compile Include="Rig\Uni\RegValve\Factory.cs" />
<Compile Include="Rig\Uni\RegValve\SetFlowOp.cs" />
<Compile Include="Rig\Uni\RegValve\SetRegValvePositionOp.cs" />
<Compile Include="Rig\Uni\SharedDialogs\iPerlCommunication\AllCompletedEventArgs.cs" />
<Compile Include="Rig\Uni\SharedDialogs\iPerlCommunication\SmartComponentBase.cs" />
<Compile Include="Rig\Uni\SharedDialogs\iPerlCommunication\CommCompletedEventArgs.cs" />
<Compile Include="Rig\Uni\SharedDialogs\iPerlCommunication\iPerlCommunicationConstants.cs" />
<Compile Include="Rig\Uni\SharedDialogs\iPerlCommunication\iPerlCommunicationForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Rig\Uni\SharedDialogs\iPerlCommunication\iPerlCommunicationForm.designer.cs">
<DependentUpon>iPerlCommunicationForm.cs</DependentUpon>
</Compile>
<Compile Include="Rig\Uni\SharedDialogs\iPerlCommunication\iPerlCommunicationParams.cs" />
<Compile Include="Rig\Uni\SharedDialogs\iPerlCommunication\iPerlDataWrite.cs" />
<Compile Include="Rig\Uni\SharedDialogs\iPerlCommunication\iPerlEnums.cs" />
<Compile Include="Rig\Uni\SharedDialogs\iPerlCommunication\ISequenceConditionOp.cs" />
<Compile Include="Rig\Uni\SharedDialogs\iPerlCommunication\ISmartTestMethod.cs" />
<Compile Include="Rig\Uni\SharedDialogs\iPerlCommunication\ISmartWrapper.cs" />
<Compile Include="Rig\Various\CoverTest\CoverTest.cs" />
<Compile Include="Rig\Various\CoverTest\CoverTestCfg.cs" />
<Compile Include="Rig\Various\CoverTest\CoverTestForm.cs">
@ -3094,9 +3120,6 @@
<EmbeddedResource Include="Rig\RegisterReaders\iPerlReaderUNI\IperlHeadTestCtrl.resx">
<DependentUpon>IperlHeadTestCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\RegisterReaders\iPerlReaderUNI\test\iPerlCommunicationForm.resx">
<DependentUpon>iPerlCommunicationForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\RegisterReaders\KPackE\DataEntryForRadio\CycleBeginningForm.resx">
<DependentUpon>CycleBeginningForm.cs</DependentUpon>
</EmbeddedResource>
@ -3239,6 +3262,9 @@
<EmbeddedResource Include="Rig\TestMethods\S640Communication\S640CommForm.resx">
<DependentUpon>S640CommForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\TestMethods\SmartTest\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\TestMethods\StandingStartMassCollectionAdvance\HeatMeters\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
@ -3278,6 +3304,9 @@
<EmbeddedResource Include="Rig\Uni\RegValve\RegValveCfgCtrl.resx">
<DependentUpon>RegValveCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\Uni\SharedDialogs\iPerlCommunication\iPerlCommunicationForm.resx">
<DependentUpon>iPerlCommunicationForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\Various\CoverTest\CoverTestForm.resx">
<DependentUpon>CoverTestForm.cs</DependentUpon>
</EmbeddedResource>