Compare commits
79
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b750379468 | ||
|
|
c783967d87 | ||
|
|
b0c95c0677 | ||
|
|
439f20bc95 | ||
|
|
7576a68651 | ||
|
|
b6380ff896 | ||
|
|
c3fd5b9366 | ||
|
|
aa24558d07 | ||
|
|
40d4c74493 | ||
|
|
bc89faf220 | ||
|
|
0b12e79820 | ||
|
|
7bdb7f99d4 | ||
|
|
afea809b97 | ||
|
|
3122f6dd9a | ||
|
|
a2f0781fb4 | ||
|
|
31a684f03a | ||
|
|
89eddaa3c2 | ||
|
|
b060068a95 | ||
|
|
3ffdf4e2cc | ||
|
|
7d1d95305f | ||
|
|
98fc15a709 | ||
|
|
a8e0a8087d | ||
|
|
f81c30f072 | ||
|
|
05f6c8c75c | ||
|
|
76a08324b4 | ||
|
|
2a98c485ef | ||
|
|
872409870e | ||
|
|
f48a71ce12 | ||
|
|
d2d571945c | ||
|
|
bd9c3aa5e2 | ||
|
|
73ea0ff586 | ||
|
|
78408ed5eb | ||
|
|
f04cdccd20 | ||
|
|
82acf60f2e | ||
|
|
68413867ad | ||
|
|
1fd8881d53 | ||
|
|
cebdd71065 | ||
|
|
668304cb72 | ||
|
|
c28c5a5554 | ||
|
|
450493069c | ||
|
|
d7519aa95a | ||
|
|
e89ab89874 | ||
|
|
025fa81941 | ||
|
|
845c66b511 | ||
|
|
3725e238fc | ||
|
|
ac2ac82187 | ||
|
|
5e6be0c4b4 | ||
|
|
ed66c6a259 | ||
|
|
0db7736247 | ||
|
|
02cebe0966 | ||
|
|
4f2bb6291f | ||
|
|
498c8afbe4 | ||
|
|
0e6dce4750 | ||
|
|
7a74579c8b | ||
|
|
c23630a980 | ||
|
|
205df83c1c | ||
|
|
b26f65dab4 | ||
|
|
8d1ac8f41d | ||
|
|
115916fd36 | ||
|
|
6641ed9d96 | ||
|
|
5e3d408706 | ||
|
|
8fc9e3e5ce | ||
|
|
e7aa9731d0 | ||
|
|
0fc63655e9 | ||
|
|
86b47cb434 | ||
|
|
b3ec97d95c | ||
|
|
1620758545 | ||
|
|
5a2d51db95 | ||
|
|
c0e99364a4 | ||
|
|
371a27c646 | ||
|
|
4a06dcff3e | ||
|
|
0f54bf86ac | ||
|
|
921c524f0e | ||
|
|
a8df9b50de | ||
|
|
5da9b1e94e | ||
|
|
63871c9bcc | ||
|
|
e5b61825ff | ||
|
|
2d484ea993 | ||
|
|
b5b7d50742 |
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -28,7 +28,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
+7
-1
@@ -20,7 +20,7 @@ namespace Config
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif FUZHOU_300 || FUZHOU_150 || PT200IL || PUCHONG_200 || GENESIS || SLM_150 || PETERSBURG_200
|
||||
#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || PUCHONG_200 || GENESIS || SLM_150 || PETERSBURG_200
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 3;
|
||||
@@ -32,6 +32,12 @@ namespace Config
|
||||
public const int CompoundWMsCount = 0;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif IZRAEL_50
|
||||
public const int WMsCount = 40;
|
||||
public const int LineSize = 10;
|
||||
public const int CompoundWMsCount = 0;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif FUZHOU_100
|
||||
public const int WMsCount = 10;
|
||||
public const int LineSize = 10;
|
||||
|
||||
@@ -12,11 +12,14 @@ namespace Config.Entities
|
||||
public virtual float Measurement { get; set; }
|
||||
public virtual float Correction { get; set; }
|
||||
|
||||
public MeasurementCorrection() { }
|
||||
public MeasurementCorrection()
|
||||
{
|
||||
RangeIx = 0;
|
||||
}
|
||||
|
||||
public MeasurementCorrection(int rangeIx)
|
||||
{
|
||||
RangeIx = rangeIx;
|
||||
RangeIx = rangeIx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+19
-2
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
///
|
||||
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,7 +12,21 @@ namespace Config
|
||||
{
|
||||
public static string SignificantDigitsToFmt(double value, int sigDigits)
|
||||
{
|
||||
if (sigDigits == 5)
|
||||
if (sigDigits == 6)
|
||||
{
|
||||
if (value >= 99999.5 || value < -99999.5) return "F0";
|
||||
else if (value >= 9999.95 || value < -9999.95) return "F1";
|
||||
else if (value >= 999.995 || value < -999.995) return "F2";
|
||||
else if (value >= 99.9995 || value < -99.9995) return "F3";
|
||||
else if (value >= 9.99995 || value < -9.99995) return "F4";
|
||||
else if (value >= 0.999995 || value < -0.999995) return "F5";
|
||||
else if (value >= 0.0999995 || value < -0.0999995) return "F6";
|
||||
else if (value >= 0.00999995 || value < -0.00999995) return "F7";
|
||||
else if (value >= 0.000999995 || value < -0.000999995) return "F8";
|
||||
else if (value >= 0.0000999995 || value < -0.0000999995) return "F9";
|
||||
else return "F10";
|
||||
}
|
||||
else if (sigDigits == 5)
|
||||
{
|
||||
if (value >= 9999.5 || value < -9999.5) return "F0";
|
||||
else if (value >= 999.95 || value < -999.95) return "F1";
|
||||
|
||||
+31
-10
@@ -56,7 +56,10 @@ namespace DeviceTest
|
||||
|
||||
|
||||
static TBF.Boxes.FloatBox floatBox;
|
||||
static Event evnt;
|
||||
static TBF.Boxes.DoubleBox dblBox1;
|
||||
static TBF.Boxes.DoubleBox dblBox2;
|
||||
static TBF.Boxes.DoubleBox dblBox3;
|
||||
static Event evnt;
|
||||
|
||||
|
||||
static DeviceTestDlg()
|
||||
@@ -657,7 +660,12 @@ namespace DeviceTest
|
||||
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
}
|
||||
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
|
||||
{
|
||||
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
|
||||
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
}
|
||||
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
//operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
|
||||
@@ -681,10 +689,15 @@ namespace DeviceTest
|
||||
}
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
|
||||
{
|
||||
operation21 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation22 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
}
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
|
||||
{
|
||||
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
|
||||
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
}
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
//operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
|
||||
@@ -708,10 +721,15 @@ namespace DeviceTest
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
|
||||
{
|
||||
operation31 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation32 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
|
||||
{
|
||||
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
|
||||
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
//operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
|
||||
@@ -720,11 +738,14 @@ namespace DeviceTest
|
||||
}
|
||||
|
||||
|
||||
while (workerThreadRunning)
|
||||
int time = 0;
|
||||
while (workerThreadRunning)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
|
||||
if (workerThreadRunning)
|
||||
StateMachine.Time = ++time;
|
||||
|
||||
if (workerThreadRunning)
|
||||
{
|
||||
foreach (var d in tbfDevices) d.RunDeviceBefore();
|
||||
|
||||
|
||||
@@ -72,10 +72,10 @@ namespace DeviceTest
|
||||
}
|
||||
|
||||
/// Configure and start logging
|
||||
log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(LocAppDataDir + log4netConfigFName));
|
||||
log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Path.Combine(LocAppDataDir, log4netConfigFName)));
|
||||
log = LogManager.GetLogger(typeof(Program));
|
||||
log.Fatal("--------------------------------------------------------------------------------");
|
||||
log.Fatal(string.Format("TBF ver.{0}", Version));
|
||||
log.FatalFormat("DeviceTest ver.{0}", Version);
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
@@ -28,6 +28,9 @@ namespace Results.Entities
|
||||
public virtual double KorrErrQ { get; set; } /// [%] not mapped to results DB, saved to Oracle DB
|
||||
public virtual bool TestDone { get; set; } /// true = test was completed
|
||||
public virtual bool Passed { get; set; } /// true = test passed, water meter is OK
|
||||
#if ORACLE_DB
|
||||
public virtual double LastError { get; set; } /// [%] Previous test error at this Q in case Pruefindex > 1
|
||||
#endif
|
||||
|
||||
public virtual WaterMeter WaterMeter { get; set; } /// reference to the WaterMeter entity
|
||||
public virtual TestRslt TestRslt { get; set; } /// reference to the TestRslt entity
|
||||
@@ -80,10 +83,18 @@ namespace Results.Entities
|
||||
public virtual bool IsDataStream() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.DataStream); }
|
||||
public virtual bool IsManual() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Manual); }
|
||||
|
||||
public virtual string PassedColorStr()
|
||||
public virtual string PassedColorStr(string yesNoFormatOrEmpty)
|
||||
{
|
||||
return Utils.PassedColorStr(Passed, Evaluate());
|
||||
}
|
||||
if (string.IsNullOrEmpty(yesNoFormatOrEmpty))
|
||||
{
|
||||
return Utils.PassedColorStr(Passed, Evaluate());
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] yesNo = yesNoFormatOrEmpty.Split(new char[] { '~' });
|
||||
return Passed ? yesNo[0] : ((yesNo.Length >= 2) ? yesNo[1] : Results.Resources.Strings.No);
|
||||
}
|
||||
}
|
||||
|
||||
public MeterTestRslt()
|
||||
{
|
||||
|
||||
@@ -25,7 +25,8 @@ namespace Results.Entities
|
||||
public virtual DateTime EndTime { get; set; } /// Date and time of the test end
|
||||
public virtual int FlowSetTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double TestTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double PulsesMaster { get; set; }
|
||||
public virtual double PulsesMaster { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the water to the tank
|
||||
public virtual double TotalPulsesMstr { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the complete test (not mapped to DB)
|
||||
public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected.
|
||||
public virtual double ConstMasterCorr { get; set; } /// [l/pls] Liters per pulse of the master flow meter corrected by a correction table.
|
||||
public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter calculated from a mass measurement.
|
||||
|
||||
@@ -60,13 +60,13 @@ namespace Results.Entities
|
||||
public virtual int SerialNrEx { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter
|
||||
public virtual double OrigCalibFactor { get; set; } /// Original iPerl calibration factor used during the test
|
||||
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test
|
||||
public virtual double OrigCalibFactorLNA { get; set; } /// Original iPerl LNA calibration factor used during the test
|
||||
public virtual double OrigCalibFactorLNA{ get; set; } /// Original iPerl LNA calibration factor used during the test
|
||||
public virtual double CalibFactorLNA { get; set; } /// iPerl LNA calibration factor used during the test
|
||||
public virtual double Q2ErrWOCorrection { get; set; }
|
||||
public virtual bool Q2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
|
||||
public virtual double Q2Correction { get; set; } /// !!! obsolete
|
||||
public virtual int Q2CorrRFlow { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
|
||||
public virtual int Q2CorrLFlow { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
|
||||
public virtual int Q2CorrRL { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
|
||||
public virtual int Q2CorrLR { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
|
||||
public virtual int Q2CorrFlowRight { get; set; } /// 1 = right to left
|
||||
public virtual double Diff2Hz8Hz { get; set; }
|
||||
public virtual bool Hz2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
|
||||
@@ -151,7 +151,7 @@ namespace Results.Entities
|
||||
{
|
||||
ErrorFlagsMode errorFlagsMode;
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
|
||||
return string.IsNullOrEmpty(eFlags) ? (WaterMeterData.Text4 + PassedColorStr()) : eFlags;
|
||||
return string.IsNullOrEmpty(eFlags) ? (WaterMeterData.Text4 + PassedColorStr(null)) : eFlags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -211,9 +211,17 @@ namespace Results.Entities
|
||||
}
|
||||
|
||||
|
||||
public virtual string PassedColorStr()
|
||||
public virtual string PassedColorStr(string yesNoFormatOrEmpty)
|
||||
{
|
||||
return Utils.PassedColorStr(Passed, true);
|
||||
if (string.IsNullOrEmpty(yesNoFormatOrEmpty))
|
||||
{
|
||||
return Utils.PassedColorStr(Passed, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] yesNo = yesNoFormatOrEmpty.Split(new char[] { '~' });
|
||||
return Passed ? yesNo[0] : ((yesNo.Length >= 2) ? yesNo[1] : Results.Resources.Strings.No);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -344,8 +352,8 @@ namespace Results.Entities
|
||||
Q2ErrWOCorrection = src.Q2ErrWOCorrection;
|
||||
Q2CorrectionDone = src.Q2CorrectionDone;
|
||||
Q2Correction = src.Q2Correction;
|
||||
Q2CorrRFlow = src.Q2CorrRFlow;
|
||||
Q2CorrLFlow = src.Q2CorrLFlow;
|
||||
Q2CorrRL = src.Q2CorrRL;
|
||||
Q2CorrLR = src.Q2CorrLR;
|
||||
Q2CorrFlowRight = src.Q2CorrFlowRight;
|
||||
Diff2Hz8Hz = src.Diff2Hz8Hz;
|
||||
Hz2CorrectionDone = src.Hz2CorrectionDone;
|
||||
|
||||
+11
-1
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
@@ -261,6 +261,16 @@ namespace Results
|
||||
Bench_address4, /// 226 'Address 4' from IBenchInfo
|
||||
Bench_address5, /// 227 'Address 5' from IBenchInfo
|
||||
|
||||
Max_test_index, /// 228 MaxPruefindex % 100
|
||||
VolumeCTV, /// 229
|
||||
|
||||
/// iPerl
|
||||
LastError, /// 230 For iPerl previous test result (test with Proefindex-1)
|
||||
OrigCalibFactorLNA, /// 231
|
||||
CalibFactorLNA, /// 232
|
||||
|
||||
WM_remark, /// 233
|
||||
|
||||
Count,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,10 @@ namespace Results.Mappings
|
||||
Map(x => x.Error);
|
||||
Map(x => x.TestDone);
|
||||
Map(x => x.Passed);
|
||||
|
||||
References(x => x.WaterMeter);
|
||||
#if ORACLE_DB
|
||||
Map(x => x.LastError);
|
||||
#endif
|
||||
References(x => x.WaterMeter);
|
||||
References(x => x.TestRslt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,24 +31,24 @@ namespace Results.Mappings
|
||||
Map(x => x.SerialNrEx);
|
||||
Map(x => x.OrigCalibFactor);
|
||||
Map(x => x.CalibFactor);
|
||||
#endif
|
||||
#if IPERL2
|
||||
Map(x => x.OrigCalibFactorLNA);
|
||||
Map(x => x.CalibFactorLNA);
|
||||
#endif
|
||||
#if IPERL
|
||||
Map(x => x.Q2ErrWOCorrection);
|
||||
Map(x => x.Q2CorrectionDone);
|
||||
Map(x => x.Q2Correction);
|
||||
Map(x => x.Q2CorrRFlow);
|
||||
Map(x => x.Q2CorrLFlow);
|
||||
Map(x => x.Q2CorrRL).Column("Q2CorrRFlow");
|
||||
Map(x => x.Q2CorrLR).Column("Q2CorrLFlow");
|
||||
Map(x => x.Q2CorrFlowRight);
|
||||
Map(x => x.Diff2Hz8Hz);
|
||||
Map(x => x.Hz2CorrectionDone);
|
||||
Map(x => x.Hz2Correction);
|
||||
Map(x => x.FWVersion);
|
||||
#endif
|
||||
References(x => x.WaterMeterData);
|
||||
#if ORACLE_DB
|
||||
Map(x => x.Pruefindex);
|
||||
Map(x => x.HydrPruefung);
|
||||
#endif
|
||||
References(x => x.WaterMeterData);
|
||||
References(x => x.Batch);
|
||||
HasMany(x => x.MeterTestRslts)
|
||||
.Cascade.All();
|
||||
|
||||
@@ -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.995.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.995.0")]
|
||||
[assembly: AssemblyVersion("2.18.1076.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1076.0")]
|
||||
|
||||
Generated
+18
@@ -114,6 +114,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Batch.
|
||||
/// </summary>
|
||||
internal static string Batch {
|
||||
get {
|
||||
return ResourceManager.GetString("Batch", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Batch nr..
|
||||
/// </summary>
|
||||
@@ -1059,6 +1068,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Relative error of a meter in previous test/in production.
|
||||
/// </summary>
|
||||
internal static string Tooltip_E_rel_last {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_E_rel_last", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Relative error of the master meter.
|
||||
/// </summary>
|
||||
|
||||
@@ -252,4 +252,7 @@
|
||||
<data name="Address" xml:space="preserve">
|
||||
<value>Adresa</value>
|
||||
</data>
|
||||
<data name="Batch" xml:space="preserve">
|
||||
<value>Dávka</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -735,4 +735,10 @@
|
||||
<data name="Address" xml:space="preserve">
|
||||
<value>Address</value>
|
||||
</data>
|
||||
<data name="Tooltip_E_rel_last" xml:space="preserve">
|
||||
<value>Relative error of a meter in previous test/in production</value>
|
||||
</data>
|
||||
<data name="Batch" xml:space="preserve">
|
||||
<value>Batch</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -27,7 +27,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -154,8 +154,9 @@ namespace Results
|
||||
/// Volume
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_volume, Strings.Test_vol + "()", Quantity.Volume, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).TargetVolume())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, string.Format("{0} Mt. ()", Strings.VName_Vol), Strings.Tooltip_Vol_Mt, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, string.Format("{0} rm ()", Strings.VName_Vol), Strings.Tooltip_Vol_rm, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeRef)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.VolumeCTV, string.Format("{0} CTV ()", Strings.VName_Vol), Quantity.Volume, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).VolumeCTV)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, string.Format("{0} Mt. ()", Strings.VName_Vol), Strings.Tooltip_Vol_Mt, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, string.Format("{0} rm ()", Strings.VName_Vol), Strings.Tooltip_Vol_rm, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeRef)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_main, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.main), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_aux, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.aux), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume, Strings.Start_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart)));
|
||||
@@ -309,12 +310,14 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Uncertainty, Strings.Uncertainty + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).Uncertainty())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error, string.Format("{0} rel.ref. ()", Strings.VName_Error), Strings.Tooltip_E_rel_ref, Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrorMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error_corr, string.Format("{0} ref.corr. ()", Strings.VName_Error), "Relative error of the reference flow meter after correction using correction curve", Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", Config.Formulas.ErrorFromVolumes(w.GetTestRslt(t).ConstMasterCorr, w.GetTestRslt(t).ConstMaster))));
|
||||
#if TURA_IPERL || TURA_SPECIAL
|
||||
#if ORACLE_DB
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.LastError, string.Format("{0} rel. last ()", Strings.VName_Error), Strings.Tooltip_E_rel_last, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).LastError)));
|
||||
#else
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
|
||||
#endif
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr() : ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr(f)
|
||||
: ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr(f))));
|
||||
|
||||
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
|
||||
|
||||
@@ -398,8 +401,9 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed_seals_count, "Seals count of passed meters", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.PassedMetersCount() * int.Parse(w.WaterMeterData.Text5))));
|
||||
|
||||
/// Extra water meter data
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Result_code, Strings.Result_code, Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.ResultCode)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Remark, Strings.Remark, Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, w.Batch.Remark)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Result_code, Strings.Result_code, Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.ResultCode)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.WM_remark, string.Format("{0} {1}", Strings.Water_Meter, Strings.Remark), Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.Remark)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Remark, string.Format("{0} {1}", Strings.Batch, Strings.Remark), Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, w.Batch.Remark)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Meter_type, Strings.Meter_type, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Compound ? Strings.Compound : (w.WaterMeterData.HeatMeter ? Strings.Heat_meter : Strings.Single))));
|
||||
|
||||
#if HEAT_METERS
|
||||
@@ -408,20 +412,25 @@ namespace Results
|
||||
#endif
|
||||
|
||||
#if IPERL
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactor, "iPerl OrigCalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.OrigCalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactor, "iPerl CalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.Q2ErrWOCorrection)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? Strings.Yes : Strings.No)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2CorrRFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRFlow)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2CorrLFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLFlow)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrFlowRight)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.FW_Version, "iPerl FW version", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.FWVersion)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactor, "iPerl OrigCalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.OrigCalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactor, "iPerl CalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactorLNA,"iPerl OrigCalibFactorLNA",Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.OrigCalibFactorLNA)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactorLNA, "iPerl CalibFactorLNA", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactorLNA)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.Q2ErrWOCorrection)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean,ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? Strings.Yes : Strings.No)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2CorrRFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRL)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2CorrLFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLR)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrFlowRight)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.FW_Version, "iPerl FW version", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.FWVersion)));
|
||||
#if ORACLE_DB
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Max_test_index, "iPerl test index", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, (w.Pruefindex % 100))));
|
||||
#endif
|
||||
#endif
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestDone, Strings.Test_done + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) != null && w.GetMeterTestRslt(t).TestDone) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestPassed, Strings.Test_passed + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) != null && w.GetMeterTestRslt(t).Passed) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlags, Strings.Error_flags + "()", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) != null) ? w.GetTestRslt(t).ErrorFlagsStr() : w.ErrorFlagsStr())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlagsEx, Strings.Error_flags + "Ex", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.ErrorFlagsStrEx())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E1, "E1 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0001) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestDone, Strings.Test_done + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => FormatBool(f, (w.GetMeterTestRslt(t) != null) && w.GetMeterTestRslt(t).TestDone)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestPassed, Strings.Test_passed + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => FormatBool(f, (w.GetMeterTestRslt(t) != null) && w.GetMeterTestRslt(t).Passed)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlags, Strings.Error_flags + "()", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) != null) ? w.GetTestRslt(t).ErrorFlagsStr() : w.ErrorFlagsStr())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlagsEx, Strings.Error_flags + "Ex", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.ErrorFlagsStrEx())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E1, "E1 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0001) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E2, "E2 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0002) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E3, "E3 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0004) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E4, "E4 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0008) != 0) ? Strings.Yes : Strings.No));
|
||||
@@ -454,9 +463,22 @@ namespace Results
|
||||
return string.IsNullOrEmpty(format) ? value : string.Format(format, value);
|
||||
}
|
||||
|
||||
public static string FormatBool(string format, bool value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(format))
|
||||
{
|
||||
return value ? Strings.Yes : Strings.No;
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] yesNo = format.Split(new char[] { '~' });
|
||||
return value ? yesNo[0] : ((yesNo.Length >= 2) ? yesNo[1] : Strings.No);
|
||||
}
|
||||
}
|
||||
|
||||
public static string FormatInt(string format, int value)
|
||||
{
|
||||
return string.IsNullOrEmpty(format) ? value.ToString() : string.Format(format, value);
|
||||
return string.IsNullOrEmpty(format) ? value.ToString() : string.Format(format, value);
|
||||
}
|
||||
|
||||
public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v)
|
||||
|
||||
@@ -237,4 +237,7 @@
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Vytisknout</value>
|
||||
</data>
|
||||
<data name="Add_data_from_Oracle" xml:space="preserve">
|
||||
<value>Dohledej údaje z Oracle</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -825,4 +825,7 @@
|
||||
<data name="Error_exporting_results" xml:space="preserve">
|
||||
<value>Error exporting results</value>
|
||||
</data>
|
||||
<data name="Add_data_from_Oracle" xml:space="preserve">
|
||||
<value>Add data from Oracle</value>
|
||||
</data>
|
||||
</root>
|
||||
+9
@@ -105,6 +105,15 @@ namespace ResultsBrowser.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add data from Oracle.
|
||||
/// </summary>
|
||||
internal static string Add_data_from_Oracle {
|
||||
get {
|
||||
return ResourceManager.GetString("Add_data_from_Oracle", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add filter.
|
||||
/// </summary>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -31,7 +31,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -30,6 +30,10 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
public string Address5 { get { return myCfg.Address5; } }
|
||||
public RemoteDBUse RemoteDBUse { get { return myCfg.RemoteDBUse; } }
|
||||
|
||||
#if ORACLE_DB
|
||||
public int MaxTestIndex { get { return myCfg.MaxTestIndex; } } /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
#endif
|
||||
|
||||
public Component()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
public string ApprovalDate;
|
||||
public string ApprovedBy;
|
||||
public RemoteDBUse RemoteDBUse;
|
||||
#if ORACLE_DB
|
||||
public int MaxTestIndex; /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
#endif
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
ComponentCfg() {}
|
||||
@@ -64,6 +67,9 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
ApprovedBy = string.Empty;
|
||||
|
||||
RemoteDBUse = RemoteDBUse.LocalDBOnly;
|
||||
#if ORACLE_DB
|
||||
MaxTestIndex = 4;
|
||||
#endif
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
@@ -79,6 +85,9 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
"Approval date",
|
||||
"Approved by",
|
||||
"Remote DB use",
|
||||
#if ORACLE_DB
|
||||
"Max.test index",
|
||||
#endif
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
@@ -117,6 +126,9 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
case 8: return ApprovalDate;
|
||||
case 9: return ApprovedBy;
|
||||
case 10: return RemoteDBUse.ToDescription();
|
||||
#if ORACLE_DB
|
||||
case 11: return MaxTestIndex.ToString();
|
||||
#endif
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -153,7 +165,9 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.Error;
|
||||
|
||||
#if ORACLE_DB
|
||||
case 11: MaxTestIndex = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
#endif
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
@@ -176,6 +190,7 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
case 9:
|
||||
return true;
|
||||
case 1:
|
||||
case 11:
|
||||
if (int.TryParse(strValue, out idummy) && (idummy >= 0)) return true;
|
||||
break;
|
||||
case 10:
|
||||
@@ -206,6 +221,9 @@ namespace TBF.BenchControl.BenchInfo.Extended
|
||||
prms.ApprovalDate = this.ApprovalDate;
|
||||
prms.ApprovedBy = this.ApprovedBy;
|
||||
prms.RemoteDBUse = this.RemoteDBUse;
|
||||
#if ORACLE_DB
|
||||
prms.MaxTestIndex = this.MaxTestIndex;
|
||||
#endif
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
|
||||
@@ -29,6 +29,9 @@ namespace TBF.BenchControl.BenchInfo.Munich
|
||||
public string Address4 { get { return string.Empty; } }
|
||||
public string Address5 { get { return string.Empty; } }
|
||||
public RemoteDBUse RemoteDBUse { get { return RemoteDBUse.LocalDBOnly; } }
|
||||
#if ORACLE_DB
|
||||
public int MaxTestIndex { get { return 0; } }
|
||||
#endif
|
||||
|
||||
public Component()
|
||||
{
|
||||
|
||||
@@ -188,6 +188,12 @@ namespace TBF.BenchControl.Configs.ParamsProvider
|
||||
{
|
||||
flags |= paramsProvider.UpdateParam(itemNr, e.DisplayText);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(message);
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
double refVolume;
|
||||
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
bool fixedErrorLimits; /// false in case of calculated error limits
|
||||
|
||||
int TextBoxesCount;
|
||||
///
|
||||
@@ -119,6 +120,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
this.fixedErrorLimits = (errLimHi > errLimLo);
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
@@ -286,7 +288,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { };
|
||||
exclamation1.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation1.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox2_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -298,7 +300,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation2.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation2.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox3_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -310,7 +312,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation3.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation3.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox4_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -322,7 +324,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation4.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation4.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox5_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -334,7 +336,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation5.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation5.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox6_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -346,7 +348,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation6.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation6.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox7_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -358,7 +360,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation7.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation7.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox8_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -370,7 +372,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation8.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation8.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox9_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -382,7 +384,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation9.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation9.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void endTextBox10_TextChanged(object sender, EventArgs e)
|
||||
@@ -395,7 +397,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation10.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation10.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void endTextBox11_TextChanged(object sender, EventArgs e)
|
||||
@@ -408,7 +410,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation11.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation11.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox12_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -420,7 +422,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation12.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation12.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
double refVolume;
|
||||
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
bool fixedErrorLimits; /// false in case of calculated error limits
|
||||
|
||||
int TextBoxesCount;
|
||||
///
|
||||
@@ -124,6 +125,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
this.fixedErrorLimits = (errLimHi > errLimLo);
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
@@ -289,7 +291,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { };
|
||||
exclamation1.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation1.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox2_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -301,7 +303,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation2.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation2.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox3_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -313,7 +315,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation3.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation3.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox4_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -325,7 +327,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation4.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation4.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox5_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -337,7 +339,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation5.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation5.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox6_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -349,7 +351,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation6.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation6.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox7_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -361,7 +363,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation7.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation7.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox8_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -373,7 +375,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation8.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation8.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox9_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -385,7 +387,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation9.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation9.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void endTextBox10_TextChanged(object sender, EventArgs e)
|
||||
@@ -398,7 +400,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation10.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation10.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void endTextBox11_TextChanged(object sender, EventArgs e)
|
||||
@@ -411,7 +413,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation11.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation11.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox12_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -423,7 +425,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation12.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation12.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox13_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -435,7 +437,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation13.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation13.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox14_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -447,7 +449,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation14.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation14.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox15_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -459,7 +461,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation15.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation15.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox16_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -471,7 +473,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation16.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation16.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox17_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -483,7 +485,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation17.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation17.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox18_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -495,7 +497,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation18.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation18.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox19_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -507,7 +509,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation19.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation19.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox20_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -519,7 +521,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation20.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation20.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox21_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -531,7 +533,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation21.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation21.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox22_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -543,7 +545,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation22.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation22.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox23_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -555,7 +557,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation23.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation23.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
private void endTextBox24_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
@@ -567,7 +569,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation24.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation24.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
double refVolume;
|
||||
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
bool fixedErrorLimits; /// false in case of calculated error limits
|
||||
|
||||
int TextBoxesCount;
|
||||
///
|
||||
@@ -128,6 +129,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
this.fixedErrorLimits = (errLimHi > errLimLo);
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
@@ -294,7 +296,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
exclamation.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void endTextBox1_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox1, startTextBox1, exclamation1); }
|
||||
|
||||
+291
-316
@@ -31,328 +31,303 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBeginningForm));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox2 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox3 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox7 = new System.Windows.Forms.CheckBox();
|
||||
this.checkBox3 = new System.Windows.Forms.CheckBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox4 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox4 = new System.Windows.Forms.CheckBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.groupBox5 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox5 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox5 = new System.Windows.Forms.CheckBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.groupBox6 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox6 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox6 = new System.Windows.Forms.CheckBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.orderGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.orderComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.clearButton = new System.Windows.Forms.Button();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.groupBox4.SuspendLayout();
|
||||
this.groupBox5.SuspendLayout();
|
||||
this.groupBox6.SuspendLayout();
|
||||
this.orderGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.comboBox1);
|
||||
this.groupBox1.Controls.Add(this.checkBox1);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||
this.groupBox1.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.comboBox1, "comboBox1");
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
|
||||
this.comboBox1.TextChanged += new System.EventHandler(this.comboBox1_TextChanged);
|
||||
this.comboBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox1_KeyPress);
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
resources.ApplyResources(this.checkBox1, "checkBox1");
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
resources.ApplyResources(this.label1, "label1");
|
||||
this.label1.Name = "label1";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.comboBox2);
|
||||
this.groupBox2.Controls.Add(this.checkBox2);
|
||||
this.groupBox2.Controls.Add(this.label2);
|
||||
resources.ApplyResources(this.groupBox2, "groupBox2");
|
||||
this.groupBox2.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.TabStop = false;
|
||||
//
|
||||
// comboBox2
|
||||
//
|
||||
this.comboBox2.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.comboBox2, "comboBox2");
|
||||
this.comboBox2.Name = "comboBox2";
|
||||
this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged);
|
||||
this.comboBox2.TextChanged += new System.EventHandler(this.comboBox2_TextChanged);
|
||||
this.comboBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox2_KeyPress);
|
||||
//
|
||||
// checkBox2
|
||||
//
|
||||
resources.ApplyResources(this.checkBox2, "checkBox2");
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
resources.ApplyResources(this.label2, "label2");
|
||||
this.label2.Name = "label2";
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.comboBox3);
|
||||
this.groupBox3.Controls.Add(this.checkBox7);
|
||||
this.groupBox3.Controls.Add(this.checkBox3);
|
||||
this.groupBox3.Controls.Add(this.label3);
|
||||
resources.ApplyResources(this.groupBox3, "groupBox3");
|
||||
this.groupBox3.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.TabStop = false;
|
||||
//
|
||||
// comboBox3
|
||||
//
|
||||
this.comboBox3.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.comboBox3, "comboBox3");
|
||||
this.comboBox3.Name = "comboBox3";
|
||||
this.comboBox3.SelectedIndexChanged += new System.EventHandler(this.comboBox3_SelectedIndexChanged);
|
||||
this.comboBox3.TextChanged += new System.EventHandler(this.comboBox3_TextChanged);
|
||||
this.comboBox3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox3_KeyPress);
|
||||
//
|
||||
// checkBox7
|
||||
//
|
||||
resources.ApplyResources(this.checkBox7, "checkBox7");
|
||||
this.checkBox7.Name = "checkBox7";
|
||||
this.checkBox7.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBox3
|
||||
//
|
||||
resources.ApplyResources(this.checkBox3, "checkBox3");
|
||||
this.checkBox3.Name = "checkBox3";
|
||||
this.checkBox3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
resources.ApplyResources(this.label3, "label3");
|
||||
this.label3.Name = "label3";
|
||||
//
|
||||
// groupBox4
|
||||
//
|
||||
this.groupBox4.Controls.Add(this.comboBox4);
|
||||
this.groupBox4.Controls.Add(this.checkBox4);
|
||||
this.groupBox4.Controls.Add(this.label4);
|
||||
resources.ApplyResources(this.groupBox4, "groupBox4");
|
||||
this.groupBox4.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox4.Name = "groupBox4";
|
||||
this.groupBox4.TabStop = false;
|
||||
//
|
||||
// comboBox4
|
||||
//
|
||||
this.comboBox4.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.comboBox4, "comboBox4");
|
||||
this.comboBox4.Name = "comboBox4";
|
||||
this.comboBox4.SelectedIndexChanged += new System.EventHandler(this.comboBox4_SelectedIndexChanged);
|
||||
this.comboBox4.TextChanged += new System.EventHandler(this.comboBox4_TextChanged);
|
||||
this.comboBox4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox4_KeyPress);
|
||||
//
|
||||
// checkBox4
|
||||
//
|
||||
resources.ApplyResources(this.checkBox4, "checkBox4");
|
||||
this.checkBox4.Name = "checkBox4";
|
||||
this.checkBox4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.Name = "label4";
|
||||
//
|
||||
// groupBox5
|
||||
//
|
||||
this.groupBox5.Controls.Add(this.comboBox5);
|
||||
this.groupBox5.Controls.Add(this.checkBox5);
|
||||
this.groupBox5.Controls.Add(this.label5);
|
||||
resources.ApplyResources(this.groupBox5, "groupBox5");
|
||||
this.groupBox5.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox5.Name = "groupBox5";
|
||||
this.groupBox5.TabStop = false;
|
||||
//
|
||||
// comboBox5
|
||||
//
|
||||
this.comboBox5.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.comboBox5, "comboBox5");
|
||||
this.comboBox5.Name = "comboBox5";
|
||||
this.comboBox5.SelectedIndexChanged += new System.EventHandler(this.comboBox5_SelectedIndexChanged);
|
||||
this.comboBox5.TextChanged += new System.EventHandler(this.comboBox5_TextChanged);
|
||||
this.comboBox5.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox5_KeyPress);
|
||||
//
|
||||
// checkBox5
|
||||
//
|
||||
resources.ApplyResources(this.checkBox5, "checkBox5");
|
||||
this.checkBox5.Name = "checkBox5";
|
||||
this.checkBox5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
resources.ApplyResources(this.label5, "label5");
|
||||
this.label5.Name = "label5";
|
||||
//
|
||||
// groupBox6
|
||||
//
|
||||
this.groupBox6.Controls.Add(this.comboBox6);
|
||||
this.groupBox6.Controls.Add(this.checkBox6);
|
||||
this.groupBox6.Controls.Add(this.label6);
|
||||
resources.ApplyResources(this.groupBox6, "groupBox6");
|
||||
this.groupBox6.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox6.Name = "groupBox6";
|
||||
this.groupBox6.TabStop = false;
|
||||
//
|
||||
// comboBox6
|
||||
//
|
||||
this.comboBox6.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.comboBox6, "comboBox6");
|
||||
this.comboBox6.Name = "comboBox6";
|
||||
this.comboBox6.SelectedIndexChanged += new System.EventHandler(this.comboBox6_SelectedIndexChanged);
|
||||
this.comboBox6.TextChanged += new System.EventHandler(this.comboBox6_TextChanged);
|
||||
this.comboBox6.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox6_KeyPress);
|
||||
//
|
||||
// checkBox6
|
||||
//
|
||||
resources.ApplyResources(this.checkBox6, "checkBox6");
|
||||
this.checkBox6.Name = "checkBox6";
|
||||
this.checkBox6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
resources.ApplyResources(this.label6, "label6");
|
||||
this.label6.Name = "label6";
|
||||
//
|
||||
// orderGroupBox
|
||||
//
|
||||
this.orderGroupBox.Controls.Add(this.orderComboBox);
|
||||
resources.ApplyResources(this.orderGroupBox, "orderGroupBox");
|
||||
this.orderGroupBox.ForeColor = System.Drawing.Color.Black;
|
||||
this.orderGroupBox.Name = "orderGroupBox";
|
||||
this.orderGroupBox.TabStop = false;
|
||||
//
|
||||
// orderComboBox
|
||||
//
|
||||
this.orderComboBox.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.orderComboBox, "orderComboBox");
|
||||
this.orderComboBox.Name = "orderComboBox";
|
||||
//
|
||||
// clearButton
|
||||
//
|
||||
resources.ApplyResources(this.clearButton, "clearButton");
|
||||
this.clearButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.clearButton.Name = "clearButton";
|
||||
this.clearButton.UseVisualStyleBackColor = true;
|
||||
this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
|
||||
//
|
||||
// CycleBeginningForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGoldenrod;
|
||||
this.Controls.Add(this.clearButton);
|
||||
this.Controls.Add(this.orderGroupBox);
|
||||
this.Controls.Add(this.groupBox6);
|
||||
this.Controls.Add(this.groupBox5);
|
||||
this.Controls.Add(this.groupBox4);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "CycleBeginningForm";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleBeginningForm_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
this.groupBox4.ResumeLayout(false);
|
||||
this.groupBox4.PerformLayout();
|
||||
this.groupBox5.ResumeLayout(false);
|
||||
this.groupBox5.PerformLayout();
|
||||
this.groupBox6.ResumeLayout(false);
|
||||
this.groupBox6.PerformLayout();
|
||||
this.orderGroupBox.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBeginningForm));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.clearButton = new System.Windows.Forms.Button();
|
||||
this.comboBox2 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.comboBox3 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox3 = new System.Windows.Forms.CheckBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.comboBox4 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox4 = new System.Windows.Forms.CheckBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.comboBox5 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox5 = new System.Windows.Forms.CheckBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.comboBox6 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox6 = new System.Windows.Forms.CheckBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.orderComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.orderLabel = new System.Windows.Forms.Label();
|
||||
this.snLabel = new System.Windows.Forms.Label();
|
||||
this.remarkLabel = new System.Windows.Forms.Label();
|
||||
this.remarkComboBox6 = new System.Windows.Forms.ComboBox();
|
||||
this.remarkComboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.remarkComboBox2 = new System.Windows.Forms.ComboBox();
|
||||
this.remarkComboBox3 = new System.Windows.Forms.ComboBox();
|
||||
this.remarkComboBox4 = new System.Windows.Forms.ComboBox();
|
||||
this.remarkComboBox5 = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
resources.ApplyResources(this.comboBox1, "comboBox1");
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
|
||||
this.comboBox1.TextChanged += new System.EventHandler(this.comboBox1_TextChanged);
|
||||
this.comboBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox1_KeyPress);
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
resources.ApplyResources(this.checkBox1, "checkBox1");
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
resources.ApplyResources(this.label1, "label1");
|
||||
this.label1.Name = "label1";
|
||||
//
|
||||
// clearButton
|
||||
//
|
||||
resources.ApplyResources(this.clearButton, "clearButton");
|
||||
this.clearButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.clearButton.Name = "clearButton";
|
||||
this.clearButton.UseVisualStyleBackColor = true;
|
||||
this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
|
||||
//
|
||||
// comboBox2
|
||||
//
|
||||
resources.ApplyResources(this.comboBox2, "comboBox2");
|
||||
this.comboBox2.FormattingEnabled = true;
|
||||
this.comboBox2.Name = "comboBox2";
|
||||
this.comboBox2.TextChanged += new System.EventHandler(this.comboBox2_TextChanged);
|
||||
this.comboBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox2_KeyPress);
|
||||
//
|
||||
// checkBox2
|
||||
//
|
||||
resources.ApplyResources(this.checkBox2, "checkBox2");
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
resources.ApplyResources(this.label2, "label2");
|
||||
this.label2.Name = "label2";
|
||||
//
|
||||
// comboBox3
|
||||
//
|
||||
resources.ApplyResources(this.comboBox3, "comboBox3");
|
||||
this.comboBox3.FormattingEnabled = true;
|
||||
this.comboBox3.Name = "comboBox3";
|
||||
this.comboBox3.TextChanged += new System.EventHandler(this.comboBox3_TextChanged);
|
||||
this.comboBox3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox3_KeyPress);
|
||||
//
|
||||
// checkBox3
|
||||
//
|
||||
resources.ApplyResources(this.checkBox3, "checkBox3");
|
||||
this.checkBox3.Name = "checkBox3";
|
||||
this.checkBox3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
resources.ApplyResources(this.label3, "label3");
|
||||
this.label3.Name = "label3";
|
||||
//
|
||||
// comboBox4
|
||||
//
|
||||
resources.ApplyResources(this.comboBox4, "comboBox4");
|
||||
this.comboBox4.FormattingEnabled = true;
|
||||
this.comboBox4.Name = "comboBox4";
|
||||
this.comboBox4.TextChanged += new System.EventHandler(this.comboBox4_TextChanged);
|
||||
this.comboBox4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox4_KeyPress);
|
||||
//
|
||||
// checkBox4
|
||||
//
|
||||
resources.ApplyResources(this.checkBox4, "checkBox4");
|
||||
this.checkBox4.Name = "checkBox4";
|
||||
this.checkBox4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.Name = "label4";
|
||||
//
|
||||
// comboBox5
|
||||
//
|
||||
resources.ApplyResources(this.comboBox5, "comboBox5");
|
||||
this.comboBox5.FormattingEnabled = true;
|
||||
this.comboBox5.Name = "comboBox5";
|
||||
this.comboBox5.TextChanged += new System.EventHandler(this.comboBox5_TextChanged);
|
||||
this.comboBox5.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox5_KeyPress);
|
||||
//
|
||||
// checkBox5
|
||||
//
|
||||
resources.ApplyResources(this.checkBox5, "checkBox5");
|
||||
this.checkBox5.Name = "checkBox5";
|
||||
this.checkBox5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
resources.ApplyResources(this.label5, "label5");
|
||||
this.label5.Name = "label5";
|
||||
//
|
||||
// comboBox6
|
||||
//
|
||||
resources.ApplyResources(this.comboBox6, "comboBox6");
|
||||
this.comboBox6.FormattingEnabled = true;
|
||||
this.comboBox6.Name = "comboBox6";
|
||||
this.comboBox6.TextChanged += new System.EventHandler(this.comboBox6_TextChanged);
|
||||
this.comboBox6.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox6_KeyPress);
|
||||
//
|
||||
// checkBox6
|
||||
//
|
||||
resources.ApplyResources(this.checkBox6, "checkBox6");
|
||||
this.checkBox6.Name = "checkBox6";
|
||||
this.checkBox6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
resources.ApplyResources(this.label6, "label6");
|
||||
this.label6.Name = "label6";
|
||||
//
|
||||
// orderComboBox
|
||||
//
|
||||
resources.ApplyResources(this.orderComboBox, "orderComboBox");
|
||||
this.orderComboBox.FormattingEnabled = true;
|
||||
this.orderComboBox.Name = "orderComboBox";
|
||||
//
|
||||
// orderLabel
|
||||
//
|
||||
resources.ApplyResources(this.orderLabel, "orderLabel");
|
||||
this.orderLabel.Name = "orderLabel";
|
||||
//
|
||||
// snLabel
|
||||
//
|
||||
resources.ApplyResources(this.snLabel, "snLabel");
|
||||
this.snLabel.Name = "snLabel";
|
||||
//
|
||||
// remarkLabel
|
||||
//
|
||||
resources.ApplyResources(this.remarkLabel, "remarkLabel");
|
||||
this.remarkLabel.Name = "remarkLabel";
|
||||
//
|
||||
// remarkComboBox6
|
||||
//
|
||||
resources.ApplyResources(this.remarkComboBox6, "remarkComboBox6");
|
||||
this.remarkComboBox6.FormattingEnabled = true;
|
||||
this.remarkComboBox6.Name = "remarkComboBox6";
|
||||
//
|
||||
// remarkComboBox1
|
||||
//
|
||||
resources.ApplyResources(this.remarkComboBox1, "remarkComboBox1");
|
||||
this.remarkComboBox1.FormattingEnabled = true;
|
||||
this.remarkComboBox1.Name = "remarkComboBox1";
|
||||
//
|
||||
// remarkComboBox2
|
||||
//
|
||||
resources.ApplyResources(this.remarkComboBox2, "remarkComboBox2");
|
||||
this.remarkComboBox2.FormattingEnabled = true;
|
||||
this.remarkComboBox2.Name = "remarkComboBox2";
|
||||
//
|
||||
// remarkComboBox3
|
||||
//
|
||||
resources.ApplyResources(this.remarkComboBox3, "remarkComboBox3");
|
||||
this.remarkComboBox3.FormattingEnabled = true;
|
||||
this.remarkComboBox3.Name = "remarkComboBox3";
|
||||
//
|
||||
// remarkComboBox4
|
||||
//
|
||||
resources.ApplyResources(this.remarkComboBox4, "remarkComboBox4");
|
||||
this.remarkComboBox4.FormattingEnabled = true;
|
||||
this.remarkComboBox4.Name = "remarkComboBox4";
|
||||
//
|
||||
// remarkComboBox5
|
||||
//
|
||||
resources.ApplyResources(this.remarkComboBox5, "remarkComboBox5");
|
||||
this.remarkComboBox5.FormattingEnabled = true;
|
||||
this.remarkComboBox5.Name = "remarkComboBox5";
|
||||
//
|
||||
// CycleBeginningForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGoldenrod;
|
||||
this.Controls.Add(this.remarkComboBox5);
|
||||
this.Controls.Add(this.remarkComboBox4);
|
||||
this.Controls.Add(this.remarkComboBox3);
|
||||
this.Controls.Add(this.remarkComboBox2);
|
||||
this.Controls.Add(this.remarkComboBox1);
|
||||
this.Controls.Add(this.remarkComboBox6);
|
||||
this.Controls.Add(this.remarkLabel);
|
||||
this.Controls.Add(this.snLabel);
|
||||
this.Controls.Add(this.orderLabel);
|
||||
this.Controls.Add(this.orderComboBox);
|
||||
this.Controls.Add(this.comboBox6);
|
||||
this.Controls.Add(this.checkBox6);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.comboBox5);
|
||||
this.Controls.Add(this.checkBox5);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.comboBox4);
|
||||
this.Controls.Add(this.checkBox4);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.comboBox3);
|
||||
this.Controls.Add(this.checkBox3);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.comboBox2);
|
||||
this.Controls.Add(this.checkBox2);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.comboBox1);
|
||||
this.Controls.Add(this.clearButton);
|
||||
this.Controls.Add(this.checkBox1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "CycleBeginningForm";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleBeginningForm_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.GroupBox groupBox4;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.GroupBox groupBox5;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.GroupBox groupBox6;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.CheckBox checkBox2;
|
||||
private System.Windows.Forms.CheckBox checkBox7;
|
||||
private System.Windows.Forms.CheckBox checkBox3;
|
||||
private System.Windows.Forms.CheckBox checkBox4;
|
||||
private System.Windows.Forms.CheckBox checkBox5;
|
||||
private System.Windows.Forms.CheckBox checkBox6;
|
||||
private System.Windows.Forms.GroupBox orderGroupBox;
|
||||
private System.Windows.Forms.ComboBox orderComboBox;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.ComboBox comboBox2;
|
||||
private System.Windows.Forms.ComboBox comboBox3;
|
||||
private System.Windows.Forms.ComboBox comboBox4;
|
||||
private System.Windows.Forms.ComboBox comboBox5;
|
||||
private System.Windows.Forms.ComboBox comboBox6;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.Button clearButton;
|
||||
private System.Windows.Forms.ComboBox comboBox2;
|
||||
private System.Windows.Forms.CheckBox checkBox2;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.ComboBox comboBox3;
|
||||
private System.Windows.Forms.CheckBox checkBox3;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.ComboBox comboBox4;
|
||||
private System.Windows.Forms.CheckBox checkBox4;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.ComboBox comboBox5;
|
||||
private System.Windows.Forms.CheckBox checkBox5;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.ComboBox comboBox6;
|
||||
private System.Windows.Forms.CheckBox checkBox6;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.ComboBox orderComboBox;
|
||||
private System.Windows.Forms.Label orderLabel;
|
||||
private System.Windows.Forms.Label snLabel;
|
||||
private System.Windows.Forms.Label remarkLabel;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox6;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox1;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox2;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox3;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox4;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox5;
|
||||
}
|
||||
}
|
||||
@@ -15,11 +15,13 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
public readonly bool RemarksEnabled;
|
||||
|
||||
/// To be retrieved after the form is closed
|
||||
public string PurchaseOrder;
|
||||
public string[] SNText;
|
||||
public bool[] Disabled;
|
||||
public string[] Remark;
|
||||
|
||||
/// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
@@ -27,21 +29,29 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
|
||||
IList<ComboBox> enabledComboBoxes;
|
||||
|
||||
ComboBox[] comboBoxes;
|
||||
CheckBox[] checkBoxes;
|
||||
ComboBox[] remarkBoxes;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public CycleBeginningForm(int waterMetersCount)
|
||||
public CycleBeginningForm(int waterMetersCount, bool remarksEnabled)
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
|
||||
comboBoxes = new ComboBox[] { comboBox1, comboBox2, comboBox3, comboBox4, comboBox5, comboBox6 };
|
||||
checkBoxes = new CheckBox[] { checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6 };
|
||||
remarkBoxes = new ComboBox[] { remarkComboBox1, remarkComboBox2, remarkComboBox3, remarkComboBox4, remarkComboBox5, remarkComboBox6 };
|
||||
|
||||
this.WaterMetersCount = waterMetersCount;
|
||||
this.RemarksEnabled = remarksEnabled;
|
||||
SNText = new string[WaterMetersCount];
|
||||
Disabled = new bool[WaterMetersCount];
|
||||
enabledComboBoxes = new List<ComboBox>();
|
||||
|
||||
Height = 147 + WaterMetersCount * 90;
|
||||
Remark = new string[WaterMetersCount];
|
||||
enabledComboBoxes = new List<ComboBox>();
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
@@ -49,15 +59,20 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
|
||||
/// <summary> Parameterless constructor for all watermeters </summary>
|
||||
public CycleBeginningForm()
|
||||
: this(Config.Data.WMsCount)
|
||||
: this(Config.Data.WMsCount, false)
|
||||
{
|
||||
}
|
||||
|
||||
private void CycleBeginningForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
PrepareOrderCombo(orderComboBox);
|
||||
|
||||
PrepareCombo(orderComboBox, Program.LocalSettings.PurchaseOrderHistory);
|
||||
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
PrepareCombo(remarkBoxes[i], Program.LocalSettings.RemarkHistory, true);
|
||||
}
|
||||
|
||||
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
@@ -69,53 +84,65 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
if (WaterMetersCount >= 6) comboBox6.Items.Add((Program.LocalSettings.LastSNTexts[5] == null) ? string.Empty : Program.LocalSettings.LastSNTexts[5]);
|
||||
}
|
||||
|
||||
if (WaterMetersCount < 1) { groupBox1.Visible = false; } else { enabledComboBoxes.Add(comboBox1); }
|
||||
if (WaterMetersCount < 2) { groupBox2.Visible = false; } else { enabledComboBoxes.Add(comboBox2); }
|
||||
if (WaterMetersCount < 3) { groupBox3.Visible = false; } else { enabledComboBoxes.Add(comboBox3); }
|
||||
if (WaterMetersCount < 4) { groupBox4.Visible = false; } else { enabledComboBoxes.Add(comboBox4); }
|
||||
if (WaterMetersCount < 5) { groupBox5.Visible = false; } else { enabledComboBoxes.Add(comboBox5); }
|
||||
if (WaterMetersCount < 6) { groupBox6.Visible = false; } else { enabledComboBoxes.Add(comboBox6); }
|
||||
if (WaterMetersCount >= 1) { enabledComboBoxes.Add(comboBox1); } else { comboBox1.Visible = false; label1.Visible = false; checkBox1.Visible = false; }
|
||||
if (WaterMetersCount >= 2) { enabledComboBoxes.Add(comboBox2); } else { comboBox2.Visible = false; label2.Visible = false; checkBox2.Visible = false; }
|
||||
if (WaterMetersCount >= 3) { enabledComboBoxes.Add(comboBox3); } else { comboBox3.Visible = false; label3.Visible = false; checkBox3.Visible = false; }
|
||||
if (WaterMetersCount >= 4) { enabledComboBoxes.Add(comboBox4); } else { comboBox4.Visible = false; label4.Visible = false; checkBox4.Visible = false; }
|
||||
if (WaterMetersCount >= 5) { enabledComboBoxes.Add(comboBox5); } else { comboBox5.Visible = false; label5.Visible = false; checkBox5.Visible = false; }
|
||||
if (WaterMetersCount >= 6) { enabledComboBoxes.Add(comboBox6); } else { comboBox6.Visible = false; label6.Visible = false; checkBox6.Visible = false; }
|
||||
|
||||
Height = 147 + WaterMetersCount * 90;
|
||||
}
|
||||
if (RemarksEnabled)
|
||||
{
|
||||
if (WaterMetersCount >= 1) { remarkComboBox1.Visible = true; remarkLabel.Visible = true; }
|
||||
if (WaterMetersCount >= 2) { remarkComboBox2.Visible = true; }
|
||||
if (WaterMetersCount >= 3) { remarkComboBox3.Visible = true; }
|
||||
if (WaterMetersCount >= 4) { remarkComboBox4.Visible = true; }
|
||||
if (WaterMetersCount >= 5) { remarkComboBox5.Visible = true; }
|
||||
if (WaterMetersCount >= 6) { remarkComboBox6.Visible = true; }
|
||||
}
|
||||
|
||||
Height = 177 + WaterMetersCount * 46;
|
||||
if (!RemarksEnabled) Width -= remarkComboBox1.Width;
|
||||
//Size = new System.Drawing.Size(RemarksEnabled ? 1045 : 624, 177 + WaterMetersCount * 46);
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Data;
|
||||
orderGroupBox.Text = Strings.Purchase_order;
|
||||
orderLabel.Text = Strings.Purchase_order;
|
||||
snLabel.Text = Strings.Serial_Number;
|
||||
remarkLabel.Text = Strings.Remark;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
clearButton.Text = Strings.ClearBtnText;
|
||||
|
||||
groupBox1.Text = Strings.Water_Meter + " 1";
|
||||
groupBox2.Text = Strings.Water_Meter + " 2";
|
||||
groupBox3.Text = Strings.Water_Meter + " 3";
|
||||
groupBox4.Text = Strings.Water_Meter + " 4";
|
||||
groupBox5.Text = Strings.Water_Meter + " 5";
|
||||
groupBox6.Text = Strings.Water_Meter + " 6";
|
||||
|
||||
label1.Text = Strings.Serial_Number;
|
||||
label2.Text = Strings.Serial_Number;
|
||||
label3.Text = Strings.Serial_Number;
|
||||
label4.Text = Strings.Serial_Number;
|
||||
label5.Text = Strings.Serial_Number;
|
||||
label6.Text = Strings.Serial_Number;
|
||||
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
clearButton.Text = Strings.ClearBtnText;
|
||||
label1.Text = Strings.Water_Meter + " 1";
|
||||
label2.Text = Strings.Water_Meter + " 2";
|
||||
label3.Text = Strings.Water_Meter + " 3";
|
||||
label4.Text = Strings.Water_Meter + " 4";
|
||||
label5.Text = Strings.Water_Meter + " 5";
|
||||
label6.Text = Strings.Water_Meter + " 6";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
|
||||
/// </summary>
|
||||
/// <param name="orderComboBox">Puchase order ComboBox</param>
|
||||
void PrepareOrderCombo(ComboBox orderComboBox)
|
||||
/// <param name="comboBox">Puchase order ComboBox</param>
|
||||
void PrepareCombo(ComboBox comboBox, string[] history, bool emptyOnStart = false)
|
||||
{
|
||||
for (int i = 0; i < Program.LocalSettings.PurchaseOrderHistoryCount; i++)
|
||||
int historyLen = (history != null) ? history.Length : 0;
|
||||
|
||||
if (!emptyOnStart && (historyLen > 0))
|
||||
{
|
||||
orderComboBox.Items.Add(Program.LocalSettings.PurchaseOrderHistory[i]);
|
||||
comboBox.Text = history[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBox.Text = string.Empty;
|
||||
}
|
||||
|
||||
if (orderComboBox.Items.Count > 0)
|
||||
for (int i = 0; i < historyLen; i++)
|
||||
{
|
||||
orderComboBox.Text = orderComboBox.Items[0].ToString();
|
||||
comboBox.Items.Add(history[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,14 +156,15 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
#endif
|
||||
);
|
||||
|
||||
Program.LocalSettings.LastSNTexts = SNText;
|
||||
Program.LocalSettings.LastSNTexts = SNText;
|
||||
|
||||
if (WaterMetersCount >= 1) { SNText[0] = comboBox1.Text; Disabled[0] = !checkBox1.Checked; }
|
||||
if (WaterMetersCount >= 2) { SNText[1] = comboBox2.Text; Disabled[1] = !checkBox2.Checked; }
|
||||
if (WaterMetersCount >= 3) { SNText[2] = comboBox3.Text; Disabled[2] = !checkBox3.Checked; }
|
||||
if (WaterMetersCount >= 4) { SNText[3] = comboBox4.Text; Disabled[3] = !checkBox4.Checked; }
|
||||
if (WaterMetersCount >= 5) { SNText[4] = comboBox5.Text; Disabled[4] = !checkBox5.Checked; }
|
||||
if (WaterMetersCount >= 6) { SNText[5] = comboBox6.Text; Disabled[5] = !checkBox6.Checked; }
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
Program.LocalSettings.UpdateHistory(remarkBoxes[i].Text, ref Program.LocalSettings.RemarkHistory, 20);
|
||||
SNText[i] = comboBoxes[i].Text;
|
||||
Disabled[i] = !checkBoxes[i].Checked;
|
||||
Remark[i] = remarkBoxes[i].Text;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
@@ -145,36 +173,11 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
|
||||
private void UpdateAllCombos()
|
||||
{
|
||||
if (WaterMetersCount >= 1)
|
||||
{
|
||||
comboBox1.Text = Program.LocalSettings.LastSNTexts[0];
|
||||
checkBox1.Checked = !string.IsNullOrEmpty(comboBox1.Text);
|
||||
}
|
||||
if (WaterMetersCount >= 2)
|
||||
{
|
||||
comboBox2.Text = Program.LocalSettings.LastSNTexts[1];
|
||||
checkBox2.Checked = !string.IsNullOrEmpty(comboBox2.Text);
|
||||
}
|
||||
if (WaterMetersCount >= 3)
|
||||
{
|
||||
comboBox3.Text = Program.LocalSettings.LastSNTexts[2];
|
||||
checkBox3.Checked = !string.IsNullOrEmpty(comboBox3.Text);
|
||||
}
|
||||
if (WaterMetersCount >= 4)
|
||||
{
|
||||
comboBox4.Text = Program.LocalSettings.LastSNTexts[3];
|
||||
checkBox4.Checked = !string.IsNullOrEmpty(comboBox4.Text);
|
||||
}
|
||||
if (WaterMetersCount >= 5)
|
||||
{
|
||||
comboBox5.Text = Program.LocalSettings.LastSNTexts[4];
|
||||
checkBox5.Checked = !string.IsNullOrEmpty(comboBox5.Text);
|
||||
}
|
||||
if (WaterMetersCount >= 6)
|
||||
{
|
||||
comboBox6.Text = Program.LocalSettings.LastSNTexts[5];
|
||||
checkBox6.Checked = !string.IsNullOrEmpty(comboBox6.Text);
|
||||
}
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
comboBoxes[i].Text = Program.LocalSettings.LastSNTexts[i];
|
||||
checkBoxes[i].Checked = !string.IsNullOrEmpty(comboBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBox1_TextChanged(object sender, EventArgs e) { checkBox1.Checked = true; }
|
||||
@@ -236,12 +239,11 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
|
||||
private void clearButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WaterMetersCount >= 1) { comboBox1.Text = string.Empty; checkBox1.Checked = false; }
|
||||
if (WaterMetersCount >= 2) { comboBox2.Text = string.Empty; checkBox2.Checked = false; }
|
||||
if (WaterMetersCount >= 3) { comboBox3.Text = string.Empty; checkBox3.Checked = false; }
|
||||
if (WaterMetersCount >= 4) { comboBox4.Text = string.Empty; checkBox4.Checked = false; }
|
||||
if (WaterMetersCount >= 5) { comboBox5.Text = string.Empty; checkBox5.Checked = false; }
|
||||
if (WaterMetersCount >= 6) { comboBox6.Text = string.Empty; checkBox6.Checked = false; }
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
comboBoxes[i].Text = string.Empty;
|
||||
checkBoxes[i].Checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -273,11 +275,13 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void ProcKeyPress(object sender, KeyPressEventArgs e, ComboBox currentFocusOwner)
|
||||
{
|
||||
#if !CEVAK_200
|
||||
if (e.KeyChar == '+')
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
okButton_Click(sender, e);
|
||||
}
|
||||
#endif
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
/// Process <enter> key ..... Next text field
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -123,13 +123,13 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
///
|
||||
void OpenBeginningDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleBeginningForm(myRef.waterMeters.Length);
|
||||
myRef.modelessDlg = new CycleBeginningForm(myRef.waterMeters.Length, (myRef.entryFormCfg.RemarkEnabled && !myRef.entryFormCfg.ShowCycleEndForm));
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenEndDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleEndForm(myRef.waterMeters.Length, entryFormCfg.RemarkEnabled);
|
||||
myRef.modelessDlg = new CycleEndForm(myRef.waterMeters.Length, myRef.entryFormCfg.RemarkEnabled);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
@@ -201,6 +201,10 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
{
|
||||
waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
|
||||
if (dlg.RemarksEnabled)
|
||||
{
|
||||
waterMeters[i].Remark = dlg.Remark[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
double refVolume;
|
||||
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
|
||||
bool fixedErrorLimits; /// false in case of calculated error limits
|
||||
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
this.fixedErrorLimits = (errLimHi > errLimLo);
|
||||
|
||||
InitializeComponent();
|
||||
WMEndState = new double[waterMetersCount];
|
||||
@@ -218,7 +219,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
catch { };
|
||||
|
||||
exclamation1.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation1.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void wmEndStateTextBox2_TextChanged(object sender, EventArgs e)
|
||||
@@ -232,7 +233,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
|
||||
exclamation2.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation2.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void wmEndStateTextBox3_TextChanged(object sender, EventArgs e)
|
||||
@@ -246,7 +247,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
|
||||
exclamation3.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation3.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void wmEndStateTextBox4_TextChanged(object sender, EventArgs e)
|
||||
@@ -260,7 +261,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
|
||||
exclamation4.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation4.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void wmEndStateTextBox5_TextChanged(object sender, EventArgs e)
|
||||
@@ -274,7 +275,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
|
||||
exclamation5.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation5.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void wmEndStateTextBox6_TextChanged(object sender, EventArgs e)
|
||||
@@ -288,7 +289,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
|
||||
exclamation6.Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
exclamation6.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
|
||||
private void wmStartStateTextBox1_KeyPress(object sender, KeyPressEventArgs e)
|
||||
|
||||
+54
-43
@@ -31,49 +31,59 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBeginningForm));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.orderGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.orderComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.orderGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// orderGroupBox
|
||||
//
|
||||
this.orderGroupBox.Controls.Add(this.orderComboBox);
|
||||
resources.ApplyResources(this.orderGroupBox, "orderGroupBox");
|
||||
this.orderGroupBox.ForeColor = System.Drawing.Color.Black;
|
||||
this.orderGroupBox.Name = "orderGroupBox";
|
||||
this.orderGroupBox.TabStop = false;
|
||||
//
|
||||
// orderComboBox
|
||||
//
|
||||
this.orderComboBox.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.orderComboBox, "orderComboBox");
|
||||
this.orderComboBox.Name = "orderComboBox";
|
||||
//
|
||||
// CycleBeginningForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGoldenrod;
|
||||
this.Controls.Add(this.orderGroupBox);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "CycleBeginningForm";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleBeginningForm_Load);
|
||||
this.orderGroupBox.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBeginningForm));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.orderGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.orderComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.pictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.orderGroupBox.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// orderGroupBox
|
||||
//
|
||||
this.orderGroupBox.Controls.Add(this.orderComboBox);
|
||||
resources.ApplyResources(this.orderGroupBox, "orderGroupBox");
|
||||
this.orderGroupBox.ForeColor = System.Drawing.Color.Black;
|
||||
this.orderGroupBox.Name = "orderGroupBox";
|
||||
this.orderGroupBox.TabStop = false;
|
||||
//
|
||||
// orderComboBox
|
||||
//
|
||||
this.orderComboBox.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.orderComboBox, "orderComboBox");
|
||||
this.orderComboBox.Name = "orderComboBox";
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
resources.ApplyResources(this.pictureBox, "pictureBox");
|
||||
this.pictureBox.Name = "pictureBox";
|
||||
this.pictureBox.TabStop = false;
|
||||
//
|
||||
// CycleBeginningForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGoldenrod;
|
||||
this.Controls.Add(this.pictureBox);
|
||||
this.Controls.Add(this.orderGroupBox);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "CycleBeginningForm";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleBeginningForm_Load);
|
||||
this.orderGroupBox.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
@@ -82,5 +92,6 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.GroupBox orderGroupBox;
|
||||
private System.Windows.Forms.ComboBox orderComboBox;
|
||||
private System.Windows.Forms.PictureBox pictureBox;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
using System.Drawing;
|
||||
|
||||
namespace TBF.BenchControl.DataEntry.iPerl
|
||||
{
|
||||
@@ -15,6 +16,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
|
||||
/// <summary> Number of water meters </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
public readonly bool reversedDirection;
|
||||
|
||||
/// To be retrieved after the form is closed
|
||||
public string PurchaseOrder;
|
||||
@@ -41,10 +43,11 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public CycleBeginningForm(int waterMetersCount)
|
||||
public CycleBeginningForm(int waterMetersCount, bool reversedDirection)
|
||||
: this()
|
||||
{
|
||||
this.WaterMetersCount = waterMetersCount;
|
||||
this.reversedDirection = reversedDirection;
|
||||
SNText = null;
|
||||
Disabled = null;
|
||||
}
|
||||
@@ -56,6 +59,14 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
orderGroupBox.Text = Strings.Purchase_order;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
PrepareOrderCombo(orderComboBox);
|
||||
if (reversedDirection)
|
||||
{
|
||||
pictureBox.Image = Image.FromFile(string.Format("{0}\\Pictures\\reversed_dir.jpg", Program.ExecutableDir, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
pictureBox.Image = Image.FromFile(string.Format("{0}\\Pictures\\forward_dir.jpg", Program.ExecutableDir, true));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -144,13 +144,13 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>okButton.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="orderComboBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>90, 31</value>
|
||||
<value>90, 32</value>
|
||||
</data>
|
||||
<data name="orderComboBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>376, 31</value>
|
||||
<value>432, 31</value>
|
||||
</data>
|
||||
<data name="orderComboBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
@@ -174,7 +174,7 @@
|
||||
<value>28, 12</value>
|
||||
</data>
|
||||
<data name="orderGroupBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>537, 82</value>
|
||||
<value>565, 82</value>
|
||||
</data>
|
||||
<data name="orderGroupBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
@@ -192,6 +192,27 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>orderGroupBox.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="pictureBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>28, 118</value>
|
||||
</data>
|
||||
<data name="pictureBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>711, 497</value>
|
||||
</data>
|
||||
<data name="pictureBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name=">>pictureBox.Name" xml:space="preserve">
|
||||
<value>pictureBox</value>
|
||||
</data>
|
||||
<data name=">>pictureBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>pictureBox.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>pictureBox.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
@@ -204,7 +225,7 @@
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>801, 119</value>
|
||||
<value>769, 639</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>Batch data</value>
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
///
|
||||
void OpenBeginningDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount);
|
||||
myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount, myRef.entryFormCfg.ReversedDirection);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -20,6 +20,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
/// Serialized parameters
|
||||
///
|
||||
public bool ShowCycleEndForm;
|
||||
public bool ReversedDirection;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
EntryFormCfg()
|
||||
@@ -27,6 +28,8 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
Name = "DataEntry-iPerl";
|
||||
ParentName = string.Empty;
|
||||
ShowCycleEndForm = false;
|
||||
ReversedDirection = false;
|
||||
|
||||
}
|
||||
|
||||
public EntryFormCfg(IComponentFactory factory)
|
||||
@@ -37,7 +40,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, ShowEndForm={1}", Name, ShowCycleEndForm);
|
||||
return string.Format("Name={0}, ShowEndForm={1}, ReversedDir={2}", Name, ShowCycleEndForm, ReversedDirection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
@@ -50,12 +50,14 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
showCycleEndFormCheckBox.Checked = config.ShowCycleEndForm;
|
||||
reversedIperlDirectionCheckBox.Checked = config.ReversedDirection;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
showCycleEndFormCheckBox.Enabled = true;
|
||||
reversedIperlDirectionCheckBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
@@ -72,6 +74,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ShowCycleEndForm = showCycleEndFormCheckBox.Checked;
|
||||
config.ReversedDirection = reversedIperlDirectionCheckBox.Checked;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
+70
-56
@@ -31,62 +31,75 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.showCycleEndFormCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(131, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(32, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(128, 32);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// showCycleEndFormCheckBox
|
||||
//
|
||||
this.showCycleEndFormCheckBox.AutoSize = true;
|
||||
this.showCycleEndFormCheckBox.Enabled = false;
|
||||
this.showCycleEndFormCheckBox.Location = new System.Drawing.Point(131, 90);
|
||||
this.showCycleEndFormCheckBox.Name = "showCycleEndFormCheckBox";
|
||||
this.showCycleEndFormCheckBox.Size = new System.Drawing.Size(125, 17);
|
||||
this.showCycleEndFormCheckBox.TabIndex = 13;
|
||||
this.showCycleEndFormCheckBox.Text = "Show cycle end form";
|
||||
this.showCycleEndFormCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// EntryFormCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.showCycleEndFormCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "EntryFormCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.showCycleEndFormCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.reversedIperlDirectionCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(131, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(32, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(128, 32);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// showCycleEndFormCheckBox
|
||||
//
|
||||
this.showCycleEndFormCheckBox.AutoSize = true;
|
||||
this.showCycleEndFormCheckBox.Enabled = false;
|
||||
this.showCycleEndFormCheckBox.Location = new System.Drawing.Point(131, 90);
|
||||
this.showCycleEndFormCheckBox.Name = "showCycleEndFormCheckBox";
|
||||
this.showCycleEndFormCheckBox.Size = new System.Drawing.Size(125, 17);
|
||||
this.showCycleEndFormCheckBox.TabIndex = 13;
|
||||
this.showCycleEndFormCheckBox.Text = "Show cycle end form";
|
||||
this.showCycleEndFormCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// reversedIperlDirectionCheckBox
|
||||
//
|
||||
this.reversedIperlDirectionCheckBox.AutoSize = true;
|
||||
this.reversedIperlDirectionCheckBox.Enabled = false;
|
||||
this.reversedIperlDirectionCheckBox.Location = new System.Drawing.Point(131, 113);
|
||||
this.reversedIperlDirectionCheckBox.Name = "reversedIperlDirectionCheckBox";
|
||||
this.reversedIperlDirectionCheckBox.Size = new System.Drawing.Size(158, 17);
|
||||
this.reversedIperlDirectionCheckBox.TabIndex = 14;
|
||||
this.reversedIperlDirectionCheckBox.Text = "Reversed direction of iPerl-s";
|
||||
this.reversedIperlDirectionCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// EntryFormCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.reversedIperlDirectionCheckBox);
|
||||
this.Controls.Add(this.showCycleEndFormCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "EntryFormCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -96,5 +109,6 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.CheckBox showCycleEndFormCheckBox;
|
||||
private System.Windows.Forms.CheckBox reversedIperlDirectionCheckBox;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.Dummy.Balance
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.IScale, IOperation
|
||||
public class Component : ComponentBase, IScale, IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString()
|
||||
@@ -28,8 +29,9 @@ namespace TBF.BenchControl.Dummy.Balance
|
||||
|
||||
public int ScaleNr { get { return 0; } }
|
||||
public double Capacity { get { return 10000.0; } }
|
||||
public GenericDevices.IValve DrainValve { get { return null; } }
|
||||
public bool IsEmpty(double mass) { return true; }
|
||||
public IValve DrainValve { get { return null; } }
|
||||
public IValve DrainValve2 { get { return null; } }
|
||||
public bool ContainsMoreThen(float thld) { return (thld == 0); }
|
||||
public bool IsEmpty() { return true; }
|
||||
public string Format { get { return "F3"; } }
|
||||
public int EmptyTimeSec { get { return 5; } }
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde
|
||||
EnduranceCycleStop = 13,
|
||||
}
|
||||
|
||||
#if FUZHOU_300 || PT200IL || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TURA_IPERL || TURA_SPECIAL || BADGER_VELKA_TRAT || PUCHONG_200 || SLM_50 || GENESIS || MALTA_WSD25 || SLM_END || WARSAW_END || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || DUBAJ_50
|
||||
#if FUZHOU_300 || IZRAEL_200 || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TURA_IPERL || TURA_SPECIAL || BADGER_VELKA_TRAT || PUCHONG_200 || SLM_50 || GENESIS || MALTA_WSD25 || SLM_END || WARSAW_END || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
|
||||
public enum StatusP : ulong
|
||||
{
|
||||
RefFlowMeterMask = 0x7, /// bits 0,1,2
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace TBF.BenchControl.Elde
|
||||
public uint[] DiverterEdge; /// Created and initialized in this.Initialize()
|
||||
|
||||
// Array length is the reference flowmeters count plus one
|
||||
#if DN100 || FUZHOU_150 || FUZHOU_300 || PT200IL || PUCHONG_200 || SLM_150 || SENTEC || CEVAK_200
|
||||
#if DN100 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || PUCHONG_200 || SLM_150 || SENTEC || CEVAK_200
|
||||
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
public float[] EtCalib = new float[6] { 1, 1, 1, 1, 1, 1 };
|
||||
@@ -137,11 +137,15 @@ namespace TBF.BenchControl.Elde
|
||||
{100,500}, {100,500}, {100,500}, {100,500} };
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
public float[] EtCalib = new float[7] { 1, 1, 1, 1, 1, 1, 1 };
|
||||
#elif MUNICH || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TORUN_50 || CEVAK_40 || TURA_IPERL || TURA_SPECIAL || MURES_40 || FUZHOU_50 || SLM_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || FUZHOU_100 || DUBAJ_50
|
||||
#elif MUNICH || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TORUN_50 || CEVAK_40 || TURA_IPERL || TURA_SPECIAL || MURES_40 || FUZHOU_50 || SLM_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || FUZHOU_100
|
||||
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 };
|
||||
#elif SLM_END || WARSAW_END
|
||||
#elif IZRAEL_50 || SLM_END
|
||||
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
|
||||
public byte[] MeretRS485Address = new byte[7]; /// Modbus addresses of Pr1, Pr2, Pr3, Pr4, Pr5, Pr6, T9 (Izrael) or Pr1, Pr2, Pr3, Pr4, T9, T10 (SLM END)
|
||||
public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 };
|
||||
#elif WARSAW_END
|
||||
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 };
|
||||
@@ -217,19 +221,31 @@ namespace TBF.BenchControl.Elde
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void UpdateWeights()
|
||||
{
|
||||
/// Mettler-Toledo scales
|
||||
for (int i = 0; i < MettlerToledo.Standard.BalanceDev.BalancesCount; i++)
|
||||
{
|
||||
controlCom.SetWeight(i, MettlerToledo.Standard.BalanceDev.Masses[i]);
|
||||
}
|
||||
|
||||
/// Mettler-Toledo-multi scales (Badger Brno, ...)
|
||||
for (int i = 0; i < MettlerToledo.Multi.BalanceDev.BalancesCount; i++)
|
||||
{
|
||||
controlCom.SetWeight(i, MettlerToledo.Multi.BalanceDev.Masses[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// Tanks (CEVAK, ...)
|
||||
int firstTankIx = Math.Max(MettlerToledo.Standard.BalanceDev.BalancesCount, MettlerToledo.Multi.BalanceDev.BalancesCount);
|
||||
|
||||
for (int i = 0; i < Various.TankWithLevelMsrmnt.Tank.TanksCount; i++)
|
||||
{
|
||||
controlCom.SetWeight(firstTankIx + i, Various.TankWithLevelMsrmnt.Tank.Tanks[i].Volume);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetReservoirTemp(int nr, float temp)
|
||||
{
|
||||
controlCom.SetReservoirTemp(nr, temp);
|
||||
@@ -280,7 +296,7 @@ namespace TBF.BenchControl.Elde
|
||||
ControlComponent3Munich.UserControl1 ctrlBrdComponent,
|
||||
#elif FUZHOU_300
|
||||
ControlComponent3F300.UserControl1 ctrlBrdComponent,
|
||||
#elif PT200IL || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent,
|
||||
#else /// all newer benches
|
||||
ControlComponent_Torino2015.UserControl1 ctrlBrdComponent,
|
||||
@@ -430,6 +446,8 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
if (DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
UpdateWeights();
|
||||
|
||||
uint[] uintFilters = new uint[8];
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@@ -660,15 +678,5 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
return new ExecuteCommandOp(this, commandOnStartOp, commandOnStopOp, testMethod);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the tank drawing and weight value in Elde software component.
|
||||
/// </summary>
|
||||
/// <param name="weight">Current mass in [kg] or approx. volume in [l]</param>
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation UpdateTankWeightOp()
|
||||
{
|
||||
return new UpdateTankWeightOp(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
public int EtPulses(int wmNr1) { return (int)ctrlBrdComponent.etPulses[wmNr1]; }
|
||||
|
||||
#if GENESIS || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || DUBAJ_50
|
||||
public int EtPulsesK { get { return (int)ctrlBrdComponent.etPulsesK; } }
|
||||
#else
|
||||
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40 || PUCHONG_200 || MALTA_WSD25
|
||||
public int EtPulsesK { get { return 1; } }
|
||||
#else /// all new benches
|
||||
public int EtPulsesK { get { return (int)ctrlBrdComponent.etPulsesK; } }
|
||||
#endif
|
||||
|
||||
public UInt16 WMeterPulses(int wmNr1) { return (UInt16)ctrlBrdComponent.wMeterPuls[wmNr1]; }
|
||||
@@ -62,7 +62,7 @@ namespace TBF.BenchControl.Elde
|
||||
public UInt128 RRoute { get { return ctrlBrdComponent.rRoute; } }
|
||||
#endif
|
||||
|
||||
#if GENESIS || KEMPNO_50 || KRAKOW_50 || BAHRAIN_50 || BADGER_STREDNA_TRAT || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || SENTEC || FUZHOU_100 || DUBAJ_50 || CEVAK_200
|
||||
#if GENESIS || KEMPNO_50 || KRAKOW_50 || BAHRAIN_50 || BADGER_STREDNA_TRAT || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
|
||||
public uint DivTime(int id) { return ctrlBrdComponent.divTime[id]; }
|
||||
public void SetDivLimit(int divNo, uint limLoPct, uint limHiPct)
|
||||
{
|
||||
@@ -106,7 +106,7 @@ namespace TBF.BenchControl.Elde
|
||||
public float AnalogInput(int adcNr0) { return ctrlBrdComponent.Analogy[adcNr0]; }
|
||||
public uint AnalogInputRaw(int adcNr0, int bank) { return ctrlBrdComponent.AnalogyRaw[adcNr0, bank]; } /// bank0=RV, bank1=Temp
|
||||
|
||||
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || PT200IL || PUCHONG_200 || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40
|
||||
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || PUCHONG_200 || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40
|
||||
public float TotalRefVolume { get { return ctrlBrdComponent.ReferenceVolume; } }
|
||||
public float MassRefVolume { get { return ctrlBrdComponent.ReferenceVolume; } }
|
||||
#else /// all new test benches
|
||||
@@ -122,7 +122,7 @@ namespace TBF.BenchControl.Elde
|
||||
public uint[] WMeterCont { get { return new uint[3]; } } /// Dummy
|
||||
#endif
|
||||
|
||||
#if KEMPNO_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || FUZHOU_100
|
||||
#if KEMPNO_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || FUZHOU_100 || CEVAK_200 || IZRAEL_50
|
||||
public float ValveOpenCloseTime { get { return ctrlBrdComponent.ValveMoveTime[0]; } }
|
||||
#else
|
||||
public float ValveOpenCloseTime { get { return 0.001f; } }
|
||||
@@ -158,7 +158,7 @@ namespace TBF.BenchControl.Elde
|
||||
private ControlComponent3Munich.UserControl1 ctrlBrdComponent;
|
||||
#elif FUZHOU_300
|
||||
private ControlComponent3F300.UserControl1 ctrlBrdComponent;
|
||||
#elif PT200IL || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
private ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent;
|
||||
#else /// newer benches
|
||||
private ControlComponent_Torino2015.UserControl1 ctrlBrdComponent;
|
||||
@@ -174,7 +174,7 @@ namespace TBF.BenchControl.Elde
|
||||
public ControlComWrap(ControlComponent3Munich.UserControl1 ctrlBrdComponent)
|
||||
#elif FUZHOU_300
|
||||
public ControlComWrap(ControlComponent3F300.UserControl1 ctrlBrdComponent)
|
||||
#elif PT200IL || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
public ControlComWrap(ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent)
|
||||
#else /// all newer benches
|
||||
public ControlComWrap(ControlComponent_Torino2015.UserControl1 ctrlBrdComponent)
|
||||
@@ -225,7 +225,7 @@ namespace TBF.BenchControl.Elde
|
||||
log.FatalFormat("Component: {0}", ControlComponent3Munich.UserControl1.ProgVersion);
|
||||
#elif FUZHOU_300
|
||||
log.FatalFormat("Component: {0}", ControlComponent3F300.UserControl1.ProgVersion);
|
||||
#elif PT200IL || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
log.FatalFormat("Component: {0}", ControlComponent_Izrael2014.UserControl1.ProgVersion);
|
||||
#else /// newer benches
|
||||
log.FatalFormat("Component: {0}", ControlComponent_Torino2015.UserControl1.ProgVersion);
|
||||
@@ -245,8 +245,8 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
ctrlBrdComponent.ExternalCom = true;
|
||||
|
||||
#if SENTEC || CEVAK_200
|
||||
ctrlBrdComponent.SendCalibData(rvCalib, meretA, (byte)usedCom, tempCalib, etCalib, divEdge, balanceRange, (byte)123);
|
||||
#if SENTEC || CEVAK_200 || FUZHOU_100
|
||||
ctrlBrdComponent.SendCalibData(rvCalib, meretA, (byte)usedCom, tempCalib, etCalib, divEdge, balanceRange, (byte)0Xff);
|
||||
#else
|
||||
ctrlBrdComponent.SendCalibData(rvCalib, meretA, (byte)usedCom, tempCalib, etCalib, divEdge, balanceRange);
|
||||
#endif
|
||||
@@ -369,7 +369,7 @@ namespace TBF.BenchControl.Elde
|
||||
cmd, /// 0
|
||||
refFlowMeterNr, /// 1
|
||||
Utils.RouteToStr(route), /// 2
|
||||
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 3, 4, 5, 6
|
||||
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
|
||||
@@ -381,7 +381,7 @@ namespace TBF.BenchControl.Elde
|
||||
#if DN100 || MUNICH
|
||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
|
||||
Convert.ToSingle(filterConstants[0]), fmFreq[0], (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
#elif BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || PT200IL || PUCHONG_200 || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40
|
||||
#elif BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || PUCHONG_200 || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40
|
||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
|
||||
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
#elif BERLIN || SLM_150 || PETERSBURG_200
|
||||
@@ -392,11 +392,11 @@ namespace TBF.BenchControl.Elde
|
||||
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 || ZAMBIA || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200
|
||||
#elif JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
|
||||
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
|
||||
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, pulsesArr, (uint)testMethods,
|
||||
filterConstants, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
|
||||
#else /// if TURA_IPERL || TURA_SPECIAL || MALTA_WSD25 || SLM_50 || SLM_END || WARSAW_END || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || BADGER_STREDNA_TRAT || DUBAJ_50
|
||||
#else /// if TURA_IPERL || TURA_SPECIAL || MALTA_WSD25 || SLM_50 || SLM_END || WARSAW_END || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || BADGER_STREDNA_TRAT
|
||||
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);
|
||||
|
||||
@@ -103,6 +103,10 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : ((divNrFromName == 2) ? 9 : 20);
|
||||
#elif BADGER_VELKA_TRAT
|
||||
flowMtrNr4Cmd = ((divNrFromName % 10) == 1) ? 0x11 : (((divNrFromName % 10) == 2) ? 0x22 : 0x33);
|
||||
#elif FUZHOU_100
|
||||
flowMtrNr4Cmd = divNrFromName;
|
||||
#elif CEVAK_200
|
||||
flowMtrNr4Cmd = (divNrFromName == 4) ? 5 : divNrFromName;
|
||||
#else
|
||||
flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 3;
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FlowMeter
|
||||
{
|
||||
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibInfoCfg, IChildComponentCfg
|
||||
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibRangesCfg, IChildComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -134,6 +134,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
public void Stop()
|
||||
{
|
||||
log.DebugFormat("{0}:Stop()", Name);
|
||||
}
|
||||
ReadPulses();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
readonly IFlowMeter flowMeter;
|
||||
readonly float requiredFlowLo;
|
||||
readonly float requiredFlowHi;
|
||||
readonly float requiredFlowAve;
|
||||
readonly float reqFlowAve;
|
||||
readonly float pidCoef;
|
||||
readonly int timeout;
|
||||
readonly bool leaveMeasurementRunning;
|
||||
@@ -92,9 +92,9 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
|
||||
nominalFlow = flowMeter.NominalFlow;
|
||||
|
||||
this.requiredFlowLo = requiredFlowLo;
|
||||
this.requiredFlowHi = requiredFlowHi;
|
||||
this.requiredFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
|
||||
this.requiredFlowLo = (0.7F * requiredFlowLo) + (0.3F * this.reqFlowAve); /// Move the lower limit 15% of the range up
|
||||
this.requiredFlowHi = (0.7F * requiredFlowHi) + (0.3F * this.reqFlowAve); /// Move the upper limit 15% of the range down
|
||||
this.pidCoef = pidCoef;
|
||||
|
||||
if (flowBox == null) throw new ArgumentNullException("flowBox");
|
||||
@@ -155,7 +155,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
|
||||
void StoreTargetPosition(float avgReqFlow, float actPosition)
|
||||
{
|
||||
if (!regulValve.Dict.ContainsKey(requiredFlowAve))
|
||||
if (!regulValve.Dict.ContainsKey(reqFlowAve))
|
||||
{
|
||||
regulValve.Dict.Add(new KeyValuePair<float, float>(avgReqFlow, actPosition));
|
||||
}
|
||||
@@ -173,13 +173,13 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
if (flow != 0)
|
||||
{
|
||||
flowBox.Val = flow;
|
||||
if (flow >= requiredFlowAve) currentReqFlowHi = requiredFlowAve; /// Decrease upper limit
|
||||
if (flow <= requiredFlowAve) currentReqFlowLo = requiredFlowAve; /// Increase lower limit
|
||||
if (flow >= reqFlowAve) currentReqFlowHi = reqFlowAve; /// Decrease upper limit
|
||||
if (flow <= reqFlowAve) currentReqFlowLo = reqFlowAve; /// Increase lower limit
|
||||
}
|
||||
|
||||
flowWithinBoundsTime = 0;
|
||||
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(requiredFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(reqFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
{
|
||||
log.InfoFormat("SetFlowOp:Start() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
|
||||
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
|
||||
@@ -231,7 +231,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
{
|
||||
flowWithinBoundsTime = 0;
|
||||
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(requiredFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(reqFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
{
|
||||
log.InfoFormat("Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
|
||||
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
|
||||
@@ -396,19 +396,19 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse)
|
||||
{
|
||||
float storedPosition;
|
||||
if (regulValve.Dict.TryGetValue(requiredFlowAve, out storedPosition))
|
||||
if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition))
|
||||
{
|
||||
/// update the stored valve position
|
||||
StoreTargetPosition(requiredFlowAve, (rvPosition + storedPosition) / 2.0f);
|
||||
StoreTargetPosition(reqFlowAve, (rvPosition + storedPosition) / 2.0f);
|
||||
log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% stored={3} <--- Updating a stored position",
|
||||
regulValveNr, requiredFlowAve, rvPosition.ToString("F1"), storedPosition);
|
||||
regulValveNr, reqFlowAve, rvPosition.ToString("F1"), storedPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// store the valve position
|
||||
StoreTargetPosition(requiredFlowAve, rvPosition);
|
||||
StoreTargetPosition(reqFlowAve, rvPosition);
|
||||
log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% <--- Storing a new position",
|
||||
regulValveNr, requiredFlowAve, rvPosition.ToString("F1"));
|
||||
regulValveNr, reqFlowAve, rvPosition.ToString("F1"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,9 +102,9 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
|
||||
nominalFlow = flowMeter.NominalFlow;
|
||||
|
||||
this.finalReqFlowLo = requiredFlowLo;
|
||||
this.finalReqFlowHi = requiredFlowHi;
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2;
|
||||
this.finalReqFlowLo = (0.7F * requiredFlowLo) + (0.3F * this.reqFlowAve); /// Move the lower limit 15% of the range up
|
||||
this.finalReqFlowHi = (0.7F * requiredFlowHi) + (0.3F * this.reqFlowAve); /// Move the upper limit 15% of the range down
|
||||
this.pidCoef = pidCoef;
|
||||
this.measuredFlow = measuredFlow;
|
||||
this.reTryCommands = reTryCmds;
|
||||
|
||||
@@ -108,10 +108,10 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
|
||||
nominalFlow = flowMeter.NominalFlow;
|
||||
|
||||
this.finalReqFlowLo = requiredFlowLo;
|
||||
this.finalReqFlowHi = requiredFlowHi;
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
|
||||
this.pidCoef = pidCoef;
|
||||
this.finalReqFlowLo = (0.7F * requiredFlowLo) + (0.3F * this.reqFlowAve); /// Move the lower limit 15% of the range up
|
||||
this.finalReqFlowHi = (0.7F * requiredFlowHi) + (0.3F * this.reqFlowAve); /// Move the upper limit 15% of the range down
|
||||
this.pidCoef = pidCoef;
|
||||
this.measuredFlow = measuredFlow;
|
||||
|
||||
this.timeout = timeout;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.TempMeterMeret
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "TempMeterMeret"; } }
|
||||
|
||||
public void ResetStaticProperties() { TempMeter.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new TempMeter(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new TempMeter(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new TempMeterCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(TempMeterCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.TempMeterMeret
|
||||
{
|
||||
public class ReadTempOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadTempOp));
|
||||
public override string ToString() { return string.Format("ReadTempOp({0},.,{1})", tempMeter.Name, eventDone); }
|
||||
|
||||
/// Set by the constructor
|
||||
TempMeter tempMeter;
|
||||
Event eventDone;
|
||||
DoubleBox temp;
|
||||
|
||||
/// <summary>
|
||||
/// Events: TempInDone, TempOutDone, TempDivDone or Error
|
||||
/// </summary>
|
||||
/// <param name="tempMeter">TempMeter reference</param>
|
||||
/// <param name="temp">Reference to the variable, value is in degree Celsius</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadTempOp(TempMeter tempMeter, ref DoubleBox temp, Event eventDone)
|
||||
{
|
||||
if (tempMeter == null) throw new ArgumentNullException("tempMeter");
|
||||
this.tempMeter = tempMeter;
|
||||
this.temp = temp;
|
||||
this.eventDone = eventDone;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public ReadTempOp(TempMeter tempMeter, ref DoubleBox temp)
|
||||
: this(tempMeter, ref temp, Event.TempDone)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
temp.Val = tempMeter.ReadTemperature();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.TempInDone, Event.TempOutDone or Event.TempDivDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
temp.Val = tempMeter.ReadTemperature();
|
||||
return eventDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.TempMeterMeret
|
||||
{
|
||||
public class TempMeter : ComponentBase, GenericDevices.ITempMeter
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter));
|
||||
public override string ToString() { return string.Format("TempMeter({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly TempMeterCfg tempMtrCfg;
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
|
||||
public TempMeter() {}
|
||||
|
||||
public TempMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
tempMtrCfg = cfg as TempMeterCfg;
|
||||
|
||||
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
/// Prepare data for SendCalibData() control board component method
|
||||
ControlBoard.MeretRS485Address[tempMtrCfg.MeretIdx0] = tempMtrCfg.ModbusAddress;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public double ReadTemperature()
|
||||
{
|
||||
return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(tempMtrCfg.TempIdx0), Corrections);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: TempDone, Error
|
||||
/// </summary>
|
||||
/// <param name="temp">Reference to a variable for the temperature in Celsius</param>
|
||||
/// <returns>ReadTempOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadTempOp(ref DoubleBox temp)
|
||||
{
|
||||
return new ReadTempOp(this, ref temp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: tempDone, Error
|
||||
/// </summary>
|
||||
/// <param name="temp">Reference to a variable for the temperature in Celsius</param>
|
||||
/// <param name="tempDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadTempOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadTempOp(ref DoubleBox temp, Event tempDone)
|
||||
{
|
||||
return new ReadTempOp(this, ref temp, tempDone);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.TempMeterMeret
|
||||
{
|
||||
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, Config.Entities.IParamsProvider
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl()
|
||||
{
|
||||
IList<string> parents = new List<string>();
|
||||
parents.Add("CB");
|
||||
// TODO:
|
||||
//if (StateMachine.Components != null)
|
||||
//{
|
||||
// foreach (var cmpnt in StateMachine.Components)
|
||||
// {
|
||||
// if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.BenchControl.Modbus.Common.Factory)
|
||||
// {
|
||||
// parents.Add(cmpnt.Name);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
return new Configs.ParamsProvider.ComponentCfgCtrl(this, parents);
|
||||
}
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int TempIdx0; /// 0..19
|
||||
public byte ModbusAddress; /// 1..247
|
||||
public int MeretIdx0; /// Meter pressure meters count .. (Meter pressure meters count + Meter temperature meters count - 1)
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
TempMeterCfg()
|
||||
{
|
||||
Name = "T";
|
||||
ParentName = "CB";
|
||||
}
|
||||
|
||||
public TempMeterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Factory = factory;
|
||||
Name = "T";
|
||||
ParentName = "CB";
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
TempIdx0 = 8;
|
||||
ModbusAddress = 1;
|
||||
MeretIdx0 = 4;
|
||||
}
|
||||
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Temp. index (0)",
|
||||
"Modbus address",
|
||||
"Meret index (0)",
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
public IList<string> ParamValues(int i) { return null; }
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, TempIx0={2}, Modbus address={3}, MeretIx0={4}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
TempIdx0, ModbusAddress, MeretIdx0);
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return TempIdx0.ToString();
|
||||
case 1: return ModbusAddress.ToString();
|
||||
case 2: return MeretIdx0.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
int ival = int.Parse(strValue);
|
||||
if (TempIdx0 != ival)
|
||||
{
|
||||
TempIdx0 = ival;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else return CfgUpdateFlags.None;
|
||||
|
||||
case 1:
|
||||
byte addr = byte.Parse(strValue);
|
||||
if (ModbusAddress != addr)
|
||||
{
|
||||
ModbusAddress = addr;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else return CfgUpdateFlags.None;
|
||||
|
||||
case 2:
|
||||
int ival2 = int.Parse(strValue);
|
||||
if (MeretIdx0 != ival2)
|
||||
{
|
||||
MeretIdx0 = ival2;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else return CfgUpdateFlags.None;
|
||||
|
||||
default:
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int dummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (int.TryParse(strValue, out dummy) && dummy >= 0 && dummy <= 19) return true;
|
||||
break;
|
||||
case 1:
|
||||
if (int.TryParse(strValue, out dummy) && dummy >= 1 && dummy <= 247) return true;
|
||||
message = ParamName(i) + " is invalid. Address range is 1 .. 247";
|
||||
return false;
|
||||
case 2:
|
||||
if (int.TryParse(strValue, out dummy) && dummy >= 0 && dummy <= 19) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(TempMeterCfg prms)
|
||||
{
|
||||
prms.ParentName = this.ParentName;
|
||||
prms.TempIdx0 = this.TempIdx0;
|
||||
prms.ModbusAddress = this.ModbusAddress;
|
||||
prms.MeretIdx0 = this.MeretIdx0;
|
||||
}
|
||||
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
TempMeterCfg pars = new TempMeterCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public void UpdateEmbeddedDbEntity()
|
||||
{
|
||||
/// Do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
{
|
||||
public class UpdateTankWeightOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(UpdateTankWeightOp));
|
||||
public override string ToString() { return string.Format("UpdateTankWeightOp(.)"); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
|
||||
/// <summary>
|
||||
/// Stop the previous control board operation (diverter, gate, etc.)
|
||||
/// Events: None or PreviousStopped
|
||||
/// </summary>
|
||||
/// <param name="controlBoardDev">Control board component reference</param>
|
||||
public UpdateTankWeightOp(ControlBoardDev controlBoardDev)
|
||||
{
|
||||
if (controlBoardDev == null) throw new ArgumentNullException("controlBoardDev");
|
||||
this.controlBoard = controlBoardDev;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
controlBoard.UpdateWeights();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.None or Event.PreviousStopped
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
controlBoard.UpdateWeights();
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl
|
||||
{
|
||||
@@ -93,6 +93,8 @@ namespace TBF.BenchControl
|
||||
TempInDone,
|
||||
TempOutDone,
|
||||
TempDivDone,
|
||||
LevelDone,
|
||||
VolumeDone,
|
||||
FlowMeasurementDone,
|
||||
FlowReached,
|
||||
PositionReached,
|
||||
|
||||
@@ -19,5 +19,8 @@ namespace TBF.BenchControl.GenericDevices
|
||||
string Address4 { get; }
|
||||
string Address5 { get; }
|
||||
RemoteDBUse RemoteDBUse { get; }
|
||||
}
|
||||
#if ORACLE_DB
|
||||
int MaxTestIndex { get; } /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,18 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface ICalibInfoCfg : IComponentCfg
|
||||
{
|
||||
public interface ICalibInfoCfg : IComponentCfg
|
||||
{
|
||||
///
|
||||
/// Access to parameters displayed in Metrology tab page
|
||||
/// Parameters displayed in Metrology tab page
|
||||
///
|
||||
|
||||
bool RangeEnabled(int rangeIx1);
|
||||
|
||||
double GetTempLo(int rangeIx1);
|
||||
double GetTempHi(int rangeIx1);
|
||||
double GetPressLo(int rangeIx1);
|
||||
double GetPressHi(int rangeIx1);
|
||||
|
||||
string GetCalibCertificate(int rangeIx1); /// Get calibration certificate number
|
||||
DateTime GetCalibDate(int rangeIx1); /// Get the date of calibration
|
||||
DateTime GetCalibValidDate(int rangeIx1); /// Get calibration valid until (date)
|
||||
|
||||
void SetCalibCertificate(int rangeIx1, string certificate); /// Set calibration certificate number
|
||||
void SetCalibDate(int rangeIx1, DateTime date); /// Get the date of calibration
|
||||
void SetCalibValidDate(int rangeIx1, DateTime date); /// Get calibration valid until (date)
|
||||
string CalibCertificateNr { get; set; } /// calibration certificate number
|
||||
DateTime CalibDate { get; set; } /// date of calibration
|
||||
DateTime CalibValidDate { get; set; } /// calibration valid until (date)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface ICalibRangesCfg : IComponentCfg
|
||||
{
|
||||
///
|
||||
/// Access to parameters displayed in Metrology tab page
|
||||
///
|
||||
|
||||
bool RangeEnabled(int rangeIx1);
|
||||
|
||||
double GetTempLo(int rangeIx1);
|
||||
double GetTempHi(int rangeIx1);
|
||||
double GetPressLo(int rangeIx1);
|
||||
double GetPressHi(int rangeIx1);
|
||||
|
||||
string GetCalibCertificate(int rangeIx1); /// Get calibration certificate number
|
||||
DateTime GetCalibDate(int rangeIx1); /// Get the date of calibration
|
||||
DateTime GetCalibValidDate(int rangeIx1); /// Get calibration valid until (date)
|
||||
|
||||
void SetCalibCertificate(int rangeIx1, string certificate); /// Set calibration certificate number
|
||||
void SetCalibDate(int rangeIx1, DateTime date); /// Get the date of calibration
|
||||
void SetCalibValidDate(int rangeIx1, DateTime date); /// Get calibration valid until (date)
|
||||
}
|
||||
}
|
||||
@@ -15,16 +15,7 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// They are calculated inside this function as required by Modbus specification.
|
||||
/// </summary>
|
||||
/// <param name="message">Message incl CRC fields, CRC bytes dont have to be set</param>
|
||||
void SendMessage(byte[] message);
|
||||
|
||||
/// <summary>
|
||||
/// Send a structured modbus message.
|
||||
/// </summary>
|
||||
/// <param name="modbusAddress">Device address (1..255) or 0 = broadcast</param>
|
||||
/// <param name="function">Function (0..127)</param>
|
||||
/// <param name="dataAddress">Address of data to be transferred (0..65535)</param>
|
||||
/// <param name="dataCount">Count of data bytes to be transferred (0..65535)</param>
|
||||
void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount);
|
||||
void SendMessage(int preambLen, byte[] message);
|
||||
|
||||
Queue<byte[]>[] ReceivedTelegrams { get; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
/// <summary>
|
||||
/// Basic level meter functions
|
||||
/// </summary>
|
||||
public interface ILevelMeter
|
||||
{
|
||||
/// <summary>
|
||||
/// Measurement correction table
|
||||
/// </summary>
|
||||
IList<MeasurementCorrection> Corrections { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Continuosly measured level in mm (last measured level in case of ManualLevelMsrmnt)
|
||||
/// </summary>
|
||||
double Level { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: Busy, LevelDone, Error
|
||||
/// </summary>
|
||||
/// <param name="level">Reference to a variable for the measured level in mm</param>
|
||||
/// <returns>ReadLevelOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadLevelOp(ref DoubleBox level);
|
||||
|
||||
/// <summary>
|
||||
/// Events: Busy, LevelDone, Error
|
||||
/// </summary>
|
||||
/// <param name="level">Reference to a variable for the measured level in mm</param>
|
||||
/// <returns>ReadLevelOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadStableLevelOp(ref DoubleBox level, double sdev);
|
||||
}
|
||||
}
|
||||
@@ -1,61 +1,19 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
/// <summary>
|
||||
/// Basic balance functions
|
||||
/// Scale with a water tank functions
|
||||
/// </summary>
|
||||
public interface IScale : IComponent
|
||||
public interface IScale : IScaleOrTank
|
||||
{
|
||||
/// <summary>
|
||||
/// Balance number: 0-based index required for communication with the Elde component
|
||||
/// </summary>
|
||||
int ScaleNr { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Balance water tank capacity in kg or ltr
|
||||
/// </summary>
|
||||
double Capacity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Water tank drain valve or 'null'
|
||||
/// </summary>
|
||||
IValve DrainValve { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if tank s empty, mass is less then some threshold
|
||||
/// </summary>
|
||||
bool IsEmpty(double mass);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if tank s empty, the last measured mass is less then some threshold
|
||||
/// </summary>
|
||||
bool IsEmpty();
|
||||
|
||||
/// <summary>
|
||||
/// Format string to be used as ToString() argument (e.g. "F3" to obtain resolution 1g)
|
||||
/// </summary>
|
||||
string Format { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time in seconds to empty the tank completely when it is full
|
||||
/// </summary>
|
||||
int EmptyTimeSec { get; }
|
||||
|
||||
float BuoyancyTemp { get; } ///
|
||||
float BuoyancyPress { get; } /// Displayed in Metrology tab page
|
||||
float BuoyancyHumi { get; } ///
|
||||
|
||||
/// <summary>
|
||||
/// Measurement correction table
|
||||
/// </summary>
|
||||
IList<Config.Entities.MeasurementCorrection> Corrections { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
|
||||
@@ -6,7 +6,7 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IScaleCfg : IComponentCfg
|
||||
public interface IScaleCfg : ICalibInfoCfg
|
||||
{
|
||||
///
|
||||
/// Parameters displayed in Metrology tab page
|
||||
@@ -14,11 +14,7 @@ namespace TBF.BenchControl.GenericDevices
|
||||
float BuoyancyTemp { get; set; } /// ambient temperature in [degree C]
|
||||
float BuoyancyPress { get; set; } /// ambient pressure in [100000 Pa]
|
||||
float BuoyancyHumi { get; set; } /// ambient relative humidity in [%]
|
||||
float WeightStandardDensity { get; set; } /// density of the weight standard used to calibrate the scale [kg/m3]
|
||||
|
||||
string CalibCertificateNr { get; set; } /// calibration certificate number
|
||||
DateTime CalibDate { get; set; } /// date of calibration
|
||||
DateTime CalibValidDate { get; set; } /// calibration valid until (date)
|
||||
float WeightStandardDensity { get; set; } /// density of the weight standard used to calibrate the scale [kg/m3]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
/// <summary>
|
||||
/// Water tank functions (either on a scale or with height/volume measurement)
|
||||
/// </summary>
|
||||
public interface IScaleOrTank : IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Balance number: 0-based index required for communication with the Elde component
|
||||
/// </summary>
|
||||
int ScaleNr { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Balance water tank capacity in kg or ltr
|
||||
/// </summary>
|
||||
double Capacity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Water tank drain valve or 'null'. DrainValve2 is open in the 2nd half of drain time period
|
||||
/// </summary>
|
||||
IValve DrainValve { get; }
|
||||
IValve DrainValve2 { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if tank is empty, the last measured mass is less then some threshold
|
||||
/// </summary>
|
||||
bool IsEmpty();
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if tank contains more then 'thld' kg or l of water
|
||||
/// </summary>
|
||||
bool ContainsMoreThen(float thld);
|
||||
|
||||
/// <summary>
|
||||
/// Format string to be used as ToString() argument (e.g. "F3" to obtain resolution 1g)
|
||||
/// </summary>
|
||||
string Format { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time in seconds to empty the tank completely when it is full
|
||||
/// </summary>
|
||||
int EmptyTimeSec { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Measurement correction table
|
||||
/// </summary>
|
||||
IList<Config.Entities.MeasurementCorrection> Corrections { get; }
|
||||
}
|
||||
}
|
||||
@@ -12,5 +12,6 @@ namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
IValve DrainValve { get; }
|
||||
bool IsEmpty();
|
||||
bool ContainsMoreThen(float thld);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IVolumeMeter
|
||||
{
|
||||
/// <summary>
|
||||
/// Measurement correction table
|
||||
/// </summary>
|
||||
IList<MeasurementCorrection> Corrections { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: VolumeDone, Error
|
||||
/// </summary>
|
||||
/// <param name="volume">Reference to a variable for the measured volume in l</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadVolumeOp(ref DoubleBox volume);
|
||||
|
||||
/// <summary>
|
||||
/// Events: VolumeDone, Error
|
||||
/// </summary>
|
||||
/// <param name="volume">Reference to a variable for the measured volume in l</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadStableVolumeOp(ref DoubleBox volume, double sdev);
|
||||
|
||||
/// <summary>
|
||||
/// Events: VolumeDone, Error
|
||||
/// </summary>
|
||||
/// <param name="volume">Reference to a variable for the measured volume in l</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
IOperation ManualReadVolumeOp(ref DoubleBox volume);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.Hart.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// HART start bytes
|
||||
/// </summary>
|
||||
public enum Mark : byte
|
||||
{
|
||||
ShortFrameMaster2Slave = 0x02,
|
||||
ShortFrameSlave2Master = 0x06,
|
||||
LongFrameMaster2Slave = 0x82,
|
||||
LongFrameSlave2Master = 0x86,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HART master addresses
|
||||
/// </summary>
|
||||
public enum Master : byte
|
||||
{
|
||||
Secondary = 0,
|
||||
Primary = 0x80,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HART commands
|
||||
/// </summary>
|
||||
public enum Cmd : byte
|
||||
{
|
||||
ReadUniqueID = 0,
|
||||
ReadPrimaryVar = 1,
|
||||
}
|
||||
}
|
||||
@@ -16,39 +16,49 @@ using TBF.Boxes;
|
||||
namespace TBF.BenchControl.Hart.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Root component for Modbus communication via serial port (RS485)
|
||||
/// Root component for HART communication via a modem connected to a serial port (RS232)
|
||||
/// </summary>
|
||||
public class Hart : ComponentBase, IDevice, GenericDevices.IModbus
|
||||
public class Hart : ComponentBase, IDevice, GenericDevices.IHart
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Hart));
|
||||
public override string ToString() { return string.Format("Modbus({0})", Cfg.ToString(1)); }
|
||||
|
||||
private readonly HartCfg modbusCommonCfg;
|
||||
private readonly HartCfg hartCfg;
|
||||
|
||||
/// Private fields
|
||||
SerialPort serialPort;
|
||||
DateTime lastSerialPortWrite;
|
||||
|
||||
/// <summary>
|
||||
/// An array of Queue-s of received telegrams fetched by HART components (as Nivotrack).
|
||||
/// There is one queue for each device (each slave address).
|
||||
/// </summary>
|
||||
public Queue<byte[]>[] ReceivedTelegrams
|
||||
{
|
||||
get { return receivedTelegrams; }
|
||||
}
|
||||
Queue<byte[]>[] receivedTelegrams;
|
||||
|
||||
/// <summary>
|
||||
/// A Queue of telegrams to send. System prevents sending more then one telegram per 500ms.
|
||||
/// Function SendMessage( ) either send the telegram immediately using SendMessageNow( ) or
|
||||
/// inserts the telegram into telegramsToSend queue. The queue is emptied in RunDeviceAfter( ).
|
||||
/// </summary>
|
||||
Queue<byte[]> telegramsToSend;
|
||||
|
||||
|
||||
public Hart()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
|
||||
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
|
||||
/// HART modem connected via serial interface (RS232).
|
||||
/// Connection settings: 1200 Bd 8-bits odd-parity 1-stop-bit Flow control: none or hardware.
|
||||
/// </summary>
|
||||
public Hart(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
receivedTelegrams = new Queue<byte[]>[256];
|
||||
receivedTelegrams = new Queue<byte[]>[16]; /// Max. 16 slaves with adresses 0..15
|
||||
for (int i = 0; i < receivedTelegrams.Length; i++)
|
||||
{
|
||||
receivedTelegrams[i] = new Queue<byte[]>();
|
||||
@@ -56,7 +66,7 @@ namespace TBF.BenchControl.Hart.Common
|
||||
telegramsToSend = new Queue<byte[]>();
|
||||
|
||||
serialPort = null;
|
||||
modbusCommonCfg = cfg as HartCfg;
|
||||
hartCfg = cfg as HartCfg;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
@@ -64,27 +74,62 @@ namespace TBF.BenchControl.Hart.Common
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (modbusCommonCfg.DebugLevel == DebugMode.Simulate)
|
||||
if (hartCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
serialPort = null;
|
||||
log.FatalFormat("{0} - Device simulated", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
string comPortName = "COM" + modbusCommonCfg.ComPortNr.ToString();
|
||||
serialPort = new SerialPort(comPortName, modbusCommonCfg.BaudRate, modbusCommonCfg.Parity, modbusCommonCfg.DataBits, modbusCommonCfg.StopBits);
|
||||
serialPort.Handshake = modbusCommonCfg.Handshake;
|
||||
string comPortName = "COM" + hartCfg.ComPortNr.ToString();
|
||||
serialPort = new SerialPort(comPortName, hartCfg.BaudRate, hartCfg.Parity, hartCfg.DataBits, hartCfg.StopBits);
|
||||
serialPort.Handshake = hartCfg.Handshake;
|
||||
serialPort.Open();
|
||||
|
||||
//stopWorkerThread = false;
|
||||
//workerThread = new Thread(Worker);
|
||||
//workerThread.Start();
|
||||
|
||||
log.FatalFormat("{0} - Device successfully initialized", Name);
|
||||
}
|
||||
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (serialPort != null)
|
||||
{
|
||||
ParseReceivedData();
|
||||
}
|
||||
}
|
||||
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if ((serialPort != null) && (telegramsToSend.Count > 0) && (DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 500))
|
||||
{
|
||||
SendMessageNow(telegramsToSend.Dequeue());
|
||||
}
|
||||
}
|
||||
|
||||
public void StopDevice()
|
||||
{
|
||||
if (serialPort != null)
|
||||
{
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void StopDevice2() { }
|
||||
|
||||
|
||||
|
||||
public void SendMessageNow(byte[] message)
|
||||
{
|
||||
serialPort.Write(message, 0, message.Length);
|
||||
lastSerialPortWrite = DateTime.Now;
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Sending message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send an arbitrary modbus message.
|
||||
@@ -92,21 +137,25 @@ namespace TBF.BenchControl.Hart.Common
|
||||
/// The last two message bytes (CRC) may be uninitialized or zero.
|
||||
/// They are calculated inside this function as required by Modbus specification.
|
||||
/// </summary>
|
||||
/// <param name="message">Message incl CRC fields, CRC bytes dont have to be set</param>
|
||||
public void SendMessage(byte[] message)
|
||||
/// <param name="message">Message incl. a reserved checksum byte, checksum does not have to be set</param>
|
||||
public void SendMessage(int preambLen, byte[] message)
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
Telegram.UpdateTelegramCRC(message);
|
||||
Telegram.UpdateTelegramChecksum(message);
|
||||
byte[] preambAndMessage = new byte[message.Length + preambLen];
|
||||
|
||||
if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 100))
|
||||
for (int i = 0; i < preambLen; i++) preambAndMessage[i] = (byte)0xFF;
|
||||
for (int i = preambLen; i < preambLen + message.Length; i++) preambAndMessage[i] = message[i - preambLen];
|
||||
|
||||
if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 500))
|
||||
{
|
||||
/// More then 100 ms since last 'send' --> do not enqueue the message
|
||||
SendMessageNow(message);
|
||||
SendMessageNow(preambAndMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
telegramsToSend.Enqueue(message);
|
||||
telegramsToSend.Enqueue(preambAndMessage);
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Enqueueing message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
@@ -114,98 +163,61 @@ namespace TBF.BenchControl.Hart.Common
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send a structured modbus message.
|
||||
/// </summary>
|
||||
/// <param name="modbusAddress">Device address (1..255) or 0 = broadcast</param>
|
||||
/// <param name="function">Function (0..127)</param>
|
||||
/// <param name="dataAddress">Address of data to be transferred (0..65535)</param>
|
||||
/// <param name="dataCount">Count of data bytes to be transferred (0..65535)</param>
|
||||
public void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount)
|
||||
void ParseReceivedData()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
byte[] message = new byte[8]
|
||||
{
|
||||
modbusAddress,
|
||||
function,
|
||||
(byte)(dataAddress / 256),
|
||||
(byte)(dataAddress % 256),
|
||||
(byte)(dataCount / 256),
|
||||
(byte)(dataCount % 256),
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
public void SendMessageNow(byte[] message)
|
||||
{
|
||||
serialPort.Write(message, 0, message.Length);
|
||||
lastSerialPortWrite = DateTime.Now;
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Sending message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
int nrBytes = serialPort.BytesToRead;
|
||||
if (nrBytes > 0)
|
||||
{
|
||||
byte[] buffer = new byte[nrBytes];
|
||||
serialPort.Read(buffer, 0, nrBytes);
|
||||
/// Read available data
|
||||
byte[] buf = new byte[nrBytes];
|
||||
serialPort.Read(buf, 0, nrBytes);
|
||||
|
||||
int deviceAddress = (nrBytes >= 1) ? buffer[0] : 0;
|
||||
int function = (nrBytes >= 2) ? buffer[1] : 0;
|
||||
|
||||
if ((nrBytes >= 4) && Telegram.VerifyTelegramCRC(buffer))
|
||||
/// Determine count of leading FF-s
|
||||
int preambLen = 0;
|
||||
for (int i = 0; i < nrBytes; i++)
|
||||
{
|
||||
receivedTelegrams[deviceAddress].Enqueue(buffer);
|
||||
if (buf[i] != (byte)0xFF) break;
|
||||
preambLen++;
|
||||
}
|
||||
|
||||
string s = string.Format("{0} - {1} address={2} count={3}", Name, Telegram.LogTelegram("Telegram received: ", buffer), deviceAddress, receivedTelegrams[deviceAddress].Count);
|
||||
int telegramLen = nrBytes - preambLen;
|
||||
|
||||
/// Check a telegram length, a checksum, a start byte (S -> M) and a master address (primary)
|
||||
if (preambLen < 3 ||
|
||||
telegramLen < 4 ||
|
||||
!Telegram.VerifyTelegramChecksum(preambLen, buf) ||
|
||||
((buf[preambLen] != (byte)Mark.ShortFrameSlave2Master) && (buf[preambLen] != (byte)Mark.LongFrameSlave2Master)) ||
|
||||
((buf[preambLen + 1] & 0x80) != (byte)Master.Primary))
|
||||
{
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Invalid data received ", Name), buf);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
return;
|
||||
}
|
||||
|
||||
/// Strip the preamble
|
||||
byte[] data = new byte[telegramLen];
|
||||
for (int i = preambLen; i < nrBytes; i++) data[i - preambLen] = buf[i];
|
||||
|
||||
bool isShortFrame = (data[0] == 0x06);
|
||||
|
||||
if (isShortFrame)
|
||||
{
|
||||
int address = data[1] & 0x0F;
|
||||
receivedTelegrams[address].Enqueue(data);
|
||||
|
||||
string s = string.Format("{0} - {1} address={2} preambLen={3} count={4}", Name, Telegram.LogTelegram("Valid telegram received: ", data), address, preambLen, receivedTelegrams[address].Count);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Invalid data received ", Name), buffer);
|
||||
/// TODO
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Telegram with long address received ", Name), buf);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
if (telegramsToSend.Count > 0 && (DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 500))
|
||||
{
|
||||
SendMessageNow(telegramsToSend.Dequeue());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (serialPort != null)
|
||||
{
|
||||
//stopWorkerThread = true;
|
||||
//workerThread.Join(2000);
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void StopDevice2() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,9 +56,9 @@ namespace TBF.BenchControl.Hart.Common
|
||||
public void InitializeAll()
|
||||
{
|
||||
ComPortNr = 3;
|
||||
BaudRate = 9600;
|
||||
BaudRate = 1200;
|
||||
DataBits = 8;
|
||||
Parity = System.IO.Ports.Parity.None;
|
||||
Parity = System.IO.Ports.Parity.Odd;
|
||||
StopBits = System.IO.Ports.StopBits.One;
|
||||
Handshake = System.IO.Ports.Handshake.None;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
|
||||
public IComponent DummyComponent() { return new Nivotrack(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Nivotrack(cfg); }
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Nivotrack(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new NivotrackCfg(this.GetType().Namespace.Substring(17), this); }
|
||||
|
||||
|
||||
@@ -3,39 +3,51 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO.Ports;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Config.Entities;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
using TBF.BenchControl.Hart.Common;
|
||||
|
||||
namespace TBF.BenchControl.Hart.Nivotrack
|
||||
{
|
||||
/// <summary>
|
||||
/// Root component for Modbus communication via serial port (RS485)
|
||||
/// </summary>
|
||||
public class Nivotrack : ComponentBase, IDevice, GenericDevices.IHart
|
||||
public class Nivotrack : ComponentBase, IDevice, ILevelMeter, IOperation
|
||||
{
|
||||
const int StableReadingsCount = 9;
|
||||
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Nivotrack));
|
||||
public override string ToString() { return string.Format("Modbus({0})", Cfg.ToString(1)); }
|
||||
public override string ToString() { return string.Format("{0}({1})", Cfg.Name, Cfg.ToString(-1)); }
|
||||
|
||||
private readonly NivotrackCfg modbusCommonCfg;
|
||||
readonly NivotrackCfg nivotrackCfg;
|
||||
readonly IHart hart;
|
||||
|
||||
/// Private fields
|
||||
SerialPort serialPort;
|
||||
DateTime lastSerialPortWrite;
|
||||
public double Level { get { return ReadLevel(); } }
|
||||
|
||||
public Queue<byte[]>[] ReceivedTelegrams
|
||||
double rawLevel_mm;
|
||||
bool isRawLevelValid;
|
||||
|
||||
/// For stable measurement calculation
|
||||
double maxSDev;
|
||||
double[] levelReadings;
|
||||
double[] sortedLevelReadings;
|
||||
int currentReadingsCount;
|
||||
|
||||
bool measurementCompleted; /// stableMeasurementCompleted
|
||||
|
||||
DoubleBox levelBox;
|
||||
///
|
||||
enum CurrentOp
|
||||
{
|
||||
get { return receivedTelegrams; }
|
||||
}
|
||||
Queue<byte[]>[] receivedTelegrams;
|
||||
None,
|
||||
ReadLevel,
|
||||
ReadStableLevel,
|
||||
}
|
||||
CurrentOp currentOp;
|
||||
|
||||
Queue<byte[]> telegramsToSend;
|
||||
|
||||
public Nivotrack()
|
||||
{
|
||||
@@ -45,167 +57,242 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
|
||||
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
|
||||
/// </summary>
|
||||
public Nivotrack(Generic.IComponentCfg cfg)
|
||||
public Nivotrack(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
receivedTelegrams = new Queue<byte[]>[256];
|
||||
for (int i = 0; i < receivedTelegrams.Length; i++)
|
||||
{
|
||||
receivedTelegrams[i] = new Queue<byte[]>();
|
||||
}
|
||||
telegramsToSend = new Queue<byte[]>();
|
||||
nivotrackCfg = cfg as NivotrackCfg;
|
||||
|
||||
hart = (IHart)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (hart == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
levelReadings = new double[StableReadingsCount];
|
||||
sortedLevelReadings = new double[StableReadingsCount];
|
||||
|
||||
serialPort = null;
|
||||
modbusCommonCfg = cfg as NivotrackCfg;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
~Nivotrack()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (modbusCommonCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
serialPort = null;
|
||||
log.FatalFormat("{0} - Device simulated", Name);
|
||||
return;
|
||||
}
|
||||
if (nivotrackCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
string comPortName = "COM" + modbusCommonCfg.ComPortNr.ToString();
|
||||
serialPort = new SerialPort(comPortName, modbusCommonCfg.BaudRate, modbusCommonCfg.Parity, modbusCommonCfg.DataBits, modbusCommonCfg.StopBits);
|
||||
serialPort.Handshake = modbusCommonCfg.Handshake;
|
||||
serialPort.Open();
|
||||
|
||||
//stopWorkerThread = false;
|
||||
//workerThread = new Thread(Worker);
|
||||
//workerThread.Start();
|
||||
|
||||
log.FatalFormat("{0} - Device successfully initialized", Name);
|
||||
rawLevel_mm = 0;
|
||||
isRawLevelValid = false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send an arbitrary modbus message.
|
||||
/// When the message length is N, however only bytes 1..N-2 have to be set.
|
||||
/// The last two message bytes (CRC) may be uninitialized or zero.
|
||||
/// They are calculated inside this function as required by Modbus specification.
|
||||
/// </summary>
|
||||
/// <param name="message">Message incl CRC fields, CRC bytes dont have to be set</param>
|
||||
public void SendMessage(byte[] message)
|
||||
void Detect()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
byte bcnt = (byte)0; /// block count
|
||||
|
||||
Telegram.UpdateTelegramCRC(message);
|
||||
byte[] data = new byte[5];
|
||||
data[0] = (byte)Mark.ShortFrameMaster2Slave;
|
||||
data[1] = (byte)((int)Master.Primary + (byte)nivotrackCfg.Address);
|
||||
data[2] = (byte)Cmd.ReadUniqueID;
|
||||
data[3] = bcnt;
|
||||
data[4] = 0; /// reserved for chehcksum
|
||||
|
||||
if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 100))
|
||||
{
|
||||
/// More then 100 ms since last 'send' --> do not enqueue the message
|
||||
SendMessageNow(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
telegramsToSend.Enqueue(message);
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Enqueueing message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
}
|
||||
hart.SendMessage(5, data);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send a structured modbus message.
|
||||
/// </summary>
|
||||
/// <param name="modbusAddress">Device address (1..255) or 0 = broadcast</param>
|
||||
/// <param name="function">Function (0..127)</param>
|
||||
/// <param name="dataAddress">Address of data to be transferred (0..65535)</param>
|
||||
/// <param name="dataCount">Count of data bytes to be transferred (0..65535)</param>
|
||||
public void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount)
|
||||
void RequestProcessValue()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
byte bcnt = (byte)0; /// block count
|
||||
|
||||
byte[] message = new byte[8]
|
||||
byte[] data = new byte[5];
|
||||
data[0] = (byte)Mark.ShortFrameMaster2Slave;
|
||||
data[1] = (byte)((int)Master.Primary + (byte)nivotrackCfg.Address);
|
||||
data[2] = (byte)Cmd.ReadPrimaryVar;
|
||||
data[3] = bcnt;
|
||||
data[4] = 0; /// reserved for chehcksum
|
||||
|
||||
hart.SendMessage(5, data);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (nivotrackCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
if (hart.ReceivedTelegrams[nivotrackCfg.Address].Count > 0)
|
||||
{
|
||||
modbusAddress,
|
||||
function,
|
||||
(byte)(dataAddress / 256),
|
||||
(byte)(dataAddress % 256),
|
||||
(byte)(dataCount / 256),
|
||||
(byte)(dataCount % 256),
|
||||
0,
|
||||
0,
|
||||
};
|
||||
byte[] data = hart.ReceivedTelegrams[nivotrackCfg.Address].Dequeue();
|
||||
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
public void SendMessageNow(byte[] message)
|
||||
{
|
||||
serialPort.Write(message, 0, message.Length);
|
||||
lastSerialPortWrite = DateTime.Now;
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Sending message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
int nrBytes = serialPort.BytesToRead;
|
||||
if (nrBytes > 0)
|
||||
{
|
||||
byte[] buffer = new byte[nrBytes];
|
||||
serialPort.Read(buffer, 0, nrBytes);
|
||||
|
||||
int deviceAddress = (nrBytes >= 1) ? buffer[0] : 0;
|
||||
int function = (nrBytes >= 2) ? buffer[1] : 0;
|
||||
|
||||
if ((nrBytes >= 4) && Telegram.VerifyTelegramCRC(buffer))
|
||||
if ((data.Length == 12) && (data[0] == (byte)Mark.ShortFrameSlave2Master)
|
||||
&& (data[2] == (byte)Cmd.ReadPrimaryVar)
|
||||
&& (data[3] == 7))
|
||||
{
|
||||
receivedTelegrams[deviceAddress].Enqueue(buffer);
|
||||
|
||||
string s = string.Format("{0} - {1} address={2} count={3}", Name, Telegram.LogTelegram("Telegram received: ", buffer), deviceAddress, receivedTelegrams[deviceAddress].Count);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
///
|
||||
/// A frame with a status and a primary variable
|
||||
///
|
||||
ushort state = (ushort)(256 * data[4] + data[5]);
|
||||
byte unitsID = data[6];
|
||||
byte[] floatData = new byte[] { data[10], data[9], data[8], data[7] };
|
||||
rawLevel_mm = System.BitConverter.ToSingle(floatData, 0);
|
||||
isRawLevelValid = true;
|
||||
log.InfoFormat("{0} : Received water level = {1} mm, State = {2}", Name, rawLevel_mm, state.ToString("X4"));
|
||||
}
|
||||
else
|
||||
else if ((data.Length == 7) && (data[0] == (byte)Mark.ShortFrameSlave2Master)
|
||||
&& (data[2] == (byte)Cmd.ReadPrimaryVar)
|
||||
&& (data[3] == 2))
|
||||
{
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Invalid data received ", Name), buffer);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
///
|
||||
/// A frame with a status only
|
||||
///
|
||||
ushort state = (ushort)(256 * data[4] + data[5]);
|
||||
isRawLevelValid = false;
|
||||
log.InfoFormat("{0} : State = {1}", Name, state.ToString("X4"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (nivotrackCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
if (telegramsToSend.Count > 0 && (DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 500))
|
||||
{
|
||||
SendMessageNow(telegramsToSend.Dequeue());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (serialPort != null)
|
||||
if ((StateMachine.Time % 2) == (nivotrackCfg.Address % 2))
|
||||
{
|
||||
//stopWorkerThread = true;
|
||||
//workerThread.Join(2000);
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
RequestProcessValue();
|
||||
}
|
||||
}
|
||||
|
||||
public void StopDevice() { }
|
||||
public void StopDevice2() { }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the most recent raw level measurement and applies correction table
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public double ReadLevel()
|
||||
{
|
||||
return Config.Formulas.CorrectedValue(rawLevel_mm, Corrections);
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ReadLevelOp(ref DoubleBox levelBox)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
this.levelBox = levelBox;
|
||||
currentOp = CurrentOp.ReadLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ReadStableLevelOp(ref DoubleBox levelBox, double maxSDev)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
this.levelBox = levelBox;
|
||||
this.maxSDev = maxSDev;
|
||||
currentOp = CurrentOp.ReadStableLevel;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
if (currentOp == CurrentOp.ReadLevel)
|
||||
{
|
||||
if (isRawLevelValid && (levelBox != null)) levelBox.Val = ReadLevel();
|
||||
}
|
||||
else if (currentOp == CurrentOp.ReadStableLevel)
|
||||
{
|
||||
currentReadingsCount = 0;
|
||||
measurementCompleted = false;
|
||||
if (isRawLevelValid)
|
||||
{
|
||||
levelReadings[currentReadingsCount++] = ReadLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsPrinted</returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (measurementCompleted)
|
||||
{
|
||||
if ((currentOp == CurrentOp.ReadLevel) && (levelBox != null)) levelBox.Val = ReadLevel();
|
||||
return Event.LevelDone;
|
||||
}
|
||||
|
||||
if ((currentOp == CurrentOp.ReadLevel) && isRawLevelValid)
|
||||
{
|
||||
if (levelBox != null) levelBox.Val = ReadLevel();
|
||||
measurementCompleted = true;
|
||||
return Event.LevelDone;
|
||||
}
|
||||
else if ((currentOp == CurrentOp.ReadStableLevel) && isRawLevelValid)
|
||||
{
|
||||
///
|
||||
/// Read new level and put it into a FIFO buffer
|
||||
///
|
||||
if (currentReadingsCount < StableReadingsCount)
|
||||
{
|
||||
levelReadings[currentReadingsCount++] = ReadLevel();
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Shift data in the (already full) buffer, save the mass into the last buffer item
|
||||
for (int i = 1; i < StableReadingsCount; i++)
|
||||
{
|
||||
levelReadings[i - 1] = levelReadings[i];
|
||||
}
|
||||
levelReadings[StableReadingsCount - 1] = ReadLevel();
|
||||
}
|
||||
|
||||
///
|
||||
/// Evaluate reading stability
|
||||
///
|
||||
if (currentReadingsCount >= StableReadingsCount)
|
||||
{
|
||||
Array.Copy(levelReadings, sortedLevelReadings, StableReadingsCount);
|
||||
Array.Sort(sortedLevelReadings);
|
||||
|
||||
if (true)
|
||||
{
|
||||
/// Spread of values (except of the largest and the smalles value) must be <= maxSDev
|
||||
|
||||
if ((sortedLevelReadings[StableReadingsCount - 2] - sortedLevelReadings[1]) <= maxSDev)
|
||||
{
|
||||
double massSum = 0;
|
||||
for (int i = 1; i < StableReadingsCount - 1; i++) massSum += sortedLevelReadings[i];
|
||||
double ave = massSum / (StableReadingsCount - 2);
|
||||
if (levelBox != null) levelBox.Val = ave;
|
||||
measurementCompleted = true;
|
||||
log.InfoFormat("ReadStableLevelOp.Run() ... valid level={0} ... returning LevelDone", ave);
|
||||
return Event.LevelDone;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Standard deviation (except of the largest and the smalles value) must be <= maxSDev
|
||||
double massSum = 0;
|
||||
for (int i = 1; i < StableReadingsCount - 1; i++) massSum += sortedLevelReadings[i];
|
||||
double ave = massSum / (StableReadingsCount - 2);
|
||||
double sdev = 0;
|
||||
for (int i = 1; i < StableReadingsCount - 1; i++) sdev += ((sortedLevelReadings[i] - ave) * (sortedLevelReadings[i] - ave));
|
||||
|
||||
if (Math.Sqrt(sdev / (StableReadingsCount - 2)) <= maxSDev)
|
||||
{
|
||||
if (levelBox != null) levelBox.Val = ave;
|
||||
measurementCompleted = true;
|
||||
log.InfoFormat("ReadStableMassOp.Run() ... valid mass={0} ... returning Event.BalanceDone", ave);
|
||||
return Event.LevelDone;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Event.Busy;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
@@ -10,44 +11,61 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Hart.Nivotrack
|
||||
{
|
||||
public class NivotrackCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
|
||||
public class NivotrackCfg : ComponentCfgBase, Generic.IChildComponentCfg, Config.Entities.IParamsProvider, GenericDevices.ICalibInfoCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(NivotrackCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
static readonly int[] AllBaudRates = new int[] { 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 };
|
||||
static readonly Parity[] AllParities = new Parity[] { Parity.None, Parity.Even, Parity.Odd };
|
||||
static readonly int[] AllDataBits = new int[] { 7, 8 };
|
||||
static readonly StopBits[] AllStopBits = new StopBits[] { StopBits.None, StopBits.One, StopBits.OnePointFive, StopBits.Two };
|
||||
static readonly Handshake[] AllHandshakes = new Handshake[] { Handshake.None, Handshake.XOnXOff, Handshake.RequestToSend, Handshake.RequestToSendXOnXOff };
|
||||
static readonly int[] Par1Values = new int[] { 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 };
|
||||
static readonly int[] Par2Values = new int[] { 7, 8 };
|
||||
|
||||
|
||||
public IComponentCfgCtrl GetControl()
|
||||
{
|
||||
return new Configs.ParamsProvider.ComponentCfgCtrl(this, null);
|
||||
IList<string> parents = new List<string>();
|
||||
parents.Add("Hart");
|
||||
|
||||
return new Configs.ParamsProvider.ComponentCfgCtrl(this, parents);
|
||||
}
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int ComPortNr;
|
||||
public int BaudRate;
|
||||
public int DataBits;
|
||||
public Parity Parity;
|
||||
public StopBits StopBits;
|
||||
public Handshake Handshake;
|
||||
public int Address;
|
||||
public int Par1;
|
||||
public int Par2;
|
||||
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
string calibCertificateNr;
|
||||
DateTime calibDate;
|
||||
DateTime calibValidDate;
|
||||
public string CalibCertificateNr
|
||||
{
|
||||
get { return calibCertificateNr; }
|
||||
set { calibCertificateNr = value; }
|
||||
}
|
||||
public DateTime CalibDate
|
||||
{
|
||||
get { return calibDate; }
|
||||
set { calibDate = value; }
|
||||
}
|
||||
public DateTime CalibValidDate
|
||||
{
|
||||
get { return calibValidDate; }
|
||||
set { calibValidDate = value; }
|
||||
}
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
NivotrackCfg()
|
||||
{
|
||||
}
|
||||
NivotrackCfg() { }
|
||||
|
||||
public NivotrackCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
ParentName = "Hart";
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
@@ -55,21 +73,15 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
ComPortNr = 3;
|
||||
BaudRate = 9600;
|
||||
DataBits = 8;
|
||||
Parity = System.IO.Ports.Parity.None;
|
||||
StopBits = System.IO.Ports.StopBits.One;
|
||||
Handshake = System.IO.Ports.Handshake.None;
|
||||
Address = 3;
|
||||
Par1 = 9600;
|
||||
Par2 = 8;
|
||||
}
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Com port number",
|
||||
"Baud rate",
|
||||
"Data bits",
|
||||
"Parity",
|
||||
"Stop bits",
|
||||
"Handshake"
|
||||
"HART address",
|
||||
"Parameter 1",
|
||||
"Parameter 2",
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
@@ -79,11 +91,8 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
IList<string> list = new List<string>();
|
||||
switch (i)
|
||||
{
|
||||
case 1: foreach (var v in AllBaudRates) list.Add(v.ToString()); break;
|
||||
case 2: foreach (var v in AllDataBits) list.Add(v.ToString()); break;
|
||||
case 3: foreach (var v in AllParities) list.Add(v.ToString()); break;
|
||||
case 4: foreach (var v in AllStopBits) list.Add(v.ToString()); break;
|
||||
case 5: foreach (var v in AllHandshakes) list.Add(v.ToString()); break;
|
||||
case 1: foreach (var v in Par1Values) list.Add(v.ToString()); break;
|
||||
case 2: foreach (var v in Par2Values) list.Add(v.ToString()); break;
|
||||
default: return null;
|
||||
}
|
||||
return list;
|
||||
@@ -93,18 +102,14 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
return string.Format("Com{0}, {1}Bd, {2}-bits, parity={3}, stopBits={4}, {5}",
|
||||
ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
|
||||
return string.Format("Address={0}", Address);
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return ComPortNr.ToString();
|
||||
case 1: return BaudRate.ToString();
|
||||
case 2: return DataBits.ToString();
|
||||
case 3: return Parity.ToString();
|
||||
case 4: return StopBits.ToString();
|
||||
case 5: return Handshake.ToString();
|
||||
case 0: return Address.ToString();
|
||||
case 1: return Par1.ToString();
|
||||
case 2: return Par2.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -115,9 +120,9 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (ComPortNr != int.Parse(strValue))
|
||||
if (Address != int.Parse(strValue))
|
||||
{
|
||||
ComPortNr = int.Parse(strValue);
|
||||
Address = int.Parse(strValue);
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else
|
||||
@@ -126,55 +131,22 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
}
|
||||
|
||||
case 1:
|
||||
foreach (var v in AllBaudRates)
|
||||
foreach (var v in Par1Values)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (BaudRate != v))
|
||||
if ((strValue == v.ToString()) && (Par1 != v))
|
||||
{
|
||||
BaudRate = v;
|
||||
Par1 = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
|
||||
case 2:
|
||||
foreach (var v in AllDataBits)
|
||||
foreach (var v in Par2Values)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (DataBits != v))
|
||||
if ((strValue == v.ToString()) && (Par2 != v))
|
||||
{
|
||||
DataBits = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
|
||||
case 3:
|
||||
foreach (var v in AllParities)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (Parity != v))
|
||||
{
|
||||
Parity = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
|
||||
case 4:
|
||||
foreach (var v in AllStopBits)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (StopBits != v))
|
||||
{
|
||||
StopBits = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
|
||||
case 5:
|
||||
foreach (var v in AllHandshakes)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (Handshake != v))
|
||||
{
|
||||
Handshake = v;
|
||||
Par2 = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
@@ -193,24 +165,15 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
int comPortNr;
|
||||
if (int.TryParse(strValue, out comPortNr) && comPortNr > 0 && comPortNr <= 999) return true;
|
||||
int address;
|
||||
if (int.TryParse(strValue, out address) && address >= 0 && address <= 15) return true;
|
||||
break;
|
||||
case 1:
|
||||
foreach (var v in AllBaudRates) if (strValue == v.ToString()) return true;
|
||||
foreach (var v in Par1Values) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
case 2:
|
||||
foreach (var v in AllDataBits) if (strValue == v.ToString()) return true;
|
||||
foreach (var v in Par2Values) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
case 3:
|
||||
foreach (var v in AllParities) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
case 4:
|
||||
foreach (var v in AllStopBits) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
case 5:
|
||||
foreach (var v in AllHandshakes) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
message = "Invalid index";
|
||||
@@ -224,12 +187,9 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
void CopyContentTo(NivotrackCfg prms)
|
||||
{
|
||||
prms.ParentName = this.ParentName;
|
||||
prms.ComPortNr = this.ComPortNr;
|
||||
prms.BaudRate = this.BaudRate;
|
||||
prms.DataBits = this.DataBits;
|
||||
prms.Parity = this.Parity;
|
||||
prms.StopBits = this.StopBits;
|
||||
prms.Handshake = this.Handshake;
|
||||
prms.Address = this.Address;
|
||||
prms.Par1 = this.Par1;
|
||||
prms.Par2 = this.Par2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.IO.Ports;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
@@ -48,16 +49,17 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
protected static SerialPort serialPort;
|
||||
protected static StringBuilder stringBuilder;
|
||||
|
||||
public int ScaleNr { get { return balanceNr; } }
|
||||
public int IdNr { get { return balanceCfg.IdNr; } }
|
||||
public double Capacity { get { return balanceCfg.Capacity; } }
|
||||
public double Resolution { get { return balanceCfg.Resolution; } }
|
||||
public int EmptyTimeSec { get { return balanceCfg.DrainTimeSec; } }
|
||||
public int ScaleNr { get { return balanceNr; } }
|
||||
public int IdNr { get { return balanceCfg.IdNr; } }
|
||||
public double Capacity { get { return balanceCfg.Capacity; } }
|
||||
public double Resolution { get { return balanceCfg.Resolution; } }
|
||||
public int EmptyTimeSec { get { return balanceCfg.DrainTimeSec; } }
|
||||
public IValve DrainValve2 { get { return null; } }
|
||||
|
||||
/// Buoyancy
|
||||
public float BuoyancyTemp { get { return balanceCfg.BuoyancyTemp; } }
|
||||
public float BuoyancyTemp { get { return balanceCfg.BuoyancyTemp; } }
|
||||
public float BuoyancyPress { get { return balanceCfg.BuoyancyPress; } }
|
||||
public float BuoyancyHumi { get { return balanceCfg.BuoyancyHumi; } }
|
||||
public float BuoyancyHumi { get { return balanceCfg.BuoyancyHumi; } }
|
||||
public double WeightStandardDensity { get { return balanceCfg.WeightStandardDensity; } }
|
||||
|
||||
|
||||
@@ -122,14 +124,14 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||
}
|
||||
|
||||
public bool IsEmpty()
|
||||
public override bool IsEmpty()
|
||||
{
|
||||
return (Mass <= balanceCfg.Empty);
|
||||
}
|
||||
|
||||
public bool IsEmpty(double mass)
|
||||
public override bool ContainsMoreThen(float thld)
|
||||
{
|
||||
return (mass <= balanceCfg.Empty);
|
||||
return (Mass >= thld);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.IO.Ports;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
@@ -50,6 +51,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
public int ScaleNr { get { return balanceNr; } }
|
||||
public double Capacity { get { return balanceCfg.Capacity; } }
|
||||
public int EmptyTimeSec { get { return balanceCfg.DrainTimeSec; } }
|
||||
public IValve DrainValve2 { get { return null; } }
|
||||
|
||||
/// Buoyancy
|
||||
public float BuoyancyTemp { get { return balanceCfg.BuoyancyTemp; } }
|
||||
@@ -126,9 +128,9 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
return DrainValve.State ? (mass <= balanceCfg.Empty) : (mass <= balanceCfg.EmptyUp);
|
||||
}
|
||||
|
||||
public bool IsEmpty(double mass)
|
||||
public override bool ContainsMoreThen(float thld)
|
||||
{
|
||||
return DrainValve.State ? (mass <= balanceCfg.Empty) : (mass <= balanceCfg.EmptyUp);
|
||||
return (mass >= thld);
|
||||
}
|
||||
|
||||
public void ZeroWhenStable()
|
||||
|
||||
@@ -23,7 +23,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
DoubleBox result;
|
||||
|
||||
/// Operation specific
|
||||
double[] massReadings;
|
||||
double[] massReadings;
|
||||
double[] sortedMassReadings;
|
||||
int currentReadingsCount;
|
||||
|
||||
bool measurementCompleted;
|
||||
@@ -48,7 +49,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
this.result = result;
|
||||
|
||||
massReadings = new double[totalReadingsCount];
|
||||
currentReadingsCount = 0;
|
||||
sortedMassReadings = new double[totalReadingsCount];
|
||||
currentReadingsCount = 0;
|
||||
measurementCompleted = false;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
@@ -114,17 +116,18 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
|
||||
if (currentReadingsCount >= totalReadingsCount)
|
||||
{
|
||||
Array.Sort(massReadings);
|
||||
Array.Copy(massReadings, sortedMassReadings, totalReadingsCount);
|
||||
Array.Sort(sortedMassReadings);
|
||||
|
||||
#if STABLE_MASS_EXTRAS
|
||||
if (method == Config.Entities.MassMethod.Spread)
|
||||
{
|
||||
/// Immediate mass measurement, end condition calculated below
|
||||
|
||||
if ((massReadings[totalReadingsCount - 2] - massReadings[1]) <= maxSpread)
|
||||
if ((sortedMassReadings[totalReadingsCount - 2] - sortedMassReadings[1]) <= maxSpread)
|
||||
{
|
||||
double massSum = 0;
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) massSum += massReadings[i];
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) massSum += sortedMassReadings[i];
|
||||
result.Val = (massSum / (totalReadingsCount - 2));
|
||||
log.InfoFormat("ReadStableMassOp.Run() ... valid mass={0} ... returning Event.BalanceDone", result.Val);
|
||||
|
||||
@@ -137,10 +140,10 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// Immediate mass measurement, end condition calculated below
|
||||
|
||||
double massSum = 0;
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) massSum += massReadings[i];
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) massSum += sortedMassReadings[i];
|
||||
double ave = (massSum / (totalReadingsCount - 2));
|
||||
double sdev = 0;
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) sdev += ((massReadings[i] - ave) * (massReadings[i] - ave));
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) sdev += ((sortedMassReadings[i] - ave) * (sortedMassReadings[i] - ave));
|
||||
|
||||
if (Math.Sqrt(sdev / (totalReadingsCount - 2)) <= maxSpread)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2018 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -29,13 +29,18 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
readonly GenericDevices.ITankDrainingCfg tankDrainingCfg;
|
||||
|
||||
private IValve drainValve;
|
||||
bool hasDrainValve { get { return !string.IsNullOrEmpty(tankDrainingCfg.DrainValve); } } /// Available in UI (unlike 'drainValve')
|
||||
|
||||
IValve drainValve;
|
||||
public GenericDevices.IValve DrainValve { get { return drainValve; } }
|
||||
|
||||
private IOperation openTheDrainValveOp;
|
||||
private IOperation closeTheDrainValveOp;
|
||||
private IOperation waitTankEmptyOp;
|
||||
|
||||
IOperation openTheDrainValveOp;
|
||||
IOperation closeTheDrainValveOp;
|
||||
IOperation waitTankIsEmptyOp;
|
||||
IOperation waitTankContainsMoreThenThld1Op;
|
||||
IOperation waitTankContainsMoreThenThld2Op;
|
||||
IOperation waitTankContainsMoreThenThld3Op;
|
||||
IOperation waitTankContainsMoreThenThld4Op;
|
||||
|
||||
DrainState drainState;
|
||||
|
||||
@@ -45,8 +50,12 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
{
|
||||
openTheDrainValveOp = null;
|
||||
closeTheDrainValveOp = null;
|
||||
waitTankEmptyOp = null;
|
||||
}
|
||||
waitTankIsEmptyOp = null;
|
||||
waitTankContainsMoreThenThld1Op = null;
|
||||
waitTankContainsMoreThenThld2Op = null;
|
||||
waitTankContainsMoreThenThld3Op = null;
|
||||
waitTankContainsMoreThenThld4Op = null;
|
||||
}
|
||||
|
||||
public TankDraining(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
@@ -56,8 +65,12 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
openTheDrainValveOp = null;
|
||||
closeTheDrainValveOp = null;
|
||||
waitTankEmptyOp = null;
|
||||
}
|
||||
waitTankIsEmptyOp = null;
|
||||
waitTankContainsMoreThenThld1Op = null;
|
||||
waitTankContainsMoreThenThld2Op = null;
|
||||
waitTankContainsMoreThenThld3Op = null;
|
||||
waitTankContainsMoreThenThld4Op = null;
|
||||
}
|
||||
|
||||
protected void Initalize()
|
||||
{
|
||||
@@ -65,8 +78,17 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
openTheDrainValveOp = new Elde.SetValvesOp(StateMachine.ControlBoard, drainValve, null);
|
||||
closeTheDrainValveOp = new Elde.SetValvesOp(StateMachine.ControlBoard, null, drainValve);
|
||||
waitTankEmptyOp = new WaitTankEmptyOp(this);
|
||||
}
|
||||
waitTankIsEmptyOp = new WaitTankEmptyOp(this);
|
||||
|
||||
Various.TankWithLevelMsrmnt.TankCfg tankCfg = tankDrainingCfg as Various.TankWithLevelMsrmnt.TankCfg;
|
||||
if (tankCfg != null)
|
||||
{
|
||||
waitTankContainsMoreThenThld1Op = new WaitTankContainsMoreThenOp(this, tankCfg.ThldLevel1);
|
||||
waitTankContainsMoreThenThld2Op = new WaitTankContainsMoreThenOp(this, tankCfg.ThldLevel2);
|
||||
waitTankContainsMoreThenThld3Op = new WaitTankContainsMoreThenOp(this, tankCfg.ThldLevel3);
|
||||
waitTankContainsMoreThenThld4Op = new WaitTankContainsMoreThenOp(this, tankCfg.ThldLevel4);
|
||||
}
|
||||
}
|
||||
|
||||
protected void RunBefore()
|
||||
{
|
||||
@@ -112,33 +134,65 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
public virtual string GetName() { return string.Empty; }
|
||||
public virtual bool IsEmpty() { return false; }
|
||||
public virtual bool ContainsMoreThen(float thld) { return thld == 0; }
|
||||
|
||||
|
||||
|
||||
public int ConditionsCount { get { return 3; } }
|
||||
public int ConditionsCount
|
||||
{
|
||||
get { return hasDrainValve ? 3 : ((tankDrainingCfg is Various.TankWithLevelMsrmnt.TankCfg) ? 4 : 0); }
|
||||
}
|
||||
|
||||
/// Strings are added to the combo-box for transition sequence condition selection
|
||||
public string ConditionName(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return string.Format(Strings._0_open_the_drain_valve, Name);
|
||||
case 1: return string.Format(Strings._0_close_the_drain_valve, Name);
|
||||
case 2: return string.Format(Strings._0_wait_until_the_tank_is_empty, Name);
|
||||
default: return string.Empty;
|
||||
}
|
||||
if (hasDrainValve)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return string.Format(Strings._0_open_the_drain_valve, Name);
|
||||
case 1: return string.Format(Strings._0_close_the_drain_valve, Name);
|
||||
case 2: return string.Format(Strings._0_wait_until_the_tank_is_empty, Name);
|
||||
}
|
||||
}
|
||||
else if (tankDrainingCfg is Various.TankWithLevelMsrmnt.TankCfg)
|
||||
{
|
||||
var tankCfg = tankDrainingCfg as Various.TankWithLevelMsrmnt.TankCfg;
|
||||
switch (i)
|
||||
{
|
||||
case 0: return string.Format(Strings._0_wait_until_tank_contains_more_then_1_l, Name, tankCfg.ThldLevel1);
|
||||
case 1: return string.Format(Strings._0_wait_until_tank_contains_more_then_1_l, Name, tankCfg.ThldLevel2);
|
||||
case 2: return string.Format(Strings._0_wait_until_tank_contains_more_then_1_l, Name, tankCfg.ThldLevel3);
|
||||
case 3: return string.Format(Strings._0_wait_until_tank_contains_more_then_1_l, Name, tankCfg.ThldLevel4);
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty; // Default
|
||||
}
|
||||
|
||||
/// Operation to be executed as a part of a transition sequence
|
||||
public IOperation ConditionOp(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return openTheDrainValveOp;
|
||||
case 1: return closeTheDrainValveOp;
|
||||
case 2: return waitTankEmptyOp;
|
||||
default: return null;
|
||||
}
|
||||
if (hasDrainValve)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return openTheDrainValveOp;
|
||||
case 1: return closeTheDrainValveOp;
|
||||
case 2: return waitTankIsEmptyOp;
|
||||
}
|
||||
}
|
||||
else if (tankDrainingCfg is Various.TankWithLevelMsrmnt.TankCfg)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return waitTankContainsMoreThenThld1Op;
|
||||
case 1: return waitTankContainsMoreThenThld2Op;
|
||||
case 2: return waitTankContainsMoreThenThld3Op;
|
||||
case 3: return waitTankContainsMoreThenThld4Op;
|
||||
}
|
||||
}
|
||||
|
||||
return null; /// Default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Metering Systems
|
||||
///
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo
|
||||
{
|
||||
public class WaitTankContainsMoreThenOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(WaitTankContainsMoreThenOp));
|
||||
public override string ToString() { return string.Format("WaitTankFullOp()"); }
|
||||
|
||||
readonly GenericDevices.ITankDraining tankDraining;
|
||||
float threshodLevel;
|
||||
bool conditionMet;
|
||||
|
||||
/// <summary>
|
||||
/// Events: ConditionMet, ConditionNotMet
|
||||
/// </summary>
|
||||
/// <param name="tankDraining">Tank draining (Balance device) instance</param>
|
||||
public WaitTankContainsMoreThenOp(GenericDevices.ITankDraining tankDraining, float thresholdLevel)
|
||||
{
|
||||
this.tankDraining = tankDraining;
|
||||
this.threshodLevel = thresholdLevel;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
conditionMet = tankDraining.ContainsMoreThen(threshodLevel);
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.ConditionMet . . . tank is empty
|
||||
/// Event.ConditionNotMet . tank is not empty
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
conditionMet = conditionMet || tankDraining.ContainsMoreThen(threshodLevel);
|
||||
|
||||
return conditionMet ? Event.ConditionMet : Event.ConditionNotMet;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,18 +98,8 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (easythermCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (easythermCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
}
|
||||
|
||||
public void RunDeviceAfter() { }
|
||||
public void StopDevice() { }
|
||||
public void StopDevice2() { }
|
||||
|
||||
|
||||
|
||||
@@ -6,10 +6,12 @@ using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
using Config.Entities;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
{
|
||||
public class LevelMeter : ComponentBase, GenericDevices.IPressureMeter, IDevice
|
||||
public class LevelMeter : ComponentBase, GenericDevices.ILevelMeter, GenericDevices.ITempMeter, IDevice
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(LevelMeter));
|
||||
public override string ToString() { return string.Format("LevelMeter({0})", Cfg.ToString(1)); }
|
||||
@@ -17,9 +19,23 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
readonly LevelMeterCfg myCfg;
|
||||
readonly GenericDevices.IModbus modbus;
|
||||
|
||||
private float receivedLevel;
|
||||
/// <summary>The state of the measurement</summary>
|
||||
MsrmntState msrmntState;
|
||||
|
||||
///
|
||||
/// Measured values when MsrmntState == MsrmntState.Valid
|
||||
///
|
||||
double distance; /// [mm]
|
||||
double level; /// [mm]
|
||||
double percentage; /// [%]
|
||||
double temperature; /// [°C]
|
||||
ushort state;
|
||||
|
||||
public double Level { get { return level; } }
|
||||
|
||||
/// <summary>Measurement time stamp when MsrmntState == MsrmntState.Valid</summary>
|
||||
int msrmntTimeStamp;
|
||||
|
||||
const ushort WatchdogBitMask = 0x0010;
|
||||
|
||||
public LevelMeter()
|
||||
{
|
||||
@@ -42,38 +58,33 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
/// <summary>Initialize this device</summary>
|
||||
public void Initialize()
|
||||
{
|
||||
if (myCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
distance = 200.0;
|
||||
level = 0;
|
||||
percentage = 0;
|
||||
temperature = 20.0;
|
||||
state = 0;
|
||||
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
return;
|
||||
}
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
|
||||
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the water pressure
|
||||
/// </summary>
|
||||
/// <returns>Pressure in mBar</returns>
|
||||
public float ReadLevel()
|
||||
{
|
||||
return (float)Config.Units.ConvertFrom(Config.Unit.mm, receivedLevel);
|
||||
}
|
||||
public double ReadLevel() { return level; } /// Returns water level in mm
|
||||
public double ReadTemperature() { return temperature; } /// Returns temperature in °C
|
||||
|
||||
/// <summary>
|
||||
/// Events: PressureDone, Error
|
||||
/// </summary>
|
||||
/// <param name="pressure">Reference to a variable for the pressure in Bar</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadPressureOp(ref FloatBox pressure)
|
||||
{
|
||||
return new ReadLevelOp(this, ref pressure);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: pressureDone, Error
|
||||
/// </summary>
|
||||
/// <param name="pressure">Reference to a variable for the pressure in Bar</param>
|
||||
/// <param name="pressureDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadPressureOp(ref FloatBox pressure, Event pressureDone)
|
||||
{
|
||||
return new ReadLevelOp(this, ref pressure, pressureDone);
|
||||
}
|
||||
public IOperation ReadLevelOp(ref DoubleBox level) { return new ReadLevelOp(this, ref level); }
|
||||
public IOperation ReadStableLevelOp(ref DoubleBox level, double sdev) { return new ReadStableLevelOp(this, ref level, sdev); }
|
||||
public IOperation ManualReadLevelOp(ref DoubleBox level) { return null; }
|
||||
public IOperation ReadTempOp(ref DoubleBox temperature) { return new ReadTempOp(this, ref temperature); }
|
||||
public IOperation ReadTempOp(ref DoubleBox temperature, Event eventDone) { return new ReadTempOp(this, ref temperature, eventDone); }
|
||||
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
@@ -82,33 +93,94 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
if (myCfg.DebugLevel == Config.Entities.DebugMode.Simulate ||
|
||||
myCfg.DebugLevel == Config.Entities.DebugMode.FailureDuringOperation)
|
||||
{
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
return;
|
||||
}
|
||||
|
||||
if (modbus.ReceivedTelegrams[myCfg.ModbusAddress].Count > 0)
|
||||
{
|
||||
byte[] telegram = modbus.ReceivedTelegrams[myCfg.ModbusAddress].Dequeue();
|
||||
if (telegram.Length == 9 && telegram[1] == 4 && telegram[2] == 4)
|
||||
{
|
||||
/// Swap byte order
|
||||
byte t1 = telegram[3];
|
||||
byte t2 = telegram[4];
|
||||
byte t3 = telegram[5];
|
||||
byte t4 = telegram[6];
|
||||
telegram[3] = t4;
|
||||
telegram[4] = t3;
|
||||
telegram[5] = t2;
|
||||
telegram[6] = t1;
|
||||
|
||||
receivedLevel = System.BitConverter.ToSingle(telegram, 3);
|
||||
if (telegram.Length == 15 && telegram[1] == 3 && telegram[2] == 10)
|
||||
{
|
||||
double _distance = (double)(256 * telegram[3] + telegram[4]); /// [mm]
|
||||
double _level = (double)(256 * telegram[5] + telegram[6]); /// [mm]
|
||||
double _percentage = (double)(256 * telegram[7] + telegram[8]); /// [%]
|
||||
double _temperature = (double)(256 * telegram[9] + telegram[10]); /// [°C]
|
||||
ushort _state = (ushort)(256 * telegram[11] + telegram[12]);
|
||||
|
||||
string line = string.Format("dist={0} mm level={1} mm, %={2} %, temp={3} °C, state={4}",
|
||||
_distance, _level, _percentage, _temperature, _state);
|
||||
if (_distance > 0)
|
||||
{
|
||||
distance = _distance;
|
||||
level = _level;
|
||||
percentage = _percentage;
|
||||
temperature = _temperature;
|
||||
state = _state;
|
||||
}
|
||||
|
||||
log.Debug(line);
|
||||
Debug.WriteLine(line);
|
||||
}
|
||||
}
|
||||
|
||||
if ((StateMachine.Time % 3) == (myCfg.ModbusAddress % 3)) /// Each 3 seconds
|
||||
|
||||
byte[] msg = new byte[8]; /// Buffer for data to send
|
||||
|
||||
if ((StateMachine.Time % 3) == 0) /// Each 3 seconds
|
||||
{
|
||||
const byte Function = 4; /// Read input registers
|
||||
const ushort Address = 0; /// Pressure
|
||||
modbus.SendMessage(myCfg.ModbusAddress, Function, Address, 2);
|
||||
///
|
||||
/// Read distance, level, quantity, percentage and temperature in IEEE754 (DWORD-s)
|
||||
///
|
||||
UInt16 regAddr = 100;
|
||||
UInt16 count = 5;
|
||||
|
||||
/// Prepare data to be sent
|
||||
msg[0] = myCfg.ModbusAddress;
|
||||
msg[1] = 3; /// CMD =
|
||||
msg[2] = (byte)(regAddr >> 8); /// Control Word Hi
|
||||
msg[3] = (byte)(regAddr & 0xFF); /// Control Word Lo
|
||||
msg[4] = (byte)(count >> 8); /// Serial Com Reference Hi
|
||||
msg[5] = (byte)(count & 0xFF); /// Serial Com Reference Lo
|
||||
|
||||
modbus.SendMessage(msg);
|
||||
}
|
||||
else if ((StateMachine.Time % 3) == 1) /// Each 3 seconds
|
||||
{
|
||||
/////
|
||||
///// Read STATUS1
|
||||
/////
|
||||
//UInt16 regAddr = 104;
|
||||
//UInt16 count = 1;
|
||||
|
||||
///// Prepare data to be sent
|
||||
//msg[0] = myCfg.ModbusAddress;
|
||||
//msg[1] = 3; /// CMD =
|
||||
//msg[2] = (byte)(regAddr >> 8); /// Control Word Hi
|
||||
//msg[3] = (byte)(regAddr & 0xFF); /// Control Word Lo
|
||||
//msg[4] = (byte)(count >> 8); /// Serial Com Reference Hi
|
||||
//msg[5] = (byte)(count & 0xFF); /// Serial Com Reference Lo
|
||||
|
||||
//modbus.SendMessage(msg);
|
||||
}
|
||||
else if ((StateMachine.Time % 3) == 2) /// Each 3 seconds
|
||||
{
|
||||
/////
|
||||
///// Read distance, level, quantity, percentage and temperature in IEEE754 (DWORD-s)
|
||||
/////
|
||||
//UInt16 regAddr = 300;
|
||||
//UInt16 count = 10;
|
||||
|
||||
///// Prepare data to be sent
|
||||
//msg[0] = myCfg.ModbusAddress;
|
||||
//msg[1] = 3; /// CMD =
|
||||
//msg[2] = (byte)(regAddr >> 8); /// Control Word Hi
|
||||
//msg[3] = (byte)(regAddr & 0xFF); /// Control Word Lo
|
||||
//msg[4] = (byte)(count >> 8); /// Serial Com Reference Hi
|
||||
//msg[5] = (byte)(count & 0xFF); /// Serial Com Reference Lo
|
||||
|
||||
//modbus.SendMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public byte ModbusAddress; /// 1..255
|
||||
public byte ModbusAddress; /// 1..247
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
LevelMeterCfg() {}
|
||||
@@ -55,7 +55,7 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
ModbusAddress = 49;
|
||||
ModbusAddress = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,8 +111,9 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (int.TryParse(strValue, out dummy) && dummy >= 0 && dummy <= 255) return true;
|
||||
break;
|
||||
if (int.TryParse(strValue, out dummy) && dummy >= 1 && dummy <= 247) return true;
|
||||
message = ParamName(i) + " is invalid. Address range is 1 .. 247";
|
||||
return false;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
|
||||
@@ -10,34 +10,28 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
public class ReadLevelOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadLevelOp));
|
||||
public override string ToString() { return string.Format("ReadLevelOp(.,{0},.)", eventDone); }
|
||||
public override string ToString() { return string.Format("ReadLevelOp(.,.)"); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly LevelMeter levelMeter;
|
||||
readonly Event eventDone;
|
||||
|
||||
/// Measured value
|
||||
FloatBox level;
|
||||
DoubleBox level;
|
||||
|
||||
/// <summary>
|
||||
/// Events: PressureInDone, PressureOutDone or Error
|
||||
/// Events: LevelDone or Error
|
||||
/// </summary>
|
||||
/// <param name="levelMeter">Pressure meter reference</param>
|
||||
/// <param name="pressure">Reference to the measured pressure variable, value is in bar</param>
|
||||
/// <param name="levelMeter">Water level meter reference</param>
|
||||
/// <param name="level">Reference to the measured level variable, value is in mm</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadLevelOp(LevelMeter levelMeter, ref FloatBox pressure, Event eventDone)
|
||||
public ReadLevelOp(LevelMeter levelMeter, ref DoubleBox level)
|
||||
{
|
||||
if (levelMeter == null) throw new ArgumentNullException("levelMeter");
|
||||
this.levelMeter = levelMeter;
|
||||
this.level = pressure;
|
||||
this.eventDone = eventDone;
|
||||
this.level = level;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadLevelOp(LevelMeter pressureMeter, ref FloatBox pressure)
|
||||
: this(pressureMeter, ref pressure, Event.PressureDone)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
@@ -48,12 +42,12 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.PressureInDone or Event.PressureOutDone
|
||||
/// Event.LevelDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
level.Val = levelMeter.ReadLevel();
|
||||
return eventDone;
|
||||
return Event.LevelDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
{
|
||||
public class ReadStableLevelOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadLevelOp));
|
||||
public override string ToString() { return string.Format("ReadLevelOp(.,.)"); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly LevelMeter levelMeter;
|
||||
readonly DoubleBox level;
|
||||
readonly double sdev;
|
||||
|
||||
/// <summary>
|
||||
/// Events: LevelDone or Error
|
||||
/// </summary>
|
||||
/// <param name="levelMeter">Water level meter reference</param>
|
||||
/// <param name="level">Reference to the measured level variable, value is in mm</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadStableLevelOp(LevelMeter levelMeter, ref DoubleBox level, double sdev)
|
||||
{
|
||||
if (levelMeter == null) throw new ArgumentNullException("levelMeter");
|
||||
this.levelMeter = levelMeter;
|
||||
this.level = level;
|
||||
this.sdev = sdev;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
level.Val = levelMeter.ReadLevel();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.LevelDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
level.Val = levelMeter.ReadLevel();
|
||||
return Event.LevelDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
{
|
||||
public class ReadTempOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadTempOp));
|
||||
public override string ToString() { return string.Format("ReadTempOp(.,{0},.)", eventDone); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly LevelMeter levelMeter;
|
||||
readonly Event eventDone;
|
||||
|
||||
/// Measured value
|
||||
DoubleBox temperature;
|
||||
|
||||
/// <summary>
|
||||
/// Events: eventDone or Error
|
||||
/// </summary>
|
||||
/// <param name="levelMeter">Water temperature meter reference</param>
|
||||
/// <param name="temperature">Reference to the measured temperature variable, value is in l</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadTempOp(LevelMeter levelMeter, ref DoubleBox temperature, Event eventDone)
|
||||
{
|
||||
if (levelMeter == null) throw new ArgumentNullException("levelMeter");
|
||||
this.levelMeter = levelMeter;
|
||||
this.temperature = temperature;
|
||||
this.eventDone = eventDone;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadTempOp(LevelMeter levelMeter, ref DoubleBox temperature)
|
||||
: this(levelMeter, ref temperature, Event.TempDone)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
temperature.Val = levelMeter.ReadTemperature();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.temperatureDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
temperature.Val = levelMeter.ReadTemperature();
|
||||
return eventDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,6 +99,8 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
|
||||
|
||||
public void StopDevice()
|
||||
{
|
||||
if (tracingCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
using (ISession session = sessionFactory.OpenSession())
|
||||
{
|
||||
TracingDB.DB.UnregisterWorkplace(session, workplace);
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
|
||||
session.SaveOrUpdate(mc);
|
||||
}
|
||||
|
||||
ICalibInfoCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(cmpnt) as ICalibInfoCfg;
|
||||
ICalibRangesCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(cmpnt) as ICalibRangesCfg;
|
||||
if (cfg != null)
|
||||
{
|
||||
cfg.SetCalibDate(rangeIx, DateTime.Now);
|
||||
|
||||
@@ -389,7 +389,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
completeTestInfos = null;
|
||||
for (LogType lt = 0; lt < LogType.Count; lt++)
|
||||
{
|
||||
SensusTestInfo[] myTinfos = SensusCommon.GetTestInfos(lt);
|
||||
SensusTestInfo[] myTinfos = SensusTestInfo.GetTestInfos(lt);
|
||||
if (SensusTestInfo.AreCompatible(oraDbTestInfos, myTinfos))
|
||||
{
|
||||
completeTestInfos = myTinfos;
|
||||
@@ -629,8 +629,8 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
parm = new OracleParameter("WITHQ2CORRECTION", OracleDbType.Int32); parm.Value = wm.Q2CorrectionDone ? 1 : 0; cmd.Parameters.Add(parm); ///:7
|
||||
parm = new OracleParameter("ERRQ2", OracleDbType.Double); parm.Value = q2ErrWOCorrection; cmd.Parameters.Add(parm); ///:8
|
||||
parm = new OracleParameter("Q2CORRECTIONFLOWRIGHT", OracleDbType.Int32);parm.Value = wm.Q2CorrFlowRight;/*1=right to left*/ cmd.Parameters.Add(parm); ///:9
|
||||
parm = new OracleParameter("Q2CORRECTIONLEFT", OracleDbType.Int32); parm.Value = wm.Q2CorrLFlow; cmd.Parameters.Add(parm); ///:10
|
||||
parm = new OracleParameter("Q2CORRECTIONRIGHT", OracleDbType.Int32); parm.Value = wm.Q2CorrRFlow; cmd.Parameters.Add(parm); ///:11
|
||||
parm = new OracleParameter("Q2CORRECTIONLEFT", OracleDbType.Int32); parm.Value = wm.Q2CorrLR; cmd.Parameters.Add(parm); ///:10
|
||||
parm = new OracleParameter("Q2CORRECTIONRIGHT", OracleDbType.Int32); parm.Value = wm.Q2CorrRL; cmd.Parameters.Add(parm); ///:11
|
||||
|
||||
int rowsUpdated = cmd.ExecuteNonQuery();
|
||||
log.InfoFormat("VT_IP_ZAEHLER_PINDEX_PD inserted, PcbNr={0}, pruefix={1}", wm.SerialNr, max_Pruefindex);
|
||||
|
||||
@@ -187,10 +187,12 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
|
||||
|
||||
Results.Entities.MeterTestRslt[] wm0trs = new Results.Entities.MeterTestRslt[testInfos.Length];
|
||||
double totalTestTime = 0;
|
||||
int maxPruefungsNr = 0;
|
||||
for (int j = 0; j < testInfos.Length; j++)
|
||||
{
|
||||
wm0trs[j] = wm0.GetMeterTestRslt(testInfos[j].TestName);
|
||||
if (Math.Abs(testInfos[j].PruefungsNr) > maxPruefungsNr) maxPruefungsNr = Math.Abs(testInfos[j].PruefungsNr);
|
||||
|
||||
wm0trs[j] = wm0.GetMeterTestRslt(testInfos[j].TestName);
|
||||
if (wm0trs[j] != null)
|
||||
{
|
||||
totalTestTime += wm0trs[j].TargetTime();
|
||||
@@ -204,7 +206,7 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
|
||||
try
|
||||
{
|
||||
logger.WriteLine("[Wasserzähler-Daten]");
|
||||
logger.WriteLine(string.Format("PruefPunkte={0}", 3));
|
||||
logger.WriteLine(string.Format("PruefPunkte={0}", (maxPruefungsNr > 15) ? 20 : ((maxPruefungsNr > 10) ? 15 : ((maxPruefungsNr > 5) ? 10 : 5))));
|
||||
logger.WriteLine(string.Format("Typ={0}", batch.ProcedureName)); /// iP 020 Q3_4 R160 A XXXX
|
||||
logger.WriteLine(string.Format("MetroKlasse={0}", wmData.MetrologicalClass));
|
||||
logger.WriteLine(string.Format("Zulassungszeichen={0}", wmData.ApprovalInfo));
|
||||
@@ -222,15 +224,6 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
|
||||
bool pb_100_110 = (testInfos[j].Range == Range.R100_110);
|
||||
|
||||
if (wm0r != null)
|
||||
{
|
||||
logger.WriteLine(string.Format("Durchfluss{0}=0,0", fId));
|
||||
logger.WriteLine(string.Format("Prüfzeit{0}=0", fId));
|
||||
logger.WriteLine(string.Format("Prüfbereich100_110{0}=0", fId));
|
||||
logger.WriteLine(string.Format("PrüfbereichMin{0}=0", fId));
|
||||
logger.WriteLine(string.Format("PrüfbereichMax{0}=0", fId));
|
||||
logger.WriteLine(string.Format("QBezeichnung{0}=", fId));
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.WriteLine(string.Format("Durchfluss{0}={1}", fId, Units.ConvertTo(Unit.lph, wm0r.Qfrom()).ToString("F1", Program.AltCulture)));
|
||||
logger.WriteLine(string.Format("Prüfzeit{0}={1}", fId, wm0r.TargetTime().ToString("F0")));
|
||||
@@ -246,6 +239,15 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
|
||||
logger.WriteLine(string.Format("NegFehlergrenzeWarm{0}=0,0", fId));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.WriteLine(string.Format("Durchfluss{0}=0,0", fId));
|
||||
logger.WriteLine(string.Format("Prüfzeit{0}=0", fId));
|
||||
logger.WriteLine(string.Format("Prüfbereich100_110{0}=0", fId));
|
||||
logger.WriteLine(string.Format("PrüfbereichMin{0}=0", fId));
|
||||
logger.WriteLine(string.Format("PrüfbereichMax{0}=0", fId));
|
||||
logger.WriteLine(string.Format("QBezeichnung{0}=", fId));
|
||||
}
|
||||
}
|
||||
|
||||
logger.WriteLine(string.Format("GetriebeImpulse=2,000")); /// 2,000
|
||||
@@ -280,9 +282,9 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
|
||||
Results.Entities.MeterTestRslt[] wmtrs = new Results.Entities.MeterTestRslt[testInfos.Length];
|
||||
for (int j = 0; j < testInfos.Length; j++)
|
||||
{
|
||||
wmtrs[j] = wm0.GetMeterTestRslt(testInfos[j].TestName);
|
||||
wmtrs[j] = wMtr.GetMeterTestRslt(testInfos[j].TestName);
|
||||
|
||||
if (wm0trs[j] == null && !string.IsNullOrEmpty(testInfos[j].TestName))
|
||||
if (wmtrs[j] == null && !string.IsNullOrEmpty(testInfos[j].TestName))
|
||||
{
|
||||
testRsltIsMissing = true; /// Missing test result for one of specified tests
|
||||
}
|
||||
@@ -351,8 +353,8 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
|
||||
logger.WriteLine(string.Format("JustierWert=0,2")); /// 0,2
|
||||
logger.WriteLine(string.Format("Corrected2Hz={0}", wMtr.Hz2CorrectionDone ? 1 : 0));
|
||||
logger.WriteLine(string.Format("Q2Corrected={0}", wMtr.Q2CorrectionDone ? 1 : 0));
|
||||
logger.WriteLine(string.Format("Q2CorrectionRight={0}", wMtr.Q2CorrRFlow));
|
||||
logger.WriteLine(string.Format("Q2CorrectionLeft={0}", wMtr.Q2CorrLFlow));
|
||||
logger.WriteLine(string.Format("Q2CorrectionRight={0}", wMtr.Q2CorrRL));
|
||||
logger.WriteLine(string.Format("Q2CorrectionLeft={0}", wMtr.Q2CorrLR));
|
||||
logger.WriteLine(string.Format("Q2CorrectionFlowRight={0}", wMtr.Q2CorrFlowRight));
|
||||
logger.WriteLine(string.Format("FlowDirectionRight={0}", wMtr.Q2CorrFlowRight));
|
||||
logger.WriteLine(string.Format("Position={0}", wMtr.WMPosition));
|
||||
|
||||
@@ -9,9 +9,10 @@ namespace TBF.BenchControl.Output
|
||||
public enum LogType
|
||||
{
|
||||
Just_Q1Q2Q3,
|
||||
Just_Q1Q2Q2adjQ3, /// Greece
|
||||
Just_Q1Q2__Q3,
|
||||
DEWA, /// Q1, Q2adj, Q2, Q3, Q4
|
||||
Suez, /// two directions
|
||||
DEWA, /// Q1, Q2adj, Q2, Q3, Q4
|
||||
Suez, /// two directions
|
||||
Count
|
||||
}
|
||||
|
||||
@@ -92,6 +93,17 @@ namespace TBF.BenchControl.Output
|
||||
new SensusTestInfo( 3, "03", "Q3", Range.R90_100, "Q3"),
|
||||
};
|
||||
|
||||
case LogType.Just_Q1Q2Q2adjQ3:
|
||||
|
||||
return new SensusTestInfo[]
|
||||
{
|
||||
new SensusTestInfo(-1, "-1", "Just", Range.R90_100, "Adjustment"),
|
||||
new SensusTestInfo( 1, "01", "Q1", Range.R100_110, "Q1"),
|
||||
new SensusTestInfo( 2, "02", "Q2", Range.R100_110, "Q2"),
|
||||
new SensusTestInfo( 3, "03", "Q2adj", Range.R100_110, "Q2adj"),
|
||||
new SensusTestInfo( 4, "04", "Q3", Range.R90_100, "Q3"),
|
||||
};
|
||||
|
||||
case LogType.Just_Q1Q2__Q3:
|
||||
|
||||
return new SensusTestInfo[]
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace TBF.BenchControl
|
||||
public float PidCoef;
|
||||
public IDiverter Diverter;
|
||||
public ITempMeter TempDiv;
|
||||
public IScale Scale;
|
||||
public IScaleOrTank Scale;
|
||||
public IValve StartValve1;
|
||||
public bool InvertSV1;
|
||||
public IValve StartValve2;
|
||||
@@ -39,19 +39,19 @@ namespace TBF.BenchControl
|
||||
}
|
||||
|
||||
/// Constructor from data entity
|
||||
public OutputPath(Config.Entities.OutputPath entity, IList<BenchControl.Generic.IComponent> components)
|
||||
: this(entity.Name, entity.ItemNr)
|
||||
public OutputPath(Config.Entities.OutputPath outputPathEntity, IList<BenchControl.Generic.IComponent> components)
|
||||
: this(outputPathEntity.Name, outputPathEntity.ItemNr)
|
||||
{
|
||||
Qfrom = entity.Qfrom;
|
||||
Qto = entity.Qto;
|
||||
FlowMeter = (IFlowMeter)TbfComponents.FindComponent(entity.FlowMeter, components);
|
||||
RegulValve = (IRegulValve)TbfComponents.FindComponent(entity.RegulValve, components);
|
||||
PidCoef = entity.PidCoef;
|
||||
Diverter = (IDiverter)TbfComponents.FindComponent(entity.Diverter, components);
|
||||
TempDiv = (ITempMeter)TbfComponents.FindComponent(entity.TempDiv, components);
|
||||
Scale = (IScale)TbfComponents.FindComponent(entity.Scale, components);
|
||||
Qfrom = outputPathEntity.Qfrom;
|
||||
Qto = outputPathEntity.Qto;
|
||||
FlowMeter = (IFlowMeter)TbfComponents.FindComponent(outputPathEntity.FlowMeter, components);
|
||||
RegulValve = (IRegulValve)TbfComponents.FindComponent(outputPathEntity.RegulValve, components);
|
||||
PidCoef = outputPathEntity.PidCoef;
|
||||
Diverter = (IDiverter)TbfComponents.FindComponent(outputPathEntity.Diverter, components);
|
||||
TempDiv = (ITempMeter)TbfComponents.FindComponent(outputPathEntity.TempDiv, components);
|
||||
Scale = (IScaleOrTank)TbfComponents.FindComponent(outputPathEntity.Scale, components);
|
||||
|
||||
string[] svs = entity.StartValve != null ? entity.StartValve.Split(new char[] { '~' }) : new string[0];
|
||||
string[] svs = outputPathEntity.StartValve != null ? outputPathEntity.StartValve.Split(new char[] { '~' }) : new string[0];
|
||||
int iTmp;
|
||||
///
|
||||
StartValve1 = (IValve)TbfComponents.FindComponent(((svs.Length > 0) ? svs[0] : string.Empty), components);
|
||||
@@ -63,11 +63,11 @@ namespace TBF.BenchControl
|
||||
InvertSV3 = (svs.Length > 6) ? svs[6].Equals("i") : false;
|
||||
LagSV3 = (svs.Length > 7 && int.TryParse(svs[7], out iTmp)) ? iTmp : 0;
|
||||
|
||||
string[] vOpen = entity.ValvesOpen.Split(new char[] { ';' });
|
||||
string[] vOpen = outputPathEntity.ValvesOpen.Split(new char[] { ';' });
|
||||
ValvesOpen = new List<IValve>();
|
||||
foreach (var vName in vOpen) ValvesOpen.Add((IValve)TbfComponents.FindComponent(vName, components));
|
||||
|
||||
string[] vClose = entity.ValvesClose.Split(new char[] { ';' });
|
||||
string[] vClose = outputPathEntity.ValvesClose.Split(new char[] { ';' });
|
||||
ValvesClose = new List<IValve>();
|
||||
foreach (var vName in vClose) ValvesClose.Add((IValve)TbfComponents.FindComponent(vName, components));
|
||||
}
|
||||
|
||||
@@ -126,12 +126,13 @@ namespace TBF.BenchControl.Sequences
|
||||
///
|
||||
/// Read S/N-s from scales (cannot be stopped, but is limitted to Scales count x 3s (=timeout)
|
||||
///
|
||||
IScale[] scales = new IScale[] { StateMachine.Scale1, StateMachine.Scale2, StateMachine.Scale3 };
|
||||
IScaleOrTank[] tanks = new IScaleOrTank[] { StateMachine.Tank1, StateMachine.Tank2, StateMachine.Tank3 };
|
||||
|
||||
foreach (var scale in scales)
|
||||
foreach (var tank in tanks)
|
||||
{
|
||||
if (scale != null)
|
||||
if (tank is IScale)
|
||||
{
|
||||
IScale scale = tank as IScale;
|
||||
string sn = string.Empty;
|
||||
IOperation getSNOp = scale.GetSerNumOp(ref sn);
|
||||
|
||||
@@ -194,72 +195,104 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Drain tanks for the first time, use defined drain times
|
||||
/// Enable stop draining buttons
|
||||
///
|
||||
Bridge.Bench2UI(((StateMachine.DrainValve1 != null) ? ButtonsEtc.DrainTankBtn1Hi : 0) |
|
||||
((StateMachine.DrainValve2 != null) ? ButtonsEtc.DrainTankBtn2Hi : 0) |
|
||||
((StateMachine.DrainValve3 != null) ? ButtonsEtc.DrainTankBtn3Hi : 0));
|
||||
|
||||
IntBox remainingTime = new IntBox();
|
||||
State startNew = State.Create("MainSeq : Drain tanks")
|
||||
.AddOperation(checkUiOp);
|
||||
|
||||
///
|
||||
/// Determine lists of drain valves and drain times (max. of all tank drain times)
|
||||
///
|
||||
IList<IValve> fullDrainValves = new List<IValve>();
|
||||
IList<IValve> secondHalfDrainValves = new List<IValve>();
|
||||
IList<IValve> allDrainValves = new List<IValve>();
|
||||
if (StateMachine.DrainValve1 != null) allDrainValves.Add(StateMachine.DrainValve1);
|
||||
if (StateMachine.DrainValve2 != null) allDrainValves.Add(StateMachine.DrainValve2);
|
||||
if (StateMachine.DrainValve3 != null) allDrainValves.Add(StateMachine.DrainValve3);
|
||||
|
||||
// Determine the tank emptying time (the maximum for all balances)
|
||||
int scaleDrainTime = 0;
|
||||
if (StateMachine.Scale1 != null && StateMachine.Scale1.EmptyTimeSec > scaleDrainTime)
|
||||
int totalDrainTime = 0;
|
||||
int maxDrainTimeFor2VlvTanks = 0;
|
||||
bool areTwoDrainPhases = false;
|
||||
foreach (IScaleOrTank tank in new IScaleOrTank[] { StateMachine.Tank1, StateMachine.Tank2, StateMachine.Tank3 })
|
||||
{
|
||||
scaleDrainTime = StateMachine.Scale1.EmptyTimeSec;
|
||||
}
|
||||
if (StateMachine.Scale2 != null && StateMachine.Scale2.EmptyTimeSec > scaleDrainTime)
|
||||
{
|
||||
scaleDrainTime = StateMachine.Scale2.EmptyTimeSec;
|
||||
}
|
||||
if (StateMachine.Scale3 != null && StateMachine.Scale3.EmptyTimeSec > scaleDrainTime)
|
||||
{
|
||||
scaleDrainTime = StateMachine.Scale3.EmptyTimeSec;
|
||||
}
|
||||
if (scaleDrainTime > 0)
|
||||
{
|
||||
startNew.AddOperation(new TimerOp(scaleDrainTime, remainingTime))
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(allDrainValves, null));
|
||||
}
|
||||
|
||||
startNew.EnterState();
|
||||
do
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Emptying_tank, remainingTime.Val / 60, "min", remainingTime.Val % 60, Strings.sec));
|
||||
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
bool stopDrainingCmd = e.Contains(Event.UiCmdStopDrainingTank1) || e.Contains(Event.UiCmdStopDrainingTank2) || e.Contains(Event.UiCmdStopDrainingTank3);
|
||||
if (stopDrainingCmd && !e.Contains(Event.ValvesBusy) && !e.Contains(Event.CameraBusy))
|
||||
if (tank != null && tank.DrainValve != null)
|
||||
{
|
||||
goto stop_draining;
|
||||
if (tank.EmptyTimeSec > totalDrainTime) totalDrainTime = tank.EmptyTimeSec;
|
||||
if (tank.DrainValve2 != null)
|
||||
{
|
||||
areTwoDrainPhases = true;
|
||||
if (tank.EmptyTimeSec > maxDrainTimeFor2VlvTanks) maxDrainTimeFor2VlvTanks = tank.EmptyTimeSec;
|
||||
|
||||
if (!secondHalfDrainValves.Contains(tank.DrainValve)) secondHalfDrainValves.Add(tank.DrainValve);
|
||||
if (!fullDrainValves.Contains(tank.DrainValve2)) fullDrainValves.Add(tank.DrainValve2);
|
||||
if (!allDrainValves.Contains(tank.DrainValve)) allDrainValves.Add(tank.DrainValve);
|
||||
if (!allDrainValves.Contains(tank.DrainValve2)) allDrainValves.Add(tank.DrainValve2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!fullDrainValves.Contains(tank.DrainValve)) fullDrainValves.Add(tank.DrainValve);
|
||||
if (!allDrainValves.Contains(tank.DrainValve)) allDrainValves.Add(tank.DrainValve);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (e.Contains(Event.TimerBusy) ||
|
||||
e.Contains(Event.CameraBusy) ||
|
||||
e.Contains(Event.ValvesBusy));
|
||||
|
||||
Bridge.OnActivity(this, Strings.Emptying_tank);
|
||||
|
||||
stop_draining:
|
||||
|
||||
State stopDraining = State.Create("MainSeq : Stop draining water tanks")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, allDrainValves))
|
||||
.EnterState();
|
||||
do
|
||||
///
|
||||
/// Drain the tanks, two phases if necessary
|
||||
///
|
||||
if (totalDrainTime > 0)
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
IntBox timerTime = new IntBox(); /// Contains remaining time in each phase
|
||||
int firstPhaseTime = maxDrainTimeFor2VlvTanks / 2;
|
||||
|
||||
State.Create(areTwoDrainPhases ? "MainSeq : Drain tanks - phase 1" : "MainSeq : Drain tanks")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new TimerOp(areTwoDrainPhases ? firstPhaseTime : totalDrainTime, timerTime))
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(fullDrainValves, null))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
int remTime = areTwoDrainPhases ? (timerTime.Val + totalDrainTime - firstPhaseTime) : timerTime.Val;
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Emptying_tank, remTime / 60, "min", remTime % 60, Strings.sec));
|
||||
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
bool stopDrainingCmd = e.Contains(Event.UiCmdStopDrainingTank1) || e.Contains(Event.UiCmdStopDrainingTank2) || e.Contains(Event.UiCmdStopDrainingTank3);
|
||||
if (stopDrainingCmd && !e.Contains(Event.ValvesBusy) && !e.Contains(Event.CameraBusy)) break;
|
||||
}
|
||||
while (e.Contains(Event.TimerBusy) || e.Contains(Event.CameraBusy) || e.Contains(Event.ValvesBusy));
|
||||
|
||||
if (areTwoDrainPhases)
|
||||
{
|
||||
State.Create("MainSeq : Drain tanks - phase 2")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new TimerOp(totalDrainTime - firstPhaseTime, timerTime))
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(secondHalfDrainValves, null))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
int remTime = timerTime.Val;
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Emptying_tank, remTime / 60, "min", remTime % 60, Strings.sec));
|
||||
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
bool stopDrainingCmd = e.Contains(Event.UiCmdStopDrainingTank1) || e.Contains(Event.UiCmdStopDrainingTank2) || e.Contains(Event.UiCmdStopDrainingTank3);
|
||||
if (stopDrainingCmd && !e.Contains(Event.ValvesBusy) && !e.Contains(Event.CameraBusy)) break;
|
||||
}
|
||||
while (e.Contains(Event.TimerBusy) || e.Contains(Event.CameraBusy) || e.Contains(Event.ValvesBusy));
|
||||
}
|
||||
|
||||
Bridge.OnActivity(this, Strings.Emptying_tank);
|
||||
|
||||
State stopDraining = State.Create("MainSeq : Stop draining water tanks")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, allDrainValves))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
|
||||
//--------------------------------------------------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Resetting_scales);
|
||||
@@ -270,9 +303,9 @@ namespace TBF.BenchControl.Sequences
|
||||
DoubleBox tara2 = new DoubleBox(0);
|
||||
DoubleBox tara3 = new DoubleBox(0);
|
||||
State.Create("MainSeq : Reset scales").AddOperation(checkUiOp)
|
||||
.AddOperation((StateMachine.Scale1 != null) ? StateMachine.Scale1.TaringOp(ref tara1) : null)
|
||||
.AddOperation((StateMachine.Scale2 != null) ? StateMachine.Scale2.TaringOp(ref tara2) : null)
|
||||
.AddOperation((StateMachine.Scale3 != null) ? StateMachine.Scale3.TaringOp(ref tara3) : null)
|
||||
.AddOperation((StateMachine.Tank1 is IScale) ? (StateMachine.Tank1 as IScale).TaringOp(ref tara1) : null)
|
||||
.AddOperation((StateMachine.Tank2 is IScale) ? (StateMachine.Tank2 as IScale).TaringOp(ref tara2) : null)
|
||||
.AddOperation((StateMachine.Tank3 is IScale) ? (StateMachine.Tank3 as IScale).TaringOp(ref tara3) : null)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -667,7 +700,7 @@ namespace TBF.BenchControl.Sequences
|
||||
!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
|
||||
out inPath, out benchPath, out outPath, out sensPath,
|
||||
out heatMetersPath,
|
||||
out transitionBefore, out transitionAfter,
|
||||
out transitionBefore, out transitionBetween, out transitionAfter,
|
||||
out errorMsg))
|
||||
{
|
||||
UiBridge.Bridge.OnError(this, errorMsg);
|
||||
@@ -694,7 +727,7 @@ namespace TBF.BenchControl.Sequences
|
||||
!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
|
||||
out inPath, out benchPath, out outPath, out sensPath,
|
||||
out heatMetersPath,
|
||||
out transitionBefore, out transitionAfter,
|
||||
out transitionBefore, out transitionBetween, out transitionAfter,
|
||||
out errorMsg))
|
||||
{
|
||||
UiBridge.Bridge.OnError(this, errorMsg);
|
||||
@@ -731,58 +764,70 @@ namespace TBF.BenchControl.Sequences
|
||||
/// e = testMethod.Execute(test, outerLoopMode, (outerLoopMode ? outerLoopCounter: repetNr));
|
||||
///
|
||||
Event rsltTransBefore = Event.Done;
|
||||
Event rsltTransBetween = Event.Done;
|
||||
Event rsltTransAfter = Event.Done;
|
||||
{
|
||||
int timeEstTransBefore = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionBefore) : 1;
|
||||
int timeEstTransBetween = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionBetween) : 1;
|
||||
int timeEstTransAfter = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionAfter) : 1;
|
||||
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, timeEstTransBefore, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, timeEstTransAfter, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, Config.Entities.Progress.JustStarted));
|
||||
|
||||
if (testMethod.DoTransitions())
|
||||
{
|
||||
rsltTransBefore = Transition(transitionBefore, TransitionContext.BeforeTest); /// Transition or SetRoute - start of test
|
||||
log.InfoFormat("Test {0}: Transition({1}, BeforeTest) returned {2}", test.Name, (transitionBefore == null ? "null" : transitionBefore.Name), rsltTransBefore);
|
||||
}
|
||||
|
||||
bool currentTestFinished = true;
|
||||
if (rsltTransBefore == Event.Done)
|
||||
bool doOneMoreRepetition = false;
|
||||
do
|
||||
{
|
||||
do
|
||||
if (testMethod.DoTransitions())
|
||||
{
|
||||
log.InfoFormat("Test {0}: Execute(., {1}, {2})", test.Name, repetNr, isOuterLoopMode || repetNr == test.Repeats);
|
||||
e = testMethod.Execute(test, repetNr, isOuterLoopMode || repetNr == test.Repeats);
|
||||
|
||||
if (e.Contains(Event.MakeSecondPass) && testMethod is ITestMethodWith2ndPass)
|
||||
{
|
||||
deferredData.Add(new DeferredTestEvaluationData(test, repetNr, (testMethod as ITestMethodWith2ndPass).IntermediateData));
|
||||
}
|
||||
|
||||
currentTestFinished = (rsltTransBefore == Event.Done && !e.Contains(Event.Error)
|
||||
&& !e.Contains(Event.ConfigurationError)
|
||||
&& !e.Contains(Event.OpArgumentError)
|
||||
&& !e.Contains(Event.UiCmdStop));
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, currentTestFinished ? Config.Entities.Progress.Completed
|
||||
: Config.Entities.Progress.Aborted));
|
||||
|
||||
if (e.Contains(Event.OuterLoopStart)) break; /// Do not repeat OuterLoopStart test in this loop
|
||||
if (currentTestFinished && !isOuterLoopMode) repetNr++;
|
||||
/// Make a transition before a test and before each test repetition
|
||||
rsltTransBefore = Transition(transitionBefore, TransitionContext.BeforeTest); /// Transition or SetRoute - start of test
|
||||
log.InfoFormat("Test {0}: Transition({1}, BeforeTest) returned {2}", test.Name, (transitionBefore == null ? "null" : transitionBefore.Name), rsltTransBefore);
|
||||
}
|
||||
while (currentTestFinished && !isOuterLoopMode && repetNr <= test.Repeats);
|
||||
if (rsltTransBefore != Event.Done) break;
|
||||
|
||||
if (currentTestFinished && !isOuterLoopMode && repetNr > test.Repeats) repetNr = 1; /// Reset repetNr
|
||||
log.InfoFormat("Test {0}: Execute(., {1}, {2})", test.Name, repetNr, isOuterLoopMode || repetNr == test.Repeats);
|
||||
e = testMethod.Execute(test, repetNr, isOuterLoopMode || repetNr == test.Repeats);
|
||||
|
||||
if (e.Contains(Event.MakeSecondPass) && testMethod is ITestMethodWith2ndPass)
|
||||
{
|
||||
deferredData.Add(new DeferredTestEvaluationData(test, repetNr, (testMethod as ITestMethodWith2ndPass).IntermediateData));
|
||||
}
|
||||
|
||||
currentTestFinished = (rsltTransBefore == Event.Done && !e.Contains(Event.Error)
|
||||
&& !e.Contains(Event.ConfigurationError)
|
||||
&& !e.Contains(Event.OpArgumentError)
|
||||
&& !e.Contains(Event.UiCmdStop));
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, currentTestFinished ? Config.Entities.Progress.Completed
|
||||
: Config.Entities.Progress.Aborted));
|
||||
|
||||
if (e.Contains(Event.OuterLoopStart)) break; /// Do not repeat OuterLoopStart test in this loop
|
||||
if (currentTestFinished && !isOuterLoopMode) repetNr++;
|
||||
|
||||
doOneMoreRepetition = currentTestFinished && !isOuterLoopMode && (repetNr <= test.Repeats);
|
||||
|
||||
if (testMethod.DoTransitions() && doOneMoreRepetition)
|
||||
{
|
||||
/// Make a transition between two test repetitions
|
||||
rsltTransBetween = Transition(transitionBetween, TransitionContext.BetweenTests); /// Transition or SetRoute - start of test
|
||||
log.InfoFormat("Test {0}: Transition({1}, BetweenTests) returned {2}", test.Name, (transitionBetween == null ? "null" : transitionBetween.Name), rsltTransBetween);
|
||||
}
|
||||
}
|
||||
while ((rsltTransBetween == Event.Done) && doOneMoreRepetition);
|
||||
|
||||
if (currentTestFinished && !isOuterLoopMode && repetNr > test.Repeats) repetNr = 1; /// Reset repetNr
|
||||
|
||||
if (testMethod.DoTransitions())
|
||||
{
|
||||
/// Make a transition after the last test repetition
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (rsltTransBefore == Event.Error || e.Contains(Event.Error))
|
||||
if (rsltTransBefore == Event.Error || rsltTransBetween == Event.Error|| e.Contains(Event.Error))
|
||||
{
|
||||
isOuterLoopMode = false;
|
||||
goto error;
|
||||
@@ -849,8 +894,8 @@ namespace TBF.BenchControl.Sequences
|
||||
StateMachine.GetPaths(dfrrdData.Test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
|
||||
out inPath, out benchPath, out outPath, out sensPath,
|
||||
out heatMetersPath,
|
||||
out transitionBefore, out transitionAfter,
|
||||
out errorMsg);
|
||||
out transitionBefore, out transitionBetween, out transitionAfter,
|
||||
out errorMsg);
|
||||
|
||||
ITestMethodWith2ndPass testMethod = TbfComponents.FindComponent(dfrrdData.Test.Method) as ITestMethodWith2ndPass;
|
||||
|
||||
@@ -896,7 +941,7 @@ namespace TBF.BenchControl.Sequences
|
||||
!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
|
||||
out inPath, out benchPath, out outPath, out sensPath,
|
||||
out heatMetersPath,
|
||||
out transitionBefore, out transitionAfter,
|
||||
out transitionBefore, out transitionBetween, out transitionAfter,
|
||||
out errorMsg))
|
||||
{
|
||||
UiBridge.Bridge.OnError(this, errorMsg);
|
||||
@@ -926,6 +971,7 @@ namespace TBF.BenchControl.Sequences
|
||||
Event rsltTransAfter = Event.Done;
|
||||
{
|
||||
int timeEstTransBefore = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionBefore) : 1;
|
||||
int timeEstTransBetween = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionBetween) : 1;
|
||||
int timeEstTransAfter = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionAfter) : 1;
|
||||
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, timeEstTransBefore, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, timeEstTransAfter, 0 });
|
||||
@@ -1265,10 +1311,9 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
State.Create("MainSeq : Select an activity")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((StateMachine.Scale1 != null) ? StateMachine.Scale1.ReadMassOp(ref mass1) : null)
|
||||
.AddOperation((StateMachine.Scale2 != null) ? StateMachine.Scale2.ReadMassOp(ref mass2) : null)
|
||||
.AddOperation((StateMachine.Scale3 != null) ? StateMachine.Scale3.ReadMassOp(ref mass3) : null)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation((StateMachine.Tank1 is IScale) ? (StateMachine.Tank1 as IScale).ReadMassOp(ref mass1) : null)
|
||||
.AddOperation((StateMachine.Tank2 is IScale) ? (StateMachine.Tank2 as IScale).ReadMassOp(ref mass2) : null)
|
||||
.AddOperation((StateMachine.Tank3 is IScale) ? (StateMachine.Tank3 as IScale).ReadMassOp(ref mass3) : null)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -1282,9 +1327,9 @@ namespace TBF.BenchControl.Sequences
|
||||
if (draining1 && e.Contains(Event.UiCmdStopDrainingTank1)) break;
|
||||
if (draining2 && e.Contains(Event.UiCmdStopDrainingTank2)) break;
|
||||
if (draining3 && e.Contains(Event.UiCmdStopDrainingTank3)) break;
|
||||
if (draining1 && StateMachine.Scale1.IsEmpty(mass1.Val)) break;
|
||||
if (draining2 && StateMachine.Scale2.IsEmpty(mass2.Val)) break;
|
||||
if (draining3 && StateMachine.Scale3.IsEmpty(mass3.Val)) break;
|
||||
if (draining1 && StateMachine.Tank1.IsEmpty()) break;
|
||||
if (draining2 && StateMachine.Tank2.IsEmpty()) break;
|
||||
if (draining3 && StateMachine.Tank3.IsEmpty()) break;
|
||||
|
||||
/// Quit the selection loop and leave MakeSelection()
|
||||
if (e.Contains(Event.UiCmdBreak) && context == MKSelContext.InsideProcedure) return Selection.Break;
|
||||
@@ -1317,19 +1362,19 @@ namespace TBF.BenchControl.Sequences
|
||||
IList<IValve> openValves = new List<IValve>();
|
||||
IList<IValve> closeValves = new List<IValve>();
|
||||
|
||||
if (draining1 && (StateMachine.Scale1.IsEmpty(mass1.Val) || e.Contains(Event.UiCmdStopDrainingTank1)))
|
||||
if (draining1 && (StateMachine.Tank1.IsEmpty() || e.Contains(Event.UiCmdStopDrainingTank1)))
|
||||
{
|
||||
draining1 = false;
|
||||
closeValves.Add(StateMachine.DrainValve1);
|
||||
stateText = stateText + "close tank 1, ";
|
||||
}
|
||||
else if (draining2 && (StateMachine.Scale2.IsEmpty(mass2.Val) || e.Contains(Event.UiCmdStopDrainingTank2)))
|
||||
else if (draining2 && (StateMachine.Tank2.IsEmpty() || e.Contains(Event.UiCmdStopDrainingTank2)))
|
||||
{
|
||||
draining2 = false;
|
||||
closeValves.Add(StateMachine.DrainValve2);
|
||||
stateText = stateText + "close tank 2, ";
|
||||
}
|
||||
else if (draining3 && (StateMachine.Scale3.IsEmpty(mass3.Val) || e.Contains(Event.UiCmdStopDrainingTank3)))
|
||||
else if (draining3 && (StateMachine.Tank3.IsEmpty() || e.Contains(Event.UiCmdStopDrainingTank3)))
|
||||
{
|
||||
draining3 = false;
|
||||
closeValves.Add(StateMachine.DrainValve3);
|
||||
@@ -1513,6 +1558,10 @@ namespace TBF.BenchControl.Sequences
|
||||
{
|
||||
wm.CopyContentFrom(wm2);
|
||||
wm.Disabled = false;
|
||||
#if ORACLE_DB
|
||||
wm.WaterMeterData.WMTypeId = wm2.WaterMeterData.WMTypeId;
|
||||
wm.WaterMeterData.WMTypeRev = wm2.WaterMeterData.WMTypeRev;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,27 +103,27 @@ namespace TBF.BenchControl.Sequences
|
||||
public static int machineTimeStart;
|
||||
public static int lastMachineTime;
|
||||
|
||||
protected static void StartNewStatistics(int machineTime, int batchNr, string testName, int repetition)
|
||||
protected static void StartNewStatistics(int machineTime, int batchNr, string testName, int repetition, int skippedSamplesCount)
|
||||
{
|
||||
machineTimeStart = machineTime;
|
||||
lastMachineTime = machineTime;
|
||||
lastMachineTime = machineTime;
|
||||
|
||||
AmbTempStat.Start(batchNr, testName, repetition);
|
||||
AmbTempStat.Start (batchNr, testName, repetition);
|
||||
AmbPressStat.Start(batchNr, testName, repetition);
|
||||
AmbHumiStat.Start(batchNr, testName, repetition);
|
||||
AmbHumiStat.Start (batchNr, testName, repetition);
|
||||
|
||||
TempUpStat.Start(batchNr, testName, repetition);
|
||||
TempDownStat.Start(batchNr, testName, repetition);
|
||||
TempDiffStat.Start(batchNr, testName, repetition);
|
||||
TempDivStat.Start(batchNr, testName, repetition);
|
||||
PressUpStat.Start(batchNr, testName, repetition);
|
||||
PressDownStat.Start(batchNr, testName, repetition);
|
||||
PressDeltaStat.Start(batchNr, testName, repetition);
|
||||
RefFlowStat.Start(batchNr, testName, repetition);
|
||||
TempUpStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
||||
TempDownStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
||||
TempDiffStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
||||
TempDivStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
||||
PressUpStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
||||
PressDownStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
||||
PressDeltaStat.Start(batchNr, testName, repetition, skippedSamplesCount);
|
||||
RefFlowStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
||||
|
||||
TempRefHiStat.Start(batchNr, testName, repetition);
|
||||
TempRefLoStat.Start(batchNr, testName, repetition);
|
||||
Energy.Start(batchNr, testName, repetition);
|
||||
TempRefHiStat.Start (batchNr, testName, repetition);
|
||||
TempRefLoStat.Start (batchNr, testName, repetition);
|
||||
Energy.Start (batchNr, testName, repetition);
|
||||
VolumeForEnergy.Start(batchNr, testName, repetition);
|
||||
lastEnergyUpdateTime = 0;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace TBF.BenchControl.Sequences
|
||||
protected static BenchControl.HeatMetersPath heatMetersPath;
|
||||
|
||||
protected static TransitionSequence transitionBefore;
|
||||
protected static TransitionSequence transitionBetween;
|
||||
protected static TransitionSequence transitionAfter;
|
||||
|
||||
|
||||
@@ -181,107 +182,239 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
|
||||
|
||||
protected Event DrainTheTank(IValve drainValve, IScale scale)
|
||||
protected Event DrainTheTank(IScaleOrTank tank)
|
||||
{
|
||||
return DrainTheTank(drainValve, scale, new List<IOperation>());
|
||||
return DrainTheTank(tank, new List<IOperation>());
|
||||
}
|
||||
|
||||
protected Event DrainTheTank(IValve drainValve, IScale scale, IOperation extraOperation)
|
||||
protected Event DrainTheTank(IScaleOrTank tank, IOperation extraOperation)
|
||||
{
|
||||
IList<IOperation> extraOperations = new List<IOperation>();
|
||||
extraOperations.Add(extraOperation);
|
||||
return DrainTheTank(drainValve, scale, extraOperations);
|
||||
return DrainTheTank(tank, extraOperations);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Empties the tank: opens the emptying valve and measures the weight.
|
||||
/// </summary>
|
||||
/// <param name="drainValve">Valve to empty the tank</param>
|
||||
/// <param name="scale">Scale underneath the tank</param>
|
||||
/// <param name="tank">Scale underneath the tank</param>
|
||||
/// <returns>Event.Done or Event.Error</returns>
|
||||
protected Event DrainTheTank(IValve drainValve, IScale scale, IList<IOperation> extraOperations)
|
||||
protected Event DrainTheTank(IScaleOrTank tank, IList<IOperation> extraOperations)
|
||||
{
|
||||
bool stopped = false;
|
||||
IList<Event> e;
|
||||
bool stopped = false;
|
||||
Bridge.Bench2UI(ButtonsEtc.StopBtnEn);
|
||||
IntBox remainingTimeSec = new IntBox();
|
||||
|
||||
//------------------------------------------------------------
|
||||
Bridge.OnActivity(this, TBF.Resources.Strings.Emptying_tank);
|
||||
//------------------------------------------------------------
|
||||
|
||||
IList<Event> e;
|
||||
Bridge.Bench2UI(ButtonsEtc.StopBtnEn);
|
||||
if (tank.DrainValve2 == null)
|
||||
{
|
||||
///
|
||||
/// Draining with 1 valve 'DrainValve'
|
||||
///
|
||||
State.Create("SequenceBase : Open the drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(tank.DrainValve, null))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
IOperation timer = new TimerOp(tank.EmptyTimeSec, remainingTimeSec);
|
||||
do
|
||||
{
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(timer)
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
if (e.Contains(Event.BalanceOverload)) { }; /// Tank should be emptying now
|
||||
///
|
||||
if (!(tank is IScale))
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}",
|
||||
Strings.Emptying_tank,
|
||||
remainingTimeSec.Val / 60, "min",
|
||||
remainingTimeSec.Val % 60, Strings.sec));
|
||||
}
|
||||
}
|
||||
while ((tank is IScale) && !e.Contains(Event.BalanceDone));
|
||||
|
||||
if (stopped) break;
|
||||
}
|
||||
while (!tank.IsEmpty() && !e.Contains(Event.TimerExpired));
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
/// Draining with 2 valves: 'DrainValve' is open in the 2nd half of time, 'DrainValve2' is open all the time
|
||||
///
|
||||
State.Create("SequenceBase : Open the drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(tank.DrainValve2, null))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
///
|
||||
/// 1st half
|
||||
///
|
||||
IOperation timer1 = new TimerOp(tank.EmptyTimeSec / 2, remainingTimeSec);
|
||||
do
|
||||
{
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(timer1)
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
if (e.Contains(Event.BalanceOverload)) { }; /// Tank should be emptying now
|
||||
///
|
||||
if (!(tank is IScale))
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}",
|
||||
Strings.Emptying_tank,
|
||||
(remainingTimeSec.Val + tank.EmptyTimeSec / 2) / 60, "min",
|
||||
(remainingTimeSec.Val + tank.EmptyTimeSec / 2) % 60, Strings.sec));
|
||||
}
|
||||
}
|
||||
while ((tank is IScale) && !e.Contains(Event.BalanceDone));
|
||||
|
||||
State.Create("SequenceBase : Drain valve opened")
|
||||
if (stopped) break;
|
||||
}
|
||||
while (!tank.IsEmpty() && !e.Contains(Event.TimerExpired));
|
||||
|
||||
///
|
||||
/// 2nd half
|
||||
///
|
||||
if (!tank.IsEmpty())
|
||||
{
|
||||
State.Create("SequenceBase : Open the 2nd drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(tank.DrainValve, null))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
IOperation timer2 = new TimerOp(tank.EmptyTimeSec / 2, remainingTimeSec);
|
||||
do
|
||||
{
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(timer2)
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
if (e.Contains(Event.BalanceOverload)) { }; /// Tank should be emptying now
|
||||
///
|
||||
if (!(tank is IScale))
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}",
|
||||
Strings.Emptying_tank,
|
||||
remainingTimeSec.Val / 60, "min",
|
||||
remainingTimeSec.Val % 60, Strings.sec));
|
||||
}
|
||||
|
||||
}
|
||||
while ((tank is IScale) && !e.Contains(Event.BalanceDone));
|
||||
|
||||
if (stopped) break;
|
||||
}
|
||||
while (!tank.IsEmpty() && !e.Contains(Event.TimerExpired));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Quit emptying, close the drain valve
|
||||
//
|
||||
State.Create("SequenceBase : Closing the drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(drainValve, null))
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, tank.DrainValve))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
while (!e.Contains(Event.ValvesSet) || ((tank is IScale) && !e.Contains(Event.BalanceDone)));
|
||||
|
||||
do
|
||||
if (tank.DrainValve2 != null)
|
||||
{
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
State.Create("SequenceBase : Closing the 2nd drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, tank.DrainValve2))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
if (e.Contains(Event.BalanceOverload)) { }; /// Tank should be emptying now
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
|
||||
|
||||
if (stopped) break;
|
||||
while (!e.Contains(Event.ValvesSet) || ((tank is IScale) && !e.Contains(Event.BalanceDone)));
|
||||
}
|
||||
while (!scale.IsEmpty(Mass.Val));
|
||||
|
||||
//
|
||||
// Quit emptying
|
||||
//
|
||||
State.Create("SequenceBase : Closing the drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, drainValve))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
if (tank is IScale)
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
State.Create("SequenceBase : Updating the mass")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((tank as IScale).ReadMassOp(ref Mass))
|
||||
.AddOperation(new Operations.TimerOp(5))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone) || !e.Contains(Event.TimerExpired));
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet) || !e.Contains(Event.BalanceDone));
|
||||
|
||||
|
||||
State.Create("SequenceBase : Updating the mass")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(new Operations.TimerOp(5))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone) || !e.Contains(Event.TimerExpired));
|
||||
|
||||
|
||||
if (stopped)
|
||||
return Event.UiCmdStop;
|
||||
@@ -297,6 +430,7 @@ namespace TBF.BenchControl.Sequences
|
||||
{
|
||||
PurgeBegin,
|
||||
BeforeTest,
|
||||
BetweenTests,
|
||||
AfterTest,
|
||||
PurgeEnd,
|
||||
Stop,
|
||||
@@ -335,12 +469,13 @@ namespace TBF.BenchControl.Sequences
|
||||
///
|
||||
switch (context)
|
||||
{
|
||||
case TransitionContext.PurgeBegin: message = Strings.Purging_i_n; break;
|
||||
case TransitionContext.BeforeTest: message = Strings.Test_start_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;
|
||||
case TransitionContext.PurgeBegin: message = Strings.Purging_i_n; break;
|
||||
case TransitionContext.BeforeTest: message = Strings.Test_start_sequence_i_n; break;
|
||||
case TransitionContext.BetweenTests: message = Strings.Between_tests_sequence_i_n; break;
|
||||
case TransitionContext.AfterTest: message = Strings.Test_stop_sequence_i_n; break;
|
||||
case TransitionContext.PurgeEnd: message = Strings.Emptying_i_n; break;
|
||||
case TransitionContext.Stop: message = Strings.Test_stop_sequence_i_n; break;
|
||||
default: message = "Transition"; break;
|
||||
}
|
||||
|
||||
if (transitionSequence == null)
|
||||
@@ -357,7 +492,6 @@ namespace TBF.BenchControl.Sequences
|
||||
State.Create("SequenceBase : Transition : TestEnd - Default action")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen,
|
||||
StateMachine.DefaultValvesClose))
|
||||
.EnterState();
|
||||
@@ -472,7 +606,6 @@ namespace TBF.BenchControl.Sequences
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(conditionOperation)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(Utils.ValvesOpen(step), Utils.ValvesClose(step)));
|
||||
for (int j = 0; j <= i; j++)
|
||||
{
|
||||
@@ -495,7 +628,6 @@ namespace TBF.BenchControl.Sequences
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(conditionOperation)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(Utils.ValvesOpen(step), Utils.ValvesClose(step)))
|
||||
.AddOperation(new TimerOp(delay));
|
||||
for (int j = 0; j <= lastStartedRV; j++)
|
||||
@@ -542,7 +674,6 @@ namespace TBF.BenchControl.Sequences
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(conditionOperation)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(Utils.ValvesOpen(step), Utils.ValvesClose(step)));
|
||||
for (int j = first; j <= lastStartedRV; j++)
|
||||
{
|
||||
@@ -577,7 +708,6 @@ namespace TBF.BenchControl.Sequences
|
||||
///
|
||||
State.Create("SequenceBase.Transition() : Test stopped -> Stopping the pump")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, inPath.Pump))
|
||||
.EnterState();
|
||||
do
|
||||
@@ -595,7 +725,6 @@ namespace TBF.BenchControl.Sequences
|
||||
State.Create("SequenceBase : Transition : TestStart - Default action")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard
|
||||
.SetValvesOp(GenericDevices.ValveBase.Merge(inPath.ValvesOpen, benchPath.ValvesOpen, outPath.ValvesOpen),
|
||||
GenericDevices.ValveBase.Merge(inPath.ValvesClose, benchPath.ValvesClose, outPath.ValvesClose)))
|
||||
@@ -740,18 +869,17 @@ namespace TBF.BenchControl.Sequences
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
|
||||
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
|
||||
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
|
||||
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
|
||||
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(realTest ? outPath.Scale.ReadMassOp(ref Mass) : null)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
|
||||
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
|
||||
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
|
||||
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
|
||||
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((realTest && (outPath.Scale is IScale)) ? (outPath.Scale as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
|
||||
: null)
|
||||
@@ -766,7 +894,7 @@ namespace TBF.BenchControl.Sequences
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
if (e.Contains(Event.MeasurementCompleted) || e.Contains(Event.Next)) return Event.MeasurementCompleted;
|
||||
}
|
||||
while ( (realTest && !e.Contains(Event.BalanceDone)) ||
|
||||
while ( (realTest && (outPath.Scale is IScale) && !e.Contains(Event.BalanceDone)) ||
|
||||
!e.Contains(Event.ReadAllRegistersDone));
|
||||
|
||||
return Event.Done;
|
||||
@@ -929,7 +1057,7 @@ namespace TBF.BenchControl.Sequences
|
||||
sb.Append(";"); sb.Append(tstRslt.FlowMin); /// BG Qm [kg/h]
|
||||
sb.Append(";"); sb.Append(tstRslt.FlowVolume); /// BH Qv [l/h]
|
||||
sb.Append(";"); sb.Append(tstRslt.VolumeCTV); /// BI Vet . . . komercne prava hodnota - podla vahy
|
||||
sb.Append(";"); sb.Append(tstRslt.VolumeMaster); /// BJ Velm . . . . objem podla etalonu
|
||||
sb.Append(";"); sb.Append(tstRslt.VolumeMaster); /// BJ Velm . . . . objem podla etalonu (Prolonged: objem do vahy podla impulzov do vahy)
|
||||
sb.Append(";"); sb.Append(" "); /// BK Vmass . . . objem podla druheho etalonu / prietokomeru pred tratou (teraz vynechavame)
|
||||
sb.Append(";"); sb.Append(tstRslt.TestTime); /// BL t
|
||||
sb.Append(";"); sb.Append(tstRslt.ErrorMaster); /// BM Eelm . . . chyba etalonu voci komercne pravej hodnote
|
||||
@@ -946,13 +1074,13 @@ namespace TBF.BenchControl.Sequences
|
||||
sb.Append(";"); sb.Append(tstRslt.TempDownMax); /// BV [°C]
|
||||
sb.Append(";"); sb.Append(tstRslt.TempUpMin); /// BW [°C]
|
||||
sb.Append(";"); sb.Append(tstRslt.TempDownMin); /// BX [°C]
|
||||
sb.Append(";"); sb.Append(isPMaxTest ? tstRslt.TestTime : 0); /// BY [s] Duration of the pressure test
|
||||
sb.Append(";"); sb.Append(isPMaxTest ? tstRslt.TestTime : 0); /// BY [s] Duration of the pressure test
|
||||
sb.Append(";"); sb.AppendFormat("{0:F1}", Units.ConvertTo(Unit.C, tstRslt.AmbTempEnd)); /// BZ [°C]
|
||||
sb.Append(";"); sb.AppendFormat("{0:F0}", Units.ConvertTo(Unit.mbar, tstRslt.AmbPressEnd)); /// CA [mbar]
|
||||
sb.Append(";"); sb.AppendFormat("{0:F1}", Units.ConvertTo(Unit.RPct, tstRslt.AmbHumiEnd)); /// CB [R%]
|
||||
|
||||
sb.Append(";"); sb.Append(tstRslt.PulsesMaster); /// CC Celkovy pocet et. pulzov skusky
|
||||
sb.Append(";"); sb.Append(" "); /// CD - '' - pre druhy
|
||||
sb.Append(";"); sb.Append(tstRslt.PulsesMaster); /// CC Celkovy pocet et. pulzov skusky (Prolonged : do vahy)
|
||||
sb.Append(";"); sb.Append((tstRslt.TotalPulsesMstr != 0) ? tstRslt.TotalPulsesMstr.ToString() : " "); /// CD - '' - pre druhy (Prolonged : celkovy pocet)
|
||||
for (int i = 0; i < ProcessData.BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
if (ProcessData.BatchRslts.WaterMeters[i] != null)
|
||||
@@ -989,8 +1117,10 @@ namespace TBF.BenchControl.Sequences
|
||||
#endif
|
||||
sb.Append(";"); sb.Append(isCamera ? mtrRslt.VolumeStart * mtrRslt.PulsesPerLiter : 0); /// CQ WM Phi_start - pri hodnotach z kamery
|
||||
sb.Append(";"); sb.Append(isCamera ? mtrRslt.VolumeEnd * mtrRslt.PulsesPerLiter : 0); /// CR WM Phi_end - ' ' -
|
||||
sb.Append(";"); sb.Append(isCamera ? mtrRslt.TimestampStart : 0); /// CS WM Time_start - ' ' -
|
||||
sb.Append(";"); sb.Append(isCamera ? mtrRslt.TimestampEnd : 0); /// CT WM Time_end - ' ' -
|
||||
|
||||
sb.Append(";"); sb.Append(mtrRslt.TimestampStart); /// CS WM Time_start - ' ' -
|
||||
sb.Append(";"); sb.Append(mtrRslt.TimestampEnd); /// CT WM Time_end - ' ' -
|
||||
|
||||
sb.Append(";"); sb.Append(isCamera ? mtrRslt.PulsesPerLiter : 0); /// CU WM Degree per liter
|
||||
|
||||
sb.Append(";"); sb.Append(0); /// CV Analog out 1 (max mA)
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace TBF.BenchControl.Sequences
|
||||
{
|
||||
public class Statistics
|
||||
{
|
||||
public readonly int SkippedSamplesCount; /// 0 = do not skip any samples
|
||||
public readonly int DefaultSkippedSamplesCount; /// 0 = do not skip any samples
|
||||
public readonly int FilterSize; /// 0 = no filter
|
||||
public readonly bool MedianFilter; /// true - median filter instead of average
|
||||
public readonly IPlotter plotter;
|
||||
@@ -18,6 +18,7 @@ namespace TBF.BenchControl.Sequences
|
||||
double min;
|
||||
double max;
|
||||
double sum;
|
||||
int skippedSamplesCount;
|
||||
int totalCount; /// Number of samples passed to Update()
|
||||
int count; /// Number of processed and filtered samples
|
||||
int fifoCount; /// Number of samples inserted into FIFO
|
||||
@@ -34,9 +35,9 @@ namespace TBF.BenchControl.Sequences
|
||||
public double Sum { get { return sum; } }
|
||||
|
||||
|
||||
public Statistics(int skippedSamplesCount, int filterSize, bool medianFilter, IPlotter plotter)
|
||||
public Statistics(int defaultSkippedSamplesCount, int filterSize, bool medianFilter, IPlotter plotter)
|
||||
{
|
||||
this.SkippedSamplesCount = skippedSamplesCount;
|
||||
this.DefaultSkippedSamplesCount = defaultSkippedSamplesCount;
|
||||
this.FilterSize = filterSize;
|
||||
this.MedianFilter = medianFilter;
|
||||
this.plotter = plotter;
|
||||
@@ -50,8 +51,8 @@ namespace TBF.BenchControl.Sequences
|
||||
recordingInProgress = false;
|
||||
}
|
||||
|
||||
public Statistics(int skippedSamplesCount, int filterSize, bool medianFilter)
|
||||
: this(skippedSamplesCount, filterSize, medianFilter, new DummyPlotter())
|
||||
public Statistics(int defaultSkippedSamplesCount, int filterSize, bool medianFilter)
|
||||
: this(defaultSkippedSamplesCount, filterSize, medianFilter, new DummyPlotter())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -69,8 +70,17 @@ namespace TBF.BenchControl.Sequences
|
||||
/// <summary>
|
||||
/// Resets statistics and start collecting
|
||||
/// </summary>
|
||||
public void Start(int batchNr, string testName, int repetition)
|
||||
public void Start(int batchNr, string testName, int repetition)
|
||||
{
|
||||
Start(batchNr, testName, repetition, DefaultSkippedSamplesCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets statistics and start collecting, 4th arument specifies skipped samples count
|
||||
/// </summary>
|
||||
public void Start(int batchNr, string testName, int repetition, int skippedSamplesCount)
|
||||
{
|
||||
this.skippedSamplesCount = skippedSamplesCount;
|
||||
sum = 0;
|
||||
min = double.MaxValue;
|
||||
max = double.MinValue;
|
||||
@@ -124,7 +134,7 @@ namespace TBF.BenchControl.Sequences
|
||||
{
|
||||
if (recordingInProgress)
|
||||
{
|
||||
if (totalCount >= SkippedSamplesCount)
|
||||
if (totalCount >= skippedSamplesCount)
|
||||
{
|
||||
Process(value);
|
||||
}
|
||||
@@ -146,10 +156,10 @@ namespace TBF.BenchControl.Sequences
|
||||
sum += filteredValue;
|
||||
if (count == 0) first = filteredValue;
|
||||
last = filteredValue;
|
||||
if (value < min) min = filteredValue;
|
||||
if (value > max) max = filteredValue;
|
||||
if (filteredValue < min) min = filteredValue;
|
||||
if (filteredValue > max) max = filteredValue;
|
||||
|
||||
plotter.UpdateGraph(graphId, (float)(count + SkippedSamplesCount + FilterSize / 2), (float)value);
|
||||
plotter.UpdateGraph(graphId, (float)(count + skippedSamplesCount + FilterSize / 2), (float)filteredValue);
|
||||
|
||||
count++;
|
||||
}
|
||||
@@ -173,15 +183,15 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
|
||||
/// Shift values in FIFO buffer, calculate the sum
|
||||
double sum = 0;
|
||||
double sum1 = 0;
|
||||
for (int i = FilterSize - 1; i > 0; i--)
|
||||
{
|
||||
fifo[i] = fifo[i - 1];
|
||||
sum += fifo[i];
|
||||
sum1 += fifo[i];
|
||||
}
|
||||
/// Insert the current value into FIFO, add it to the sum
|
||||
fifo[0] = value;
|
||||
sum += value;
|
||||
sum1 += value;
|
||||
|
||||
|
||||
fifoCount++;
|
||||
@@ -210,7 +220,7 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
else
|
||||
{
|
||||
filteredValue = sum / FilterSize;
|
||||
filteredValue = sum1 / FilterSize;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -45,9 +45,9 @@ namespace TBF.BenchControl
|
||||
/// Public components
|
||||
public static Elde.ControlBoardDev ControlBoard;
|
||||
public static GenericDevices.IAmbient Ambient;
|
||||
public static GenericDevices.IScale Scale1;
|
||||
public static GenericDevices.IScale Scale2;
|
||||
public static GenericDevices.IScale Scale3;
|
||||
public static GenericDevices.IScaleOrTank Tank1;
|
||||
public static GenericDevices.IScaleOrTank Tank2;
|
||||
public static GenericDevices.IScaleOrTank Tank3;
|
||||
public static GenericDevices.IValve DrainValve1;
|
||||
public static GenericDevices.IValve DrainValve2;
|
||||
public static GenericDevices.IValve DrainValve3;
|
||||
@@ -121,7 +121,11 @@ namespace TBF.BenchControl
|
||||
/// <summary>
|
||||
/// Current state name
|
||||
/// </summary>
|
||||
public static int Time { get { return currentTimeSec; } }
|
||||
public static int Time
|
||||
{
|
||||
get { return currentTimeSec; }
|
||||
set { currentTimeSec = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
@@ -194,7 +198,7 @@ namespace TBF.BenchControl
|
||||
public static void InitializeBoardEtc(ControlComponent3Munich.UserControl1 ctrlBrdComponent)
|
||||
#elif FUZHOU_300
|
||||
public static void InitializeBoardEtc(ControlComponent3F300.UserControl1 ctrlBrdComponent)
|
||||
#elif PT200IL || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN || SLM_150 || PETERSBURG_200
|
||||
public static void InitializeBoardEtc(ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent)
|
||||
#else /// all newer benches
|
||||
public static void InitializeBoardEtc(ControlComponent_Torino2015.UserControl1 ctrlBrdComponent)
|
||||
@@ -209,7 +213,7 @@ namespace TBF.BenchControl
|
||||
|
||||
/// Find all balances (to initialize tank capacities in the control board)
|
||||
/// Find the control board
|
||||
IList<IScale> balances = new List<IScale>();
|
||||
IList<IScaleOrTank> tanks = new List<IScaleOrTank>();
|
||||
SequenceBase.FlowMeters = new List<IFlowMeter>();
|
||||
SequenceBase.RegulValves = new List<IRegulValve>();
|
||||
SequenceBase.PumpsWithFM = new List<IPumpFM>();
|
||||
@@ -237,14 +241,14 @@ namespace TBF.BenchControl
|
||||
if (cmpnt is IWaterMeter) SequenceBase.WaterMeters.Add(cmpnt as IWaterMeter);
|
||||
if (cmpnt is ICamera) SequenceBase.Cameras.Add(cmpnt as ICamera);
|
||||
if (cmpnt is GenericDevices.IAmbient) Ambient = cmpnt as GenericDevices.IAmbient;
|
||||
if (cmpnt is IScale)
|
||||
if (cmpnt is IScaleOrTank)
|
||||
{
|
||||
IScale scale = cmpnt as IScale;
|
||||
balances.Add(scale);
|
||||
IScaleOrTank tank = cmpnt as IScaleOrTank;
|
||||
tanks.Add(tank);
|
||||
|
||||
if (scale.ScaleNr == 0) Scale1 = scale;
|
||||
else if (scale.ScaleNr == 1) Scale2 = scale;
|
||||
else if (scale.ScaleNr == 2) Scale3 = scale;
|
||||
if (tank.ScaleNr == 0) Tank1 = tank;
|
||||
else if (tank.ScaleNr == 1) Tank2 = tank;
|
||||
else if (tank.ScaleNr == 2) Tank3 = tank;
|
||||
}
|
||||
|
||||
Elde.Valve.Valve eldeValve = (cmpnt as Elde.Valve.Valve);
|
||||
@@ -254,8 +258,8 @@ namespace TBF.BenchControl
|
||||
}
|
||||
|
||||
/// Create an array with tank capacities
|
||||
double[] tankCapacities = new double[balances.Count];
|
||||
for (int i = 0; i < tankCapacities.Length; i++) tankCapacities[i] = balances[i].Capacity;
|
||||
double[] tankCapacities = new double[tanks.Count];
|
||||
for (int i = 0; i < tankCapacities.Length; i++) tankCapacities[i] = tanks[i].Capacity;
|
||||
|
||||
/// Pre-initialize the control board (= buffer the arguments ctrlBrdComponent, tankCapacities)
|
||||
if (ControlBoard != null)
|
||||
@@ -315,27 +319,27 @@ namespace TBF.BenchControl
|
||||
}
|
||||
}
|
||||
|
||||
if (cmpnt is IScale)
|
||||
if (cmpnt is IScaleOrTank)
|
||||
{
|
||||
IScale scale = cmpnt as IScale;
|
||||
IScaleOrTank tank = cmpnt as IScaleOrTank;
|
||||
|
||||
if (scale.ScaleNr == 0)
|
||||
if (tank.ScaleNr == 0)
|
||||
{
|
||||
DrainValve1 = scale.DrainValve;
|
||||
DrainValve1 = tank.DrainValve;
|
||||
log.WarnFormat("InitializeBoardEtc() ... Scale1={0} Draining valve1={1}",
|
||||
scale.Name, (DrainValve1 != null) ? DrainValve1.Name : "---");
|
||||
tank.Name, (DrainValve1 != null) ? DrainValve1.Name : "---");
|
||||
}
|
||||
else if (scale.ScaleNr == 1)
|
||||
else if (tank.ScaleNr == 1)
|
||||
{
|
||||
DrainValve2 = scale.DrainValve;
|
||||
DrainValve2 = tank.DrainValve;
|
||||
log.WarnFormat("InitializeBoardEtc() ... Scale2={0} Draining valve2={1}",
|
||||
scale.Name, (DrainValve2 != null) ? DrainValve2.Name : "---");
|
||||
tank.Name, (DrainValve2 != null) ? DrainValve2.Name : "---");
|
||||
}
|
||||
else if (scale.ScaleNr == 2)
|
||||
else if (tank.ScaleNr == 2)
|
||||
{
|
||||
DrainValve3 = scale.DrainValve;
|
||||
DrainValve3 = tank.DrainValve;
|
||||
log.WarnFormat("InitializeBoardEtc() ... Scale3={0} Draining valve3={1}",
|
||||
scale.Name, (DrainValve3 != null) ? DrainValve3.Name : "---");
|
||||
tank.Name, (DrainValve3 != null) ? DrainValve3.Name : "---");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -380,6 +384,27 @@ namespace TBF.BenchControl
|
||||
/// <returns>true when DB-s are compatible</returns>
|
||||
public static bool IsRemoteDBCompatible(out string message)
|
||||
{
|
||||
IList<Config.Entities.FeedingPath> remoteFeedingPaths;
|
||||
IList<Config.Entities.BenchPath> remoteBenchPaths;
|
||||
IList<Config.Entities.OutputPath> remoteOutputPaths;
|
||||
IList<Config.Entities.MetersPath> remoteMetersPaths;
|
||||
IList<Config.Entities.TransitionSequence> remoteTransitions;
|
||||
|
||||
try
|
||||
{
|
||||
ISession remoteSession = Config.FluentCommon.CreateSession(Users.Entities.DBKind.RemoteConfig);
|
||||
remoteFeedingPaths = remoteSession.QueryOver<Config.Entities.FeedingPath>().List();
|
||||
remoteBenchPaths = remoteSession.QueryOver<Config.Entities.BenchPath>().List();
|
||||
remoteOutputPaths = remoteSession.QueryOver<Config.Entities.OutputPath>().List();
|
||||
remoteMetersPaths = remoteSession.QueryOver<Config.Entities.MetersPath>().List();
|
||||
remoteTransitions = remoteSession.QueryOver<Config.Entities.TransitionSequence>().List();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
message = "Cannot open remote database";
|
||||
return false;
|
||||
}
|
||||
|
||||
ISession localSession = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
|
||||
var localFeedingPaths = localSession.QueryOver<Config.Entities.FeedingPath>().List();
|
||||
var localBenchPaths = localSession.QueryOver<Config.Entities.BenchPath>().List();
|
||||
@@ -387,13 +412,6 @@ namespace TBF.BenchControl
|
||||
var localMetersPaths = localSession.QueryOver<Config.Entities.MetersPath>().List();
|
||||
var localTransitions = localSession.QueryOver<Config.Entities.TransitionSequence>().List();
|
||||
|
||||
ISession remoteSession = Config.FluentCommon.CreateSession(Users.Entities.DBKind.RemoteConfig);
|
||||
var remoteFeedingPaths = remoteSession.QueryOver<Config.Entities.FeedingPath>().List();
|
||||
var remoteBenchPaths = remoteSession.QueryOver<Config.Entities.BenchPath>().List();
|
||||
var remoteOutputPaths = remoteSession.QueryOver<Config.Entities.OutputPath>().List();
|
||||
var remoteMetersPaths = remoteSession.QueryOver<Config.Entities.MetersPath>().List();
|
||||
var remoteTransitions = remoteSession.QueryOver<Config.Entities.TransitionSequence>().List();
|
||||
|
||||
string subMsg;
|
||||
if (!IsCompatible(localFeedingPaths, remoteFeedingPaths, out subMsg))
|
||||
{
|
||||
@@ -584,6 +602,7 @@ namespace TBF.BenchControl
|
||||
out MetersPath pmtrs,
|
||||
out HeatMetersPath phmtrs,
|
||||
out TransitionSequence transitionBefore,
|
||||
out TransitionSequence transitionBetween,
|
||||
out TransitionSequence transitionAfter,
|
||||
out string errorMsg)
|
||||
{
|
||||
@@ -592,7 +611,8 @@ namespace TBF.BenchControl
|
||||
pout = null;
|
||||
phmtrs = null;
|
||||
transitionBefore = null;
|
||||
transitionAfter = null;
|
||||
transitionBetween = null;
|
||||
transitionAfter = null;
|
||||
|
||||
foreach (var path in feedingPaths)
|
||||
{
|
||||
@@ -636,7 +656,8 @@ namespace TBF.BenchControl
|
||||
foreach (var tr in TransitionSequences)
|
||||
{
|
||||
if (tr.Name == test.RelTransBefore) transitionBefore = tr;
|
||||
if (tr.Name == test.TransitionAfter) transitionAfter = tr;
|
||||
if (tr.Name == test.RelTransBetween) transitionBetween = tr;
|
||||
if (tr.Name == test.TransitionAfter) transitionAfter = tr;
|
||||
}
|
||||
|
||||
if (pout.Scale == null)
|
||||
|
||||
@@ -57,19 +57,26 @@ namespace TBF.BenchControl
|
||||
Factories.Add(new TestMethods.FixedStartMassCollection.Single.Factory());
|
||||
Factories.Add(new TestMethods.FixedStartMassCollection.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FixedStartMassCollection.HeatMeters.Factory());
|
||||
Factories.Add(new TestMethods.FixedStartTankCollection.Single.Factory());
|
||||
Factories.Add(new TestMethods.FixedStartTankCollection.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStart.Single.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStart.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStart.HeatMeters.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollection.Single.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollection.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollection.HeatMeters.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollComparative.Single.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollComparative.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollComparative.HeatMeters.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollProlonged.Single.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollProlonged.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollProlonged.HeatMeters.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartFirstRepetWithMassColl.Single.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartFirstRepetWithMassColl.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartFirstRepetWithMassColl.HeatMeters.Factory());
|
||||
Factories.Add(new TestMethods.GrabImage.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartTankCollection.Single.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartTankCollection.Compound.Factory());
|
||||
Factories.Add(new TestMethods.GrabImage.Factory());
|
||||
Factories.Add(new TestMethods.LeakTest.TestMethodFactory());
|
||||
Factories.Add(new TestMethods.LiveStream.Factory());
|
||||
Factories.Add(new TestMethods.OuterLoop.Start.Factory());
|
||||
@@ -77,7 +84,7 @@ namespace TBF.BenchControl
|
||||
Factories.Add(new TestMethods.PMaxTest.TestMethodFactory());
|
||||
Factories.Add(new TestMethods.PulsesTest.Factory());
|
||||
Factories.Add(new TestMethods.PulsesTestManual.Factory());
|
||||
Factories.Add(new TestMethods.SensitivityTest.TestMethodFactory());
|
||||
Factories.Add(new TestMethods.SensitivityTest.Factory());
|
||||
Factories.Add(new TestMethods.iPerlCommunication.TestMethodFactory()); /// iPerlCommunication
|
||||
Factories.Add(new TestMethods.RoiDetection.RoiDetectionFactory());
|
||||
Factories.Add(new DataEntry.WMStates.EntryFormFactory());
|
||||
@@ -85,7 +92,7 @@ namespace TBF.BenchControl
|
||||
Factories.Add(new Ambient.Greco.Factory());
|
||||
Factories.Add(new Hart.Common.Factory());
|
||||
Factories.Add(new Hart.Nivotrack.Factory());
|
||||
Factories.Add(new Keithley.Multimeter_2010_RS232.Factory()); /// Keithley.Multimeter_2010_RS232
|
||||
Factories.Add(new Keithley.Multimeter_2010_RS232.Factory()); /// Keithley.Multimeter_2010_RS232
|
||||
Factories.Add(new Keithley.TempMeter.Factory()); /// Keithley.TempMeter
|
||||
Factories.Add(new MettlerToledo.Standard.BalanceFactory()); /// MettlerToledo Balance
|
||||
Factories.Add(new MettlerToledo.Standard.BalanceOldFactory()); /// MettlerToledoBalanceOld
|
||||
@@ -148,10 +155,12 @@ namespace TBF.BenchControl
|
||||
Factories.Add(new Elde.RegulValveTandem.RegulValveTandemFactory());
|
||||
Factories.Add(new Elde.TempMeter.TempMeterFactory());
|
||||
Factories.Add(new Elde.TempMeterInternal.TempMeterFactory());
|
||||
Factories.Add(new Elde.Valve.ValveFactory());
|
||||
Factories.Add(new Elde.TempMeterMeret.Factory()); /// Meret temp. meter connected to control board Modbus
|
||||
Factories.Add(new Elde.Valve.ValveFactory());
|
||||
Factories.Add(new Elde.ValveEx.ValveFactory());
|
||||
Factories.Add(new Various.ErrorFlags.Factory());
|
||||
Factories.Add(new WaterMeters.Munich.WaterMeterFactory()); /// 'WaterMeters.Munich'
|
||||
Factories.Add(new Various.ErrorFlags.Factory());
|
||||
Factories.Add(new Various.TankWithLevelMsrmnt.Factory());
|
||||
Factories.Add(new WaterMeters.Munich.WaterMeterFactory()); /// 'WaterMeters.Munich'
|
||||
Factories.Add(new WaterMeters.WaterMeter.WaterMeterFactory()); /// 'WaterMeter'
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace TBF.BenchControl
|
||||
const ulong Path3 = VL12 | VI31 | VI32;
|
||||
const ulong Path4 = VL12 | VI41 | VI42;
|
||||
const ulong Path5 = VL12 | VI41 | VI43;
|
||||
#elif PT200IL || PUCHONG_200 || GENESIS || BERLIN
|
||||
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN
|
||||
const ulong VM11 = (1L << 4);
|
||||
const ulong VM12 = (1L << 5);
|
||||
const ulong VM21 = (1L << 6);
|
||||
@@ -505,7 +505,7 @@ namespace TBF.BenchControl
|
||||
if (Div2sim && (SimRoute & Path3) == Path3) Mass2sim += DiffKg(Flow3sim, time);
|
||||
if (Div2sim && (SimRoute & Path4) == Path4) Mass2sim += DiffKg(Flow4sim, time);
|
||||
if (Div1sim && (SimRoute & Path5) == Path5) Mass1sim += DiffKg(Flow5sim, time);
|
||||
#elif MUNICH || FUZHOU_150 || FUZHOU_300 || PT200IL || PUCHONG_200 || GENESIS || BERLIN
|
||||
#elif MUNICH || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN
|
||||
if (Div1sim && (SimRoute & Path1) == Path1)
|
||||
{
|
||||
float diff = DiffKg(Flow1sim, time);
|
||||
@@ -636,7 +636,7 @@ namespace TBF.BenchControl
|
||||
if (toTank) { throw (new Exception()); }
|
||||
break;
|
||||
}
|
||||
#elif MUNICH || FUZHOU_150 || FUZHOU_300 || PT200IL || PUCHONG_200 || GENESIS || BERLIN
|
||||
#elif MUNICH || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN
|
||||
switch (regulValveNo)
|
||||
{
|
||||
case 1:
|
||||
|
||||
@@ -110,7 +110,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
///
|
||||
State.Create("Adjustment : Starting the pump")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
|
||||
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
|
||||
.EnterState();
|
||||
@@ -132,7 +131,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -151,7 +149,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -168,7 +165,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -333,7 +329,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
queryEnd1 = cBrd.QueryMeasurementEndOp();
|
||||
queryEnd2 = cBrd.QueryMeasurementEndOp();
|
||||
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr);
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
|
||||
/// Measurement loop - begin
|
||||
while (true)
|
||||
|
||||
@@ -8,6 +8,7 @@ using log4net;
|
||||
using TBF.BenchControl;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
{
|
||||
@@ -22,70 +23,35 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
CombinedWithDetTestParams testParams,
|
||||
Config.Entities.DebugMode debugLevel)
|
||||
{
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
if (debugLevel == Config.Entities.DebugMode.Simulate)
|
||||
{
|
||||
return Simulate(test, repetitionNr, isLastRepetition, testParams);
|
||||
}
|
||||
|
||||
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
|
||||
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
|
||||
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
|
||||
IScale scale = outPath.Scale as IScale;
|
||||
if (scale == null)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_scale);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
|
||||
if (test.Part < 1 || test.Part > Config.Data.CompoundWMsCount)
|
||||
{
|
||||
UiBridge.Bridge.OnError(this, string.Format("Test 'Part' should be 1 .. {0}", Config.Data.CompoundWMsCount));
|
||||
IList<Event> retv = new List<Event>(1);
|
||||
retv.Add(Event.ConfigurationError);
|
||||
return retv;
|
||||
}
|
||||
|
||||
if (debugLevel == Config.Entities.DebugMode.Simulate)
|
||||
{
|
||||
///
|
||||
/// Test method simulation
|
||||
///
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (test.Name.ToLower().Contains("rise") || test.Name.ToLower().Contains("steig"))
|
||||
{
|
||||
MakeSimulatedCompound(test, 1, 0, 0.7f, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeSimulatedCompound(test, 1, 0, 0.7f, 0.9f);
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, BatchRslts.GetTestRslt(Results.Utils.GetTestName(test.Name, 1, 1), 0)));
|
||||
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
|
||||
|
||||
for (int i = 0; i < Config.Data.WMsCount; i++)
|
||||
{
|
||||
TestMethods.iPerlCommunication.iPerlHead.IperlHead iPerl = ((sensPath.RegisterReaders != null) && (i < sensPath.RegisterReaders.Length))
|
||||
? (sensPath.RegisterReaders[i] as TestMethods.iPerlCommunication.iPerlHead.IperlHead)
|
||||
: null;
|
||||
if (iPerl != null)
|
||||
{
|
||||
/// TODO: Reimplement
|
||||
//iPerl.LastTestResult = meterRslt; /// Save this water meter test result to iPerl WM
|
||||
iPerl.NominalTestFlowLph = 500.0 * (double)(test.Qfrom + test.Qto); /// Ave. + convert to liter/hour
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, string.Format("Simulating {0}", test.Name));
|
||||
//------------------------------------------------
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Simulating {1}", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retListSim = new List<Event>(1);
|
||||
retListSim.Add(TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done);
|
||||
return retListSim;
|
||||
e.Add(Event.ConfigurationError);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
|
||||
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
|
||||
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
|
||||
|
||||
/// Specific for combined meters
|
||||
int[] lastWMPulses = new int[2 * Config.Data.CompoundWMsCount];
|
||||
@@ -153,7 +119,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
//--------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Mesuring mass of water in the tank", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -164,14 +130,14 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
|
||||
double estimatedEndMass = Mass.Val + test.Volume;
|
||||
if (estimatedEndMass < outPath.Scale.Capacity * Constants.TankFullFactor)
|
||||
if (estimatedEndMass < scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
goto switching_flow_detection; /// Enough room in the tank -> skip emptying
|
||||
}
|
||||
}
|
||||
|
||||
/// Empty the water tank
|
||||
switch (DrainTheTank(outPath.Scale.DrainValve, outPath.Scale))
|
||||
switch (DrainTheTank(scale))
|
||||
{
|
||||
case Event.Error: goto error;
|
||||
case Event.UiCmdStop: goto stopTest;
|
||||
@@ -472,12 +438,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
|
||||
//--------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Going to the test flow", test.Method, test.Name))
|
||||
//State.Create("set_RV_position",
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, qfrom_detected, qto_detected, outPath.PidCoef, RefFlow, 600)) /// timeout = 10 sec.
|
||||
//.AddOp(pOut.RegulValve.SetPositionOp(35.0f, 38.0f, uint.MaxValue))
|
||||
.EnterState();
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, qfrom_detected, qto_detected, outPath.PidCoef, RefFlow, 600)) /// timeout = 10 sec.
|
||||
//.AddOp(pOut.RegulValve.SetPositionOp(35.0f, 38.0f, uint.MaxValue))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -499,7 +464,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
State.Create(Strings.Measure_the_mass)
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(outPath.Scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -534,7 +499,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
queryEnd1 = cBrd.QueryMeasurementEndOp();
|
||||
queryEnd2 = cBrd.QueryMeasurementEndOp();
|
||||
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr);
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TstTime;
|
||||
|
||||
/// Read the diverter switch time
|
||||
@@ -588,7 +553,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
//------------------------------------------------
|
||||
State.Create(Strings.Measure_the_mass)
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -611,7 +576,6 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
|
||||
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -653,19 +617,18 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
|
||||
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.MassStartRaw = StartMass.Val;
|
||||
tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections);
|
||||
tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, scale.Corrections);
|
||||
tstRslt.MassEndRaw = EndMass.Val;
|
||||
tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections);
|
||||
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h]
|
||||
tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, scale.Corrections);
|
||||
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h]
|
||||
tstRslt.Buoyancy = Config.Formulas.Buoyancy();
|
||||
double density = Config.Formulas.WaterDensityFromTemp((tstRslt.TempUpMean + tstRslt.TempDownMean) / 2.0, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature);
|
||||
tstRslt.VolumeCTV = 1000.0 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / density; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
|
||||
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
|
||||
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
|
||||
tstRslt.VolumeCTV = 1000 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume
|
||||
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
|
||||
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
|
||||
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
|
||||
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
|
||||
/// Calculated master pulses per liter
|
||||
/// Calculated master pulses per liter
|
||||
tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
|
||||
|
||||
tstRslt.FlowMean = (float)RefFlowStat.Average;
|
||||
@@ -742,7 +705,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
@@ -829,5 +792,42 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
retval3.Add(Event.Error);
|
||||
return retval3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IList<Event> Simulate(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
|
||||
CombinedWithDetTestParams testParams)
|
||||
{
|
||||
///
|
||||
/// Test method simulation
|
||||
///
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (test.Name.ToLower().Contains("rise") || test.Name.ToLower().Contains("steig"))
|
||||
{
|
||||
MakeSimulatedCompound(test, 1, 0, 0.7f, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeSimulatedCompound(test, 1, 0, 0.7f, 0.9f);
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, BatchRslts.GetTestRslt(Results.Utils.GetTestName(test.Name, 1, 1), 0)));
|
||||
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, string.Format("Simulating {0}", test.Name));
|
||||
//------------------------------------------------
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Simulating {1}", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
IList<Event> e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retListSim = new List<Event>(1);
|
||||
retListSim.Add(TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done);
|
||||
return retListSim;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,6 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
|
||||
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
|
||||
.EnterState();
|
||||
@@ -277,7 +276,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
||||
queryEnd1 = cBrd.QueryMeasurementEndOp();
|
||||
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TstTime;
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr);
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
|
||||
/// Measurement loop - begin
|
||||
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
|
||||
@@ -448,7 +447,6 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
||||
|
||||
iPerl.LastTestResult2 = iPerl.LastTestResult; /// Save shift previous test result
|
||||
iPerl.LastTestResult = meterRslt; /// Save this test result
|
||||
iPerl.NominalTestFlowLph = 500.0 * (test.Qfrom + test.Qto); /// Ave. + convert to liter/hour
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -508,7 +506,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
||||
while (!e.Contains(Event.PreviousStopped));
|
||||
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TstTime;
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr);
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
|
||||
|
||||
///
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user