(1) iPerl RFID comm. evaluation in case RegisterReaders are not complete fixed

(2) Procedure copy UI bug fixed
(3) Genesis : A bug when using TankSelector via Modbus and closing the program fixed.
This commit is contained in:
Milan Hanajik
2017-02-14 15:52:44 +01:00
parent 8d4910fcb0
commit d039df5361
4 changed files with 25 additions and 13 deletions
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -64,6 +64,7 @@ namespace TBF.BenchControl.Modbus.Common
{
if (modbusCommonCfg.DebugLevel == DebugMode.Simulate)
{
serialPort = null;
log.FatalFormat("Simulated device {0}", ToString());
return;
}
@@ -90,7 +91,7 @@ namespace TBF.BenchControl.Modbus.Common
/// <param name="message">Message incl CRC fields, CRC bytes dont have to be set</param>
public void SendMessage(byte[] message)
{
if (modbusCommonCfg.DebugLevel == DebugMode.Simulate) return;
if (serialPort == null) return;
Telegram.UpdateTelegramCRC(message);
@@ -110,7 +111,7 @@ namespace TBF.BenchControl.Modbus.Common
/// <param name="dataCount">Count of data bytes to be transferred (0..65535)</param>
public void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount)
{
if (modbusCommonCfg.DebugLevel == DebugMode.Simulate) return;
if (serialPort == null) return;
byte[] message = new byte[8]
{
@@ -135,6 +136,8 @@ namespace TBF.BenchControl.Modbus.Common
/// <summary>Run this device</summary>
public void RunDeviceBefore()
{
if (serialPort == null) return;
int nrBytes = serialPort.BytesToRead;
if (nrBytes > 0)
{
@@ -170,6 +173,7 @@ namespace TBF.BenchControl.Modbus.Common
//stopWorkerThread = true;
//workerThread.Join(2000);
serialPort.Close();
serialPort = null;
}
}
}
@@ -69,9 +69,9 @@ namespace TBF.BenchControl.Modbus.TankSelector
}
public void Initialize() { SetOutputs(0); }
public void RunDeviceBefore() { }
public void RunDeviceAfter() { }
public void StopDevice() { SetOutputs(0); }
public void RunDeviceBefore() {}
public void RunDeviceAfter() {}
public void StopDevice() {}
void CreateConditions(bool createAll)
{
@@ -258,6 +258,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
TextBox[] messages;
static IList<WaterMeters.iPerl.WaterMeter> waterMeters;
static IList<int> waterMeterPositions; /// keeps original indices in RegisterReaders list
Modbus.QuidoRS.QuidoRS quido;
@@ -409,12 +410,18 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
void ConstructorCommon()
{
waterMeters = new List<WaterMeters.iPerl.WaterMeter>();
foreach (var rr in ProcessData.RegisterReaders)
waterMeterPositions = new List<int>();
///
for (int wmPos = 0; wmPos < ProcessData.RegisterReaders.Length; wmPos++)
{
if (rr is WaterMeters.iPerl.WaterMeter)
WaterMeters.iPerl.WaterMeter iPerl = ProcessData.RegisterReaders[wmPos] as WaterMeters.iPerl.WaterMeter;
if (iPerl != null)
{
waterMeters.Add(rr as WaterMeters.iPerl.WaterMeter);
waterMeters.Add(iPerl);
waterMeterPositions.Add(wmPos);
}
wmPos++;
}
WaterMetersCount = waterMeters.Count;
@@ -565,7 +572,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
CommCompletedHandler = null;
AllCompletedHandler = null;
if (multiTestParams != null && multiTestParams.Count > 0 && multiTestParams[0].SimultWithPrevious)
if (multiTestParams != null &&
multiTestParams.Count > 0 &&
!multiTestParams[0].SimultWithNext) /// RFID Communication at the end of the cycle does not influence the result
{
UpdateRfidCommResult(tests); /// TODO: Pass the test info in a correct way
}
@@ -1510,10 +1519,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
tstRslt.FlowSetTime = 0;
tstRslt.TestTime += testTime; /// [s] total communication time of all tests
for (int i = 0; i < Math.Min(ProcessData.BatchRslts.WMPositionsCount, waterMeters.Count); i++)
for (int i = 0; i < waterMeters.Count; i++)
{
Results.Entities.MeterTestRslt meterRslt =
ProcessData.BatchRslts.GetMeterTestRslt(test.Name, i, Config.Entities.CompoundMeterId.Single);
ProcessData.BatchRslts.GetMeterTestRslt(test.Name, waterMeterPositions[i], Config.Entities.CompoundMeterId.Single);
WaterMeters.iPerl.WaterMeter iPerl = waterMeters[i] as WaterMeters.iPerl.WaterMeter;
@@ -302,7 +302,6 @@ namespace TBF.UiControls
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
base.AddOne(newProcedure);
}
}
}