Compare commits

..
53 changed files with 562 additions and 819 deletions
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;DEBUG;BADGER_VELKA_TRAT;LANG_CS</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;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;BADGER_VELKA_TRAT;LANG_CS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
-36
View File
@@ -234,42 +234,6 @@ 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);
-27
View File
@@ -313,33 +313,6 @@ 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
View File
@@ -135,6 +135,7 @@ namespace Results.Entities
public virtual double TargetTime() { return TestData.TargetTime; }
public virtual string Method() { return TestData.Method; }
public virtual string RefFlowmeter() { return (Components != null) ? Components.Flowmeter : string.Empty; }
public virtual string Scale() { return (Components != null) ? Components.Scale : string.Empty; }
public virtual bool IsRelErrTest() { return (MethodClass != null) ? (MethodClass.Contains("FixedStart") || MethodClass.Contains("FlyingStart") || MethodClass.Contains("CombinedWithDetection") || MethodClass.Contains("DiverterTest")) : true; }
public virtual bool IsPMaxTest() { return (MethodClass != null) ? (MethodClass.Contains("PMaxTest") || MethodClass.Contains("LeakTest")) : true; }
public virtual bool IsStartStop() { return (MethodClass != null) ? MethodClass.Contains("FixedStart") : true; }
+13
View File
@@ -318,6 +318,19 @@ namespace Results
TimeBtwnMassMsrmnts, /// 270
TestTimeCorrection, /// 271
ThreeState, /// 272
Conduct, /// 273
Conduct_start, /// 274
Conduct_end, /// 275
Conduct_avg, /// 276
Conduct_min, /// 277
Conduct_max, /// 278
InfoFlags, /// 279
Scale, /// 280
Count,
}
}
+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.1340.0")]
[assembly: AssemblyFileVersion("2.18.1340.0")]
[assembly: AssemblyVersion("2.18.1290.0")]
[assembly: AssemblyFileVersion("2.18.1290.0")]
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;DEBUG;BADGER_VELKA_TRAT;LANG_CS</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;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;BADGER_VELKA_TRAT;LANG_CS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+1 -5
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
///
using System;
using System.Text;
@@ -30,8 +30,6 @@ 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;
}
}
@@ -49,8 +47,6 @@ 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;
}
}
+1
View File
@@ -325,6 +325,7 @@ namespace Results
: ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr(f))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Scale, "Scale", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Scale()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
///
+2 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;DEBUG;BADGER_VELKA_TRAT;LANG_CS</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;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;BADGER_VELKA_TRAT;LANG_CS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+134 -103
View File
@@ -18,8 +18,6 @@ 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;
///
@@ -81,22 +79,48 @@ namespace TBF.BenchControl.Elde
bool previousEmergencyStop;
public void DiverterToTank(int flowMtrNr)
private int flowmeterNr4DiverterTest;
private bool scheduleDiverterToTank;
private bool scheduleDiverterToSink;
private bool scheduleReadDiverterTransition;
private bool pumpPowerChanged;
///
public void DiverterToTank(int flowmeterNr)
{
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Start, flowMtrNr, int.MaxValue, int.MaxValue, TestMethods.Diverter | TestMethods.Synchro, StopDevs.None));
if (!scheduleDiverterToSink && !scheduleReadDiverterTransition && !emergencyStop)
{
flowmeterNr4DiverterTest = flowmeterNr;
scheduleDiverterToTank = true;
}
}
///
public void DiverterToSink(int flowMtrNr)
public void DiverterToSink(int flowmeterNr)
{
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Stop, 0, 0, 0, TestMethods.Diverter,
StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation));
if (!scheduleDiverterToTank && !scheduleReadDiverterTransition && !emergencyStop)
{
flowmeterNr4DiverterTest = flowmeterNr;
scheduleDiverterToSink = true;
}
}
///
public void ReadDiverterTransition(int flowMtrNr)
public void ReadDiverterTransition(int flowmeterNr)
{
cbCommandQueue.Enqueue(new SendCommandArgs(Command.ReadDivTransition, flowMtrNr, 0, 0, TestMethods.Diverter, 0));
if (!scheduleDiverterToTank && !scheduleDiverterToSink && !emergencyStop)
{
flowmeterNr4DiverterTest = flowmeterNr;
scheduleReadDiverterTransition = true;
}
}
/// <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.
@@ -153,22 +177,21 @@ namespace TBF.BenchControl.Elde
public uint[] BalanceRange = new uint[2];
Queue<SendCommandArgs> cbCommandQueue;
/// <summary>
/// Route: 128-bit word representing the current state of all valves and pumps
/// </summary>
public UInt128 Route { get { return benchModelRoute; } }
///
/// Private values sent by the last SendCommand()
///
bool sendCommandFlag;
Command cmd;
int refNr;
UInt128 benchModelRoute;
UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
int totalRefPulses;
int massRefPulses;
TestMethods testMethods;
int[] filters;
float[] FMFreq;
int regConst;
int shortImp;
StopDevs stopDevs;
/// <summary>
@@ -191,8 +214,6 @@ 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))
{
@@ -271,9 +292,6 @@ 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
@@ -361,9 +379,7 @@ 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;
@@ -384,89 +400,95 @@ 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, };
}
///
/// Used in RunDeviceAfter() when sending commands
///
UInt128 lastSentRoute;
uint[] lastSentFilters;
float[] lastSentFMFreq;
int lastsentRegConst;
int lastSentShortImp;
/// <summary>
/// Run this device
/// </summary>
/// <summary>Run this device</summary>
public void RunDeviceAfter()
{
if (DebugLevel == DebugMode.Simulate) return;
UpdateWeights();
/// Modify queue in case of emergency stop
if (emergencyStop && !previousEmergencyStop)
uint[] uintFilters = new uint[8];
for (int i = 0; i < 8; i++)
{
/// SendCommand() arguments to clear the emergency stop state
cbCommandQueue.Clear();
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Stop, 0, 0, 0, 0, StopDevs.All));
uintFilters[i] = (filters.Length > i) ? (uint)filters[i] : uintFilters[i - 1];
}
/// 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++)
///
if (sendCommandFlag)
{
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.SendCommand(cmd, refNr, (benchModelRoute & routeMask),
totalRefPulses, massRefPulses, testMethods,
uintFilters, FMFreq, regConst, shortImp, stopDevs);
}
controlCom.RunDeviceAfter();
@@ -490,17 +512,25 @@ 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">State of valves, 128-bit word</param>
/// <param name="route">Route: 64-bit installation specific number</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, int totalRefPulses, int massRefPulses,
TestMethods testMethods, StopDevs stopDevs)
public void SendCommand(Command cmd, int refFlowmtrNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods, StopDevs stopDevs)
{
cbCommandQueue.Enqueue(new SendCommandArgs(cmd, refFlowmtrNr, totalRefPulses, massRefPulses, testMethods, stopDevs));
this.cmd = cmd;
this.refNr = refFlowmtrNr;
this.benchModelRoute = route;
this.totalRefPulses = totalRefPulses;
this.massRefPulses = massRefPulses;
this.testMethods = testMethods;
this.stopDevs = stopDevs;
sendCommandFlag = true;
}
/// <summary>
@@ -515,6 +545,7 @@ 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;
}
+17 -15
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">State of valves, 128-bit word</param>
/// <param name="route">Route: 64-bit installation specific number</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,15 +177,17 @@ 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(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
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)
{
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})",
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
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
fmFreq[0].ToString(), /// 10
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 11
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 12
@@ -197,8 +199,8 @@ namespace TBF.BenchControl.Elde
/// Simulation
///
Command lastCmd = this.cmd;
this.cmd = sendCommandArgs.Cmd;
this.refFlowmtrNr = sendCommandArgs.RefFlowmtrNr;
this.cmd = cmd;
this.refFlowmtrNr = refFlowmtrNr;
#if FUZHOU_300
///
@@ -212,14 +214,14 @@ namespace TBF.BenchControl.Elde
log.DebugFormat("SendCommand route = {0}", Utils.RouteToStr(route));
#endif
TestBenchSim.SimRoute = this.simRoute = route;
this.totalRefPulses = sendCommandArgs.TotalRefPulses;
this.massRefPulses = sendCommandArgs.MassRefPulses;
this.testMethods = sendCommandArgs.TestMethods;
this.stopDevs = sendCommandArgs.StopDevs;
this.filterConstants = filterConstants;
this.totalRefPulses = totalRefPulses;
this.massRefPulses = massRefPulses;
this.testMethods = testMethods;
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);
+65 -88
View File
@@ -308,35 +308,63 @@ namespace TBF.BenchControl.Elde
/// <summary>
/// Sends a command to the control board.
/// </summary>
/// <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="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="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
public void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
/// <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)
{
if (Program.MainWnd.InvokeRequired)
{
/// From another thread ... use Invoke()
Program.MainWnd.Invoke((SendCommandDlgt)DoSendCommand, new object[] { sendCommandArgs, route, filterConstants, fmFreq, regConst, shortImp });
/// 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()
}
else
{
/// Call DoSendCommand() directly
DoSendCommand(sendCommandArgs, route, filterConstants, fmFreq, regConst, shortImp);
/// When SendCommand(...) called from the UI thread
DoSendCommand(cmd, refFlowMeterNr, route, totalRefPulses, massRefPulses, testMethods,
filterConstants, fmFreq, regConst, shortImp, stopDevs);
}
}
///
delegate void SendCommandDlgt(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int 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);
///
private void DoSendCommand(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)
{
//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 to value FMIndex+50).
/// (in FUZHOU_300 the FM pump bit should be set set to value FMIndex+50).
///
bool bit39 = (route & 0x00FC000000000000) != 0; /// true if any of bits 50 through 55 is set
route = route & 0xFF03FFFFFFFFFFFF;
@@ -353,100 +381,49 @@ 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})",
sendCommandArgs.Cmd, /// 0
sendCommandArgs.RefFlowmtrNr, /// 1
Utils.RouteToStr(route), /// 2
sendCommandArgs.TotalRefPulses,
sendCommandArgs.MassRefPulses,
sendCommandArgs.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})",
cmd, /// 0
refFlowMeterNr, /// 1
Utils.RouteToStr(route), /// 2
totalRefPulses, massRefPulses, 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, /// 13
shortImp, /// 14
sendCommandArgs.StopDevs); /// 15
regConst, shortImp, stopDevs); /// 13, 14, 15
#if DN100 || MUNICH
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);
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq[0], (uint)regConst, (uint)shortImp, (uint)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)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);
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
#elif BERLIN || SLM_150 || PETERSBURG_200
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);
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);
#elif GENESIS || DEWA_300
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);
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);
#elif JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
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);
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);
#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
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);
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);
#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, 0, 0, testMethod, StopDevs.None);
controlBoard.SendCommand(commandOnStartOp, 0, controlBoard.Route, 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, 0, 0, testMethod, StopDevs.None);
controlBoard.SendCommand(commandOnStopOp, 0, controlBoard.Route, 0, 0, testMethod, StopDevs.None);
}
}
}
+13 -7
View File
@@ -61,13 +61,19 @@ namespace TBF.BenchControl.Elde
/// <summary>
/// Updates a command that is regularly sent to the control board by SendCommand.
/// </summary>
/// <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);
/// <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);
/// <summary>
/// Control of regulating valves.
@@ -132,7 +132,7 @@ namespace TBF.BenchControl.Elde
void SendCommand()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(Command.ReadDivTransition, 0, 0, 0, 0, StopDevs.None);
controlBoard.SendCommand(Command.ReadDivTransition, 0, controlBoard.Route, 0, 0, 0, StopDevs.None);
cmdSent = true;
}
+34 -31
View File
@@ -198,17 +198,16 @@ namespace TBF.BenchControl.Elde.RegulValve
opState = OpState.ValveMoveToFlow1;
}
/// Start flow measurement
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, int.MaxValue, int.MaxValue, 0, 0); /// TestMethods=0, StopDevs=0
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);
}
/// <summary>Run this operation</summary>
/// <returns>
/// Event.OpArgumentError
/// Event.Starting
/// Event.Busy
/// Event.FlowReached
/// Event.RegulValveTimeOut
/// Event.None, Event.FlowReached, Event.RegulValveTimeOut, Event.OpArgumentError
/// </returns>
public Event Run()
{
@@ -247,14 +246,17 @@ namespace TBF.BenchControl.Elde.RegulValve
opState = OpState.ValveMoveToFlow1;
}
/// Start flow measurement
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, int.MaxValue, int.MaxValue, 0, 0); /// TestMethods=0, StopDevs=0
return Event.Starting;
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;
}
else if (opState == OpState.ValveMoveToPosition1)
{
opState = OpState.ValveMoveToPosition2;
return Event.Starting;
return Event.None;
}
else if (opState == OpState.ValveMoveToPosition2) /// Move to position
{
@@ -264,7 +266,7 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValve.StableTime);
opState = OpState.SettingPosition;
return Event.Starting;
return Event.None;
}
else if (opState == OpState.ValveMoveToPosition3)
{
@@ -276,14 +278,14 @@ namespace TBF.BenchControl.Elde.RegulValve
{
opState = OpState.SettingPosition;
}
return Event.Starting;
return Event.None;
}
else if (opState == OpState.CheckStatePosition) /// Verify
{
if (((ulong)controlBoard.StatusP & (ulong)StatusP.RefPulsesMsrmnt) == 0)
{
opState = OpState.SendCommandAgain;
return Event.Starting;
return Event.None;
}
else if (controlBoard.RegulValveState(regulValveNr) != RegulValveState.DacValueRegul)
{
@@ -296,12 +298,12 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValveNr, targetPositionLo, targetPositionHi, regulValve.StableTime);
opState = OpState.ValveMoveToPosition3;
return Event.Starting;
return Event.None;
}
else
{
opState = OpState.SettingPosition;
return Event.Starting;
return Event.None;
}
}
else if (opState == OpState.SettingPosition)
@@ -311,12 +313,12 @@ namespace TBF.BenchControl.Elde.RegulValve
{
opState = OpState.ValveMoveToFlow1;
}
return Event.Starting;
return Event.None;
}
else if (opState == OpState.ValveMoveToFlow1)
{
opState = OpState.ValveMoveToFlow2;
return Event.Starting;
return Event.None;
}
else if (opState == OpState.ValveMoveToFlow2) /// Move to flow
{
@@ -338,7 +340,7 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValve.StableTime);
opState = OpState.ValveMoveToFlow3;
return Event.Starting;
return Event.None;
}
else if (opState == OpState.ValveMoveToFlow3)
{
@@ -350,7 +352,7 @@ namespace TBF.BenchControl.Elde.RegulValve
{
opState = OpState.SettingFlow;
}
return Event.Starting;
return Event.None;
}
else if (opState == OpState.CheckStateFlow) /// Verify the flow setting
{
@@ -358,7 +360,7 @@ namespace TBF.BenchControl.Elde.RegulValve
(controlBoard.RegulValveState(regulValveNr) & RegulValveState.PwOrFreqRegul) != RegulValveState.PwOrFreqRegul)
{
opState = OpState.SendCommandAgain;
return Event.Starting;
return Event.None;
}
else if (controlBoard.RegulValveState(regulValveNr) != RegulValveState.PwOrFreqRegul)
{
@@ -373,12 +375,12 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValveNr, freqLo, freqHi, regulValve.StableTime);
opState = OpState.ValveMoveToFlow3;
return Event.Starting;
return Event.None;
}
else
{
opState = OpState.SettingFlow;
return Event.Busy;
return Event.None;
}
}
else if (opState == OpState.SettingFlow)
@@ -421,7 +423,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.Busy;
return Event.None;
}
}
else if (StateMachine.Time > expireTime)
@@ -432,7 +434,7 @@ namespace TBF.BenchControl.Elde.RegulValve
{
log.InfoFormat("flow = {0} m3/h (lo={1}, hi={2})", flow, currentReqFlowLo, currentReqFlowHi);
flowWithinBoundsTime = 0;
return Event.Busy;
return Event.None;
}
}
else /// opState == OpState.FlowReached
@@ -445,13 +447,14 @@ namespace TBF.BenchControl.Elde.RegulValve
/// <summary>Start this operation</summary>
public void Stop()
{
if (!leaveMeasurementRunning)
{
/// Stop measurement
controlBoard.SendCommand(Command.Stop, flowMeter.Idx1, 50000, 50000, 0, StopDevs.RegValveRegulation); /// TestMethods=0
}
opState = OpState.Idle;
opState = OpState.Idle;
if (leaveMeasurementRunning) return;
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeter.Idx1, controlBoard.Route, 50000, 50000, tm, sd);
}
}
}
@@ -212,7 +212,8 @@ 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, int.MaxValue, int.MaxValue, tm, sd);
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
}
/// <summary>Run this operation</summary>
@@ -261,7 +262,8 @@ 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, int.MaxValue, int.MaxValue, tm, sd);
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
log.DebugFormat(" return Event.None");
return Event.None;
}
@@ -477,7 +479,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeterNr, 50000, 50000, tm, sd);
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route, 50000, 50000, tm, sd);
log.WarnFormat("Stop() SendCommand(Stop, {0}, ...)", flowMeterNr);
}
@@ -217,7 +217,8 @@ 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, int.MaxValue, int.MaxValue, tm, sd);
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
}
/// <summary>Run this operation</summary>
@@ -370,7 +371,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeterNr, 50000, 50000, tm, sd);
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route, 50000, 50000, tm, sd);
}
}
}
-33
View File
@@ -1,33 +0,0 @@
///
/// 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;
}
}
}
+2 -1
View File
@@ -125,7 +125,8 @@ 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, totalRefPulses, massRefPulses, testMethod, StopDevs.None);
controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, controlBoard.Route,
totalRefPulses, massRefPulses, testMethod, StopDevs.None);
}
/// <summary>Start this operation</summary>
@@ -35,7 +35,12 @@ namespace TBF.BenchControl.Elde
void SendStopFlowRegulationCommand()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(Command.Stop, flowMeterNr, 0, 0, 0, StopDevs.RegValveRegulation);
controlBoard.SendCommand(Command.Stop,
flowMeterNr, /// ref. flowmeter number
controlBoard.Route, /// route
0, 0, /// ref. pulses
0,
StopDevs.RegValveRegulation);
}
+5 -1
View File
@@ -43,7 +43,11 @@ namespace TBF.BenchControl.Elde
void SendStopCommand()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(Command.Stop, 0, 0, 0, TestMethods.Diverter,
controlBoard.SendCommand(Command.Stop,
0, /// ref. flowmeter number
controlBoard.Route, /// route
0, 0, /// ref. pulses
TestMethods.Diverter,
StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation);
}
-1
View File
@@ -73,7 +73,6 @@ 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
@@ -149,7 +149,11 @@ namespace TBF.BenchControl.Network.Comet.Ambient
state = State.Idle;
}
}
}
UpdateProcessData(temperature, pressure, humidity);
log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
}
catch (Exception e)
{
DebugLevel = DebugMode.FailureDuringOperation;
@@ -220,6 +224,13 @@ namespace TBF.BenchControl.Network.Comet.Ambient
public void StopDevice2() { }
void UpdateProcessData(float temperature, float pressure, float humidity)
{
TBF.BenchControl.Sequences.ProcessData.AmbTemp.Val = temperature;
TBF.BenchControl.Sequences.ProcessData.AmbPress.Val = pressure;
TBF.BenchControl.Sequences.ProcessData.AmbHumi.Val = humidity;
}
///
/// Boxes for the operation result
///
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public IComponentCfgCtrl GetControl() { return new TracingCfgCtrl(); }
public string Workplace;
public string ConnStr;
public string NetAdapter;
public bool CheckPreviousRecords;
@@ -27,6 +28,7 @@ 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;
@@ -42,8 +44,9 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public string ToString(int i)
{
return string.Format("Name={0}, CheckPreviousRecords={1}, SaveTracingRecords={2}, ConnStr={3}",
return string.Format("Name={0}, Workplace={1}, CheckPreviousRecords={2}, SaveTracingRecords={3}, ConnStr={4}",
Name,
Workplace,
CheckPreviousRecords,
SaveTracingRecords,
ConnStr);
@@ -35,14 +35,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public const string WorkstepName = "Test_bench";
MonitoringCfg tracingCfg;
string workplace
{
get
{
TBF.BenchControl.GenericDevices.IBenchInfo benchInfo = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
return (benchInfo != null) ? benchInfo.TestBenchName : "TestBench";
}
}
string workplace { get { return tracingCfg.Workplace; } }
readonly IPAddress ipAddress;
readonly IPAddress netMask;
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2018-2019 Sensus Slovensko a.s.
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
@@ -46,6 +46,7 @@ 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;
@@ -101,6 +102,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public void Unlock()
{
nameTextBox.Enabled = true;
workplaceTextBox.Enabled = true;
connStrTextBox.Enabled = true;
netAdapterComboBox.Enabled = true;
checkPreviousRecordsCheckBox.Enabled = true;
@@ -124,6 +126,7 @@ 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,6 +34,8 @@ 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();
@@ -45,7 +47,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(110, 51);
this.nameTextBox.Location = new System.Drawing.Point(110, 41);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
this.nameTextBox.TabIndex = 2;
@@ -53,7 +55,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(15, 54);
this.nameLabel.Location = new System.Drawing.Point(15, 44);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
@@ -62,16 +64,33 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(107, 26);
this.classNameLabel.Location = new System.Drawing.Point(107, 19);
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, 76);
this.connStrTextBox.Location = new System.Drawing.Point(110, 93);
this.connStrTextBox.Name = "connStrTextBox";
this.connStrTextBox.Size = new System.Drawing.Size(327, 20);
this.connStrTextBox.TabIndex = 6;
@@ -79,7 +98,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// connStrLabel
//
this.connStrLabel.AutoSize = true;
this.connStrLabel.Location = new System.Drawing.Point(15, 79);
this.connStrLabel.Location = new System.Drawing.Point(15, 96);
this.connStrLabel.Name = "connStrLabel";
this.connStrLabel.Size = new System.Drawing.Size(89, 13);
this.connStrLabel.TabIndex = 5;
@@ -89,7 +108,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
//
this.saveTracingRecordsCheckBox.AutoSize = true;
this.saveTracingRecordsCheckBox.Enabled = false;
this.saveTracingRecordsCheckBox.Location = new System.Drawing.Point(110, 159);
this.saveTracingRecordsCheckBox.Location = new System.Drawing.Point(110, 177);
this.saveTracingRecordsCheckBox.Name = "saveTracingRecordsCheckBox";
this.saveTracingRecordsCheckBox.Size = new System.Drawing.Size(177, 17);
this.saveTracingRecordsCheckBox.TabIndex = 10;
@@ -100,7 +119,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
//
this.checkPreviousRecordsCheckBox.AutoSize = true;
this.checkPreviousRecordsCheckBox.Enabled = false;
this.checkPreviousRecordsCheckBox.Location = new System.Drawing.Point(110, 136);
this.checkPreviousRecordsCheckBox.Location = new System.Drawing.Point(110, 154);
this.checkPreviousRecordsCheckBox.Name = "checkPreviousRecordsCheckBox";
this.checkPreviousRecordsCheckBox.Size = new System.Drawing.Size(138, 17);
this.checkPreviousRecordsCheckBox.TabIndex = 9;
@@ -110,7 +129,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// netAdapterLabel
//
this.netAdapterLabel.AutoSize = true;
this.netAdapterLabel.Location = new System.Drawing.Point(15, 104);
this.netAdapterLabel.Location = new System.Drawing.Point(15, 122);
this.netAdapterLabel.Name = "netAdapterLabel";
this.netAdapterLabel.Size = new System.Drawing.Size(86, 13);
this.netAdapterLabel.TabIndex = 7;
@@ -119,7 +138,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// netAdapterComboBox
//
this.netAdapterComboBox.FormattingEnabled = true;
this.netAdapterComboBox.Location = new System.Drawing.Point(110, 101);
this.netAdapterComboBox.Location = new System.Drawing.Point(110, 119);
this.netAdapterComboBox.Name = "netAdapterComboBox";
this.netAdapterComboBox.Size = new System.Drawing.Size(327, 21);
this.netAdapterComboBox.TabIndex = 11;
@@ -134,6 +153,8 @@ 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);
@@ -150,6 +171,8 @@ 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,9 +661,8 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
int maxpruefindexLowPart = ReadMaxPruefindex(conn, wm);
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 MAX_Pruefindex = 100 * dbCfg.TestBenchId + maxpruefindexLowPart + 1;
int Hydr_Pruefung;
if (wm.Passed)
@@ -34,6 +34,7 @@ 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;
@@ -47,6 +48,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
{
Name = "Sensus-Oracle-DB";
ParentName = string.Empty;
TestBenchId = 1;
DBUsed = DBUsed.Test;
Baujahr = 2015;
ReadStartInfo = true;
@@ -63,8 +65,9 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public string ToString(int i)
{
return string.Format("Name={0}, DB={1}, Bjahr={2}, RdStartInfo={3}, SaveRslts={4}, StartInfoRqrd={5}, TestMode={6}",
return string.Format("Name={0}, BenchId={1}, DB={2}, Bjahr={3}, RdStartInfo={4}, SaveRslts={5}, StartInfoRqrd={6}, TestMode={7}",
Name,
TestBenchId,
DBUsed,
Baujahr,
ReadStartInfo,
@@ -47,6 +47,7 @@ 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;
@@ -58,6 +59,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public void Unlock()
{
nameTextBox.Enabled = true;
benchIdTextBox.Enabled = true;
dbUsedComboBox.Enabled = true;
baujahrTextBox.Enabled = true;
readStartInfoCheckBox.Enabled = true;
@@ -70,7 +72,13 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
int tmp;
int tmp;
if (!int.TryParse(benchIdTextBox.Text, out tmp) || tmp <= 0)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Test bench ID'";
}
if (!int.TryParse(baujahrTextBox.Text, out tmp) || tmp < 2015 || tmp > 2099)
{
flags |= CfgUpdateFlags.Error;
@@ -97,6 +105,13 @@ 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,6 +36,8 @@ 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();
@@ -47,7 +49,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(110, 55);
this.nameTextBox.Location = new System.Drawing.Point(110, 30);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
this.nameTextBox.TabIndex = 2;
@@ -55,7 +57,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(19, 58);
this.nameLabel.Location = new System.Drawing.Point(19, 33);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
@@ -64,7 +66,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(107, 27);
this.classNameLabel.Location = new System.Drawing.Point(107, 8);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
@@ -92,11 +94,28 @@ 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, 79);
this.dbUsedComboBox.Location = new System.Drawing.Point(110, 76);
this.dbUsedComboBox.Name = "dbUsedComboBox";
this.dbUsedComboBox.Size = new System.Drawing.Size(145, 21);
this.dbUsedComboBox.TabIndex = 6;
@@ -104,7 +123,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// dbUsedLabel
//
this.dbUsedLabel.AutoSize = true;
this.dbUsedLabel.Location = new System.Drawing.Point(19, 81);
this.dbUsedLabel.Location = new System.Drawing.Point(19, 78);
this.dbUsedLabel.Name = "dbUsedLabel";
this.dbUsedLabel.Size = new System.Drawing.Size(79, 13);
this.dbUsedLabel.TabIndex = 5;
@@ -113,7 +132,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// baujahrTextBox
//
this.baujahrTextBox.Enabled = false;
this.baujahrTextBox.Location = new System.Drawing.Point(110, 104);
this.baujahrTextBox.Location = new System.Drawing.Point(110, 100);
this.baujahrTextBox.Name = "baujahrTextBox";
this.baujahrTextBox.Size = new System.Drawing.Size(57, 20);
this.baujahrTextBox.TabIndex = 8;
@@ -121,7 +140,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// baujahrLabel
//
this.baujahrLabel.AutoSize = true;
this.baujahrLabel.Location = new System.Drawing.Point(19, 107);
this.baujahrLabel.Location = new System.Drawing.Point(19, 103);
this.baujahrLabel.Name = "baujahrLabel";
this.baujahrLabel.Size = new System.Drawing.Size(43, 13);
this.baujahrLabel.TabIndex = 7;
@@ -159,6 +178,8 @@ 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);
@@ -179,6 +200,8 @@ 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;
+32 -96
View File
@@ -523,26 +523,10 @@ namespace TBF.BenchControl.Sequences
for (int i = 0; i < BatchRslts.WaterMeters.Length; i++)
{
WaterMeter wm = BatchRslts.WaterMeters[i];
if (wm != null)
if (wm != null && wm.Passed)
{
if (wm.Passed)
{
/// Water meter passed and was already saved to Oracle, do not reload & fix it now
wm.Disabled = true;
}
else if (!wm.Disabled && Users.GlobalData.GetCurrentUserName() == "milan")
{
/// Water meter not passed and not disabled and user is 'milan' => reset flag E28
wm.ErrorFlags = wm.ErrorFlags & (~(int)ErrorFlagMask.E28);
foreach (var mtr in wm.MeterTestRslts)
{
if (mtr.TestData().Evaluate && (mtr.TestData().Name == "Kontrola montaze") && (mtr.TestData().Method == "iPerlCommunication"))
{
mtr.TestDone = true;
mtr.Passed = true;
}
}
}
/// Water meter passed and was already saved to Oracle, do not reload & fix it now
wm.Disabled = true;
}
}
}
@@ -713,7 +697,7 @@ namespace TBF.BenchControl.Sequences
log.ErrorFormat("StartInfoReader failed to read data from the database");
/// TODO: Message for an operator? Error?
}
else if ((selection == Selection.RestoreAndFixBatch) && (Users.GlobalData.GetCurrentUserName() != "milan"))
else if (selection == Selection.RestoreAndFixBatch)
{
/// Restore and fix a batch - part 2
for (int i = 0; i < BatchRslts.WaterMeters.Length; i++)
@@ -819,9 +803,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,14 +832,23 @@ namespace TBF.BenchControl.Sequences
///
if (selection == Selection.RestOfCycle) /// ... otherwise
{
Test slctdTest = TBF.BenchControl.StateMachine.Procedure.GetTest(selectedTestName, out selsctedTestIx, out repetNr);
if (slctdTest == null || (selsctedTestIx < simultWithPurgingCount)
|| (selsctedTestIx >= StateMachine.Tests.Count - simultWithEvacuationCount))
Test slctdTest = TBF.BenchControl.StateMachine.GetTest(selectedTestName, out repetNr);
if (slctdTest == null)
{
/// 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
}
@@ -869,8 +862,8 @@ namespace TBF.BenchControl.Sequences
/// Try to fetch all test paths and transitions
/// to detect configuration errors as early as possible.
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
string errorMsg;
string errorMsg;
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
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),
@@ -890,65 +883,15 @@ 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;
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) &&
/// 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) &&
!(testMethodComp is TBF.BenchControl.TestMethods.OuterLoop.End.Component) &&
!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
out inPath, out benchPath, out outPath, out sensPath,
@@ -961,12 +904,9 @@ namespace TBF.BenchControl.Sequences
}
/// Update format for the water mass
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;
}
Mass.Format = outPath.Scale.Format;
StartMass.Format = outPath.Scale.Format;
EndMass.Format = outPath.Scale.Format;
ITestMethod testMethod = testMethodComp as ITestMethod;
@@ -1052,10 +992,7 @@ namespace TBF.BenchControl.Sequences
if (testMethod.DoTransitions() && !e.Contains(Event.RecoverableError))
{
/// Make a transition after the last test repetition
TransitionContext endContext =
!currentTestFinished ? TransitionContext.Stop
: ((nextTransitionBefore != null) && (nextTransitionBefore.Name.ToLower().Contains("fastflow"))) ? TransitionContext.AfterTestWithOverlap
: TransitionContext.AfterTest;
TransitionContext endContext = currentTestFinished ? TransitionContext.AfterTest : TransitionContext.Stop;
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);
}
@@ -1163,8 +1100,7 @@ namespace TBF.BenchControl.Sequences
/// Single test will be executed
int repetNr;
int testIx;
Test test = TBF.BenchControl.StateMachine.Procedure.GetTest(selectedTestName, out testIx, out repetNr);
Test test = TBF.BenchControl.StateMachine.GetTest(selectedTestName, out repetNr);
if (test == null)
{
UiBridge.Bridge.OnError(this, string.Format("No test specified"));
+18 -195
View File
@@ -68,21 +68,6 @@ 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;
@@ -454,11 +439,10 @@ namespace TBF.BenchControl.Sequences
public enum TransitionContext
{
PurgeBegin,
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,
BeforeTest,
BetweenTests,
AfterTest,
PurgeEnd,
Stop,
}
@@ -498,12 +482,7 @@ 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.AfterTestWithOverlap:
case TransitionContext.AfterTest:
message = Strings.Test_stop_sequence_i_n;
break;
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;
@@ -516,7 +495,7 @@ namespace TBF.BenchControl.Sequences
///
/// No transition sequence defined --> Default action
///
if ((context == TransitionContext.AfterTest) || (context == TransitionContext.AfterTestWithOverlap))
if (context == TransitionContext.AfterTest)
{
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOff();
@@ -701,8 +680,7 @@ 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())
@@ -739,10 +717,11 @@ 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;
}
@@ -751,19 +730,17 @@ namespace TBF.BenchControl.Sequences
}
else if (context == TransitionContext.BeforeTest)
{
///
/// Always set route at the beginning of this test
///
if (inPath != null && benchPath != null && outPath != null)
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;
@@ -771,54 +748,8 @@ 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)
@@ -935,114 +866,6 @@ 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>
@@ -1815,7 +1638,7 @@ namespace TBF.BenchControl.Sequences
/// <summary>
/// Returns true and makes a log when 'e' contains Event.UiCmdStop
/// </summary>
/// <param name="test">test or null (only for logs)</param>
/// <param name="test"></param>
/// <param name="e"></param>
/// <returns></returns>
protected bool TestAndLogUiCmdStop(Test test, IList<Event> e)
+30 -8
View File
@@ -575,6 +575,31 @@ 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>
@@ -599,9 +624,6 @@ 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;
@@ -627,12 +649,12 @@ namespace TBF.BenchControl
pmtrs = GetMetersPath(test);
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;
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;
else if (pmtrs == null) errorMsg = Strings.Cannot_load_sensor_path;
else errorMsg = string.Empty;
if ((isHydroTest && (pfeed == null || pben == null || pout == null)) || (pmtrs == null))
if ((pfeed == null) || (pben == null) || (pout == null) || (pmtrs == null))
{
return false;
}
@@ -656,7 +678,7 @@ namespace TBF.BenchControl
if (tr.Name == test.TransitionAfter) transitionAfter = tr;
}
if (isHydroTest && pout.Scale == null)
if (pout.Scale == null)
{
errorMsg = string.Format("No balance specified in path {0}", test.OutputPath);
return false;
@@ -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.Dummy({0})", Cfg.ToString(1)); }
public override string ToString() { return string.Format("TestMethods.ChangeFlowDirection({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return true; }
@@ -693,19 +693,11 @@ 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();
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.18.1351.0")]
[assembly: AssemblyFileVersion("2.18.1351.0")]
[assembly: AssemblyVersion("2.18.1824.0")]
[assembly: AssemblyFileVersion("2.18.1824.0")]
+6 -26
View File
@@ -39,7 +39,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK;STABLE_MASS_EXTRAS</DefineConstants>
<DefineConstants>TRACE;DEBUG;BADGER_VELKA_TRAT;LANG_CS</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;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK;STABLE_MASS_EXTRAS</DefineConstants>
<DefineConstants>TRACE;BADGER_VELKA_TRAT;LANG_CS</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;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK;STABLE_MASS_EXTRAS</DefineConstants>
<DefineConstants>TRACE;DEBUG;BADGER_VELKA_TRAT;LANG_CS</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;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK;STABLE_MASS_EXTRAS</DefineConstants>
<DefineConstants>TRACE;BADGER_VELKA_TRAT;LANG_CS</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
@@ -97,9 +97,8 @@
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="ControlComponent3U, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ControlBoard\iPerlST-new\ControlComponent3U.dll</HintPath>
<Reference Include="ControlComponent3U">
<HintPath>..\packages\ControlBoard\Badger-velka-trat\ControlComponent3U.dll</HintPath>
</Reference>
<Reference Include="FluentNHibernate">
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
@@ -573,7 +572,6 @@
<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" />
@@ -3307,24 +3305,6 @@
<None Include="Resources\RoiStyle1.bmp" />
<None Include="Resources\RoiStyle2.bmp" />
<None Include="Resources\RoiStyle3.bmp" />
<Content Include="libgcc_s_dw2-1.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="libRfid1.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="libRfid2.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="libRfid3.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="libRfid4.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="libstdc++-6.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Pictures\forward_dir_left.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+1 -1
View File
@@ -56,7 +56,7 @@ namespace TBF.UI
this.homeTabPage = new System.Windows.Forms.TabPage();
this.ctrlBrdComponent = new ControlComponent_Torino2015.UserControl1();
this.processTabPage = new System.Windows.Forms.TabPage();
this.processTabPageCtrl = new TBF.UI.Process.ProcessTabPageCtrl48();
this.processTabPageCtrl = new TBF.UI.Process.ProcessTabPageCtrl6();
this.insertTabPage = new System.Windows.Forms.TabPage();
this.resultsTabPage = new System.Windows.Forms.TabPage();
this.resultsTabPageCtrl = new TBF.UI.Results.ResultsTabPageCtrl();
+20 -75
View File
@@ -1250,46 +1250,22 @@ 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
lvi.Tag = test;
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
if (tm != null && tm.DoTransitions())
{
lvi.SubItems.Add(test.FeedingPath);
lvi.SubItems.Add(test.BenchPath);
lvi.SubItems.Add(test.OutputPath);
}
else
{
lvi.SubItems.Add(string.Empty);
lvi.SubItems.Add(string.Empty);
lvi.SubItems.Add(string.Empty);
}
lvi.SubItems.Add(test.FeedingPath);
lvi.SubItems.Add(test.BenchPath);
lvi.SubItems.Add(test.OutputPath);
lvi.SubItems.Add(test.MetersPath);
#if HEAT_METERS
lvi.SubItems.Add(test.HeatMetersPath);
#endif
if (tm != null && tm.DoTransitions())
{
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);
lvi.SubItems.Add(string.Empty);
lvi.SubItems.Add(string.Empty);
}
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);
processListViewEx.Items.Add(lvi);
}
@@ -1314,32 +1290,21 @@ namespace TBF.UI.Procedures
entity.Part = part;
}
int column = (int)ProcessClmn.Feeding;
string subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
if ((processEditors[(int)ProcessClmn.Feeding] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Feeding].Text))
{
entity.FeedingPath = subItemText;
entity.FeedingPath = lvi.SubItems[(int)ProcessClmn.Feeding].Text;
}
column = (int)ProcessClmn.Bench;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
if ((processEditors[(int)ProcessClmn.Bench] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Bench].Text))
{
entity.BenchPath = subItemText;
entity.BenchPath = lvi.SubItems[(int)ProcessClmn.Bench].Text;
}
column = (int)ProcessClmn.Output;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
if ((processEditors[(int)ProcessClmn.Output] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Output].Text))
{
entity.OutputPath = subItemText;
entity.OutputPath = lvi.SubItems[(int)ProcessClmn.Output].Text;
}
column = (int)ProcessClmn.Sensor;
subItemText = lvi.SubItems[column].Text;
if ((processEditors[column] as ComboBox).Items.Contains(subItemText))
if ((processEditors[(int)ProcessClmn.Sensor] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.Sensor].Text))
{
entity.MetersPath = subItemText;
entity.MetersPath = lvi.SubItems[(int)ProcessClmn.Sensor].Text;
}
#if HEAT_METERS
if ((processEditors[(int)ProcessClmn.HeatMeterSensors] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text))
@@ -1347,25 +1312,17 @@ namespace TBF.UI.Procedures
entity.HeatMetersPath = lvi.SubItems[(int)ProcessClmn.HeatMeterSensors].Text;
}
#endif
column = (int)ProcessClmn.TrnStart;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
if ((processEditors[(int)ProcessClmn.TrnStart] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.TrnStart].Text))
{
entity.RelTransBefore = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
entity.RelTransBefore = lvi.SubItems[(int)ProcessClmn.TrnStart].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)ProcessClmn.TrnStart].Text;
}
column = (int)ProcessClmn.TrnBetween;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
if ((processEditors[(int)ProcessClmn.TrnBetween] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.TrnBetween].Text))
{
entity.RelTransBetween = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
entity.RelTransBetween = lvi.SubItems[(int)ProcessClmn.TrnBetween].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)ProcessClmn.TrnBetween].Text;
}
column = (int)ProcessClmn.TrnStop;
subItemText = lvi.SubItems[column].Text;
if (string.IsNullOrEmpty(subItemText) || (processEditors[column] as ComboBox).Items.Contains(subItemText))
if ((processEditors[(int)ProcessClmn.TrnStop] as ComboBox).Items.Contains(lvi.SubItems[(int)ProcessClmn.TrnStop].Text))
{
entity.TransitionAfter = (string.IsNullOrEmpty(subItemText) || subItemText.Equals("---")) ? string.Empty : subItemText;
entity.TransitionAfter = lvi.SubItems[(int)ProcessClmn.TrnStop].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)ProcessClmn.TrnStop].Text;
}
}
}
@@ -1377,18 +1334,6 @@ 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.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);
}
@@ -218,7 +218,7 @@ namespace TBF.UI.Procedures.TestWizard
SensusTestInfo[] completeTestInfos = SensusTestInfo.GetBestMatch(SelectedTestInfos, wmTestNames, out testInfoName);
foreach (var sti in SelectedTestInfos)
{
foreach (var cti in completeTestInfos) if (cti.PruefungsNrOpto == sti.PruefungsNrDB) sti.TestName = cti.TestName;
foreach (var cti in completeTestInfos) if (cti.PruefungsNrDB == sti.PruefungsNrDB) sti.TestName = cti.TestName;
}
materialCodeTextBox.Text = materialNr;
+1 -1
View File
@@ -186,7 +186,7 @@ namespace TBF.UI.Shared
{
for (int i = 1; i <= test.Repeats; i++)
{
testComboBox.Items.Add(test.GetExpandedTestName(i));
testComboBox.Items.Add(Utils.TestTitle(test, 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, test2.GetExpandedTestName(r), r, test2.Repeats);
new TestProgressCtrl(test2.Id, test2Name, test2.Part, Utils.TestTitle(test2, 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, test.GetExpandedTestName(r), r, test.Repeats);
new TestProgressCtrl(test.Id, testName, test.Part, Utils.TestTitle(test, r), r, test.Repeats);
progresses.Add(progress);
parent.Controls.Add(progress);
Console.WriteLine(testName);
+26
View File
@@ -265,6 +265,32 @@ 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>
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;TURA_IPERL_NEW;LANG_SK</DefineConstants>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -26,7 +26,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;TURA_IPERL_NEW;LANG_SK</DefineConstants>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>