Compare commits

...
Author SHA1 Message Date
Milan Hanajik 2fca8df484 Reconfigured for Rumunsko-Mobile 2019-11-15 16:56:35 +01:00
Milan Hanajik 03e8108704 FixedStartDeferredEval a FixedStartMassCollDeferredEval, ver. 2.18.1362 2019-11-15 16:55:55 +01:00
Milan Hanajik ed4179be5f All three TesttMethods.Adjustment.WMErrorsForm-s are more robust. 2019-11-15 16:55:53 +01:00
Milan Hanajik bedbecbcc3 TestMethods.FixedStart.FixedStartSeq code cleanup, references to scale/tank/draining/mass measurement removed. 2019-11-15 16:55:29 +01:00
Milan Hanajik e81de2267b ver. 2.18.1361 2019-11-12 07:57:44 +01:00
Milan Hanajik 3dfff4ad70 New iPerlCommunication.iPerlHead porc. parameter DoQ2CorrInside05pct and related functionality. 2019-11-11 11:28:39 +01:00
Milan Hanajik 7a640621ac Bug fixes : (1) FlowMeterDewa, (2) ControlComWrap.ReferenceFreqs(int i), ver. 2.18.1360 2019-11-11 09:46:25 +01:00
Milan Hanajik 807daf2bcd ver. 2.18.1357 2019-10-29 13:37:16 +01:00
Milan Hanajik ede1773b4f ver. 2.18.1356 2019-10-28 15:45:35 +01:00
Milan Hanajik e3ae1b24f1 Output.fileWriters.IperlLogger bug fix, ver. 2.18.1355 2019-10-28 15:38:42 +01:00
Milan Hanajik f6dc9d74fc iPerlCommunication : DelayBetweenRetries introduced. 2019-10-28 14:47:05 +01:00
Milan Hanajik 51f3a6e6c2 (1) ProcedureDlg: Draining before/after in Process tab, (2) DoDrainingAfter implemented in test method sequences. 2019-10-25 15:25:47 +02:00
Milan Hanajik f81d5111a9 ver. 2.18.1351 2019-10-24 09:02:12 +02:00
Milan Hanajik b24ec4ea2d ver. 2.18.1350 2019-10-24 08:55:44 +02:00
Milan Hanajik f3ed9a64f7 Transition sequences and hydraulic paths are not displayed and cannot be edited for test methods with DoTranisitions( ) == false. 2019-10-24 08:55:41 +02:00
Milan Hanajik 866939abbd (1) TBF.BenchControl.Elde.SendCommandArgs class and cbCommandQueue (2) DiverterToTank, DiverterToSink commands modified. 2019-10-24 08:55:40 +02:00
Milan Hanajik 248f51fa69 TransitionContext.AfterTestWithOverlap, PID coef. set earlier as well, nextHydroTest in MainSeq. 2019-10-24 08:55:31 +02:00
Milan Hanajik b4dc83e7fa (1) Modifications for WR20, WR21 (2) ProcessData.BenchInfo.TestBenchId/TextBenchName are always used by Oracle and ProductionTracing. 2019-10-22 12:48:58 +02:00
94 changed files with 3153 additions and 849 deletions
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;RUM_MOB;LANG_RO</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -28,7 +28,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;RUM_MOB;LANG_RO</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+36
View File
@@ -234,6 +234,42 @@ namespace Config.Entities
return null;
}
/// <summary>
/// Processes the selection done by the bench control panel in the main sequence.
/// </summary>
/// <param name="selection">Selection.Q1, .Q2, .Q3 or .Test</param>
/// <returns>The selected test or null</returns>
public virtual Test GetTest(string expandedTestName, out int testIx, out int repetNr)
{
for (int ix = 0; ix < Tests.Count; ix++)
{
Test test = Tests[ix];
if (test.Name.Equals(expandedTestName))
{
/// Name is not expanded => Repeats==1
testIx = ix;
repetNr = 1;
return test;
}
for (int r = 1; r <= test.Repeats; r++)
{
if (test.GetExpandedTestName(r).Equals(expandedTestName))
{
testIx = ix;
repetNr = r;
return test;
}
}
}
testIx = 0;
repetNr = 1;
return null;
}
public override string ToString()
{
return string.Format("{0}, rev.{1}", Name, Revision);
+33 -6
View File
@@ -30,7 +30,7 @@ namespace Config.Entities
public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual int Repeats { get; set; }
public virtual bool DoDraining { get; set; }
public virtual bool DoZeroing { get; set; }
public virtual bool DoDrainingAfter { get; set; }
public virtual bool DoControlWaterTemp { get; set; }
public virtual float TempLimLo { get; set; } /// Lower limit for the controlled temperature
public virtual float TempLimHi { get; set; } /// Upper limit for the controlled temperature
@@ -76,7 +76,7 @@ namespace Config.Entities
DoEvaluate = true;
Repeats = 1;
DoDraining = false;
DoZeroing = false;
DoDrainingAfter = false;
DoControlWaterTemp = false;
TempLimLo = 15.0f;
TempLimHi = 25.0f;
@@ -124,7 +124,7 @@ namespace Config.Entities
result.Uncertainty = Uncertainty;
result.Repeats = Repeats;
result.DoDraining = DoDraining;
result.DoZeroing = DoZeroing;
result.DoDrainingAfter = DoDrainingAfter;
result.DoControlWaterTemp = DoControlWaterTemp;
result.TempLimLo = TempLimLo;
result.TempLimHi = TempLimHi;
@@ -172,7 +172,7 @@ namespace Config.Entities
output.WriteLine(Uncertainty.ToString(ci));
output.WriteLine(Repeats.ToString(ci));
output.WriteLine(DoDraining.ToString());
output.WriteLine(DoZeroing.ToString());
output.WriteLine(DoDrainingAfter.ToString());
output.WriteLine(DoControlWaterTemp.ToString());
output.WriteLine(TempLimLo.ToString(ci));
output.WriteLine(TempLimHi.ToString(ci));
@@ -222,7 +222,7 @@ namespace Config.Entities
tst.Uncertainty = float.Parse(input.ReadLine(), ci);
tst.Repeats = int.Parse(input.ReadLine(), ci);
tst.DoDraining = bool.Parse(input.ReadLine());
tst.DoZeroing = bool.Parse(input.ReadLine());
tst.DoDrainingAfter = bool.Parse(input.ReadLine());
tst.DoControlWaterTemp = bool.Parse(input.ReadLine());
tst.TempLimLo = float.Parse(input.ReadLine(), ci);
tst.TempLimHi = float.Parse(input.ReadLine(), ci);
@@ -280,7 +280,7 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != Uncertainty.ToString(ci)) { diff.AppendFormat(fmt, "Uncertainty", Uncertainty.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Repeats.ToString(ci)) { diff.AppendFormat(fmt, "Repeats", Repeats.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDraining.ToString(ci)) { diff.AppendFormat(fmt, "Draining", DoDraining.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoZeroing.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoZeroing.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDrainingAfter.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoDrainingAfter.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoControlWaterTemp.ToString()) { diff.AppendFormat(fmt, "DoControlWaterTemp", DoControlWaterTemp.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); };
@@ -313,6 +313,33 @@ namespace Config.Entities
return null;
}
/// <summary>
/// Return test title for a this test and a given repetition number
/// </summary>
/// <param name="repetitonNr">1 .. Nr. repetitions</param>
/// <returns>Test title (string)</returns>
public virtual string GetExpandedTestName(int repetitionNr)
{
if (Repeats == 1)
{
if (Part == 0)
{
/// Single test
return Name;
}
else
{
/// A part of a single test
return string.Format("{0} ({1})", Name, Part);
}
}
else
{
/// More test repetitions
return string.Format("{0} ({1}/{2})", Name, repetitionNr, Repeats);
}
}
public virtual double GetErrLimLo(double volumeCTV, double testTime)
{
if (ErrLimLo <= ErrLimHi)
+1 -1
View File
@@ -24,7 +24,7 @@ namespace Config.Mappings
Map(x => x.Repeats);
Map(x => x.DoDraining)
.Column("Emptying");
Map(x => x.DoZeroing)
Map(x => x.DoDrainingAfter)
.Column("Zeroing");
Map(x => x.DoControlWaterTemp);
Map(x => x.TempLimLo);
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1290.0")]
[assembly: AssemblyFileVersion("2.18.1290.0")]
[assembly: AssemblyVersion("2.18.1340.0")]
[assembly: AssemblyFileVersion("2.18.1340.0")]
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;RUM_MOB;LANG_RO</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -27,7 +27,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;RUM_MOB;LANG_RO</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+5 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
///
using System;
using System.Text;
@@ -30,6 +30,8 @@ namespace Results
case 10: return 38; /// WR14
case 11: return 39; /// WR18
case 12: return 40; /// WR19
case 13: return 41; /// WR20
case 14: return 42; /// WR21
default: return 0;
}
}
@@ -47,6 +49,8 @@ namespace Results
case 10: return "WR14";
case 11: return "WR18";
case 12: return "WR19";
case 13: return "WR20";
case 14: return "WR21";
default: return string.Empty;
}
}
+2 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;RUM_MOB;LANG_RO</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -31,7 +31,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;RUM_MOB;LANG_RO</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+103 -134
View File
@@ -18,6 +18,8 @@ namespace TBF.BenchControl.Elde
private static readonly ILog log = LogManager.GetLogger(typeof(ControlBoardDev));
public override string ToString() { return string.Format("ControlBoard({0})", Cfg.ToString(1)); }
const int FiltersCount = 8;
readonly ControlBoardCfg controlBoardCfg;
///
@@ -79,48 +81,22 @@ namespace TBF.BenchControl.Elde
bool previousEmergencyStop;
private int flowmeterNr4DiverterTest;
private bool scheduleDiverterToTank;
private bool scheduleDiverterToSink;
private bool scheduleReadDiverterTransition;
private bool pumpPowerChanged;
///
public void DiverterToTank(int flowmeterNr)
public void DiverterToTank(int flowMtrNr)
{
if (!scheduleDiverterToSink && !scheduleReadDiverterTransition && !emergencyStop)
{
flowmeterNr4DiverterTest = flowmeterNr;
scheduleDiverterToTank = true;
}
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Start, flowMtrNr, int.MaxValue, int.MaxValue, TestMethods.Diverter | TestMethods.Synchro, StopDevs.None));
}
///
public void DiverterToSink(int flowmeterNr)
public void DiverterToSink(int flowMtrNr)
{
if (!scheduleDiverterToTank && !scheduleReadDiverterTransition && !emergencyStop)
{
flowmeterNr4DiverterTest = flowmeterNr;
scheduleDiverterToSink = true;
}
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Stop, 0, 0, 0, TestMethods.Diverter,
StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation));
}
///
public void ReadDiverterTransition(int flowmeterNr)
public void ReadDiverterTransition(int flowMtrNr)
{
if (!scheduleDiverterToTank && !scheduleDiverterToSink && !emergencyStop)
{
flowmeterNr4DiverterTest = flowmeterNr;
scheduleReadDiverterTransition = true;
}
cbCommandQueue.Enqueue(new SendCommandArgs(Command.ReadDivTransition, flowMtrNr, 0, 0, TestMethods.Diverter, 0));
}
/// <summary> State of valves sent out - buffered by the last SendCommand() </summary>
public UInt128 Route { get { return benchModelRoute; } }
UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
///
/// Initialization data updated by constructors of children components
/// and sent to 'controlCom2panel' by SendCalibData() method.
@@ -177,21 +153,22 @@ namespace TBF.BenchControl.Elde
public uint[] BalanceRange = new uint[2];
///
/// Private values sent by the last SendCommand()
///
bool sendCommandFlag;
Command cmd;
int refNr;
Queue<SendCommandArgs> cbCommandQueue;
/// <summary>
/// Route: 128-bit word representing the current state of all valves and pumps
/// </summary>
public UInt128 Route { get { return benchModelRoute; } }
UInt128 benchModelRoute;
int totalRefPulses;
int massRefPulses;
TestMethods testMethods;
UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
int[] filters;
float[] FMFreq;
int regConst;
int shortImp;
StopDevs stopDevs;
/// <summary>
@@ -214,6 +191,8 @@ namespace TBF.BenchControl.Elde
/// <param name="power">Power (0.0f .. 100.0f)</param>
public void SetFMFreq(int index, float power)
{
bool pumpPowerChanged = false;
#if DN100 || MUNICH || FUZHOU_150
if ((FMFreq == null) || (FMFreq.Length != 2))
{
@@ -292,6 +271,9 @@ namespace TBF.BenchControl.Elde
{
controlBoardCfg = cfg as ControlBoardCfg;
cbCommandQueue = new Queue<SendCommandArgs>();
lastSentFilters = new uint[FiltersCount];
#if DN100 || MUNICH || FUZHOU_150
FMFreq = new float[2] { 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300=6, newer=6
#elif SLM_END || WARSAW_END
@@ -379,7 +361,9 @@ namespace TBF.BenchControl.Elde
log.FatalFormat("Successfully initialized device {0}", ToString());
}
/// <summary>Run this device</summary>
/// <summary>
/// Run this device
/// </summary>
public void RunDeviceBefore()
{
if (DebugLevel == DebugMode.Simulate) return;
@@ -400,95 +384,89 @@ namespace TBF.BenchControl.Elde
{
UiBridge.Bridge.OnEmergencyStopChanged(this,UiBridge.EmergencyStopEventArgs.State.CloseForm);
}
if (emergencyStop)
{
/// SendCommand() arguments to clear the emergency stop state
sendCommandFlag = true;
this.refNr = 0;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.cmd = Command.Stop;
this.testMethods = 0;
this.stopDevs = StopDevs.All;
}
else if (scheduleDiverterToTank)
{
/// Reset all SendCommand() arguments
sendCommandFlag = true;
this.cmd = Command.Start;
this.refNr = flowmeterNr4DiverterTest;
this.totalRefPulses = int.MaxValue;
this.massRefPulses = int.MaxValue;
this.testMethods = TestMethods.Diverter;
this.stopDevs = 0;
scheduleDiverterToTank = false;
}
else if (scheduleDiverterToSink)
{
/// Reset all SendCommand() arguments
sendCommandFlag = true;
this.cmd = Command.Stop;
this.refNr = flowmeterNr4DiverterTest;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.testMethods = TestMethods.Diverter;
this.stopDevs = StopDevs.Diverter;
scheduleDiverterToSink = false;
}
else if (scheduleReadDiverterTransition)
{
/// Reset all SendCommand() arguments
sendCommandFlag = true;
this.cmd = Command.ReadDivTransition;
this.refNr = flowmeterNr4DiverterTest;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.testMethods = TestMethods.Diverter;
this.stopDevs = 0;
scheduleReadDiverterTransition = false;
}
else if (pumpPowerChanged)
{
/// Reset all SendCommand() arguments
sendCommandFlag = true;
this.cmd = Command.None;
pumpPowerChanged = false;
}
else
{
/// Reset all SendCommand() arguments
sendCommandFlag = false;
this.cmd = Command.None;
this.refNr = 0;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.testMethods = 0;
this.stopDevs = 0;
}
if (this.filters == null) this.filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, };
}
/// <summary>Run this device</summary>
///
/// Used in RunDeviceAfter() when sending commands
///
UInt128 lastSentRoute;
uint[] lastSentFilters;
float[] lastSentFMFreq;
int lastsentRegConst;
int lastSentShortImp;
/// <summary>
/// Run this device
/// </summary>
public void RunDeviceAfter()
{
if (DebugLevel == DebugMode.Simulate) return;
UpdateWeights();
uint[] uintFilters = new uint[8];
for (int i = 0; i < 8; i++)
/// Modify queue in case of emergency stop
if (emergencyStop && !previousEmergencyStop)
{
uintFilters[i] = (filters.Length > i) ? (uint)filters[i] : uintFilters[i - 1];
/// SendCommand() arguments to clear the emergency stop state
cbCommandQueue.Clear();
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Stop, 0, 0, 0, 0, StopDevs.All));
}
///
if (sendCommandFlag)
/// Prepare uintFilters array and evaluate changes
uint[] uintFilters = new uint[FiltersCount];
uintFilters[0] = (filters != null && filters.Length > 0) ? (uint)filters[0] : 0;
bool filtersAreDifferent = (uintFilters[0] != lastSentFilters[0]);
for (int i = 1; i < FiltersCount; i++)
{
controlCom.SendCommand(cmd, refNr, (benchModelRoute & routeMask),
totalRefPulses, massRefPulses, testMethods,
uintFilters, FMFreq, regConst, shortImp, stopDevs);
uintFilters[i] = (filters != null && filters.Length > i) ? (uint)filters[i] : uintFilters[i - 1];
filtersAreDifferent |= (uintFilters[i] != lastSentFilters[i]);
}
/// Evaluate FMFreq changes
bool fmFreqsAreDifferent = false;
if ((FMFreq == null) || (lastSentFMFreq == null) || (FMFreq.Length != lastSentFMFreq.Length))
{
fmFreqsAreDifferent = true;
}
else
{
for (int i = 0; i < FMFreq.Length; i++)
{
if (FMFreq[i] != lastSentFMFreq[i])
{
fmFreqsAreDifferent = true;
break;
}
}
}
if (cbCommandQueue.Count > 0)
{
/// There is a command in the queue
///
controlCom.SendCommand(cbCommandQueue.Dequeue(), (benchModelRoute & routeMask), uintFilters, FMFreq, regConst, shortImp);
lastSentRoute = (benchModelRoute & routeMask);
lastSentFilters = uintFilters;
lastSentFMFreq = FMFreq;
lastsentRegConst = regConst;
lastSentShortImp = shortImp;
}
else if (((benchModelRoute & routeMask) != lastSentRoute) ||
filtersAreDifferent ||
fmFreqsAreDifferent ||
(lastsentRegConst != regConst) ||
(lastSentShortImp != shortImp))
{
/// Command queue is mepty, but 'route', pump frequency, PID coef., filters or shortImp have changed
///
controlCom.SendCommand(new SendCommandArgs(Command.None, 0, 0, 0, 0, 0), (benchModelRoute & routeMask), uintFilters, FMFreq, regConst, shortImp);
lastSentRoute = (benchModelRoute & routeMask);
lastSentFilters = uintFilters;
lastSentFMFreq = FMFreq;
lastsentRegConst = regConst;
lastSentShortImp = shortImp;
}
controlCom.RunDeviceAfter();
@@ -512,25 +490,17 @@ namespace TBF.BenchControl.Elde
/// </summary>
/// <param name="cmd">See ControlBoard.Command enum</param>
/// <param name="refFlowmtrNr">Number of the etalon/reference (1..5)</param>
/// <param name="route">Route: 64-bit installation specific number</param>
/// <param name="route">State of valves, 128-bit word</param>
/// <param name="totalRefPulses">kolko impulzov ma trvat skuska</param>
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
/// <param name="filterConstant">0 = No filtering (0..255)</param>
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
public void SendCommand(Command cmd, int refFlowmtrNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods, StopDevs stopDevs)
public void SendCommand(Command cmd, int refFlowmtrNr, int totalRefPulses, int massRefPulses,
TestMethods testMethods, StopDevs stopDevs)
{
this.cmd = cmd;
this.refNr = refFlowmtrNr;
this.benchModelRoute = route;
this.totalRefPulses = totalRefPulses;
this.massRefPulses = massRefPulses;
this.testMethods = testMethods;
this.stopDevs = stopDevs;
sendCommandFlag = true;
cbCommandQueue.Enqueue(new SendCommandArgs(cmd, refFlowmtrNr, totalRefPulses, massRefPulses, testMethods, stopDevs));
}
/// <summary>
@@ -545,7 +515,6 @@ namespace TBF.BenchControl.Elde
benchModelRoute = (((benchModelRoute ^ valvesToInvert) | valvesToOpen) & (~valvesToClose)) ^ valvesToInvert;
foreach (var extV in extendedValves) extV.UpdateRoute(ref benchModelRoute);
log.DebugFormat("SetValves(x,x), new route = {0}", Utils.RouteToStr(benchModelRoute));
sendCommandFlag = true;
return oldRoute ^ benchModelRoute;
}
+15 -17
View File
@@ -169,7 +169,7 @@ namespace TBF.BenchControl.Elde
/// </summary>
/// <param name="cmd">See ControlBoard.Command enum</param>
/// <param name="refFlowmtrNr">Number of the etalon/reference (1..5)</param>
/// <param name="route">Route: 64-bit installation specific number</param>
/// <param name="route">State of valves, 128-bit word</param>
/// <param name="refPulses">kolko impulzov ma trvat skuska</param>
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
/// <param name="filterConstant">0 = No filtering (0..255)</param>
@@ -177,17 +177,15 @@ namespace TBF.BenchControl.Elde
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
public void SendCommand(Command cmd, int refFlowmtrNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
public void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
{
log.InfoFormat("SendCommand(Cmd={0},Ref#={1},Route={2} {3} {4} {5},TotalPls={6},MassPls={7},TstM={8},filt={9},FM=[{10}{11}{12}{13}{14}{15}],Reg={16},ShrtImp={17},Stop={18})",
cmd, refFlowmtrNr, /// 0, 1
((route >> 48) & 0xFFFF).ToString("X4"), /// 2
((route >> 32) & 0xFFFF).ToString("X4"), /// 3
((route >> 16) & 0xFFFF).ToString("X4"), /// 4
(route & 0xFFFF).ToString("X4"), /// 5
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 6, 7, 8, 9
sendCommandArgs.Cmd, sendCommandArgs.RefFlowmtrNr, /// 0, 1
((route >> 48) & 0xFFFF).ToString("X4"), /// 2
((route >> 32) & 0xFFFF).ToString("X4"), /// 3
((route >> 16) & 0xFFFF).ToString("X4"), /// 4
(route & 0xFFFF).ToString("X4"), /// 5
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 6, 7, 8, 9
fmFreq[0].ToString(), /// 10
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 11
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 12
@@ -199,8 +197,8 @@ namespace TBF.BenchControl.Elde
/// Simulation
///
Command lastCmd = this.cmd;
this.cmd = cmd;
this.refFlowmtrNr = refFlowmtrNr;
this.cmd = sendCommandArgs.Cmd;
this.refFlowmtrNr = sendCommandArgs.RefFlowmtrNr;
#if FUZHOU_300
///
@@ -214,14 +212,14 @@ namespace TBF.BenchControl.Elde
log.DebugFormat("SendCommand route = {0}", Utils.RouteToStr(route));
#endif
TestBenchSim.SimRoute = this.simRoute = route;
this.totalRefPulses = totalRefPulses;
this.massRefPulses = massRefPulses;
this.testMethods = testMethods;
this.filterConstants = filterConstants;
this.totalRefPulses = sendCommandArgs.TotalRefPulses;
this.massRefPulses = sendCommandArgs.MassRefPulses;
this.testMethods = sendCommandArgs.TestMethods;
this.stopDevs = sendCommandArgs.StopDevs;
this.filterConstants = filterConstants;
this.FMFreq = fmFreq;
this.regConst = regConst;
this.shortImp = shortImp;
this.stopDevs = stopDevs;
#pragma warning disable
statusP = (StatusP)(((ulong)statusP & (ulong)0xFFFFFFFFFFFFFFF8L) | (ulong)refFlowmtrNr);
+99 -77
View File
@@ -20,25 +20,24 @@ namespace TBF.BenchControl.Elde
public StatusP StatusP { get { return (StatusP)ctrlBrdComponent.StatusP; } }
#if DN100 || MUNICH || FUZHOU_150
public double ReferenceFreq { get { return 1000.0f * ctrlBrdComponent.referenceFreq; } } /// In [Hz] 0..2500, nom.=2000
public double ReferenceFreq { get { return 1000.0f * ctrlBrdComponent.referenceFreq; } } /// Returns in [Hz] 0..2500, nom.=2000
public double ReferenceFreqs(int i) { return 0; }
#else /// all newer benches
#else
/// All newer benches
public double ReferenceFreq { get { return 1000.0 * ctrlBrdComponent.referenceFreq[0]; } } /// Returns in [Hz] 0..2500, nom.=2000
///
/// <summary>
/// In case of I11, I12
/// referenceFreq[0] = I11 + I12
/// referenceFreq[1] = I11
/// referenceFreq[2] = I12
/// cBrd.referenceFreq[0] = I11 + I12
/// cBrd.referenceFreq[1] = I11
/// cBrd.referenceFreq[2] = I12
/// otherwise
/// referenceFreq[0] = I2 or I3 or I4
/// cBrd.referenceFreq[0] = I2 or I3 or I4
/// </summary>
public double ReferenceFreq { get { return 1000.0 * ctrlBrdComponent.referenceFreq[0]; } } /// In [Hz] 0..2500, nom.=2000 ///
/// <returns>Reference frequency in Hz</returns>
public double ReferenceFreqs(int i)
{
if ((i >= 0) && (i < ctrlBrdComponent.referenceFreq.Length))
{
return 1000.0 * ctrlBrdComponent.referenceFreq[0]; /// In [Hz] 0..2500, nom.=2000
}
else return 0;
return ((i >= 0) && (i < ctrlBrdComponent.referenceFreq.Length)) ? (1000.0 * ctrlBrdComponent.referenceFreq[i]) : 0;
}
#endif
@@ -308,63 +307,35 @@ namespace TBF.BenchControl.Elde
/// <summary>
/// Sends a command to the control board.
/// </summary>
/// <param name="cmd">See ControlBoard.Command enum</param>
/// <param name="refFlowMeterNr">Reference flow meter number (1..5)</param>
/// <param name="route">Route: 64-bit installation specific number</param>
/// <param name="refPulses">Test duration as a number of reference flow meter pulses</param>
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
/// <param name="filterConstants">0 = No filtering (0..255)</param>
/// <param name="FMFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
/// <param name="regConst">Coefficient used to control the regulation valve (1..100)</param>
/// <param name="sendCommandArgs">Arguments</param>
/// <param name="route">State of valves, 128-bit word</param>
/// <param name="filterConstants">Array with length=8 of filter costants (0..255, 0 = no filtering)</param>
/// <param name="fmFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
/// <param name="regConst">PID coefficient for flow control</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
public void SendCommand(Command cmd, int refFlowMeterNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
public void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
{
if (Program.MainWnd.InvokeRequired)
{
/// When SendCommand(...) called from the worker thread
object[] args = new object[] { cmd, refFlowMeterNr, route, totalRefPulses, massRefPulses,
testMethods, filterConstants, fmFreq, regConst, shortImp, stopDevs };
Program.MainWnd.Invoke((SendCommandDlgt)DoSendCommand, args); /// Component was created in UI thread - use Invoke()
/// From another thread ... use Invoke()
Program.MainWnd.Invoke((SendCommandDlgt)DoSendCommand, new object[] { sendCommandArgs, route, filterConstants, fmFreq, regConst, shortImp });
}
else
{
/// When SendCommand(...) called from the UI thread
DoSendCommand(cmd, refFlowMeterNr, route, totalRefPulses, massRefPulses, testMethods,
filterConstants, fmFreq, regConst, shortImp, stopDevs);
/// Call DoSendCommand() directly
DoSendCommand(sendCommandArgs, route, filterConstants, fmFreq, regConst, shortImp);
}
}
///
delegate void SendCommandDlgt(Command cmd, int refFlowmtrNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
delegate void SendCommandDlgt(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp);
///
private void DoSendCommand(Command cmd, int refFlowMeterNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
private void DoSendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
{
//TBF.UiBridge.Bridge.OnLog(this, string.Format("{0} SendCommand({1}, {2}, {3}, {4}, {5}, {6}, [{7},{8}], {9}, {10}, {11})\r\n",
// DateTime.Now.ToLongTimeString(),
// cmd,
// refFlowMeterNr,
// route.ToString("X"),
// totalRefPulses,
// testMethods,
// filterConstant,
// fmFreq[0],
// fmFreq[1],
// regConst,
// shortImp,
// stopDevs));
#if FUZHOU_300
///
/// The following code deals with the situation that all FM controlled pumps share bit #39.
/// In settings the bits of pumps should be sent as follows: P1=50, P2=51, P3=52, P4=53, P5=54 and P7=55
/// (in FUZHOU_300 the FM pump bit should be set set to value FMIndex+50).
/// (in FUZHOU_300 the FM pump bit should be set to value FMIndex+50).
///
bool bit39 = (route & 0x00FC000000000000) != 0; /// true if any of bits 50 through 55 is set
route = route & 0xFF03FFFFFFFFFFFF;
@@ -381,49 +352,100 @@ namespace TBF.BenchControl.Elde
route = route & (~(((UInt128)1) << 80));
#endif
log.InfoFormat("DoSendCommand(Cmd={0},Ref#={1},Route={2},TotalPls={3},MassPls={4},TM={5},filt={6},FM=[{7}{8}{9}{10}{11}{12}],Reg={13},ShrtImp={14},Stop={15})",
cmd, /// 0
refFlowMeterNr, /// 1
Utils.RouteToStr(route), /// 2
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 3, 4, 5, 6
log.InfoFormat("DoSendCommand(Cmd={0},Ref#={1},Route={2},TotalPls={3},MassPls={4},TM={5},filt={6},FM=[{7}{8}{9}{10}{11}{12}],Reg={13},ShrtImp={14},Stop={15})",
sendCommandArgs.Cmd, /// 0
sendCommandArgs.RefFlowmtrNr, /// 1
Utils.RouteToStr(route), /// 2
sendCommandArgs.TotalRefPulses,
sendCommandArgs.MassRefPulses,
sendCommandArgs.TestMethods,
filterConstants, /// 3, 4, 5, 6
fmFreq[0].ToString(), /// 7
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 8
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 9
(fmFreq.Length > 3) ? ("," + fmFreq[3].ToString()) : "", /// 10
(fmFreq.Length > 4) ? ("," + fmFreq[4].ToString()) : "", /// 11
(fmFreq.Length > 5) ? ("," + fmFreq[5].ToString()) : "", /// 12
regConst, shortImp, stopDevs); /// 13, 14, 15
regConst, /// 13
shortImp, /// 14
sendCommandArgs.StopDevs); /// 15
#if DN100 || MUNICH
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq[0], (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)route,
(uint)sendCommandArgs.TotalRefPulses,
(uint)sendCommandArgs.TestMethods,
Convert.ToSingle(filterConstants[0]),
fmFreq[0],
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#elif BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)route,
(uint)sendCommandArgs.TotalRefPulses,
(uint)sendCommandArgs.TestMethods,
Convert.ToSingle(filterConstants[0]),
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#elif BERLIN || SLM_150 || PETERSBURG_200
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF), (ulong)(route >> 64), pulsesArr, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF),
(ulong)(route >> 64),
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
(uint)sendCommandArgs.TestMethods,
Convert.ToSingle(filterConstants[0]),
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#elif GENESIS || DEWA_300
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF), (ulong)(route >> 64), pulsesArr, (uint)testMethods,
filterConstants, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF),
(ulong)(route >> 64),
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
(uint)sendCommandArgs.TestMethods,
filterConstants,
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#elif JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, pulsesArr, (uint)testMethods,
filterConstants, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)route,
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
(uint)sendCommandArgs.TestMethods,
filterConstants,
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#else /// if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL || MALTA_WSD25 || SLM_50 || SLM_END || WARSAW_END || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || BADGER_STREDNA_TRAT || PUCHONG_200
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, pulsesArr, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)route,
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
(uint)sendCommandArgs.TestMethods,
Convert.ToSingle(filterConstants[0]),
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#endif
log.DebugFormat("DoSendCommand() Route = {0}", Utils.RouteToStr(route));
if (lastRoute != route) /// This is to update the MainWnd status bar on changes only
if (lastRoute != route) /// This is to update the MainWnd status bar on changes only
{
UInt128 rRoute = RRoute;
Program.MainWnd.UpdateRoute(string.Format("{0} ({1})", Utils.RouteToStr(route), Utils.RouteToStr(rRoute)));
lastRoute = route;
lastRoute = route;
}
}
+2 -2
View File
@@ -56,7 +56,7 @@ namespace TBF.BenchControl.Elde
public void Start()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(commandOnStartOp, 0, controlBoard.Route, 0, 0, testMethod, StopDevs.None);
controlBoard.SendCommand(commandOnStartOp, 0, 0, 0, testMethod, StopDevs.None);
opState = OpState.StartingCommand;
}
@@ -99,7 +99,7 @@ namespace TBF.BenchControl.Elde
if (commandOnStopOp != Command.None)
{
controlBoard.SyncRoute();
controlBoard.SendCommand(commandOnStopOp, 0, controlBoard.Route, 0, 0, testMethod, StopDevs.None);
controlBoard.SendCommand(commandOnStopOp, 0, 0, 0, testMethod, StopDevs.None);
}
}
}
@@ -52,8 +52,9 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
double flow1, flow2, flow3;
double contribution1, contribution2, contribution3;
if (refFreq[0] != 0)
if (refPulses[0] != 0)
{
/// Division by zero prevented inside this 'if'
double ltrPerPulseCorrected = 0;
if (flowMeter1 != null)
{
+7 -13
View File
@@ -61,19 +61,13 @@ namespace TBF.BenchControl.Elde
/// <summary>
/// Updates a command that is regularly sent to the control board by SendCommand.
/// </summary>
/// <param name="cmd">See ControlBoard.Command enum</param>
/// <param name="refNr">Number of the etalon/reference (1..5)</param>
/// <param name="route">Route: 64-bit installation specific number</param>
/// <param name="totalRefPulses">Kolko impulzov ma trvat skuska</param>
/// <param name="massRefPulses">Pri 'MassAndContinue' metode kolko impulzov ma trvat mass measurement</param>
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
/// <param name="filterConstant">0 = No filtering (0..255)</param>
/// <param name="FMFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
void SendCommand(Command cmd, int refNr, UInt128 route, int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
/// <param name="sendCommandArgs">Arguments, see SendCommandArgs class</param>
/// <param name="route">State of valves, 128-bit word</param>
/// <param name="filterConstants">Array with length=8 of filter costants (0..255, 0 = no filtering)</param>
/// <param name="fmFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
/// <param name="regConst">PID coefficient for flow control</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp);
/// <summary>
/// Control of regulating valves.
@@ -132,7 +132,7 @@ namespace TBF.BenchControl.Elde
void SendCommand()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(Command.ReadDivTransition, 0, controlBoard.Route, 0, 0, 0, StopDevs.None);
controlBoard.SendCommand(Command.ReadDivTransition, 0, 0, 0, 0, StopDevs.None);
cmdSent = true;
}
+31 -34
View File
@@ -198,16 +198,17 @@ namespace TBF.BenchControl.Elde.RegulValve
opState = OpState.ValveMoveToFlow1;
}
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
/// Start flow measurement
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, int.MaxValue, int.MaxValue, 0, 0); /// TestMethods=0, StopDevs=0
}
/// <summary>Run this operation</summary>
/// <returns>
/// Event.None, Event.FlowReached, Event.RegulValveTimeOut, Event.OpArgumentError
/// Event.OpArgumentError
/// Event.Starting
/// Event.Busy
/// Event.FlowReached
/// Event.RegulValveTimeOut
/// </returns>
public Event Run()
{
@@ -246,17 +247,14 @@ namespace TBF.BenchControl.Elde.RegulValve
opState = OpState.ValveMoveToFlow1;
}
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
return Event.None;
/// Start flow measurement
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, int.MaxValue, int.MaxValue, 0, 0); /// TestMethods=0, StopDevs=0
return Event.Starting;
}
else if (opState == OpState.ValveMoveToPosition1)
{
opState = OpState.ValveMoveToPosition2;
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToPosition2) /// Move to position
{
@@ -266,7 +264,7 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValve.StableTime);
opState = OpState.SettingPosition;
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToPosition3)
{
@@ -278,14 +276,14 @@ namespace TBF.BenchControl.Elde.RegulValve
{
opState = OpState.SettingPosition;
}
return Event.None;
return Event.Starting;
}
else if (opState == OpState.CheckStatePosition) /// Verify
{
if (((ulong)controlBoard.StatusP & (ulong)StatusP.RefPulsesMsrmnt) == 0)
{
opState = OpState.SendCommandAgain;
return Event.None;
return Event.Starting;
}
else if (controlBoard.RegulValveState(regulValveNr) != RegulValveState.DacValueRegul)
{
@@ -298,12 +296,12 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValveNr, targetPositionLo, targetPositionHi, regulValve.StableTime);
opState = OpState.ValveMoveToPosition3;
return Event.None;
return Event.Starting;
}
else
{
opState = OpState.SettingPosition;
return Event.None;
return Event.Starting;
}
}
else if (opState == OpState.SettingPosition)
@@ -313,12 +311,12 @@ namespace TBF.BenchControl.Elde.RegulValve
{
opState = OpState.ValveMoveToFlow1;
}
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToFlow1)
{
opState = OpState.ValveMoveToFlow2;
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToFlow2) /// Move to flow
{
@@ -340,7 +338,7 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValve.StableTime);
opState = OpState.ValveMoveToFlow3;
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToFlow3)
{
@@ -352,7 +350,7 @@ namespace TBF.BenchControl.Elde.RegulValve
{
opState = OpState.SettingFlow;
}
return Event.None;
return Event.Starting;
}
else if (opState == OpState.CheckStateFlow) /// Verify the flow setting
{
@@ -360,7 +358,7 @@ namespace TBF.BenchControl.Elde.RegulValve
(controlBoard.RegulValveState(regulValveNr) & RegulValveState.PwOrFreqRegul) != RegulValveState.PwOrFreqRegul)
{
opState = OpState.SendCommandAgain;
return Event.None;
return Event.Starting;
}
else if (controlBoard.RegulValveState(regulValveNr) != RegulValveState.PwOrFreqRegul)
{
@@ -375,12 +373,12 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValveNr, freqLo, freqHi, regulValve.StableTime);
opState = OpState.ValveMoveToFlow3;
return Event.None;
return Event.Starting;
}
else
{
opState = OpState.SettingFlow;
return Event.None;
return Event.Busy;
}
}
else if (opState == OpState.SettingFlow)
@@ -423,7 +421,7 @@ namespace TBF.BenchControl.Elde.RegulValve
else
{
log.InfoFormat("flow = {0} m3/h (lo={1}, hi={2}, FLOW_OK_TIMER={3}s)", flow, currentReqFlowLo, currentReqFlowHi, flowWithinBoundsTime);
return Event.None;
return Event.Busy;
}
}
else if (StateMachine.Time > expireTime)
@@ -434,7 +432,7 @@ namespace TBF.BenchControl.Elde.RegulValve
{
log.InfoFormat("flow = {0} m3/h (lo={1}, hi={2})", flow, currentReqFlowLo, currentReqFlowHi);
flowWithinBoundsTime = 0;
return Event.None;
return Event.Busy;
}
}
else /// opState == OpState.FlowReached
@@ -447,14 +445,13 @@ namespace TBF.BenchControl.Elde.RegulValve
/// <summary>Start this operation</summary>
public void Stop()
{
opState = OpState.Idle;
if (!leaveMeasurementRunning)
{
/// Stop measurement
controlBoard.SendCommand(Command.Stop, flowMeter.Idx1, 50000, 50000, 0, StopDevs.RegValveRegulation); /// TestMethods=0
}
if (leaveMeasurementRunning) return;
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeter.Idx1, controlBoard.Route, 50000, 50000, tm, sd);
opState = OpState.Idle;
}
}
}
@@ -212,8 +212,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
}
/// <summary>Run this operation</summary>
@@ -262,8 +261,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
log.DebugFormat(" return Event.None");
return Event.None;
}
@@ -479,7 +477,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route, 50000, 50000, tm, sd);
controlBoard.SendCommand(Command.Stop, flowMeterNr, 50000, 50000, tm, sd);
log.WarnFormat("Stop() SendCommand(Stop, {0}, ...)", flowMeterNr);
}
@@ -217,8 +217,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveTandemCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
}
/// <summary>Run this operation</summary>
@@ -371,7 +370,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route, 50000, 50000, tm, sd);
controlBoard.SendCommand(Command.Stop, flowMeterNr, 50000, 50000, tm, sd);
}
}
}
+33
View File
@@ -0,0 +1,33 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using Dirichlet.Numerics;
namespace TBF.BenchControl.Elde
{
public class SendCommandArgs
{
public Command Cmd;
public int RefFlowmtrNr;
public int TotalRefPulses;
public int MassRefPulses;
public TestMethods TestMethods;
public StopDevs StopDevs;
public SendCommandArgs()
{
}
public SendCommandArgs(Command cmd, int refFlowmtrNr, int totalRefPulses, int massRefPulses,
TestMethods testMethods, StopDevs stopDevs)
{
Cmd = cmd;
RefFlowmtrNr = refFlowmtrNr;
TotalRefPulses = totalRefPulses;
MassRefPulses = massRefPulses;
TestMethods = testMethods;
StopDevs = stopDevs;
}
}
}
+1 -2
View File
@@ -125,8 +125,7 @@ namespace TBF.BenchControl.Elde
log.InfoFormat("Start() : SendCommand(Cmd.Start, {0}, route, {1}, {1}, {2}, Stop.None)",
flowMeterIdxAndDiv, totalRefPulses, testMethod);
controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, controlBoard.Route,
totalRefPulses, massRefPulses, testMethod, StopDevs.None);
controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, totalRefPulses, massRefPulses, testMethod, StopDevs.None);
}
/// <summary>Start this operation</summary>
@@ -35,12 +35,7 @@ namespace TBF.BenchControl.Elde
void SendStopFlowRegulationCommand()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(Command.Stop,
flowMeterNr, /// ref. flowmeter number
controlBoard.Route, /// route
0, 0, /// ref. pulses
0,
StopDevs.RegValveRegulation);
controlBoard.SendCommand(Command.Stop, flowMeterNr, 0, 0, 0, StopDevs.RegValveRegulation);
}
+1 -5
View File
@@ -43,11 +43,7 @@ namespace TBF.BenchControl.Elde
void SendStopCommand()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(Command.Stop,
0, /// ref. flowmeter number
controlBoard.Route, /// route
0, 0, /// ref. pulses
TestMethods.Diverter,
controlBoard.SendCommand(Command.Stop, 0, 0, 0, TestMethods.Diverter,
StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation);
}
+1
View File
@@ -73,6 +73,7 @@ namespace TBF.BenchControl
public enum Event
{
None = 0,
Starting, /// During initial phase of some process, sending a command to a device, etc.
Busy, /// Useful when waiting in state until at least one is busy (all are done)
Done, /// Useful when waiting in state until the first is done, the rest miht still be busy
MakeSecondPass, /// Test completed OK but 2nd pass (evaluation) is required
@@ -17,7 +17,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public IComponentCfgCtrl GetControl() { return new TracingCfgCtrl(); }
public string Workplace;
public string ConnStr;
public string NetAdapter;
public bool CheckPreviousRecords;
@@ -28,7 +27,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
MonitoringCfg()
{
ParentName = string.Empty;
Workplace = "WR10";
NetAdapter = string.Empty;
ConnStr = "SERVER=10.42.128.16; DATABASE=sledovanie2019; UID=vyroba2019; PASSWORD=qwerty; CHARSET=utf8;";
CheckPreviousRecords = true;
@@ -44,9 +42,8 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public string ToString(int i)
{
return string.Format("Name={0}, Workplace={1}, CheckPreviousRecords={2}, SaveTracingRecords={3}, ConnStr={4}",
return string.Format("Name={0}, CheckPreviousRecords={1}, SaveTracingRecords={2}, ConnStr={3}",
Name,
Workplace,
CheckPreviousRecords,
SaveTracingRecords,
ConnStr);
@@ -35,7 +35,14 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public const string WorkstepName = "Test_bench";
MonitoringCfg tracingCfg;
string workplace { get { return tracingCfg.Workplace; } }
string workplace
{
get
{
TBF.BenchControl.GenericDevices.IBenchInfo benchInfo = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
return (benchInfo != null) ? benchInfo.TestBenchName : "TestBench";
}
}
readonly IPAddress ipAddress;
readonly IPAddress netMask;
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
/// Copyright (c) 2018-2019 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
@@ -46,7 +46,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
workplaceTextBox.Text = config.Workplace;
connStrTextBox.Text = config.ConnStr;
checkPreviousRecordsCheckBox.Checked = config.CheckPreviousRecords;
saveTracingRecordsCheckBox.Checked = config.SaveTracingRecords;
@@ -102,7 +101,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public void Unlock()
{
nameTextBox.Enabled = true;
workplaceTextBox.Enabled = true;
connStrTextBox.Enabled = true;
netAdapterComboBox.Enabled = true;
checkPreviousRecordsCheckBox.Enabled = true;
@@ -126,7 +124,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
}
flags |= UpdateDifferent(ref config.Workplace, workplaceTextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
flags |= UpdateDifferent(ref config.ConnStr, connStrTextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
flags |= UpdateDifferent(ref config.CheckPreviousRecords, checkPreviousRecordsCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
flags |= UpdateDifferent(ref config.SaveTracingRecords, saveTracingRecordsCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
@@ -34,8 +34,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.workplaceTextBox = new System.Windows.Forms.TextBox();
this.workplaceLabel = new System.Windows.Forms.Label();
this.connStrTextBox = new System.Windows.Forms.TextBox();
this.connStrLabel = new System.Windows.Forms.Label();
this.saveTracingRecordsCheckBox = new System.Windows.Forms.CheckBox();
@@ -47,7 +45,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(110, 41);
this.nameTextBox.Location = new System.Drawing.Point(110, 51);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
this.nameTextBox.TabIndex = 2;
@@ -55,7 +53,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(15, 44);
this.nameLabel.Location = new System.Drawing.Point(15, 54);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
@@ -64,33 +62,16 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(107, 19);
this.classNameLabel.Location = new System.Drawing.Point(107, 26);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// workplaceTextBox
//
this.workplaceTextBox.Enabled = false;
this.workplaceTextBox.Location = new System.Drawing.Point(110, 67);
this.workplaceTextBox.Name = "workplaceTextBox";
this.workplaceTextBox.Size = new System.Drawing.Size(146, 20);
this.workplaceTextBox.TabIndex = 4;
//
// workplaceLabel
//
this.workplaceLabel.AutoSize = true;
this.workplaceLabel.Location = new System.Drawing.Point(15, 70);
this.workplaceLabel.Name = "workplaceLabel";
this.workplaceLabel.Size = new System.Drawing.Size(59, 13);
this.workplaceLabel.TabIndex = 3;
this.workplaceLabel.Text = "Workplace";
//
// connStrTextBox
//
this.connStrTextBox.Enabled = false;
this.connStrTextBox.Location = new System.Drawing.Point(110, 93);
this.connStrTextBox.Location = new System.Drawing.Point(110, 76);
this.connStrTextBox.Name = "connStrTextBox";
this.connStrTextBox.Size = new System.Drawing.Size(327, 20);
this.connStrTextBox.TabIndex = 6;
@@ -98,7 +79,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// connStrLabel
//
this.connStrLabel.AutoSize = true;
this.connStrLabel.Location = new System.Drawing.Point(15, 96);
this.connStrLabel.Location = new System.Drawing.Point(15, 79);
this.connStrLabel.Name = "connStrLabel";
this.connStrLabel.Size = new System.Drawing.Size(89, 13);
this.connStrLabel.TabIndex = 5;
@@ -108,7 +89,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
//
this.saveTracingRecordsCheckBox.AutoSize = true;
this.saveTracingRecordsCheckBox.Enabled = false;
this.saveTracingRecordsCheckBox.Location = new System.Drawing.Point(110, 177);
this.saveTracingRecordsCheckBox.Location = new System.Drawing.Point(110, 159);
this.saveTracingRecordsCheckBox.Name = "saveTracingRecordsCheckBox";
this.saveTracingRecordsCheckBox.Size = new System.Drawing.Size(177, 17);
this.saveTracingRecordsCheckBox.TabIndex = 10;
@@ -119,7 +100,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
//
this.checkPreviousRecordsCheckBox.AutoSize = true;
this.checkPreviousRecordsCheckBox.Enabled = false;
this.checkPreviousRecordsCheckBox.Location = new System.Drawing.Point(110, 154);
this.checkPreviousRecordsCheckBox.Location = new System.Drawing.Point(110, 136);
this.checkPreviousRecordsCheckBox.Name = "checkPreviousRecordsCheckBox";
this.checkPreviousRecordsCheckBox.Size = new System.Drawing.Size(138, 17);
this.checkPreviousRecordsCheckBox.TabIndex = 9;
@@ -129,7 +110,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// netAdapterLabel
//
this.netAdapterLabel.AutoSize = true;
this.netAdapterLabel.Location = new System.Drawing.Point(15, 122);
this.netAdapterLabel.Location = new System.Drawing.Point(15, 104);
this.netAdapterLabel.Name = "netAdapterLabel";
this.netAdapterLabel.Size = new System.Drawing.Size(86, 13);
this.netAdapterLabel.TabIndex = 7;
@@ -138,7 +119,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// netAdapterComboBox
//
this.netAdapterComboBox.FormattingEnabled = true;
this.netAdapterComboBox.Location = new System.Drawing.Point(110, 119);
this.netAdapterComboBox.Location = new System.Drawing.Point(110, 101);
this.netAdapterComboBox.Name = "netAdapterComboBox";
this.netAdapterComboBox.Size = new System.Drawing.Size(327, 21);
this.netAdapterComboBox.TabIndex = 11;
@@ -153,8 +134,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
this.Controls.Add(this.checkPreviousRecordsCheckBox);
this.Controls.Add(this.connStrTextBox);
this.Controls.Add(this.connStrLabel);
this.Controls.Add(this.workplaceTextBox);
this.Controls.Add(this.workplaceLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
@@ -171,8 +150,6 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.TextBox workplaceTextBox;
private System.Windows.Forms.Label workplaceLabel;
private System.Windows.Forms.TextBox connStrTextBox;
private System.Windows.Forms.Label connStrLabel;
private System.Windows.Forms.CheckBox saveTracingRecordsCheckBox;
@@ -661,8 +661,9 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
int maxpruefindexLowPart = ReadMaxPruefindex(conn, wm);
int MAX_Pruefindex = 100 * dbCfg.TestBenchId + maxpruefindexLowPart + 1;
TBF.BenchControl.GenericDevices.IBenchInfo benchInfo = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
int testBenchID = (benchInfo != null) ? benchInfo.TestBenchId : 1;
int MAX_Pruefindex = 100 * testBenchID + maxpruefindexLowPart + 1;
int Hydr_Pruefung;
if (wm.Passed)
@@ -34,7 +34,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public IComponentCfgCtrl GetControl() { return new DatabaseCfgCtrl(); }
public int TestBenchId;
public DBUsed DBUsed;
public int Baujahr; /// Written to the database
public bool ReadStartInfo;
@@ -48,7 +47,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
{
Name = "Sensus-Oracle-DB";
ParentName = string.Empty;
TestBenchId = 1;
DBUsed = DBUsed.Test;
Baujahr = 2015;
ReadStartInfo = true;
@@ -65,9 +63,8 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public string ToString(int i)
{
return string.Format("Name={0}, BenchId={1}, DB={2}, Bjahr={3}, RdStartInfo={4}, SaveRslts={5}, StartInfoRqrd={6}, TestMode={7}",
return string.Format("Name={0}, DB={1}, Bjahr={2}, RdStartInfo={3}, SaveRslts={4}, StartInfoRqrd={5}, TestMode={6}",
Name,
TestBenchId,
DBUsed,
Baujahr,
ReadStartInfo,
@@ -47,7 +47,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
benchIdTextBox.Text = config.TestBenchId.ToString();
dbUsedComboBox.Text = config.DBUsed.ToString();
baujahrTextBox.Text = config.Baujahr.ToString();
readStartInfoCheckBox.Checked = config.ReadStartInfo;
@@ -59,7 +58,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public void Unlock()
{
nameTextBox.Enabled = true;
benchIdTextBox.Enabled = true;
dbUsedComboBox.Enabled = true;
baujahrTextBox.Enabled = true;
readStartInfoCheckBox.Enabled = true;
@@ -72,13 +70,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
int tmp;
if (!int.TryParse(benchIdTextBox.Text, out tmp) || tmp <= 0)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Test bench ID'";
}
int tmp;
if (!int.TryParse(baujahrTextBox.Text, out tmp) || tmp < 2015 || tmp > 2099)
{
flags |= CfgUpdateFlags.Error;
@@ -105,13 +97,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
flags |= CfgUpdateFlags.RestartRqrd;
}
int benchId = int.Parse(benchIdTextBox.Text);
if (config.TestBenchId != benchId)
{
config.TestBenchId = benchId;
flags |= CfgUpdateFlags.RestartRqrd;
}
int baujahr = int.Parse(baujahrTextBox.Text);
if (config.Baujahr != baujahr)
{
@@ -36,8 +36,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
this.classNameLabel = new System.Windows.Forms.Label();
this.readStartInfoCheckBox = new System.Windows.Forms.CheckBox();
this.saveResultsCheckBox = new System.Windows.Forms.CheckBox();
this.benchIdTextBox = new System.Windows.Forms.TextBox();
this.benchIdLabel = new System.Windows.Forms.Label();
this.dbUsedComboBox = new System.Windows.Forms.ComboBox();
this.dbUsedLabel = new System.Windows.Forms.Label();
this.baujahrTextBox = new System.Windows.Forms.TextBox();
@@ -49,7 +47,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(110, 30);
this.nameTextBox.Location = new System.Drawing.Point(110, 55);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
this.nameTextBox.TabIndex = 2;
@@ -57,7 +55,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(19, 33);
this.nameLabel.Location = new System.Drawing.Point(19, 58);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
@@ -66,7 +64,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(107, 8);
this.classNameLabel.Location = new System.Drawing.Point(107, 27);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
@@ -94,28 +92,11 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
this.saveResultsCheckBox.Text = "Save results";
this.saveResultsCheckBox.UseVisualStyleBackColor = true;
//
// benchIdTextBox
//
this.benchIdTextBox.Enabled = false;
this.benchIdTextBox.Location = new System.Drawing.Point(110, 53);
this.benchIdTextBox.Name = "benchIdTextBox";
this.benchIdTextBox.Size = new System.Drawing.Size(57, 20);
this.benchIdTextBox.TabIndex = 4;
//
// benchIdLabel
//
this.benchIdLabel.AutoSize = true;
this.benchIdLabel.Location = new System.Drawing.Point(19, 56);
this.benchIdLabel.Name = "benchIdLabel";
this.benchIdLabel.Size = new System.Drawing.Size(76, 13);
this.benchIdLabel.TabIndex = 3;
this.benchIdLabel.Text = "Test Bench ID";
//
// dbUsedComboBox
//
this.dbUsedComboBox.Enabled = false;
this.dbUsedComboBox.FormattingEnabled = true;
this.dbUsedComboBox.Location = new System.Drawing.Point(110, 76);
this.dbUsedComboBox.Location = new System.Drawing.Point(110, 79);
this.dbUsedComboBox.Name = "dbUsedComboBox";
this.dbUsedComboBox.Size = new System.Drawing.Size(145, 21);
this.dbUsedComboBox.TabIndex = 6;
@@ -123,7 +104,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// dbUsedLabel
//
this.dbUsedLabel.AutoSize = true;
this.dbUsedLabel.Location = new System.Drawing.Point(19, 78);
this.dbUsedLabel.Location = new System.Drawing.Point(19, 81);
this.dbUsedLabel.Name = "dbUsedLabel";
this.dbUsedLabel.Size = new System.Drawing.Size(79, 13);
this.dbUsedLabel.TabIndex = 5;
@@ -132,7 +113,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// baujahrTextBox
//
this.baujahrTextBox.Enabled = false;
this.baujahrTextBox.Location = new System.Drawing.Point(110, 100);
this.baujahrTextBox.Location = new System.Drawing.Point(110, 104);
this.baujahrTextBox.Name = "baujahrTextBox";
this.baujahrTextBox.Size = new System.Drawing.Size(57, 20);
this.baujahrTextBox.TabIndex = 8;
@@ -140,7 +121,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// baujahrLabel
//
this.baujahrLabel.AutoSize = true;
this.baujahrLabel.Location = new System.Drawing.Point(19, 103);
this.baujahrLabel.Location = new System.Drawing.Point(19, 107);
this.baujahrLabel.Name = "baujahrLabel";
this.baujahrLabel.Size = new System.Drawing.Size(43, 13);
this.baujahrLabel.TabIndex = 7;
@@ -178,8 +159,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
this.Controls.Add(this.baujahrLabel);
this.Controls.Add(this.dbUsedComboBox);
this.Controls.Add(this.dbUsedLabel);
this.Controls.Add(this.benchIdTextBox);
this.Controls.Add(this.benchIdLabel);
this.Controls.Add(this.saveResultsCheckBox);
this.Controls.Add(this.readStartInfoCheckBox);
this.Controls.Add(this.nameTextBox);
@@ -200,8 +179,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.CheckBox readStartInfoCheckBox;
private System.Windows.Forms.CheckBox saveResultsCheckBox;
private System.Windows.Forms.TextBox benchIdTextBox;
private System.Windows.Forms.Label benchIdLabel;
private System.Windows.Forms.ComboBox dbUsedComboBox;
private System.Windows.Forms.Label dbUsedLabel;
private System.Windows.Forms.TextBox baujahrTextBox;
@@ -177,11 +177,12 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
/// Obtain one representative water meter data
Results.Entities.WaterMeter wm0 = null;
foreach (var m in batch.WaterMeters)
foreach (var wm in batch.WaterMeters)
{
if (m != null)
if ((wm != null) && (wm.CompleteTestInfos != null) && (wm.WaterMeterData != null))
//if ((wm != null) && wm.PassedFromTests())
{
wm0 = m;
wm0 = wm;
break;
}
}
+76 -28
View File
@@ -819,9 +819,9 @@ namespace TBF.BenchControl.Sequences
{
//--------------------------------
State.Create("MainSeq : Continue in the cycle?")
.AddOperation(new Operations.AskYesNoOp(Strings.Continue_in_the_cycle))
.AddOperation(checkUiOp)
.EnterState();
.AddOperation(new Operations.AskYesNoOp(Strings.Continue_in_the_cycle))
.AddOperation(checkUiOp)
.EnterState();
while (true)
{
e = StateMachine.WaitRunDevsRunOps();
@@ -848,23 +848,14 @@ namespace TBF.BenchControl.Sequences
///
if (selection == Selection.RestOfCycle) /// ... otherwise
{
Test slctdTest = TBF.BenchControl.StateMachine.GetTest(selectedTestName, out repetNr);
if (slctdTest == null)
Test slctdTest = TBF.BenchControl.StateMachine.Procedure.GetTest(selectedTestName, out selsctedTestIx, out repetNr);
if (slctdTest == null || (selsctedTestIx < simultWithPurgingCount)
|| (selsctedTestIx >= StateMachine.Tests.Count - simultWithEvacuationCount))
{
/// Invalid test selection
UiBridge.Bridge.OnError(this, string.Format("No test specified"));
goto select_cycle_or_test;
}
selsctedTestIx = -1;
for (int i = simultWithPurgingCount; i < StateMachine.Tests.Count - simultWithEvacuationCount; i++)
{
if (slctdTest == StateMachine.Tests[i])
{
selsctedTestIx = i;
break;
}
}
if (selsctedTestIx == -1) goto select_cycle_or_test; /// goto ... when selection is not valid
}
@@ -878,8 +869,8 @@ namespace TBF.BenchControl.Sequences
/// Try to fetch all test paths and transitions
/// to detect configuration errors as early as possible.
string errorMsg;
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
string errorMsg;
if (!(testMethodComp is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) &&
!(testMethodComp is TBF.BenchControl.TestMethods.OuterLoop.End.Component) &&
!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
@@ -899,15 +890,65 @@ namespace TBF.BenchControl.Sequences
int outerLoopRepeats = 0;
while (currentTestIx < StateMachine.Tests.Count - simultWithEvacuationCount)
{
Test test = StateMachine.Tests[currentTestIx];
Test nextTest = (currentTestIx + 1 < StateMachine.Tests.Count - simultWithEvacuationCount)
? StateMachine.Tests[currentTestIx + 1]
: null;
/// Fetch the test paths and transitions
string errorMsg;
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
if (!(testMethodComp is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) &&
Test nextHydroTest = null;
for (int i = currentTestIx + 1; i < StateMachine.Tests.Count - simultWithEvacuationCount; i++)
{
Test tst = StateMachine.Tests[i];
if (tst != null)
{
ITestMethod tm = TbfComponents.FindComponent(tst.Method) as ITestMethod;
if (tm != null && tm.DoTransitions())
{
nextHydroTest = tst;
break;
}
}
}
if (nextHydroTest != null)
{
/// Fetch paths and 'transition before' of the next test
TBF.BenchControl.Generic.IComponent nextTestMethodComp = TbfComponents.FindComponent(nextHydroTest.Method);
TransitionSequence dummy2, dummy3;
string errorMsg2;
if (!(nextTestMethodComp is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) &&
!(nextTestMethodComp is TBF.BenchControl.TestMethods.OuterLoop.End.Component) &&
!StateMachine.GetPaths(nextHydroTest, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
out nextInPath, out nextBenchPath, out nextOutPath, out nextSensPath,
out nextHeatMetersPath,
out nextTransitionBefore, out dummy2, out dummy3,
out errorMsg2))
{
UiBridge.Bridge.OnError(this, errorMsg2);
goto select_cycle_or_test;
}
nextQfrom = nextHydroTest.Qfrom;
nextQto = nextHydroTest.Qto;
nextPumpPower = nextHydroTest.PumpPower;
nextTolerRed = nextHydroTest.TolerRed;
nextPidCoef = (nextOutPath != null) ? nextOutPath.PidCoef : 1.0F;
}
else
{
/// Clear paths and 'transition before' of the next test it does not exist
nextInPath = null;
nextBenchPath = null;
nextOutPath = null;
nextSensPath = null;
nextHeatMetersPath = null;
nextTransitionBefore = null;
}
/// Fetch paths and transitions of this test
Test test = StateMachine.Tests[currentTestIx];
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
string errorMsg;
if (!(testMethodComp is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) &&
!(testMethodComp is TBF.BenchControl.TestMethods.OuterLoop.End.Component) &&
!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
out inPath, out benchPath, out outPath, out sensPath,
@@ -920,9 +961,12 @@ namespace TBF.BenchControl.Sequences
}
/// Update format for the water mass
Mass.Format = outPath.Scale.Format;
StartMass.Format = outPath.Scale.Format;
EndMass.Format = outPath.Scale.Format;
if (outPath != null && outPath.Scale != null && !string.IsNullOrEmpty(outPath.Scale.Format))
{
Mass.Format = outPath.Scale.Format;
StartMass.Format = outPath.Scale.Format;
EndMass.Format = outPath.Scale.Format;
}
ITestMethod testMethod = testMethodComp as ITestMethod;
@@ -1008,7 +1052,10 @@ namespace TBF.BenchControl.Sequences
if (testMethod.DoTransitions() && !e.Contains(Event.RecoverableError))
{
/// Make a transition after the last test repetition
TransitionContext endContext = currentTestFinished ? TransitionContext.AfterTest : TransitionContext.Stop;
TransitionContext endContext =
!currentTestFinished ? TransitionContext.Stop
: ((nextTransitionBefore != null) && (nextTransitionBefore.Name.ToLower().Contains("fastflow"))) ? TransitionContext.AfterTestWithOverlap
: TransitionContext.AfterTest;
rsltTransAfter = Transition(transitionAfter, endContext); /// Transition or SetRoute - end of test
log.InfoFormat("Test {0}: Transition({1}, {2}) returned {3}", test.Name, (transitionAfter == null ? "null" : transitionAfter.Name), endContext, rsltTransAfter);
}
@@ -1116,7 +1163,8 @@ namespace TBF.BenchControl.Sequences
/// Single test will be executed
int repetNr;
Test test = TBF.BenchControl.StateMachine.GetTest(selectedTestName, out repetNr);
int testIx;
Test test = TBF.BenchControl.StateMachine.Procedure.GetTest(selectedTestName, out testIx, out repetNr);
if (test == null)
{
UiBridge.Bridge.OnError(this, string.Format("No test specified"));
+195 -18
View File
@@ -68,6 +68,21 @@ namespace TBF.BenchControl.Sequences
protected static TransitionSequence transitionBetween;
protected static TransitionSequence transitionAfter;
/// <summary>
/// Advanced information about the next test
/// </summary>
protected static BenchControl.FeedingPath nextInPath;
protected static BenchControl.BenchPath nextBenchPath;
protected static BenchControl.OutputPath nextOutPath;
protected static BenchControl.MetersPath nextSensPath;
protected static BenchControl.HeatMetersPath nextHeatMetersPath;
protected static TransitionSequence nextTransitionBefore;
protected static float nextQfrom;
protected static float nextQto;
protected static float nextPumpPower;
protected static float nextPidCoef;
protected static double nextTolerRed;
protected IOperation readRegistersOp;
protected IOperation queryEnd1;
@@ -439,10 +454,11 @@ namespace TBF.BenchControl.Sequences
public enum TransitionContext
{
PurgeBegin,
BeforeTest,
BetweenTests,
AfterTest,
PurgeEnd,
BeforeTest, /// Before starting a test, paths are always applied aftr this sequence
BetweenTests, /// Between two repetitions of the same test
AfterTest, /// After completing a test
AfterTestWithOverlap, /// After completing transition sequence paths of the next test are selected and flow setting starts
PurgeEnd,
Stop,
}
@@ -482,7 +498,12 @@ namespace TBF.BenchControl.Sequences
case TransitionContext.PurgeBegin: message = Strings.Purging_i_n; break;
case TransitionContext.BeforeTest: message = Strings.Test_start_sequence_i_n; break;
case TransitionContext.BetweenTests: message = Strings.Between_tests_sequence_i_n; break;
case TransitionContext.AfterTest: message = Strings.Test_stop_sequence_i_n; break;
case TransitionContext.AfterTestWithOverlap:
case TransitionContext.AfterTest:
message = Strings.Test_stop_sequence_i_n;
break;
case TransitionContext.PurgeEnd: message = Strings.Emptying_i_n; break;
case TransitionContext.Stop: message = Strings.Test_stop_sequence_i_n; break;
default: message = "Transition"; break;
@@ -495,7 +516,7 @@ namespace TBF.BenchControl.Sequences
///
/// No transition sequence defined --> Default action
///
if (context == TransitionContext.AfterTest)
if ((context == TransitionContext.AfterTest) || (context == TransitionContext.AfterTestWithOverlap))
{
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOff();
@@ -680,7 +701,8 @@ namespace TBF.BenchControl.Sequences
for (int first = 1; first <= lastStartedRV; first++)
{
log.DebugFormat("SequenceBase.Transition() : Step {0} stop, opening={1}, closing={2}", step.ItemNr + 1, step.ValvesOpen, step.ValvesClose);
State stepStop = State.Create(string.Format("SequenceBase.Transition() : Step {0} stop, opening={1}, closing={2}", step.ItemNr + 1, step.ValvesOpen, step.ValvesClose))
State stepStop = State
.Create(string.Format("SequenceBase.Transition() : Step {0} stop, opening={1}, closing={2}", step.ItemNr + 1, step.ValvesOpen, step.ValvesClose))
.AddOperation(checkUiOp)
.AddOperation(conditionOperation)
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
@@ -717,11 +739,10 @@ namespace TBF.BenchControl.Sequences
/// Stop the pump
///
State.Create("SequenceBase.Transition() : Test stopped -> Stopping the pump")
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, inPath.Pump))
.EnterState();
do
{
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, inPath.Pump))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) return Event.Error;
}
@@ -730,17 +751,19 @@ namespace TBF.BenchControl.Sequences
}
else if (context == TransitionContext.BeforeTest)
{
if (inPath != null && benchPath != null && outPath != null)
///
/// Always set route at the beginning of this test
///
if (inPath != null && benchPath != null && outPath != null)
{
State.Create("SequenceBase : Transition : TestStart - Default action")
.AddOperation(checkUiOp)
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
.AddOperation(StateMachine.ControlBoard
.SetValvesOp(GenericDevices.ValveBase.Merge(inPath.ValvesOpen, benchPath.ValvesOpen, outPath.ValvesOpen),
GenericDevices.ValveBase.Merge(inPath.ValvesClose, benchPath.ValvesClose, outPath.ValvesClose)))
.SetValvesOp(GenericDevices.ValveBase.Merge(inPath.ValvesOpen, benchPath.ValvesOpen, outPath.ValvesOpen),
GenericDevices.ValveBase.Merge(inPath.ValvesClose, benchPath.ValvesClose, outPath.ValvesClose)))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) return Event.Error;
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
@@ -748,8 +771,54 @@ namespace TBF.BenchControl.Sequences
while (e.Contains(Event.ValvesBusy));
}
}
else if ((context == TransitionContext.AfterTestWithOverlap) && (nextInPath != null) && (nextBenchPath != null) && (nextOutPath != null))
{
/// Set route for the next test
State.Create("SequenceBase : AfterTestWithOverlap : Default action")
.AddOperation(checkUiOp)
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
.AddOperation(StateMachine.ControlBoard
.SetValvesOp(GenericDevices.ValveBase.Merge(nextInPath.ValvesOpen, nextBenchPath.ValvesOpen, nextOutPath.ValvesOpen),
GenericDevices.ValveBase.Merge(nextInPath.ValvesClose, nextBenchPath.ValvesClose, nextOutPath.ValvesClose)))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) return Event.Error;
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
}
while (e.Contains(Event.ValvesBusy));
/// Set PID coefficient, etc.
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
StateMachine.ControlBoard.SetFiltersPidShortPulses(filters, nextPidCoef, (nextTolerRed == 0) ? 0 : 1);
/// Set pump power
if (nextInPath.Pump is GenericDevices.IPumpFM) (nextInPath.Pump as GenericDevices.IPumpFM).TurnOn(nextPumpPower);
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
/// Set flow for the next test
State.Create(string.Format("SequenceBase : AfterTestWithOverlap - Setting the flow to {0} - {1} m3/h", nextQfrom, nextQto))
.AddOperation(checkUiOp)
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
.AddOperation(nextOutPath.RegulValve.SetFlowAndMeasureOp(nextOutPath.FlowMeter, nextQfrom, nextQto, RefFlow, FlowSettingTimeoutSec, 0))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.OpArgumentError)) return Event.Error;
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
if (e.Contains(Event.RegulValveTimeOut))
{
Bridge.OnError(this, Strings.Flow_adjustment_failed);
return Event.UiCmdStop;
}
}
while (!e.Contains(Event.Busy) && !e.Contains(Event.FlowReached));
}
if (errorFlag)
return Event.Error;
else if (stopFlag)
@@ -866,6 +935,114 @@ namespace TBF.BenchControl.Sequences
}
protected Event SetFlowEtc(Test test, IFlowMeter flowMeter, IRegulValve regulValve, IValve pump, IValve stopBFValve, IList<IOperation> extraOperations, bool doNotWait)
{
IList<Event> e;
Event retVal = Event.Done;
if (pump is GenericDevices.IPumpFM) (pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(extraOperations)
.AddOperation(pump != null ? StateMachine.ControlBoard.SetValvesOp(pump, null) : null)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
//Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
//Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
if (e.Contains(Event.Error)) return Event.Error;
}
while (e.Contains(Event.ValvesBusy) /* || !e.Contains(Event.AllPositionsReached)*/);
if (test.TimePump2StartV > 0)
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.AddOperations(extraOperations)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
//Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
//Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
}
while (!e.Contains(Event.TimerExpired));
}
if (stopBFValve != null)
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(stopBFValve, null))
.AddOperations(extraOperations)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
if (e.Contains(Event.Error)) return Event.Error;
}
while (!e.Contains(Event.ValvesSet));
}
if (test.TimeBeforeFlow > 0)
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.AddOperations(extraOperations)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
//Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
//Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
}
while (!e.Contains(Event.TimerExpired));
}
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(doNotWait ? regulValve.SetFlowAndMeasureOp(flowMeter, test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec, 0)
: regulValve.SetFlowOp(flowMeter, test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec))
.AddOperations(extraOperations)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
//Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
//Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (e.Contains(Event.OpArgumentError)) return Event.OpArgumentError;
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
if (e.Contains(Event.RegulValveTimeOut))
{
Bridge.OnError(this, Strings.Flow_adjustment_failed);
return Event.RecoverableError;
}
if (e.Contains(Event.Next)) return Event.Done;
}
while (!(e.Contains(Event.FlowReached) || (doNotWait && e.Contains(Event.Busy)))); /// Stay in the loop while e.Contains(Event.Starting)
return retVal;
}
/// <summary>
/// Main loop where measurements are collected.
/// </summary>
@@ -1638,7 +1815,7 @@ namespace TBF.BenchControl.Sequences
/// <summary>
/// Returns true and makes a log when 'e' contains Event.UiCmdStop
/// </summary>
/// <param name="test"></param>
/// <param name="test">test or null (only for logs)</param>
/// <param name="e"></param>
/// <returns></returns>
protected bool TestAndLogUiCmdStop(Test test, IList<Event> e)
+8 -30
View File
@@ -575,31 +575,6 @@ namespace TBF.BenchControl
}
}
/// <summary>
/// Processes the selection done by the bench control panel in the main sequence.
/// </summary>
/// <param name="selection">Selection.Q1, .Q2, .Q3 or .Test</param>
/// <returns>The selected test or null</returns>
public static Config.Entities.Test GetTest(string selectedTestName, out int repetNr)
{
repetNr = 1;
foreach (var test in Tests)
{
if (test.Name.Equals(selectedTestName)) return test; /// Test name specified, keep repetNr = 1
for (int i = 1; i <= test.Repeats; i++)
{
if (Utils.TestTitle(test, i).Equals(selectedTestName))
{
repetNr = i;
return test;
}
}
}
return null;
}
/// <summary>
/// Called from the sequence to update paths based on the selected test
/// </summary>
@@ -624,6 +599,9 @@ namespace TBF.BenchControl
out TransitionSequence transitionAfter,
out string errorMsg)
{
ITestMethod tm = TbfComponents.FindComponent(test.Method) as ITestMethod;
bool isHydroTest = (tm != null) ? tm.DoTransitions() : false;
pfeed = null;
pben = null;
pout = null;
@@ -649,12 +627,12 @@ namespace TBF.BenchControl
pmtrs = GetMetersPath(test);
if (pfeed == null) errorMsg = Strings.Cannot_load_feeding_path;
else if (pben == null) errorMsg = Strings.Cannot_load_bench_path;
else if (pout == null) errorMsg = Strings.Cannot_load_output_path;
if (isHydroTest && (pfeed == null)) errorMsg = Strings.Cannot_load_feeding_path;
else if (isHydroTest && (pben == null)) errorMsg = Strings.Cannot_load_bench_path;
else if (isHydroTest && (pout == null)) errorMsg = Strings.Cannot_load_output_path;
else if (pmtrs == null) errorMsg = Strings.Cannot_load_sensor_path;
else errorMsg = string.Empty;
if ((pfeed == null) || (pben == null) || (pout == null) || (pmtrs == null))
if ((isHydroTest && (pfeed == null || pben == null || pout == null)) || (pmtrs == null))
{
return false;
}
@@ -678,7 +656,7 @@ namespace TBF.BenchControl
if (tr.Name == test.TransitionAfter) transitionAfter = tr;
}
if (pout.Scale == null)
if (isHydroTest && pout.Scale == null)
{
errorMsg = string.Format("No balance specified in path {0}", test.OutputPath);
return false;
+7 -5
View File
@@ -61,14 +61,16 @@ namespace TBF.BenchControl
Factories.Add(new TestMethods.FixedStart.Single.Factory());
Factories.Add(new TestMethods.FixedStart.Compound.Factory());
Factories.Add(new TestMethods.FixedStart.HeatMeters.Factory());
Factories.Add(new TestMethods.FixedStartAdvanced.Single.Factory());
Factories.Add(new TestMethods.FixedStartDeferredEvaluation.Single.Factory());
Factories.Add(new TestMethods.FixedStartDeferredEvaluation.Compound.Factory());
Factories.Add(new TestMethods.FixedStartDeferredEvaluation.HeatMeters.Factory());
Factories.Add(new TestMethods.FixedStartDeferredEval.Single.Factory());
Factories.Add(new TestMethods.FixedStartDeferredEval.Compound.Factory());
Factories.Add(new TestMethods.FixedStartDeferredEval.HeatMeters.Factory());
Factories.Add(new TestMethods.FixedStartMassCollection.Single.Factory());
Factories.Add(new TestMethods.FixedStartMassCollection.Compound.Factory());
Factories.Add(new TestMethods.FixedStartMassCollection.HeatMeters.Factory());
Factories.Add(new TestMethods.FixedStartTankCollection.Single.Factory());
Factories.Add(new TestMethods.FixedStartMassCollDeferredEval.Single.Factory());
Factories.Add(new TestMethods.FixedStartMassCollDeferredEval.Compound.Factory());
Factories.Add(new TestMethods.FixedStartMassCollDeferredEval.HeatMeters.Factory());
Factories.Add(new TestMethods.FixedStartTankCollection.Single.Factory());
Factories.Add(new TestMethods.FixedStartTankCollection.Compound.Factory());
Factories.Add(new TestMethods.FlyingStart.Single.Factory());
Factories.Add(new TestMethods.FlyingStart.Compound.Factory());
@@ -402,10 +402,12 @@ namespace TBF.BenchControl.TestMethods.Adjustment
tstRslt.FlowSetTime = flowSetTime;
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
tstRslt.MassStart = 0;
tstRslt.MassEnd = 0;
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h]
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = 0;
tstRslt.MassEndRaw = 0;
tstRslt.MassEnd = 0;
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.Buoyancy = Config.Formulas.Buoyancy();
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -15,6 +15,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
{
private static readonly ILog log = LogManager.GetLogger(typeof(WMErrorsForm));
const int MaxWMsCount = 6; /// Implementation limit of this form
///
/// Updated in constructor
///
@@ -43,13 +45,16 @@ namespace TBF.BenchControl.TestMethods.Adjustment
public WMErrorsForm(IList<GenericDevices.IWaterMeter> waterMeters)
: this()
{
waterMetersCount = waterMeters.Count;
waterMetersCount = Math.Min(Config.Data.WMsCount, waterMeters.Count);
rects = new Rectangle[waterMetersCount];
for (int i = 0; i < waterMetersCount; i++) rects[i] = new Rectangle(385, 30 + 90 * i, 324, 57);
disabled = new bool[waterMetersCount];
for (int i = 0; i < waterMetersCount; i++) disabled[i] = waterMeters[i].Disabled;
for (int i = 0; i < waterMetersCount; i++)
{
if (i < MaxWMsCount) disabled[i] = waterMeters[i].Disabled;
}
error = new double[waterMetersCount];
}
@@ -123,17 +128,20 @@ namespace TBF.BenchControl.TestMethods.Adjustment
string testName = args.TestName;
Results.Entities.TestRslt tr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetTestRslt(testName, 0);
errLimLo = tr.ErrLimLo() + tr.Uncertainty();
errLimHi = tr.ErrLimHi() - tr.Uncertainty();
if (tr != null)
{
errLimLo = tr.ErrLimLo() + tr.Uncertainty();
errLimHi = tr.ErrLimHi() - tr.Uncertainty();
int count = Math.Min(waterMetersCount, TBF.BenchControl.Sequences.ProcessData.BatchRslts.WMPositionsCount);
for (int i = 0; i < count; i++)
{
Results.Entities.MeterTestRslt mtr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
if (mtr != null) error[i] = mtr.Error;
int count = Math.Min(waterMetersCount, TBF.BenchControl.Sequences.ProcessData.BatchRslts.WMPositionsCount);
for (int i = 0; i < count; i++)
{
Results.Entities.MeterTestRslt mtr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
if (mtr != null) error[i] = mtr.Error;
}
Redraw();
}
Redraw();
}
void Redraw()
@@ -154,7 +162,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
for (int i = 0; i < waterMetersCount; i++)
{
if (!disabled[i])
if ((i < MaxWMsCount) && (!disabled[i]))
{
PaintOne(graphics, rects[i], error[i], errLimLo, errLimHi);
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -90,12 +90,15 @@ namespace TBF.BenchControl.TestMethods.Adjustment
public WMErrorsForm12(IList<GenericDevices.IWaterMeter> waterMeters)
: this()
{
waterMetersCount = waterMeters.Count;
waterMetersCount = Math.Min(Config.Data.WMsCount, waterMeters.Count);
ShuffleTextBoxes(waterMetersCount, Config.Data.LineSize);
disabled = new bool[waterMetersCount];
for (int i = 0; i < waterMetersCount; i++) disabled[i] = waterMeters[i].Disabled;
for (int i = 0; i < waterMetersCount; i++)
{
if (i < MaxWMsCount) disabled[i] = waterMeters[i].Disabled;
}
error = new double[waterMetersCount];
}
@@ -109,7 +112,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
/// <param name="lineSize">Number of watermeters in one line</param>
void ShuffleTextBoxes(int wmsCount, int lineSize)
{
if (wmsCount < textBoxesCount && lineSize > 0)
if ((wmsCount < textBoxesCount) && (lineSize > 0))
{
int nrLines = (wmsCount + lineSize - 1) / lineSize;
int gap = (textBoxesCount - wmsCount) / nrLines;
@@ -164,17 +167,20 @@ namespace TBF.BenchControl.TestMethods.Adjustment
string testName = args.TestName;
Results.Entities.TestRslt tr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetTestRslt(testName, 0);
errLimLo = tr.ErrLimLo() + tr.Uncertainty();
errLimHi = tr.ErrLimHi() - tr.Uncertainty();
if (tr != null)
{
errLimLo = tr.ErrLimLo() + tr.Uncertainty();
errLimHi = tr.ErrLimHi() - tr.Uncertainty();
int count = Math.Min(waterMetersCount, TBF.BenchControl.Sequences.ProcessData.BatchRslts.WMPositionsCount);
for (int i = 0; i < count; i++)
{
Results.Entities.MeterTestRslt mtr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
if (mtr != null) error[i] = mtr.Error;
int count = Math.Min(waterMetersCount, TBF.BenchControl.Sequences.ProcessData.BatchRslts.WMPositionsCount);
for (int i = 0; i < count; i++)
{
Results.Entities.MeterTestRslt mtr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
if (mtr != null) error[i] = mtr.Error;
}
Redraw();
}
Redraw();
}
void Redraw()
@@ -192,7 +198,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
for (int i = 0; i < waterMetersCount; i++)
{
if (!disabled[i])
if ((i < MaxWMsCount) && (!disabled[i]))
{
PaintOne(graphics, rects[i], error[i], errLimLo, errLimHi);
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -94,12 +94,15 @@ namespace TBF.BenchControl.TestMethods.Adjustment
public WMErrorsForm24(IList<GenericDevices.IWaterMeter> waterMeters)
: this()
{
waterMetersCount = waterMeters.Count;
waterMetersCount = Math.Min(Config.Data.WMsCount, waterMeters.Count);
ShuffleTextBoxes(waterMetersCount, Config.Data.LineSize);
disabled = new bool[waterMetersCount];
for (int i = 0; i < waterMetersCount; i++) disabled[i] = waterMeters[i].Disabled;
for (int i = 0; i < waterMetersCount; i++)
{
if (i < MaxWMsCount) disabled[i] = waterMeters[i].Disabled;
}
error = new double[waterMetersCount];
}
@@ -113,7 +116,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
/// <param name="lineSize">Number of watermeters in one line</param>
void ShuffleTextBoxes(int wmsCount, int lineSize)
{
if (wmsCount < textBoxesCount && lineSize > 0)
if ((wmsCount < textBoxesCount) && (lineSize > 0))
{
int nrLines = (wmsCount + lineSize - 1) / lineSize;
int gap = (textBoxesCount - wmsCount) / nrLines;
@@ -608,6 +608,21 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
tMass2 = StateMachine.Time;
TestEndTime = DateTime.Now;
if (test.DoDrainingAfter)
{
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.AddOperations(readTempPressOps)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { goto error; }
}
while (e.Contains(Event.ValvesBusy));
}
/// Read the diverter switch time
switchTimeEnd = 0.001f * (float)cBrd.DivTime(0);
log.WarnFormat("Diverter switch time on test end = {0} ms", cBrd.DivTime(0));
@@ -645,6 +645,21 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
log.WarnFormat("End mass = {0}kg", EndMass);
TestEndTime = DateTime.Now;
if (test.DoDrainingAfter)
{
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.AddOperations(readTempPressOps)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
}
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_completed);
//------------------------------------------------
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.TestMethods.Dummy
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
public override string ToString() { return string.Format("TestMethods.ChangeFlowDirection({0})", Cfg.ToString(1)); }
public override string ToString() { return string.Format("TestMethods.Dummy({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return true; }
@@ -31,13 +31,6 @@ namespace TBF.BenchControl.TestMethods.FixedStart
HeatMeters.TestParams heatMetersTestParams,
Config.Entities.DebugMode debugLevel)
{
IScale scale = outPath.Scale as IScale;
if (scale == null)
{
Bridge.OnError(this, Strings.Missing_a_scale);
new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop
}
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
{
@@ -138,61 +131,6 @@ namespace TBF.BenchControl.TestMethods.FixedStart
}
if (!test.DoDraining)
{
///
/// Measure the weight in case there is no unconditional draining
///
State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.BalanceDone));
}
///
/// Skip draining in case there is enough room in the tank
///
if (test.DoDraining || (Mass.Val + test.Volume >= scale.Capacity * Constants.TankFullFactor))
{
///
/// Drain the water tank
///
switch (DrainTheTank(scale, heatMetersPromptOp))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
}
}
///
/// Make sure the drain valve is closed
///
State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.ValvesSet) || !e.Contains(Event.BalanceDone));
//------------------------------------------------
Bridge.OnActivity(this, Strings.Starting_the_pump);
//------------------------------------------------
@@ -371,12 +309,12 @@ namespace TBF.BenchControl.TestMethods.FixedStart
{
double Tw = (TempRefHi1.Val + TempRefHi2.Val) / 2;
double Tc = (TempRefLo1.Val + TempRefLo2.Val) / 2;
if (heatMetersTestParams.TempWarmLo <= Tw && Tw <= heatMetersTestParams.TempWarmHi &&
heatMetersTestParams.TempColdLo <= Tc && Tc <= heatMetersTestParams.TempColdHi &&
Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm &&
Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold &&
Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm &&
Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold)
if ((heatMetersTestParams.TempWarmLo <= Tw) && (Tw <= heatMetersTestParams.TempWarmHi) &&
(heatMetersTestParams.TempColdLo <= Tc) && (Tc <= heatMetersTestParams.TempColdHi) &&
(Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm) &&
(Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold) &&
(Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm) &&
(Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold))
{
goto temperature_set;
}
@@ -434,26 +372,6 @@ namespace TBF.BenchControl.TestMethods.FixedStart
double currentFlow = RefFlow.Val;
//------------------------------------------------
Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------
if (test.TimeFlow2Mass > 0)
{
State.Create(string.Format("{0}({1}) : Waiting before 1st measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.TimerExpired));
}
TestStartTime = DateTime.Now;
LogProcessDataTestInfo(processDataLogger, test.Procedure.Name, test.Name);
int startPulses = 0;
@@ -486,8 +404,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
}
}
state2.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
@@ -553,12 +470,19 @@ namespace TBF.BenchControl.TestMethods.FixedStart
{
string srcDir = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
string destDir = Path.Combine(Program.ImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
if (File.Exists(Path.Combine(srcDir, fileName)))
{
Directory.CreateDirectory(destDir);
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, fileName), true);
try
{
if (File.Exists(Path.Combine(srcDir, fileName)))
{
Directory.CreateDirectory(destDir);
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, fileName), true);
}
}
}
catch (Exception exc)
{
log.ErrorFormat("Failed to copy image {0} to {1}: {2}", fileName, destDir, exc.Message);
}
}
}
}
}
@@ -603,7 +527,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
queryEnd1 = cBrd.QueryMeasurementEndOp();
queryEnd2 = cBrd.QueryMeasurementEndOp();
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, Math.Max((int)(test.TstTime/10), 5));
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, Math.Max((int)(test.TstTime / 10), 5));
int estimtdEndTime = StateMachine.Time + (int)test.TstTime;
/// Measurement loop - begin
@@ -696,22 +620,22 @@ namespace TBF.BenchControl.TestMethods.FixedStart
}
while (e.Contains(Event.ValvesBusy));
switchTimeEnd = 0.001f * cBrd.ValveOpenCloseTime;
log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime);
State.Create(string.Format("{0}({1}) : Waiting before 2nd measurement", test.Method, test.Name))
State.Create(string.Format("{0}({1}) : Stopping flow regulation", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(processDataLoggingOp)
.AddOperation(cBrd.StopFlowRegulationOp(outPath))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.TimerExpired));
while (!e.Contains(Event.FlowRegulationStopped));
switchTimeEnd = 0.001f * cBrd.ValveOpenCloseTime;
log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime);
TestEndTime = DateTime.Now;
@@ -780,7 +704,8 @@ namespace TBF.BenchControl.TestMethods.FixedStart
State state = State.Create(string.Format("{0}({1}) : Entering the end-state", test.Method, test.Name));
if (heatMetersTestParams != null && dataEntryCmpnt is GenericDevices.IHasHeatMtrStatesForm)
{
state.AddOperation((dataEntryCmpnt as GenericDevices.IHasHeatMtrStatesForm).ShowTestEndFormOp(sensPath.RegisterReaders,
state.AddOperation((dataEntryCmpnt as GenericDevices.IHasHeatMtrStatesForm).
ShowTestEndFormOp(sensPath.RegisterReaders,
volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty,
refEnergy, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty));
}
@@ -840,11 +765,18 @@ namespace TBF.BenchControl.TestMethods.FixedStart
{
string srcDir = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
string destDir = Path.Combine(Program.ImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
if (File.Exists(Path.Combine(srcDir, fileName)))
{
Directory.CreateDirectory(destDir);
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, fileName), true);
}
try
{
if (File.Exists(Path.Combine(srcDir, fileName)))
{
Directory.CreateDirectory(destDir);
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, fileName), true);
}
}
catch (Exception exc)
{
log.ErrorFormat("Failed to copy image {0} to {1}: {2}", fileName, destDir, exc.Message);
}
}
}
}
@@ -1060,7 +992,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
scale != null ? scale.Name : string.Empty,
string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
@@ -490,6 +490,21 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
tMass2 = StateMachine.Time;
TestEndTime = DateTime.Now;
if (test.DoDrainingAfter)
{
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.AddOperations(readTempPressOps)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
}
State.Create("FixedStartAdvanced : Stopping diverter, gate, etc.")
.AddOperation(checkUiOp)
@@ -1,12 +1,12 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.Compound
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval.Compound
{
public class Component : ComponentBase, GenericDevices.ITestMethodWith2ndPass
{
@@ -35,12 +35,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.Compound
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartDeferredEvaluationSeq()).Execute(test, repetNr, isLastRepetition, true, null, DebugLevel, out intermediateData);
return (new FixedStartDeferredEvalSeq()).Execute(test, repetNr, isLastRepetition, true, null, DebugLevel, out intermediateData);
}
public IList<Event> Execute2ndPass(Test test, int repetNr, object data)
{
return (new FixedStartDeferredEvaluationSeq()).Execute2ndPass(test, repetNr, data as IntermediateData);
return (new FixedStartDeferredEvalSeq()).Execute2ndPass(test, repetNr, data as IntermediateData);
}
}
}
@@ -1,11 +1,11 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs.NameOnly;
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.Single
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval.Compound
{
public class Factory : IComponentFactory
{
@@ -0,0 +1,988 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using log4net;
using TBF.BenchControl;
using TBF.Boxes;
using TBF.Resources;
using TBF.UiBridge;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval
{
public class FixedStartDeferredEvalSeq : Sequences.SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(FixedStartDeferredEvalSeq));
/// <summary>
/// Fixed start mass collection method with deferred evaluation of images
/// </summary>
/// <param name="test">Test entity</param>
/// <returns>
/// Event.Done . . . . . . . OK
/// Event.MakeSecondPass . . OK, 2nd pass (=evaluation) required
/// 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(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
bool compound,
HeatMeters.TestParams heatMetersTestParams,
Config.Entities.DebugMode debugLevel,
out IntermediateData intermediateData)
{
intermediateData = new IntermediateData
{
Compound = compound,
TestName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr),
TestPart = test.Part,
};
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
{
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
new List<Event> { Event.ConfigurationError };
}
}
GenericDevices.IHasWMStatesForm dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
if (!(dataEntryCmpnt is GenericDevices.IDataEntryForCamera))
{
Bridge.OnError(this, "Wrong DataEntry component");
new List<Event> { Event.ConfigurationError };
}
IList<Event> e; /// Events from currently running operations
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
if (sensPath != null && sensPath.RegisterReaders != null)
{
foreach (var rr in sensPath.RegisterReaders)
{
TBF.BenchControl.Elde.RegisterReader.RegisterReader eldeRR = rr as TBF.BenchControl.Elde.RegisterReader.RegisterReader;
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
{
filters[eldeRR.Position - 1] = eldeRR.Filter;
}
}
}
cBrd.SetFiltersPidShortPulses(filters, outPath.PidCoef, (test.TolerRed == 0) ? 0 : 1);
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
Event retVal = Event.Done;
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
/// Notes:
/// float timeHr = volumeLtr / (1000.0f * targetFlow);
/// float timeSec = 3600.0f * timeHr;
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
//====================================
loop:
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
///
/// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test
///
IOperation heatMetersPromptOp = null;
if (heatMetersTestParams != null && !string.IsNullOrEmpty(heatMetersTestParams.Prompt))
{
/// Make sure the CycleBeginForm is closed
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
heatMetersPromptOp = new Operations.MessageBoxOp(heatMetersTestParams.Prompt);
}
//------------------------------------------------
Bridge.OnActivity(this, Strings.Starting_the_pump);
//------------------------------------------------
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
int flowSetTime0 = StateMachine.Time;
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(heatMetersPromptOp)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy) /* || !e.Contains(Event.AllPositionsReached)*/);
if (test.TimePump2StartV > 0)
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.AddOperation(heatMetersPromptOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.TimerExpired));
}
if (benchPath.StopBFValve != null)
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (!e.Contains(Event.ValvesSet));
}
if (test.TimeBeforeFlow > 0)
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.AddOperation(heatMetersPromptOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.TimerExpired));
}
setting_flow:
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
if (inPath.Pump is GenericDevices.IPumpFM)
{
(inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
}
///
State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
///
State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(heatMetersPromptOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
//--------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec))
.AddOperation(heatMetersPromptOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.RegulValveTimeOut))
{
Bridge.OnError(this, Strings.Flow_adjustment_failed);
retVal = Event.RecoverableError;
goto stopTest;
}
if (e.Contains(Event.Next)) goto flow_set;
}
while (!e.Contains(Event.FlowReached));
flow_set:
int flowSetTime = StateMachine.Time - flowSetTime0;
if (heatMetersTestParams != null && heatMetersPath != null)
{
//---------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_temperature);
//---------------------------------------------------
int lastTimeSec = StateMachine.Time;
double Tw_last = 0;
double Tc_last = 0;
State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if (TempRefHi1.Val != 0 && TempRefHi2.Val != 0 && TempRefLo1.Val != 0 && TempRefLo2.Val != 0)
{
if (StateMachine.Time - lastTimeSec > 10 || StateMachine.Time - lastTimeSec < 0)
{
double Tw = (TempRefHi1.Val + TempRefHi2.Val) / 2;
double Tc = (TempRefLo1.Val + TempRefLo2.Val) / 2;
if ((heatMetersTestParams.TempWarmLo <= Tw) && (Tw <= heatMetersTestParams.TempWarmHi) &&
(heatMetersTestParams.TempColdLo <= Tc) && (Tc <= heatMetersTestParams.TempColdHi) &&
(Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm) &&
(Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold) &&
(Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm) &&
(Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold))
{
goto temperature_set;
}
lastTimeSec = StateMachine.Time;
Tw_last = Tw;
Tc_last = Tc;
}
}
}
while (true);
}
else if (test.DoControlWaterTemp && (benchPath.TempMtrUp != null) && (benchPath.TempMtrDown != null))
{
//---------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_temperature);
//---------------------------------------------------
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{
goto temperature_set;
}
}
while (true);
}
temperature_set:
//-----------------------------------------------------------------
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
//-----------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (!e.Contains(Event.ValvesSet));
int time = StateMachine.Time;
double currentFlow = RefFlow.Val;
TestStartTime = DateTime.Now;
LogProcessDataTestInfo(processDataLogger, test.Procedure.Name, test.Name);
int startPulses = 0;
///
/// Grab start images
///
string fileName = string.Format("{0}-start.bmp", test.Name);
string[] startImages = new string[sensPath.RegisterReaders.Length];
///
if (debugLevel != Config.Entities.DebugMode.Simulate)
{
State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps);
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
if (roi != null)
{
string directory = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
Directory.CreateDirectory(directory);
startImages[i] = Path.Combine(directory, fileName);
state2.AddOperation(roi.GrabImageOp(startImages[i]));
}
}
state2.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
if (e.Contains(Event.Error)) { retVal = Event.Error; break; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; break; }
}
while (e.Contains(Event.CameraBusy));
intermediateData.StartImages = startImages;
if ((dataEntryCmpnt is GenericDevices.IDataEntryForCamera) && (dataEntryCmpnt as GenericDevices.IDataEntryForCamera).SaveImages)
{
/// SaveImages==true ... copy images to the directory that will be archived at the end of the cycle
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
if (roi != null)
{
string srcDir = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
string destDir = Path.Combine(Program.ImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
try
{
if (File.Exists(Path.Combine(srcDir, fileName)))
{
Directory.CreateDirectory(destDir);
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, fileName), true);
}
}
catch (Exception exc)
{
log.ErrorFormat("Failed to copy image {0} to {1}: {2}", fileName, destDir, exc.Message);
}
}
}
}
}
else
{
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
if (roi != null)
{
string directory = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
Directory.CreateDirectory(directory);
startImages[i] = Path.Combine(directory, fileName);
File.Copy(string.Format("C:\\TBF\\SampleImages\\{0}", fileName), startImages[i], true);
}
}
}
intermediateData.StartImages = startImages;
///
if ((dataEntryCmpnt is GenericDevices.IDataEntryForCamera) && (dataEntryCmpnt as GenericDevices.IDataEntryForCamera).SaveImages)
{
/// SaveImages==true ... copy images to the directory that will be archived at the end of the cycle
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
if (roi != null)
{
string srcDir = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
string destDir = Path.Combine(Program.ImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
try
{
if (File.Exists(Path.Combine(srcDir, fileName)))
{
Directory.CreateDirectory(destDir);
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, fileName), true);
}
}
catch (Exception exc)
{
log.ErrorFormat("Failed to copy image {0} to {1}: {2}", fileName, destDir, exc.Message);
}
}
}
}
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "Measurement");
else LogProcessDataHeaderHeatMeters(processDataLogger, "Measurement");
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.MeasurementStarted));
StartTime = (double)StateMachine.Time;
State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (!e.Contains(Event.ValvesSet));
switchTimeStart = 0.001f * cBrd.ValveOpenCloseTime;
log.WarnFormat("Start valve switch time on test start = {0} ms", cBrd.ValveOpenCloseTime);
/// Measurement loop - preparation
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
queryEnd1 = cBrd.QueryMeasurementEndOp();
queryEnd2 = cBrd.QueryMeasurementEndOp();
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, Math.Max((int)(test.TstTime / 10), 5));
int estimtdEndTime = StateMachine.Time + (int)test.TstTime;
/// Measurement loop - begin
do
{
//--------------------------------
switch (ReadRegistersTempPressAmbient(null, true))
{
case Event.Error:
retVal = Event.Error;
goto stopTest;
case Event.UiCmdStop:
retVal = Event.UiCmdStop;
goto stopTest;
case Event.MeasurementCompleted:
goto test_completed;
}
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
if (remainingTime > 60)
{
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
}
else
{
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
}
RefFreq.Val = cBrd.ReferenceFreq;
RefFlow.Val = cBrd.ReferenceFlow;
UpdateAllStatistics(StateMachine.Time);
if (heatMetersTestParams != null)
{
if (lastEnergyUpdateTime == 0)
{
lastEnergyUpdateTime = StateMachine.Time;
}
else
{
//double deltaTime = (double)(StateMachine.Time - lastEnergyUpdateTime);
double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C]
double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C]
double deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l]
double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Config.Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)]
Energy.Update(deltaEnergy);
VolumeForEnergy.Update(deltaVolume);
lastEnergyUpdateTime = StateMachine.Time;
}
}
if (compound)
{
/// TODO: Reimplement for combined meters
//for (int i = 0; i < Config.Data.CompoundWMsCount; i++)
//{
// data.TestResult.CombinedMeters[i].VolumeMeter = data.TestResult.Meters[2 * i].VolumeMeter
// + data.TestResult.Meters[2 * i + 1].VolumeMeter;
// if (data.Volume.Valid)
// {
// data.TestResult.CombinedMeters[i].VolumeErrorPct =
// Formulas.ErrorFromVolumes(data.TestResult.CombinedMeters[i].VolumeMeter, data.Volume.Val);
// }
//}
}
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
}
while (cBrd.EtPulses(0) < totalPulses);
/// Measurement loop - end
test_completed:
StopRecordingStatistics();
State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
EndTime = (double)StateMachine.Time;
TestEndTime = DateTime.Now;
int endPulses = cBrd.EtPulses(0);
switchTimeEnd = 0.001f * cBrd.ValveOpenCloseTime;
log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime);
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.PreviousStopped));
double flowVolume = 3.6 * LtrPerRefPulse * Convert.ToDouble(endPulses - startPulses) / cBrd.TTime;
double constMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flowVolume, rangeIx);
double volumeCTV = constMasterCorr * Convert.ToDouble(endPulses - startPulses);
if (debugLevel == Config.Entities.DebugMode.Simulate) volumeCTV = test.Volume;
double refEnergy = Energy.Sum * volumeCTV / VolumeForEnergy.Sum; /// [J]=[J]*[l]/[l]
///
/// Grab END images
///
fileName = string.Format("{0}-end.bmp", test.Name);
string[] endImages = new string[sensPath.RegisterReaders.Length];
///
if (debugLevel != Config.Entities.DebugMode.Simulate)
{
State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps);
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
if (roi != null)
{
string directory = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
Directory.CreateDirectory(directory);
endImages[i] = Path.Combine(directory, fileName);
state2.AddOperation(roi.GrabImageOp(endImages[i]));
}
}
state2.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
if (e.Contains(Event.Error)) { retVal = Event.Error; break; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; break; }
}
while (e.Contains(Event.CameraBusy));
}
else
{
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
if (roi != null)
{
string directory = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
Directory.CreateDirectory(directory);
endImages[i] = Path.Combine(directory, fileName);
File.Copy(string.Format("C:\\TBF\\SampleImages\\{0}", fileName), endImages[i], true);
}
}
}
intermediateData.EndImages = endImages;
///
if ((dataEntryCmpnt is GenericDevices.IDataEntryForCamera) && (dataEntryCmpnt as GenericDevices.IDataEntryForCamera).SaveImages)
{
/// SaveImages==true ... copy images to the directory that will be archived at the end of the cycle
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
if (roi != null)
{
string srcDir = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
string destDir = Path.Combine(Program.ImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
try
{
if (File.Exists(Path.Combine(srcDir, fileName)))
{
Directory.CreateDirectory(destDir);
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, fileName), true);
}
}
catch (Exception exc)
{
log.ErrorFormat("Failed to copy image {0} to {1}: {2}", fileName, destDir, exc.Message);
}
}
}
}
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_completed);
//------------------------------------------------
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
///
/// Populate TestResult data entity with data
///
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
if (tstRslt != null)
{
UpdateTempPressDensAmb(tstRslt);
/// Main results
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
tstRslt.StartTime = TestStartTime;
tstRslt.EndTime = TestEndTime;
tstRslt.FlowSetTime = flowSetTime;
tstRslt.TestTime = Math.Max(1.0, EndTime - StartTime); /// [s] measurement time, at least 1 to prevent division by zero
tstRslt.TimeBtwnMassMsrmnts = 0;
tstRslt.PulsesMaster = Convert.ToDouble(endPulses - startPulses); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = 0;
tstRslt.MassEndRaw = 0;
tstRslt.MassEnd = 0;
tstRslt.FlowMass = 0;
tstRslt.FlowVolume = flowVolume; /// [m3/h]
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.Buoyancy = Config.Formulas.Buoyancy();
tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = constMasterCorr; /// Corrected master pulses per liter
tstRslt.ConstMaster = constMasterCorr;
/// Calculated master pulses per liter
tstRslt.ErrorMaster = 0;
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
tstRslt.FlowEnd = (float)RefFlowStat.Last;
tstRslt.FlowMin = (float)RefFlowStat.Min;
tstRslt.FlowMax = (float)RefFlowStat.Max;
tstRslt.DiverterStart = switchTimeStart;
tstRslt.DiverterEnd = switchTimeEnd;
tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0;
tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, true, switchTimeStart, switchTimeEnd) : 0;
tstRslt.Components = Results.Entities.Components
.UpdateList(BatchRslts.ComponentsList,
new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
tstRslt.TestDone = false;
}
retVal = Event.MakeSecondPass;
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
stopTest:
StopRecordingStatistics();
///
/// Quit this sequence
///
if (isLastRepetition || retVal == Event.UiCmdStop || retVal == Event.OpArgumentError
|| retVal == Event.Error || retVal == Event.ConfigurationError)
{
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } /// TODO: this is an endless loop !!!
}
while (!e.Contains(Event.PreviousStopped));
}
stopTestWOTransitionAfter:
return new List<Event> { retVal }; /// default 'retVal' value is Event.Done
}
/// <summary>
/// Fixed start mass collection method with deferred evaluation of images
/// </summary>
/// <param name="test">Test entity</param>
/// <returns>Always Event.Done</returns>
public IList<Event> Execute2ndPass(Config.Entities.Test test, int repetNr, IntermediateData data)
{
IList<Event> e; /// Events from currently running operations
///
/// Populate TestResult data entity with data
///
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(data.TestName, data.TestPart);
GenericDevices.IHasWMStatesForm deCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
GenericDevices.IDataEntryForCamera de4Cam = deCmpnt as GenericDevices.IDataEntryForCamera;
if (tstRslt != null && de4Cam != null)
{
de4Cam.StartImages = data.StartImages;
de4Cam.EndImages = data.EndImages;
Bridge.OnActivity(this, Strings.Enter_water_meter_data);
State.Create(string.Format("{0}({1}) : Entering water meter states", test.Method, test.Name))
.AddOperation(de4Cam.ShowDeferredTestEvalFormOp(sensPath.RegisterReaders, tstRslt.VolumeCTV,
test.ErrLimLo + test.Uncertainty,
test.ErrLimHi - test.Uncertainty))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
}
while (e.Contains(Event.ModelessFormIsOpen));
/// Update register reader star and end-volumes from data entry forms
for (int i = 0; i < Config.Data.WMsCount; i++)
{
GenericDevices.IRegisterReader r = sensPath.RegisterReaders[i];
BenchControl.Network.Camera.RoiForFixedStart.Roi rr = r as BenchControl.Network.Camera.RoiForFixedStart.Roi;
if (rr != null)
{
rr.BeginWMState = deCmpnt.WMStartState(i);
rr.EndWMState = deCmpnt.WMEndState(i);
}
}
if (data.Compound)
{
///
/// Compound meters
///
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
if (!test.IsPartCompatible(Utils.PartNr(i + 1, BatchRslts.Batch.Compound))) continue;
Results.Entities.MeterTestRslt mainMeterRslt = BatchRslts.GetMeterTestRslt(data.TestName, i, Config.Entities.CompoundMeterId.CompoundMain);
Results.Entities.MeterTestRslt auxMeterRslt = BatchRslts.GetMeterTestRslt(data.TestName, i, Config.Entities.CompoundMeterId.CompoundAux);
for (int isAux = 0; isAux <= 1; isAux++) /// 0=main, 1=aux
{
Results.Entities.MeterTestRslt meterRslt = (isAux == 0) ? mainMeterRslt : auxMeterRslt;
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[2 * i + isAux];
if (meterRslt != null && regReader != null)
{
meterRslt.RegReaderType = (int)regReader.RegisterReaderType;
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
meterRslt.VolumeStart = regReader.BeginWMState; /// [l] From forms/images
meterRslt.VolumeEnd = regReader.EndWMState; /// [l] From forms/images
meterRslt.VolumeMeter = meterRslt.VolumeEnd - meterRslt.VolumeStart; /// [l]
meterRslt.VolumeRef = tstRslt.VolumeCTV; /// [l]
meterRslt.PulsesMeter = meterRslt.VolumeMeter * regReader.PulsesPerLtr;
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
meterRslt.TestTime = tstRslt.TestTime;
meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); /// Not used for evaluation
}
}
Results.Entities.MeterTestRslt compoundMeterRslt = BatchRslts.GetMeterTestRslt(data.TestName, i, Config.Entities.CompoundMeterId.Compound);
if (compoundMeterRslt != null && mainMeterRslt != null && auxMeterRslt != null)
{
compoundMeterRslt.VolumeRef = tstRslt.VolumeCTV; /// [l] must be calculated before main & aux. meter error
compoundMeterRslt.VolumeMeter = mainMeterRslt.VolumeMeter + auxMeterRslt.VolumeMeter;
compoundMeterRslt.PulsesMaster = tstRslt.PulsesMaster;
compoundMeterRslt.TestTime = tstRslt.TestTime;
compoundMeterRslt.Error = Config.Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef);
compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.GetErrLimLo(tstRslt.VolumeCTV, tstRslt.TestTime) + test.Uncertainty)
&& (compoundMeterRslt.Error <= test.GetErrLimHi(tstRslt.VolumeCTV, tstRslt.TestTime) - test.Uncertainty)
&& (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On);
mainMeterRslt.Passed = auxMeterRslt.Passed = compoundMeterRslt.Passed;
mainMeterRslt.TestDone = auxMeterRslt.TestDone = compoundMeterRslt.TestDone = true;
}
}
tstRslt.TestDone = true;
}
else
{
///
/// Single meters
///
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
if (!test.IsPartCompatible(Utils.PartNr(i + 1, BatchRslts.Batch.Compound))) continue;
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(data.TestName, i, Config.Entities.CompoundMeterId.Single);
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i];
if (meterRslt != null && regReader != null)
{
meterRslt.RegReaderType = (int)regReader.RegisterReaderType;
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
meterRslt.VolumeStart = regReader.BeginWMState; /// From forms/images
meterRslt.VolumeEnd = regReader.EndWMState; /// From forms/images
meterRslt.VolumeMeter = meterRslt.VolumeEnd - meterRslt.VolumeStart;
meterRslt.VolumeRef = tstRslt.VolumeCTV; /// liter
meterRslt.PulsesMeter = meterRslt.VolumeMeter * regReader.PulsesPerLtr;
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
meterRslt.TestTime = tstRslt.TestTime;
meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.VolumeCTV, tstRslt.TestTime) + test.Uncertainty)
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.VolumeCTV, tstRslt.TestTime) - test.Uncertainty)
&& (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On);
meterRslt.TestDone = true;
}
}
tstRslt.TestDone = true;
}
/// Update water meter error flags
if (ErrorFlagsComp != null)
{
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
if (BatchRslts.WaterMeters[i] != null)
{
BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts);
}
}
}
/// Update results
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(data.TestName, tstRslt));
/// Append the results to the CSV-file
allResults.Info(TestResult2CsvLine(data.TestName, data.TestPart));
}
/// No operation for 1 period so that Stop() function of Data entry component is called
State.Create(string.Format("{0}({1}) : No Op.", test.Method, test.Name)).EnterState();
StateMachine.WaitRunDevsRunOps();
return new List<Event> { Event.Done }; ;
}
}
}
@@ -1,12 +1,12 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.HeatMeters
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval.HeatMeters
{
public class Component : ComponentBase, GenericDevices.ITestMethodWith2ndPass
{
@@ -38,12 +38,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.HeatMeters
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartDeferredEvaluationSeq()).Execute(test, repetNr, isLastRepetition, false, testMethodCfg.TestParams, DebugLevel, out intermediateData);
return (new FixedStartDeferredEvalSeq()).Execute(test, repetNr, isLastRepetition, false, testMethodCfg.TestParams, DebugLevel, out intermediateData);
}
public IList<Event> Execute2ndPass(Test test, int repetNr, object data)
{
return (new FixedStartDeferredEvaluationSeq()).Execute2ndPass(test, repetNr, data as IntermediateData);
return (new FixedStartDeferredEvalSeq()).Execute2ndPass(test, repetNr, data as IntermediateData);
}
}
}
@@ -1,10 +1,10 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.HeatMeters
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval.HeatMeters
{
public class Factory : IComponentFactory
{
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -8,7 +8,7 @@ using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.HeatMeters
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval.HeatMeters
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
@@ -1,12 +1,12 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.HeatMeters
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval.HeatMeters
{
public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl
{
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.HeatMeters
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval.HeatMeters
{
partial class TestMethodCfgCtrl
{
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.IO;
@@ -9,7 +9,7 @@ using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.HeatMeters
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval.HeatMeters
{
public class TestParams : TestParamsBase, IParamsProvider, ITestParams
{
@@ -1,9 +1,9 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval
{
public class IntermediateData
{
@@ -1,12 +1,12 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.Single
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval.Single
{
public class Component : ComponentBase, GenericDevices.ITestMethodWith2ndPass
{
@@ -35,12 +35,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.Single
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartDeferredEvaluationSeq()).Execute(test, repetNr, isLastRepetition, false, null, DebugLevel, out intermediateData);
return (new FixedStartDeferredEvalSeq()).Execute(test, repetNr, isLastRepetition, false, null, DebugLevel, out intermediateData);
}
public IList<Event> Execute2ndPass(Test test, int repetNr, object data)
{
return (new FixedStartDeferredEvaluationSeq()).Execute2ndPass(test, repetNr, data as IntermediateData);
return (new FixedStartDeferredEvalSeq()).Execute2ndPass(test, repetNr, data as IntermediateData);
}
}
}
@@ -1,11 +1,11 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs.NameOnly;
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.Compound
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval.Single
{
public class Factory : IComponentFactory
{
@@ -0,0 +1,46 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval.Compound
{
public class Component : ComponentBase, GenericDevices.ITestMethodWith2ndPass
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString()
{
return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
}
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
public bool DoTransitions() { return true; }
public Component()
{
}
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
log.Debug(this.ToString());
}
private IntermediateData intermediateData;
public object IntermediateData { get { return intermediateData; } }
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartMassCollDeferredEvalSeq()).Execute(test, repetNr, isLastRepetition, true, null, DebugLevel, out intermediateData);
}
public IList<Event> Execute2ndPass(Test test, int repetNr, object data)
{
return (new FixedStartMassCollDeferredEvalSeq()).Execute2ndPass(test, repetNr, data as IntermediateData);
}
}
}
@@ -0,0 +1,27 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs.NameOnly;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval.Compound
{
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
public IComponent DummyComponent() { return new Component(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(29), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -12,11 +12,11 @@ using TBF.Resources;
using TBF.UiBridge;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval
{
public class FixedStartDeferredEvaluationSeq : Sequences.SequenceBase
public class FixedStartMassCollDeferredEvalSeq : Sequences.SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(FixedStartDeferredEvaluationSeq));
private static readonly ILog log = LogManager.GetLogger(typeof(FixedStartMassCollDeferredEvalSeq));
/// <summary>
/// Fixed start mass collection method with deferred evaluation of images
@@ -798,6 +798,21 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
tMass2 = StateMachine.Time;
TestEndTime = DateTime.Now;
if (test.DoDrainingAfter)
{
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.AddOperations(readTempPressOps)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
}
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp)
@@ -0,0 +1,49 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval.HeatMeters
{
public class Component : ComponentBase, GenericDevices.ITestMethodWith2ndPass
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString()
{
return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
}
readonly TestMethodCfg testMethodCfg;
public bool CanTest(MetersKind meters) { return meters == MetersKind.HeatMeter; }
public bool DoTransitions() { return true; }
public Component()
{
}
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
log.Debug(this.ToString());
}
private IntermediateData intermediateData;
public object IntermediateData { get { return intermediateData; } }
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartMassCollDeferredEvalSeq()).Execute(test, repetNr, isLastRepetition, false, testMethodCfg.TestParams, DebugLevel, out intermediateData);
}
public IList<Event> Execute2ndPass(Test test, int repetNr, object data)
{
return (new FixedStartMassCollDeferredEvalSeq()).Execute2ndPass(test, repetNr, data as IntermediateData);
}
}
}
@@ -0,0 +1,26 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval.HeatMeters
{
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
public IComponent DummyComponent() { return new Component(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(29), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -0,0 +1,49 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval.HeatMeters
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// <summary> Test parameters </summary>
[XmlIgnore]
public TestParams TestParams; /// Created in constructor
public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; }
public override IParamsProvider CreateTestParamsProvider() { return new TestParams(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()
{
TestParams = new TestParams(true);
}
public TestMethodCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
Factory = factory;
ParentName = string.Empty;
}
public string ToString(int i)
{
return string.Format("Name={0}", Name);
}
}
}
@@ -0,0 +1,69 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval.HeatMeters
{
public partial class TestMethodCfgCtrl : UserControl, 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;
}
public void Unlock()
{
nameTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
config.Name = nameTextBox.Text;
return flags;
}
}
}
@@ -0,0 +1,86 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval.HeatMeters
{
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.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 5;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(27, 60);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 4;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 3;
this.classNameLabel.Text = "ComonentName";
//
// BasicPrinterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "BasicPrinterCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
}
}
@@ -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>
@@ -0,0 +1,197 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval.HeatMeters
{
public class TestParams : TestParamsBase, IParamsProvider, ITestParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public float ErrorLimitLo; /// [%]
public float ErrorLimitHi; /// [%]
public bool EvaluateVolume; /// true = evaluate also the volume, false = evaluate only energy
public float TempWarmLo; /// Low limit for warm temperature [°C]
public float TempWarmHi; /// High limit for warm temperature [°C]
public float TempColdLo; /// Low limit for cold temperature [°C]
public float TempColdHi; /// High limit for cold temperature [°C]
public bool FlowMeasuredAtHiTempPipe; /// true = flow measured at high temp. pipe, false = flow measured at low temp. pipe
public float DeltaTempWarm;
public float DeltaTempCold;
public float ChangeInTimeWarm;
public float ChangeInTimeCold;
public string Prompt;
public override void InitializeAll()
{
FlowMeasuredAtHiTempPipe = false;
}
string[] paramNames = new string[]
{
Strings.Err_limit_neg_pct_chdr,
Strings.Err_limit_pos_pct_chdr,
Strings.Evaluate_volume,
"T hi min",
"T hi max",
"T lo min",
"T lo max",
"Flow measured at high temp.pipe",
"Delta T warm",
"Delta T cold",
"Change in time T warm",
"Change in time T cold",
Strings.Prompt,
};
public override string ParamName(int i) { return paramNames[i]; }
public override int ParamsCount() { return paramNames.Length; }
public override string ToString(int i)
{
switch (i)
{
case 0: return ErrorLimitLo.ToString();
case 1: return ErrorLimitHi.ToString();
case 2: return (EvaluateVolume ? Strings.yes : Strings.no);
case 3: return TempWarmLo.ToString();
case 4: return TempWarmHi.ToString();
case 5: return TempColdLo.ToString();
case 6: return TempColdHi.ToString();
case 7: return (FlowMeasuredAtHiTempPipe ? Strings.yes : Strings.no);
case 8: return DeltaTempWarm.ToString();
case 9: return DeltaTempCold.ToString();
case 10: return ChangeInTimeWarm.ToString();
case 11: return ChangeInTimeCold.ToString();
case 12: return Prompt;
default: return string.Empty;
}
}
public CfgUpdateFlags UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: ErrorLimitLo = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 1: ErrorLimitHi = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 2: EvaluateVolume = strValue.Equals(Strings.yes); return CfgUpdateFlags.None;
case 3: TempWarmLo = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 4: TempWarmHi = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 5: TempColdLo = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 6: TempColdHi = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 7: FlowMeasuredAtHiTempPipe = strValue.Equals(Strings.yes); return CfgUpdateFlags.None;
case 8: DeltaTempWarm = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
case 9: DeltaTempCold = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
case 10: ChangeInTimeWarm = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
case 11: ChangeInTimeCold = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
case 12: Prompt = strValue; return CfgUpdateFlags.None;
default: return CfgUpdateFlags.None;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
float dummy;
switch (i)
{
case 0:
case 1:
case 3:
case 4:
case 5:
case 6:
if (Utils.TryParseSFloat(strValue, out dummy)) return true;
break;
case 2:
case 7:
if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true;
break;
case 8:
case 9:
case 10:
case 11:
if (Utils.TryParseUFloat(strValue, out dummy)) return true;
break;
case 12:
return true;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
void CopyContentTo(TestParams prms)
{
prms.ErrorLimitLo = ErrorLimitLo;
prms.ErrorLimitHi = ErrorLimitHi;
prms.EvaluateVolume = EvaluateVolume;
prms.TempWarmLo = TempWarmLo;
prms.TempWarmHi = TempWarmHi;
prms.TempColdLo = TempColdLo;
prms.TempColdHi = TempColdHi;
prms.FlowMeasuredAtHiTempPipe = FlowMeasuredAtHiTempPipe;
prms.DeltaTempWarm = DeltaTempWarm;
prms.DeltaTempCold = DeltaTempCold;
prms.ChangeInTimeWarm = ChangeInTimeWarm;
prms.ChangeInTimeCold = ChangeInTimeCold;
prms.Prompt = Prompt;
}
public IParamsProvider Clone()
{
TestParams pars = new TestParams();
CopyContentTo(pars);
return pars;
}
public override void UpdateFromDbEntity(ComponentTest dbEntity)
{
if (dbEntity == null) return;
try
{
TestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as TestParams;
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
}
}
/// <summary>
/// Parameterless constructor initializes the parameters
/// </summary>
public TestParams()
{
}
public TestParams(bool initialize)
{
if (initialize) InitializeAll();
}
public TestParams(ComponentTest testParamsEntity, string componentName, Test test)
{
this.testParamsEntity = testParamsEntity;
this.componentName = componentName;
this.test = test;
}
}
}
@@ -0,0 +1,16 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval
{
public class IntermediateData
{
public bool Compound;
public string TestName;
public int TestPart;
public string[] StartImages;
public string[] EndImages;
}
}
@@ -0,0 +1,46 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval.Single
{
public class Component : ComponentBase, GenericDevices.ITestMethodWith2ndPass
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString()
{
return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
}
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
public Component()
{
}
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
log.Debug(this.ToString());
}
private IntermediateData intermediateData;
public object IntermediateData { get { return intermediateData; } }
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartMassCollDeferredEvalSeq()).Execute(test, repetNr, isLastRepetition, false, null, DebugLevel, out intermediateData);
}
public IList<Event> Execute2ndPass(Test test, int repetNr, object data)
{
return (new FixedStartMassCollDeferredEvalSeq()).Execute2ndPass(test, repetNr, data as IntermediateData);
}
}
}
@@ -0,0 +1,27 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs.NameOnly;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval.Single
{
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
public IComponent DummyComponent() { return new Component(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(29), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
}
}
}
@@ -80,7 +80,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
foreach (var rr in sensPath.RegisterReaders)
{
TBF.BenchControl.Elde.RegisterReader.RegisterReader eldeRR = rr as TBF.BenchControl.Elde.RegisterReader.RegisterReader;
if (eldeRR != null && eldeRR.Position >= 1 && eldeRR.Position <= 8)
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
{
filters[eldeRR.Position - 1] = eldeRR.Filter;
}
@@ -618,7 +618,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StartMeasurementOp(outPath, (Elde.TestMethods.Diverter | Elde.TestMethods.FixedStart),
test.Qfrom, test.Qto, (2 * totalPulses)))
test.Qfrom, test.Qto, 2 * totalPulses))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
@@ -802,6 +802,21 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
tMass2 = StateMachine.Time;
TestEndTime = DateTime.Now;
if (test.DoDrainingAfter)
{
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.AddOperations(readTempPressOps)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
}
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp)
@@ -853,8 +868,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
}
}
state2.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
@@ -703,6 +703,21 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
log.WarnFormat("End mass = {0}kg", EndMass);
}
if (test.DoDrainingAfter)
{
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.AddOperations(readTempPressOps)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
}
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_completed);
//------------------------------------------------
@@ -807,6 +807,36 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
log.WarnFormat("End mass = {0}kg", EndMass);
TestEndTime = DateTime.Now;
if (test.DoDrainingAfter)
{
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.AddOperations(readTempPressOps)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
}
if (test.DoDrainingAfter)
{
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.AddOperations(readTempPressOps)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
}
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_completed);
//------------------------------------------------
@@ -701,6 +701,21 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
log.WarnFormat("End mass = {0}kg", EndMass);
TestEndTime = DateTime.Now;
if (test.DoDrainingAfter)
{
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.AddOperations(readTempPressOps)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
}
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_completed);
//------------------------------------------------
@@ -693,6 +693,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
log.WarnFormat("End mass = {0}kg", EndMass);
TestEndTime = DateTime.Now;
if (test.DoDrainingAfter)
{
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
}
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_completed);
//------------------------------------------------
@@ -21,6 +21,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// 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 NrThreads; /// Numbwr of parallel threads (1, 2 or 4)
public bool UseMuxBoards;
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
@@ -50,7 +50,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
rfidPortBoard4TextBox.Text = config.RfidPortNrBoard4.ToString();
commTimeoutTextBox.Text = config.CommTimeout.ToString();
maxCommRetriesTextBox.Text = config.MaxCommRetries.ToString();
nrThreadsTextBox.Text = config.NrThreads.ToString();
delayBetweenRetriesTextBox.Text = config.DelayBetweenRetries.ToString();
nrThreadsTextBox.Text = config.NrThreads.ToString();
iperlCheckErrorsToStopTextBox.Text = config.IperlCheckErrorsToStop.ToString();
}
@@ -64,6 +65,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
rfidPortBoard4TextBox.Enabled = true;
commTimeoutTextBox.Enabled = true;
maxCommRetriesTextBox.Enabled = true;
delayBetweenRetriesTextBox.Enabled = true;
nrThreadsTextBox.Enabled = true;
iperlCheckErrorsToStopTextBox.Enabled = true;
}
@@ -103,7 +105,12 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Max. retries' should be in range 1 .. 10";
}
if (!int.TryParse(nrThreadsTextBox.Text, out dummy) || (dummy != 1 && dummy != 2 && dummy != 4))
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";
@@ -143,6 +150,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
tmp = int.Parse(maxCommRetriesTextBox.Text);
if (config.MaxCommRetries != tmp) { config.MaxCommRetries = tmp; flags = CfgUpdateFlags.RestartRqrd; }
tmp = int.Parse(delayBetweenRetriesTextBox.Text);
if (config.DelayBetweenRetries != tmp) { config.DelayBetweenRetries = tmp; flags = CfgUpdateFlags.RestartRqrd; }
tmp = int.Parse(nrThreadsTextBox.Text);
if (config.NrThreads != tmp) { config.NrThreads = tmp; flags = CfgUpdateFlags.RestartRqrd; }
@@ -53,16 +53,18 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
this.groupBox1 = new System.Windows.Forms.GroupBox();
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.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(154, 25);
this.nameTextBox.Location = new System.Drawing.Point(165, 25);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 5;
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
@@ -70,22 +72,22 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
this.nameLabel.Location = new System.Drawing.Point(23, 28);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 4;
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(153, 7);
this.classNameLabel.Location = new System.Drawing.Point(164, 7);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 3;
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// rfidPortBoard1TextBox
//
this.rfidPortBoard1TextBox.Enabled = false;
this.rfidPortBoard1TextBox.Location = new System.Drawing.Point(130, 44);
this.rfidPortBoard1TextBox.Location = new System.Drawing.Point(289, 20);
this.rfidPortBoard1TextBox.Name = "rfidPortBoard1TextBox";
this.rfidPortBoard1TextBox.Size = new System.Drawing.Size(45, 20);
this.rfidPortBoard1TextBox.TabIndex = 2;
@@ -93,7 +95,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// rfidPortBoard1Label
//
this.rfidPortBoard1Label.AutoSize = true;
this.rfidPortBoard1Label.Location = new System.Drawing.Point(12, 47);
this.rfidPortBoard1Label.Location = new System.Drawing.Point(171, 23);
this.rfidPortBoard1Label.Name = "rfidPortBoard1Label";
this.rfidPortBoard1Label.Size = new System.Drawing.Size(96, 13);
this.rfidPortBoard1Label.TabIndex = 1;
@@ -102,7 +104,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// rfidPortBoard2TextBox
//
this.rfidPortBoard2TextBox.Enabled = false;
this.rfidPortBoard2TextBox.Location = new System.Drawing.Point(130, 66);
this.rfidPortBoard2TextBox.Location = new System.Drawing.Point(289, 42);
this.rfidPortBoard2TextBox.Name = "rfidPortBoard2TextBox";
this.rfidPortBoard2TextBox.Size = new System.Drawing.Size(45, 20);
this.rfidPortBoard2TextBox.TabIndex = 4;
@@ -110,7 +112,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// rfidPortBoard2Label
//
this.rfidPortBoard2Label.AutoSize = true;
this.rfidPortBoard2Label.Location = new System.Drawing.Point(12, 69);
this.rfidPortBoard2Label.Location = new System.Drawing.Point(171, 45);
this.rfidPortBoard2Label.Name = "rfidPortBoard2Label";
this.rfidPortBoard2Label.Size = new System.Drawing.Size(96, 13);
this.rfidPortBoard2Label.TabIndex = 3;
@@ -119,7 +121,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// rfidPortBoard3TextBox
//
this.rfidPortBoard3TextBox.Enabled = false;
this.rfidPortBoard3TextBox.Location = new System.Drawing.Point(130, 88);
this.rfidPortBoard3TextBox.Location = new System.Drawing.Point(289, 64);
this.rfidPortBoard3TextBox.Name = "rfidPortBoard3TextBox";
this.rfidPortBoard3TextBox.Size = new System.Drawing.Size(45, 20);
this.rfidPortBoard3TextBox.TabIndex = 6;
@@ -127,7 +129,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// rfidPortBoard3Label
//
this.rfidPortBoard3Label.AutoSize = true;
this.rfidPortBoard3Label.Location = new System.Drawing.Point(12, 91);
this.rfidPortBoard3Label.Location = new System.Drawing.Point(171, 67);
this.rfidPortBoard3Label.Name = "rfidPortBoard3Label";
this.rfidPortBoard3Label.Size = new System.Drawing.Size(96, 13);
this.rfidPortBoard3Label.TabIndex = 5;
@@ -136,7 +138,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// rfidPortBoard4TextBox
//
this.rfidPortBoard4TextBox.Enabled = false;
this.rfidPortBoard4TextBox.Location = new System.Drawing.Point(130, 110);
this.rfidPortBoard4TextBox.Location = new System.Drawing.Point(289, 86);
this.rfidPortBoard4TextBox.Name = "rfidPortBoard4TextBox";
this.rfidPortBoard4TextBox.Size = new System.Drawing.Size(45, 20);
this.rfidPortBoard4TextBox.TabIndex = 8;
@@ -144,7 +146,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// rfidPortBoard4Label
//
this.rfidPortBoard4Label.AutoSize = true;
this.rfidPortBoard4Label.Location = new System.Drawing.Point(12, 113);
this.rfidPortBoard4Label.Location = new System.Drawing.Point(171, 89);
this.rfidPortBoard4Label.Name = "rfidPortBoard4Label";
this.rfidPortBoard4Label.Size = new System.Drawing.Size(96, 13);
this.rfidPortBoard4Label.TabIndex = 7;
@@ -153,10 +155,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// commTimeoutTextBox
//
this.commTimeoutTextBox.Enabled = false;
this.commTimeoutTextBox.Location = new System.Drawing.Point(154, 47);
this.commTimeoutTextBox.Location = new System.Drawing.Point(165, 47);
this.commTimeoutTextBox.Name = "commTimeoutTextBox";
this.commTimeoutTextBox.Size = new System.Drawing.Size(45, 20);
this.commTimeoutTextBox.TabIndex = 17;
this.commTimeoutTextBox.TabIndex = 4;
//
// commTimeoutLabel
//
@@ -164,16 +166,16 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
this.commTimeoutLabel.Location = new System.Drawing.Point(23, 50);
this.commTimeoutLabel.Name = "commTimeoutLabel";
this.commTimeoutLabel.Size = new System.Drawing.Size(98, 13);
this.commTimeoutLabel.TabIndex = 16;
this.commTimeoutLabel.TabIndex = 3;
this.commTimeoutLabel.Text = "Comm. timeout [ms]";
//
// maxCommRetriesTextBox
//
this.maxCommRetriesTextBox.Enabled = false;
this.maxCommRetriesTextBox.Location = new System.Drawing.Point(154, 69);
this.maxCommRetriesTextBox.Location = new System.Drawing.Point(165, 69);
this.maxCommRetriesTextBox.Name = "maxCommRetriesTextBox";
this.maxCommRetriesTextBox.Size = new System.Drawing.Size(45, 20);
this.maxCommRetriesTextBox.TabIndex = 19;
this.maxCommRetriesTextBox.TabIndex = 6;
//
// maxNrRetriesLabel
//
@@ -181,24 +183,24 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
this.maxNrRetriesLabel.Location = new System.Drawing.Point(23, 72);
this.maxNrRetriesLabel.Name = "maxNrRetriesLabel";
this.maxNrRetriesLabel.Size = new System.Drawing.Size(61, 13);
this.maxNrRetriesLabel.TabIndex = 18;
this.maxNrRetriesLabel.TabIndex = 5;
this.maxNrRetriesLabel.Text = "Max. retries";
//
// nrThreadsTextBox
//
this.nrThreadsTextBox.Enabled = false;
this.nrThreadsTextBox.Location = new System.Drawing.Point(154, 91);
this.nrThreadsTextBox.Location = new System.Drawing.Point(165, 113);
this.nrThreadsTextBox.Name = "nrThreadsTextBox";
this.nrThreadsTextBox.Size = new System.Drawing.Size(45, 20);
this.nrThreadsTextBox.TabIndex = 21;
this.nrThreadsTextBox.TabIndex = 10;
//
// nrThreadsLabel
//
this.nrThreadsLabel.AutoSize = true;
this.nrThreadsLabel.Location = new System.Drawing.Point(23, 94);
this.nrThreadsLabel.Location = new System.Drawing.Point(23, 116);
this.nrThreadsLabel.Name = "nrThreadsLabel";
this.nrThreadsLabel.Size = new System.Drawing.Size(59, 13);
this.nrThreadsLabel.TabIndex = 20;
this.nrThreadsLabel.TabIndex = 9;
this.nrThreadsLabel.Text = "Nr. threads";
//
// useMuxBrdsCheckBox
@@ -223,10 +225,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
this.groupBox1.Controls.Add(this.rfidPortBoard3TextBox);
this.groupBox1.Controls.Add(this.rfidPortBoard4Label);
this.groupBox1.Controls.Add(this.rfidPortBoard4TextBox);
this.groupBox1.Location = new System.Drawing.Point(26, 119);
this.groupBox1.Location = new System.Drawing.Point(26, 142);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(363, 139);
this.groupBox1.TabIndex = 23;
this.groupBox1.Size = new System.Drawing.Size(363, 117);
this.groupBox1.TabIndex = 11;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Multiplexer boards connected to USB ports";
//
@@ -236,7 +238,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
this.iperlCheckErrorsToStopTextBox.Location = new System.Drawing.Point(239, 267);
this.iperlCheckErrorsToStopTextBox.Name = "iperlCheckErrorsToStopTextBox";
this.iperlCheckErrorsToStopTextBox.Size = new System.Drawing.Size(45, 20);
this.iperlCheckErrorsToStopTextBox.TabIndex = 25;
this.iperlCheckErrorsToStopTextBox.TabIndex = 13;
//
// iperlCheckErrorsToStopLabel
//
@@ -244,13 +246,32 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
this.iperlCheckErrorsToStopLabel.Location = new System.Drawing.Point(23, 270);
this.iperlCheckErrorsToStopLabel.Name = "iperlCheckErrorsToStopLabel";
this.iperlCheckErrorsToStopLabel.Size = new System.Drawing.Size(202, 13);
this.iperlCheckErrorsToStopLabel.TabIndex = 24;
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(165, 91);
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, 94);
this.delayBetweenRetriesLabel.Name = "delayBetweenRetriesLabel";
this.delayBetweenRetriesLabel.Size = new System.Drawing.Size(131, 13);
this.delayBetweenRetriesLabel.TabIndex = 7;
this.delayBetweenRetriesLabel.Text = "Delay between retries [ms]";
//
// TestMethodCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.delayBetweenRetriesTextBox);
this.Controls.Add(this.delayBetweenRetriesLabel);
this.Controls.Add(this.iperlCheckErrorsToStopTextBox);
this.Controls.Add(this.iperlCheckErrorsToStopLabel);
this.Controls.Add(this.groupBox1);
@@ -296,5 +317,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox iperlCheckErrorsToStopTextBox;
private System.Windows.Forms.Label iperlCheckErrorsToStopLabel;
private System.Windows.Forms.TextBox delayBetweenRetriesTextBox;
private System.Windows.Forms.Label delayBetweenRetriesLabel;
}
}
@@ -277,7 +277,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
case 3: retv = writeRequestPort4(messageID, offset, length, pBuf, timeout); break;
}
Thread.Sleep(250);
/// Delay min. 250 ms
Thread.Sleep(Math.Max(250, cfg.DelayBetweenRetries));
///
/// Logging
@@ -693,11 +694,19 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
UpdateRfidCommResult(tests); /// TODO: Pass the test info in a correct way
}
long checkboxStates = GetCheckBoxStates();
if (Program.LocalSettings.iPerlCommunicationsFormLeft != Location.X ||
Program.LocalSettings.iPerlCommunicationsFormTop != Location.Y ||
Program.LocalSettings.iPerlCommunicationsFormCheckboxes != checkboxStates)
{
/// Update local settings
Program.LocalSettings.iPerlCommunicationsFormLeft = Location.X;
Program.LocalSettings.iPerlCommunicationsFormTop = Location.Y;
Program.LocalSettings.iPerlCommunicationsFormCheckboxes = checkboxStates;
Program.LocalSettings.Save();
}
formCompleted = true;
Program.LocalSettings.iPerlCommunicationsFormLeft = Location.X;
Program.LocalSettings.iPerlCommunicationsFormTop = Location.Y;
Program.LocalSettings.iPerlCommunicationsFormCheckboxes = GetCheckBoxStates();
Program.LocalSettings.Save();
DialogResult = DialogResult.OK;
Close();
@@ -929,6 +938,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
resultStr = ihead.ConfigStruct.ToString(1);
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
ClosePort(threadId, ihead); /// Close RFID port
@@ -981,10 +993,18 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
byte[] cmd = new byte[1] { (byte)Command.SetActiveMode };
for (int j = 0; j < cfg.MaxCommRetries; j++)
{
if (0 == WriteRequestPort(threadId, ihead, MessageID.Command, 0, 1, cmd, cfg.CommTimeout)) { error = CommErr.None; break; }
if (0 == WriteRequestPort(threadId, ihead, MessageID.Command, 0, 1, cmd, cfg.CommTimeout))
{
error = CommErr.None;
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
Thread.Sleep(250);
/// Delay min. 250 ms
Thread.Sleep(Math.Max(250, cfg.DelayBetweenRetries));
}
if (error == CommErr.None && (ihead.ConfigStruct.TestModeConfig != testModeConfig))
@@ -1000,9 +1020,13 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
error = CommErr.None;
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
Thread.Sleep(250);
/// Delay min. 250 ms
Thread.Sleep(Math.Max(250, cfg.DelayBetweenRetries));
}
if (error == CommErr.None)
@@ -1012,10 +1036,18 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
byte[] cmd = new byte[1] { (byte)Command.SetTestMode };
for (int j = 0; j < cfg.MaxCommRetries; j++)
{
if (0 == WriteRequestPort(threadId, ihead, MessageID.Command, 0, 1, cmd, cfg.CommTimeout)) { error = CommErr.None; break; }
if (0 == WriteRequestPort(threadId, ihead, MessageID.Command, 0, 1, cmd, cfg.CommTimeout))
{
error = CommErr.None;
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
Thread.Sleep(250);
/// Delay min. 250 ms
Thread.Sleep(Math.Max(250, cfg.DelayBetweenRetries));
}
/// Now the meter should be in the Test mode ... verify
@@ -1036,6 +1068,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
break;
}
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
}
@@ -1067,6 +1102,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
error = CommErr.None;
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
#if VERIFY_ACTIVE_MODE
@@ -1091,6 +1129,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
}
}
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
}
#else
@@ -1143,6 +1184,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
error = ihead.VerifyIPerlType() ? CommErr.None : CommErr.WrongIPerlType;
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
ClosePort(threadId, ihead); /// Close RFID port
@@ -1186,6 +1230,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
error = ihead.VerifyIPerlType() ? CommErr.None : CommErr.WrongIPerlType;
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
ClosePort(threadId, ihead); /// Close RFID port
@@ -1504,8 +1551,16 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
ihead.CalibrationStructV4.Update(data, 2);
ihead.CalibrationStructV4.Update(dataLNA, 34);
writeAndVerifyRetries++;
if ((writeAndVerifyRetries <= cfg.MaxCommRetries) && (cfg.DelayBetweenRetries > 0))
{
/// Delay between retries
Thread.Sleep(cfg.DelayBetweenRetries);
}
}
while (++writeAndVerifyRetries <= cfg.MaxCommRetries);
while (writeAndVerifyRetries <= cfg.MaxCommRetries);
ClosePort(threadId, ihead); /// Close RFID port
@@ -1591,6 +1646,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
ihead.CalibrationStruct.Update(data, 2);
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
if (error == CommErr.None)
@@ -1608,6 +1666,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
resultStr = ihead.CalibrationStruct.ToString();
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
}
@@ -1663,6 +1724,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
ihead.CalibrationStructV4.Update(data, 2);
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
if (error == CommErr.None)
@@ -1680,6 +1744,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
resultStr = ihead.CalibrationStructV4.ToString();
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
}
@@ -1714,6 +1781,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
error = CommErr.None;
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
if ((error == CommErr.None) && (rdData != null) && (rdData.Length == 2))
@@ -1768,7 +1838,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
error = CommErr.None;
break;
}
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
///
/// Verification disabled on 16.02.2016
@@ -1790,6 +1863,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
resultStr = string.Format("Q2 correction set to LR={0}, RL={1}", factorLR, factorRL);
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
}
#else
@@ -1852,7 +1928,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
error = CommErr.None;
break;
}
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
///
/// Verification disabled on 16.02.2016
@@ -1875,10 +1954,13 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
ihead.Q2CorrectionFactor = 0;
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
}
#else
if (error == CommErr.None)
if (error == CommErr.None)
{
resultStr = "2Hz correction reset to 0";
ihead.Hz2Correction = 0;
@@ -2080,7 +2162,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
///
/// Standard process
///
if (Math.Abs(q2adjResult.Error - ihead.CalibTargetQ2) <= 0.5)
if ((Math.Abs(q2adjResult.Error - ihead.CalibTargetQ2) <= 0.5) && !ihead.DoQ2CorrInside05pct)
{
resultStr = string.Format("Q2 correction = 0 (writing bypassed)");
return CommErr.None;
@@ -2094,7 +2176,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
///
/// Process for DEWA
///
if (Math.Abs(q2adjResult.Error - ihead.CalibTargetQ2) <= 0.5)
if ((Math.Abs(q2adjResult.Error - ihead.CalibTargetQ2) <= 0.5) && !ihead.DoQ2CorrInside05pct)
{
resultStr = string.Format("Q2 correction = 0 (writing bypassed)");
return CommErr.None;
@@ -2109,7 +2191,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
///
/// Process for Greece
///
if (Math.Abs(q2adjResult.Error - ihead.CalibTargetQ2) <= 0.5)
if ((Math.Abs(q2adjResult.Error - ihead.CalibTargetQ2) <= 0.5) && !ihead.DoQ2CorrInside05pct)
{
resultStr = string.Format("Q2 correction = 0 (writing bypassed)");
return CommErr.None;
@@ -2120,7 +2202,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
}
else if (q2CorrType == Q2CorrType.RL) /// SUEZ
{
if (Math.Abs(q2adjResult.Error - ihead.CalibTargetQ2) <= 0.5)
if ((Math.Abs(q2adjResult.Error - ihead.CalibTargetQ2) <= 0.5) && !ihead.DoQ2CorrInside05pct)
{
resultStr = string.Format("Q2 correction = 0 (writing bypassed)");
return CommErr.None;
@@ -2130,7 +2212,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
}
else if (q2CorrType == Q2CorrType.LR) /// SUEZ
{
if (Math.Abs(q2adjResult.Error - ihead.CalibTargetQ2) <= 0.5)
if ((Math.Abs(q2adjResult.Error - ihead.CalibTargetQ2) <= 0.5) && !ihead.DoQ2CorrInside05pct)
{
resultStr = string.Format("Q2 correction = 0 (writing bypassed)");
return CommErr.None;
@@ -2165,6 +2247,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
error = CommErr.None;
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
}
else if (q2CorrType == Q2CorrType.LR)
@@ -2180,6 +2265,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
error = CommErr.None;
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
}
else
@@ -2195,6 +2283,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
error = CommErr.None;
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
}
@@ -2222,6 +2313,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (q2CorrType != Q2CorrType.RL) wm.Q2CorrLFlow = ihead.Q2CorrLFlow = (int)(sbyte)q2CorrLFlow;
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
}
#else
@@ -2297,7 +2391,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
wm.Hz2CorrectionDone = ihead.Hz2CorrectionDone = true;
break;
}
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
///
/// Verification disabled on 16.02.2016
@@ -2322,6 +2419,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
wm.Hz2CorrectionDone = ihead.Hz2CorrectionDone;
break;
}
/// Delay between retries
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
}
#else
@@ -37,6 +37,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
public double CalibTarget { get { return iperlHeadCfg.ProcParams.CalibTarget; } }
public double CalibTargetQ2 { get { return iperlHeadCfg.ProcParams.CalibTargetQ2; } }
public bool DoQ2CorrInside05pct { get { return iperlHeadCfg.ProcParams.DoQ2CorrInside05pct; } }
public ushort FactorLimitLo { get { return (ushort)iperlHeadCfg.ProcParams.FactorLimitLo; } }
public ushort FactorLimitHi { get { return (ushort)iperlHeadCfg.ProcParams.FactorLimitHi; } }
public Counting InitFlowDir { get { return (iperlHeadCfg != null && iperlHeadCfg.ProcParams != null) ? iperlHeadCfg.ProcParams.Counting : Counting.Arbitrary; } }
@@ -2,11 +2,12 @@
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
using System.Collections.Generic;
using TBF.Resources;
namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
{
@@ -18,6 +19,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
public MeterType MeterType;
public float CalibTarget; /// Target error after calibration in [%]
public float CalibTargetQ2; /// Target error at Q2 after Q2 correction in [%]
public bool DoQ2CorrInside05pct; /// true = Q2 correction is performed also when Q2 error is within -0.5% .. 0.5%
public int FactorLimitLo; /// Lower limit for the calibration factor
public int FactorLimitHi; /// Upper limit for the calibration factor
public Counting Counting; /// Initial iPerl counting (Artbitrary, Positive or Negative)
@@ -31,6 +33,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
MeterType = MeterType.AutoDetect;
CalibTarget = 0;
CalibTargetQ2 = 0;
DoQ2CorrInside05pct = false;
FactorLimitLo = 1000;
FactorLimitHi = 8000;
Counting = Counting.Arbitrary;
@@ -44,6 +47,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
"iPerl type",
"Calib. target [%]",
"Calib. target at Q2 [%]",
"Q2 corr. inside -0.5 - 0.5%",
"Calib. factor Lo",
"Calib. factor Hi",
"Counting",
@@ -62,7 +66,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
for (MeterType mt = 0; mt < MeterType.Count; mt++) retVal.Add(mt.ToString());
return retVal;
}
else if (i == 5)
else if (i == 6)
{
IList<string> retVal = new List<string>();
for (Counting c = 0; c < Counting.Count; c++) retVal.Add(c.ToString());
@@ -78,12 +82,13 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
case 0: return MeterType.ToString();
case 1: return CalibTarget.ToString();
case 2: return CalibTargetQ2.ToString();
case 3: return FactorLimitLo.ToString();
case 4: return FactorLimitHi.ToString();
case 5: return Counting.ToString();
case 6: return WMType_ID.ToString();
case 7: return InitQ2CorrLR.ToString();
case 8: return InitQ2CorrRL.ToString();
case 3: return (DoQ2CorrInside05pct ? Strings.yes : Strings.no);
case 4: return FactorLimitLo.ToString();
case 5: return FactorLimitHi.ToString();
case 6: return Counting.ToString();
case 7: return WMType_ID.ToString();
case 8: return InitQ2CorrLR.ToString();
case 9: return InitQ2CorrRL.ToString();
default: return string.Empty;
}
}
@@ -100,17 +105,18 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
break;
case 1: CalibTarget = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 2: CalibTargetQ2 = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
case 3: FactorLimitLo = int.Parse(strValue); return CfgUpdateFlags.None;
case 4: FactorLimitHi = int.Parse(strValue); return CfgUpdateFlags.None;
case 5:
case 3: DoQ2CorrInside05pct = strValue.ToLower().Equals(Strings.yes.ToLower()); return CfgUpdateFlags.None;
case 4: FactorLimitLo = int.Parse(strValue); return CfgUpdateFlags.None;
case 5: FactorLimitHi = int.Parse(strValue); return CfgUpdateFlags.None;
case 6:
for (Counting c = 0; c < Counting.Count; c++)
{
if (c.ToString().Equals(strValue)) { Counting = c; return CfgUpdateFlags.None; }
}
break;
case 6: WMType_ID = int.Parse(strValue); return CfgUpdateFlags.None;
case 7: InitQ2CorrLR = int.Parse(strValue); return CfgUpdateFlags.None;
case 8: InitQ2CorrRL = int.Parse(strValue); return CfgUpdateFlags.None;
case 7: WMType_ID = int.Parse(strValue); return CfgUpdateFlags.None;
case 8: InitQ2CorrLR = int.Parse(strValue); return CfgUpdateFlags.None;
case 9: InitQ2CorrRL = int.Parse(strValue); return CfgUpdateFlags.None;
default: return CfgUpdateFlags.None;
}
@@ -133,18 +139,21 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
case 2:
if (Utils.TryParseSFloat(strValue, out fDummy) && fDummy >= -10.0f && fDummy <= 10.0f) return true;
break;
case 3:
case 3:
if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true;
break;
case 4:
case 5:
if (int.TryParse(strValue, out iDummy) && iDummy >= 1000 && iDummy <= 8000) return true;
break;
case 5:
case 6:
for (Counting c = 0; c < Counting.Count; c++) if (c.ToString().Equals(strValue)) return true;
break;
case 6: /// WMType_ID
case 7: /// WMType_ID
if (int.TryParse(strValue, out iDummy)) return true;
break;
case 7: /// InitQ2CorrLR
case 8: /// InitQ2CorrRL
case 8: /// InitQ2CorrLR
case 9: /// InitQ2CorrRL
if (int.TryParse(strValue, out iDummy) || (iDummy < -127) || (iDummy > 127)) return true;
break;
default:
@@ -161,6 +170,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
prms.MeterType = this.MeterType;
prms.CalibTarget = this.CalibTarget;
prms.CalibTargetQ2 = this.CalibTargetQ2;
prms.DoQ2CorrInside05pct = this.DoQ2CorrInside05pct;
prms.FactorLimitLo = this.FactorLimitLo;
prms.FactorLimitHi = this.FactorLimitHi;
prms.Counting = this.Counting;
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.18.1331.0")]
[assembly: AssemblyFileVersion("2.18.1331.0")]
[assembly: AssemblyVersion("2.18.1362.0")]
[assembly: AssemblyFileVersion("2.18.1362.0")]
+18
View File
@@ -1365,6 +1365,24 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Draining after.
/// </summary>
internal static string Draining_after {
get {
return ResourceManager.GetString("Draining_after", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Draining before.
/// </summary>
internal static string Draining_before {
get {
return ResourceManager.GetString("Draining_before", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Leak duration [s].
/// </summary>
+6
View File
@@ -1494,4 +1494,10 @@
<data name="Update" xml:space="preserve">
<value>Modifikovat</value>
</data>
<data name="Draining_after" xml:space="preserve">
<value>Vyprázdnění po</value>
</data>
<data name="Draining_before" xml:space="preserve">
<value>Vyprázdnění před</value>
</data>
</root>
+6
View File
@@ -2068,4 +2068,10 @@
<data name="Update" xml:space="preserve">
<value>Update</value>
</data>
<data name="Draining_after" xml:space="preserve">
<value>Draining after</value>
</data>
<data name="Draining_before" xml:space="preserve">
<value>Draining before</value>
</data>
</root>
+18 -10
View File
@@ -4,31 +4,35 @@
<TestBenches>
<DatabaseSettings>
<BenchName>Test Bench</BenchName>
<BenchName>Mobile test bench</BenchName>
<IsRealBench>true</IsRealBench>
<ProceduresDBSettings>
<DbType>MySql</DbType>
<ConnectionString>SERVER=localhost; DATABASE=testbench; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
</ProceduresDBSettings>
<WaterMetersDBSettings>
<ConnectionString>SERVER=localhost; DATABASE=rummob; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
<DbType>MySql</DbType>
<ConnectionString>SERVER=localhost; DATABASE=testbench-r; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
</WaterMetersDBSettings>
<ConnectionString>SERVER=localhost; DATABASE=rummob-r; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
<ConnectionString />
</DatabaseSettings>
</TestBenches>
<LastBench>Test Bench</LastBench>
<LoginMethod>UserName</LoginMethod>
<LastBench>Mobile test bench</LastBench>
<BatchNr>1</BatchNr>
<RealDensity>998.2008</RealDensity>
<AtTemperature>20</AtTemperature>
<RightPaneHorizSplitterDistance>25</RightPaneHorizSplitterDistance>
<MainWndLeft>75</MainWndLeft>
<MainWndTop>5</MainWndTop>
<TopPaneVerticalSplitterDistance>596</TopPaneVerticalSplitterDistance>
<MainWndLeft>76</MainWndLeft>
<MainWndTop>21</MainWndTop>
<MainWndWidth>1250</MainWndWidth>
<MainWndHeight>750</MainWndHeight>
<ManiWndMaximized>false</ManiWndMaximized>
<ManiWndMaximized>true</ManiWndMaximized>
<ComponentsDlgLeft>200</ComponentsDlgLeft>
<ComponentsDlgTop>100</ComponentsDlgTop>
<ComponentsDlgWidth>850</ComponentsDlgWidth>
<ComponentsDlgHeight>500</ComponentsDlgHeight>
<PopupResultsLeft>0</PopupResultsLeft>
<PopupResultsTop>0</PopupResultsTop>
<PopupResultsWidth>0</PopupResultsWidth>
<PopupResultsHeight>0</PopupResultsHeight>
<PathsDlgLeft>0</PathsDlgLeft>
<PathsDlgTop>0</PathsDlgTop>
<PathsDlgWidth>0</PathsDlgWidth>
@@ -53,6 +57,10 @@
<OneProcedureDlgHeight>0</OneProcedureDlgHeight>
<PrintOrderLeft>0</PrintOrderLeft>
<PrintOrderTop>0</PrintOrderTop>
<EnduranceDlgLeft>0</EnduranceDlgLeft>
<EnduranceDlgTop>0</EnduranceDlgTop>
<EnduranceDlgWidth>0</EnduranceDlgWidth>
<EnduranceDlgHeight>0</EnduranceDlgHeight>
<PrintOrderOnlyGoodResult>false</PrintOrderOnlyGoodResult>
<PrintOrderOnlyLastResult>false</PrintOrderOnlyLastResult>
<ResultsConfigMeters>Vertically</ResultsConfigMeters>
+2 -1
View File
@@ -60,10 +60,11 @@
<logger name="NHibernate"> <level value="ERROR" /> </logger>
<logger name="TBF.BenchControl.StateMachine"> <level value="INFO" /> </logger>
<logger name="TBF.BenchControl.State"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Elde.ControlComdWrap"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Elde.ControlComWrap"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Elde.Pump"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Elde.PumpWithFM"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.MettlerToledo"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Fomulas"> <level value="FATAL" /> </logger>
<logger name="TBF.BenchControl.Elde.StartMeasurementOp"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Modbus"> <level value="DEBUG" /> </logger>
</log4net>
+39 -19
View File
@@ -39,7 +39,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEBUG;RUM_MOB;LANG_RO;STABLE_MASS_EXTRAS;CAMERA</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -49,7 +49,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;RUM_MOB;LANG_RO;STABLE_MASS_EXTRAS;CAMERA</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -58,7 +58,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEBUG;RUM_MOB;LANG_RO;STABLE_MASS_EXTRAS;CAMERA</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
@@ -67,7 +67,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;RUM_MOB;LANG_RO;STABLE_MASS_EXTRAS;CAMERA</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
@@ -97,8 +97,8 @@
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="ControlComponent3Munich">
<HintPath>..\packages\ControlBoard\Munich\ControlComponent3Munich.dll</HintPath>
<Reference Include="ControlComponent3U">
<HintPath>..\packages\ControlBoard\Rumunsko-Mob\ControlComponent3U.dll</HintPath>
</Reference>
<Reference Include="FluentNHibernate">
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
@@ -572,6 +572,7 @@
<Compile Include="BenchControl\Elde\RegulValveCoax\Factory.cs" />
<Compile Include="BenchControl\Elde\RegulValveCoax\SetFlowOp.cs" />
<Compile Include="BenchControl\Elde\RegulValveCoax\SetRegulValvePositionOp.cs" />
<Compile Include="BenchControl\Elde\SendCommandArgs.cs" />
<Compile Include="BenchControl\Elde\SetValvesOp.cs" />
<Compile Include="BenchControl\Elde\StopFlowRegulationOp.cs" />
<Compile Include="BenchControl\Elde\TempMeterInternal\ReadTempOp.cs" />
@@ -1147,22 +1148,38 @@
<Compile Include="BenchControl\TestMethods\FixedStartAdvanced\FixedStartAdvancedSeq.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartAdvanced\Single\Component.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartAdvanced\Single\Factory.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEvaluation\Compound\Component.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEvaluation\Compound\Factory.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEvaluation\FixedStartDeferredEvaluationSeq.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEvaluation\HeatMeters\Component.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEvaluation\HeatMeters\Factory.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEvaluation\HeatMeters\TestMethodCfg.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEvaluation\HeatMeters\TestMethodCfgCtrl.cs">
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEval\Compound\Component.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEval\Compound\Factory.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEval\FixedStartDeferredEvalSeq.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEval\HeatMeters\Component.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEval\HeatMeters\Factory.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEval\HeatMeters\TestMethodCfg.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEval\HeatMeters\TestMethodCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEvaluation\HeatMeters\TestMethodCfgCtrl.designer.cs">
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEval\HeatMeters\TestMethodCfgCtrl.designer.cs">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEvaluation\HeatMeters\TestParams.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEvaluation\IntermediateData.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEvaluation\Single\Component.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEvaluation\Single\Factory.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEval\HeatMeters\TestParams.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEval\IntermediateData.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEval\Single\Component.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartDeferredEval\Single\Factory.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartMassCollDeferredEval\Compound\Component.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartMassCollDeferredEval\Compound\Factory.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartMassCollDeferredEval\FixedStartMassCollDeferredEvalSeq.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartMassCollDeferredEval\HeatMeters\Component.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartMassCollDeferredEval\HeatMeters\Factory.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartMassCollDeferredEval\HeatMeters\TestMethodCfg.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartMassCollDeferredEval\HeatMeters\TestMethodCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BenchControl\TestMethods\FixedStartMassCollDeferredEval\HeatMeters\TestMethodCfgCtrl.designer.cs">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\TestMethods\FixedStartMassCollDeferredEval\HeatMeters\TestParams.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartMassCollDeferredEval\IntermediateData.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartMassCollDeferredEval\Single\Component.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartMassCollDeferredEval\Single\Factory.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartMassCollection\Compound\Component.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartMassCollection\Compound\Factory.cs" />
<Compile Include="BenchControl\TestMethods\FixedStartMassCollection\HeatMeters\Component.cs" />
@@ -2845,7 +2862,10 @@
<EmbeddedResource Include="BenchControl\TestMethods\Endurance\CycleDlg.ru.resx">
<DependentUpon>CycleDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\TestMethods\FixedStartDeferredEvaluation\HeatMeters\TestMethodCfgCtrl.resx">
<EmbeddedResource Include="BenchControl\TestMethods\FixedStartDeferredEval\HeatMeters\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\TestMethods\FixedStartMassCollDeferredEval\HeatMeters\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\TestMethods\FixedStartTankCollection\Compound\TestMethodCfgCtrl.resx">
+1 -1
View File
@@ -54,7 +54,7 @@ namespace TBF.UI
this.horizontalSplitContainer = new System.Windows.Forms.SplitContainer();
this.mainTabControl = new System.Windows.Forms.TabControl();
this.homeTabPage = new System.Windows.Forms.TabPage();
this.ctrlBrdComponent = new ControlComponent3Munich.UserControl1();
this.ctrlBrdComponent = new ControlComponent_Torino2015.UserControl1();
this.processTabPage = new System.Windows.Forms.TabPage();
this.processTabPageCtrl = new TBF.UI.Process.ProcessTabPageCtrl6();
this.insertTabPage = new System.Windows.Forms.TabPage();
+110 -42
View File
@@ -917,7 +917,6 @@ namespace TBF.UI.Procedures
{
Name,
Part,
TankDraining,
Uncertainty,
ControlWaterTemp,
TempLimLo,
@@ -935,7 +934,6 @@ namespace TBF.UI.Procedures
ListViewEx lv = metrology2ListViewEx;
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Emptying_chdr, Width = 60 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Uncertainty_pct_chdr, Width = 90 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Control_water_temp_chdr, Width = 110 });
lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [°C]", Strings.Temp_lim_lo_chdr), Width = 100 });
@@ -953,11 +951,6 @@ namespace TBF.UI.Procedures
publishCBox.Items.Add(pb.ToDescription());
}
ComboBox yesNo1CBox = new ComboBox(); /// control for Emptying
yesNo1CBox.Items.Add(Strings.yes);
yesNo1CBox.Items.Add(Strings.no);
ComboBox yesNo2CBox = new ComboBox(); /// control for Control water temp.
yesNo2CBox.Items.Add(Strings.yes);
yesNo2CBox.Items.Add(Strings.no);
@@ -970,7 +963,6 @@ namespace TBF.UI.Procedures
{
new TextBox(), /// Name
new TextBox(), /// Part
yesNo1CBox, /// Emptying
new TextBox(), /// Uncertainty
yesNo2CBox, /// Control water temp.
new TextBox(), /// Temp. lim. lo
@@ -1005,7 +997,6 @@ namespace TBF.UI.Procedures
ListViewItem lvi = new ListViewItem(test.Name); /// Name
lvi.Tag = test;
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
lvi.SubItems.Add(test.DoDraining ? Strings.yes : Strings.no);
lvi.SubItems.Add(test.Uncertainty.ToString());
lvi.SubItems.Add(test.DoControlWaterTemp ? Strings.yes : Strings.no);
lvi.SubItems.Add(test.TempLimLo.ToString());
@@ -1037,9 +1028,6 @@ namespace TBF.UI.Procedures
entity.Part = part;
}
if (lvi.SubItems[(int)Mtrlgy2Clmn.TankDraining].Text.Equals(Strings.yes)) entity.DoDraining = true;
else if (lvi.SubItems[(int)Mtrlgy2Clmn.TankDraining].Text.Equals(Strings.no)) entity.DoDraining = false;
if (lvi.SubItems[(int)Mtrlgy2Clmn.ControlWaterTemp].Text.Equals(Strings.yes)) entity.DoControlWaterTemp = true;
else if (lvi.SubItems[(int)Mtrlgy2Clmn.ControlWaterTemp].Text.Equals(Strings.no)) entity.DoControlWaterTemp = false;
@@ -1114,13 +1102,6 @@ namespace TBF.UI.Procedures
}
}
if ((e.SubItem == (int)Mtrlgy2Clmn.TankDraining) && !(metrology2Editors[(int)Mtrlgy2Clmn.TankDraining] as ComboBox).Items.Contains(e.DisplayText))
{
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return;
}
if ((e.SubItem == (int)Mtrlgy2Clmn.ControlWaterTemp) && !(metrology2Editors[(int)Mtrlgy2Clmn.ControlWaterTemp] as ComboBox).Items.Contains(e.DisplayText))
{
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
@@ -1166,6 +1147,8 @@ namespace TBF.UI.Procedures
{
Name,
Part,
DrainingBefore,
DrainingAfter,
Feeding,
Bench,
Output,
@@ -1186,6 +1169,8 @@ namespace TBF.UI.Procedures
ListViewEx lv = processListViewEx;
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Draining_before, Width = 90 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Draining_after, Width = 90 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Feeding_chdr, Width = 80 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Bench_chdr, Width = 80 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Output_chdr, Width = 80 });
@@ -1197,10 +1182,20 @@ namespace TBF.UI.Procedures
lv.Columns.Add(new ColumnHeader { Text = Strings.TransitionBetween_chdr, Width = 100 });
lv.Columns.Add(new ColumnHeader { Text = Strings.TransitionEnd_chdr, Width = 100 });
ComboBox yesNo1CBox = new ComboBox(); /// control for Draining before test
yesNo1CBox.Items.Add(Strings.yes);
yesNo1CBox.Items.Add(Strings.no);
ComboBox yesNo2CBox = new ComboBox(); /// control for Draining after test
yesNo2CBox.Items.Add(Strings.yes);
yesNo2CBox.Items.Add(Strings.no);
processEditors = new Control[]
{
new TextBox(), /// Name
new TextBox(), /// Part
yesNo1CBox,
yesNo2CBox,
new ComboBox(), /// Feeding
new ComboBox(), /// Table
new ComboBox(), /// Output
@@ -1250,22 +1245,45 @@ namespace TBF.UI.Procedures
void AddToProcessTab(Test test)
{
ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent(test.Method, TbfComponents) as ITestMethod;
///
/// Process item with subitems
///
ListViewItem lvi = new ListViewItem(test.Name); /// Name
ListViewItem lvi = new ListViewItem(test.Name); /// Name
lvi.Tag = test;
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
lvi.SubItems.Add(test.FeedingPath);
lvi.SubItems.Add(test.BenchPath);
lvi.SubItems.Add(test.OutputPath);
lvi.SubItems.Add(test.MetersPath);
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
if (tm != null && tm.DoTransitions())
{
lvi.SubItems.Add(test.DoDraining ? Strings.yes : Strings.no); /// Draining before test
lvi.SubItems.Add(test.DoDrainingAfter ? Strings.yes : Strings.no); /// Draining after test
lvi.SubItems.Add(test.FeedingPath);
lvi.SubItems.Add(test.BenchPath);
lvi.SubItems.Add(test.OutputPath);
#if HEAT_METERS
lvi.SubItems.Add(test.HeatMetersPath);
#endif
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBefore) ? "---" : test.RelTransBefore);
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBetween) ? "---" : test.RelTransBetween);
lvi.SubItems.Add(string.IsNullOrEmpty(test.TransitionAfter) ? "---" : test.TransitionAfter);
lvi.SubItems.Add(test.MetersPath);
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBefore) ? "---" : test.RelTransBefore);
lvi.SubItems.Add(string.IsNullOrEmpty(test.RelTransBetween) ? "---" : test.RelTransBetween);
lvi.SubItems.Add(string.IsNullOrEmpty(test.TransitionAfter) ? "---" : test.TransitionAfter);
}
else
{
lvi.SubItems.Add(string.Empty); /// Draining before test N/A
lvi.SubItems.Add(string.Empty); /// Draining after test N/A
lvi.SubItems.Add(string.Empty); /// FeedingPath N/A
lvi.SubItems.Add(string.Empty); /// BenchPath N/A
lvi.SubItems.Add(string.Empty); /// OutputPath N/A
#if HEAT_METERS
lvi.SubItems.Add(test.HeatMetersPath);
#endif
lvi.SubItems.Add(test.MetersPath);
lvi.SubItems.Add(string.Empty); /// RelTransBefore N/A
lvi.SubItems.Add(string.Empty); /// RelTransBetween N/A
lvi.SubItems.Add(string.Empty); /// TransitionAfter N/A
}
processListViewEx.Items.Add(lvi);
}
@@ -1290,21 +1308,35 @@ namespace TBF.UI.Procedures
entity.Part = part;
}
if ((processEditors[(int)ProcessClmn.Feeding] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Feeding].Text))
entity.DoDraining = lvi.SubItems[(int)ProcessClmn.DrainingBefore].Text.Equals(Strings.yes);
entity.DoDrainingAfter = lvi.SubItems[(int)ProcessClmn.DrainingAfter].Text.Equals(Strings.yes);
int column = (int)ProcessClmn.Feeding;
string subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.FeedingPath = lvi.SubItems[(int)ProcessClmn.Feeding].Text;
entity.FeedingPath = subItemText;
}
if ((processEditors[(int)ProcessClmn.Bench] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Bench].Text))
column = (int)ProcessClmn.Bench;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.BenchPath = lvi.SubItems[(int)ProcessClmn.Bench].Text;
entity.BenchPath = subItemText;
}
if ((processEditors[(int)ProcessClmn.Output] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Output].Text))
column = (int)ProcessClmn.Output;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.OutputPath = lvi.SubItems[(int)ProcessClmn.Output].Text;
entity.OutputPath = subItemText;
}
if ((processEditors[(int)ProcessClmn.Sensor] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Sensor].Text))
column = (int)ProcessClmn.Sensor;
subItemText = lvi.SubItems[column].Text;
if ((processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.MetersPath = lvi.SubItems[(int)ProcessClmn.Sensor].Text;
entity.MetersPath = subItemText;
}
#if HEAT_METERS
if ((processEditors[(int)ProcessClmn.HeatMeterSensors] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text))
@@ -1312,17 +1344,25 @@ namespace TBF.UI.Procedures
entity.HeatMetersPath = lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text;
}
#endif
if ((processEditors[(int)ProcessClmn.TrnStart] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.TrnStart].Text))
column = (int)ProcessClmn.TrnStart;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.RelTransBefore = lvi.SubItems[(int)ProcessClmn.TrnStart].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)ProcessClmn.TrnStart].Text;
entity.RelTransBefore = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
}
if ((processEditors[(int)ProcessClmn.TrnBetween] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.TrnBetween].Text))
column = (int)ProcessClmn.TrnBetween;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.RelTransBetween = lvi.SubItems[(int)ProcessClmn.TrnBetween].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)ProcessClmn.TrnBetween].Text;
entity.RelTransBetween = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
}
if ((processEditors[(int)ProcessClmn.TrnStop] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.TrnStop].Text))
column = (int)ProcessClmn.TrnStop;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
{
entity.TransitionAfter = lvi.SubItems[(int)ProcessClmn.TrnStop].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)ProcessClmn.TrnStop].Text;
entity.TransitionAfter = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
}
}
}
@@ -1334,6 +1374,20 @@ namespace TBF.UI.Procedures
return;
}
ITestMethod tm = TBF.BenchControl.TbfComponents.FindComponent((e.Item.Tag as Test).Method, TbfComponents) as ITestMethod;
if (tm != null && (tm.DoTransitions() == false) && ((e.SubItem == (int)ProcessClmn.DrainingBefore) ||
(e.SubItem == (int)ProcessClmn.DrainingAfter) ||
(e.SubItem == (int)ProcessClmn.Feeding) ||
(e.SubItem == (int)ProcessClmn.Bench) ||
(e.SubItem == (int)ProcessClmn.Output) ||
(e.SubItem == (int)ProcessClmn.TrnStart) ||
(e.SubItem == (int)ProcessClmn.TrnBetween) ||
(e.SubItem == (int)ProcessClmn.TrnStop)))
{
return;
}
processListViewEx.StartEditing(processEditors[e.SubItem], e.Item, e.SubItem);
}
@@ -1390,6 +1444,20 @@ namespace TBF.UI.Procedures
}
}
if ((e.SubItem == (int)ProcessClmn.DrainingBefore) && !(processEditors[(int)ProcessClmn.DrainingBefore] as ComboBox).Items.Contains(e.DisplayText))
{
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return; /// NOK
}
if ((e.SubItem == (int)ProcessClmn.DrainingAfter) && !(processEditors[(int)ProcessClmn.DrainingAfter] as ComboBox).Items.Contains(e.DisplayText))
{
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return; /// NOK
}
if (((e.SubItem == (int)ProcessClmn.Feeding) && !(processEditors[(int)ProcessClmn.Feeding] as ComboBox).Items.Contains(e.DisplayText)) ||
((e.SubItem == (int)ProcessClmn.Bench) && !(processEditors[(int)ProcessClmn.Bench] as ComboBox).Items.Contains(e.DisplayText)) ||
((e.SubItem == (int)ProcessClmn.Output) && !(processEditors[(int)ProcessClmn.Output] as ComboBox).Items.Contains(e.DisplayText)) ||
+1 -1
View File
@@ -186,7 +186,7 @@ namespace TBF.UI.Shared
{
for (int i = 1; i <= test.Repeats; i++)
{
testComboBox.Items.Add(Utils.TestTitle(test, i));
testComboBox.Items.Add(test.GetExpandedTestName(i));
}
}
+2 -2
View File
@@ -121,7 +121,7 @@ namespace TBF.UI
string test2Name = global::Results.Utils.GetTestName(test2.Name, test2.Repeats, r);
TestProgressCtrl progress =
new TestProgressCtrl(test2.Id, test2Name, test2.Part, Utils.TestTitle(test2, r), r, test2.Repeats);
new TestProgressCtrl(test2.Id, test2Name, test2.Part, test2.GetExpandedTestName(r), r, test2.Repeats);
progresses.Add(progress);
parent.Controls.Add(progress);
Console.WriteLine(test2Name);
@@ -131,7 +131,7 @@ namespace TBF.UI
{
string testName = global::Results.Utils.GetTestName(test.Name, test.Repeats, r);
TestProgressCtrl progress =
new TestProgressCtrl(test.Id, testName, test.Part, Utils.TestTitle(test, r), r, test.Repeats);
new TestProgressCtrl(test.Id, testName, test.Part, test.GetExpandedTestName(r), r, test.Repeats);
progresses.Add(progress);
parent.Controls.Add(progress);
Console.WriteLine(testName);
-26
View File
@@ -265,32 +265,6 @@ namespace TBF
return wmPartNr;
}
/// <summary>
/// Return test title for a given test and a repetition number
/// </summary>
/// <param name="test">Test entity</param>
/// <param name="repetitonNr">1 .. Nr. repetitions</param>
/// <returns>Test title (string)</returns>
public static string TestTitle(Test test, int repetitonNr)
{
if (test.Repeats == 1)
{
if (test.Part == 0)
{
return test.Name; /// Single test
}
else
{
return string.Format("{0} ({1})", test.Name, test.Part); /// A part of a single test
}
}
else
{
/// More test repetitions
return string.Format("{0} ({1}/{2})", test.Name, repetitonNr, test.Repeats);
}
}
/// <summary>
/// Return test title for a given test data and a repetition number
/// </summary>