Bugfixes in: (1) use of iPerl Board# param, (2) Evaluate and Publish flying strt test params, (3) Q2 correction, (4) opto-log-file-name cleanup, etc.
This commit is contained in:
parent
f3dabcbcc1
commit
2b8f5ebec3
@ -296,6 +296,13 @@ namespace TBF.BenchControl.Sequences
|
|||||||
{
|
{
|
||||||
StateMachine.LoadTestParams(test);
|
StateMachine.LoadTestParams(test);
|
||||||
|
|
||||||
|
if (BenchInfo != null && sensPath.RegisterReaders != null)
|
||||||
|
{
|
||||||
|
foreach (var rr in sensPath.RegisterReaders)
|
||||||
|
if (rr is WaterMeters.iPerl.WaterMeter)
|
||||||
|
(rr as WaterMeters.iPerl.WaterMeter).BenchName = BenchInfo.TestBenchId;
|
||||||
|
}
|
||||||
|
|
||||||
e = testMethodSequence.Execute(test);
|
e = testMethodSequence.Execute(test);
|
||||||
|
|
||||||
if (e.Contains(Event.ConfigurationError)) goto select_cycle_or_test;
|
if (e.Contains(Event.ConfigurationError)) goto select_cycle_or_test;
|
||||||
@ -345,7 +352,14 @@ namespace TBF.BenchControl.Sequences
|
|||||||
if (testMethodSequence != null && testMethodSequence.CanTest(StateMachine.Procedure.MetersKind))
|
if (testMethodSequence != null && testMethodSequence.CanTest(StateMachine.Procedure.MetersKind))
|
||||||
{
|
{
|
||||||
StateMachine.LoadTestParams(test);
|
StateMachine.LoadTestParams(test);
|
||||||
|
|
||||||
|
if (BenchInfo != null && sensPath.RegisterReaders != null)
|
||||||
|
{
|
||||||
|
foreach (var rr in sensPath.RegisterReaders)
|
||||||
|
if (rr is WaterMeters.iPerl.WaterMeter)
|
||||||
|
(rr as WaterMeters.iPerl.WaterMeter).BenchName = BenchInfo.TestBenchId;
|
||||||
|
}
|
||||||
|
|
||||||
e = testMethodSequence.Execute(test);
|
e = testMethodSequence.Execute(test);
|
||||||
|
|
||||||
if (e.Contains(Event.Error)) goto error;
|
if (e.Contains(Event.Error)) goto error;
|
||||||
|
|||||||
@ -255,14 +255,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
|
|||||||
while (!e.Contains(Event.MeasurementStarted));
|
while (!e.Contains(Event.MeasurementStarted));
|
||||||
|
|
||||||
|
|
||||||
/// Reset iPerl volume measurement
|
foreach (var rr in sensPath.RegisterReaders)
|
||||||
//foreach (var rr in sensPath.RegisterReaders)
|
{
|
||||||
//{
|
if (rr is WaterMeters.iPerl.WaterMeter) (rr as WaterMeters.iPerl.WaterMeter).TestName = test.Name;
|
||||||
// if (rr is WaterMeters.iPerl.WaterMeter)
|
}
|
||||||
// {
|
|
||||||
// (rr as WaterMeters.iPerl.WaterMeter).Reset();
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
/// Measurement loop - preparation
|
/// Measurement loop - preparation
|
||||||
|
|||||||
@ -30,6 +30,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
|
|||||||
{
|
{
|
||||||
Name = "FlyingStartCollection";
|
Name = "FlyingStartCollection";
|
||||||
ParentName = string.Empty;
|
ParentName = string.Empty;
|
||||||
|
TestParams = new TestParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestMethodCfg(IComponentFactory factory)
|
public TestMethodCfg(IComponentFactory factory)
|
||||||
|
|||||||
@ -82,7 +82,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
|
|||||||
test = dbEntity.Test;
|
test = dbEntity.Test;
|
||||||
|
|
||||||
Evaluate = tmp.Evaluate;
|
Evaluate = tmp.Evaluate;
|
||||||
}
|
Publish = tmp.Publish;
|
||||||
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
|||||||
|
|
||||||
public string ToString(int i)
|
public string ToString(int i)
|
||||||
{
|
{
|
||||||
return string.Format("Name={0}", Name);
|
return string.Format("Name={0}, Board#1=COM{1}, Board#2=COM{2}, Board#3=COM{3}, Board#4=COM{4}",
|
||||||
|
Name, RfidPortNrBoard1, RfidPortNrBoard2, RfidPortNrBoard3, RfidPortNrBoard4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -490,9 +490,12 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
|||||||
{
|
{
|
||||||
int threadId = (threadData as Boxes.IntBox).Val;
|
int threadId = (threadData as Boxes.IntBox).Val;
|
||||||
|
|
||||||
rfidDataLogger.InfoFormat(""); /// Makes the log more readable when there is a lot of data
|
if (threadId == 0)
|
||||||
rfidDataLogger.WarnFormat("Activity = {0}", activity);
|
{
|
||||||
rfidDataLogger.InfoFormat(""); /// Makes the log more readable when there is a lot of data
|
rfidDataLogger.InfoFormat(""); /// Makes the log more readable when there is a lot of data
|
||||||
|
rfidDataLogger.WarnFormat("Activity = {0}", activity);
|
||||||
|
rfidDataLogger.InfoFormat(""); /// Makes the log more readable when there is a lot of data
|
||||||
|
}
|
||||||
|
|
||||||
for (int group = 1; group <= lastGroup; group++)
|
for (int group = 1; group <= lastGroup; group++)
|
||||||
{
|
{
|
||||||
@ -560,8 +563,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
|||||||
/// <returns>true on success</returns>
|
/// <returns>true on success</returns>
|
||||||
static CommErr ReadConfiguration(WaterMeters.iPerl.WaterMeter wm, ref string resultStr)
|
static CommErr ReadConfiguration(WaterMeters.iPerl.WaterMeter wm, ref string resultStr)
|
||||||
{
|
{
|
||||||
int boardNr = wm.MuxBoardNr - 51;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The activity is "Read configuration" (this enables the watermeter, resets error flag)
|
/// The activity is "Read configuration" (this enables the watermeter, resets error flag)
|
||||||
/// or "Read configuration if enabled" (this keeps th error flag).
|
/// or "Read configuration if enabled" (this keeps th error flag).
|
||||||
@ -581,7 +582,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
|||||||
byte[] config = null;
|
byte[] config = null;
|
||||||
for (int j = 0; j < MaxCommRetries; j++)
|
for (int j = 0; j < MaxCommRetries; j++)
|
||||||
{
|
{
|
||||||
if (0 == ReadRequestPort(boardNr, MessageID.Configuration, 0, ConfigStruct.Length, out config, CommTimeout))
|
if (0 == ReadRequestPort(wm.MuxBoardNr, MessageID.Configuration, 0, ConfigStruct.Length, out config, CommTimeout))
|
||||||
{
|
{
|
||||||
error = CommErr.None;
|
error = CommErr.None;
|
||||||
wm.ConfigStruct = ConfigStruct.FromByteArray(config);
|
wm.ConfigStruct = ConfigStruct.FromByteArray(config);
|
||||||
@ -590,7 +591,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClosePort(boardNr); /// Close RFID port
|
ClosePort(wm.MuxBoardNr); /// Close RFID port
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@ -932,8 +933,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
|||||||
(rdData != null) && (rdData.Length == 2) && (rdData[0] == q2CorrRFlow) && (rdData[1] == q2CorrRFlow))
|
(rdData != null) && (rdData.Length == 2) && (rdData[0] == q2CorrRFlow) && (rdData[1] == q2CorrRFlow))
|
||||||
{
|
{
|
||||||
error = CommErr.None;
|
error = CommErr.None;
|
||||||
resultStr = string.Format("Q2 correction factors set: RightFlow = {0}, LeftFlow = {1}",
|
resultStr = string.Format("Group={0}, Board={1}, Q2 correction factors set: RightFlow = {2}, LeftFlow = {3}",
|
||||||
q2CorrRFlow, q2CorrRFlow);
|
wm.Group, wm.MuxBoardNr, q2CorrRFlow, q2CorrRFlow);
|
||||||
|
rfidDataLogger.Warn(resultStr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -130,6 +130,8 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
|||||||
/// <returns>Q2 correction factor</returns>
|
/// <returns>Q2 correction factor</returns>
|
||||||
public double Q2CorrectionFactor()
|
public double Q2CorrectionFactor()
|
||||||
{
|
{
|
||||||
|
if (Math.Abs(LastTestResult.VolumeErrorPct) <= 0.5f) return 0; /// No Q2 correction if error < +/-0.5 %
|
||||||
|
|
||||||
double A = 16.0 / ScalingFactor(); /// Raw units per ml: DN15=16, DN20=8, DN25=4, DN32=2, DN40=1
|
double A = 16.0 / ScalingFactor(); /// Raw units per ml: DN15=16, DN20=8, DN25=4, DN32=2, DN40=1
|
||||||
const double B = 8.0; /// Raw units per minute, 8
|
const double B = 8.0; /// Raw units per minute, 8
|
||||||
const double C = B * 60.0; /// Raw units per hour, 480
|
const double C = B * 60.0; /// Raw units per hour, 480
|
||||||
@ -140,6 +142,11 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
|||||||
return (-1) * (LastTestResult.VolumeErrorPct / G) * (LastTestResult.VolumeRef / LastTestResult.VolumeMeter);
|
return (-1) * (LastTestResult.VolumeErrorPct / G) * (LastTestResult.VolumeRef / LastTestResult.VolumeMeter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> Name set by the test, to be used as a part og the opto-data log file name </summary>
|
||||||
|
public string TestName;
|
||||||
|
|
||||||
|
/// <summary> Name set by the test, to be used as a part og the opto-data log file name </summary>
|
||||||
|
public string BenchName;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Volume of water from the opto telegram
|
/// Volume of water from the opto telegram
|
||||||
@ -331,8 +338,12 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
|||||||
{
|
{
|
||||||
/// Reset opto data
|
/// Reset opto data
|
||||||
optoDataCount = 0;
|
optoDataCount = 0;
|
||||||
optoDataLogFileName = (ConfigStruct != null) ? ConfigStruct.PCBNumber2String() : "Unknown PCBNumber";
|
optoDataLogFileName = string.Format("{0}_{1}_{2}_{3}_{4}",
|
||||||
optoDataLogFileName += "_" + Name + "_" + Utils.ToMyString(DateTime.Now);
|
(ConfigStruct != null) ? ConfigStruct.PCBNumber2String() : "UnknownPcbNr",
|
||||||
|
Utils.ToMyString(DateTime.Now),
|
||||||
|
BenchName,
|
||||||
|
Name,
|
||||||
|
(TestName != null ? TestName : string.Empty));
|
||||||
|
|
||||||
sampleNr = 0;
|
sampleNr = 0;
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,7 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
|||||||
|
|
||||||
public string ToString(int i)
|
public string ToString(int i)
|
||||||
{
|
{
|
||||||
return string.Format("Name={0}, Type={1}, Opto=COM{2}, RFID=COM{3}, Group={4}",
|
return string.Format("Name={0}, Type={1}, Opto=COM{2}, MuxBoard#={3}, Group={4}",
|
||||||
Name,
|
Name,
|
||||||
MeterType,
|
MeterType,
|
||||||
OptoComPortNr,
|
OptoComPortNr,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user