Stable level and volume measurement ... in progress.
This commit is contained in:
@@ -30,5 +30,12 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// <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,12 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface ITankWithVolumeMsrmnt : IScaleOrTank
|
||||
{
|
||||
IOperation MeasureVolumeOp(ref DoubleBox volume);
|
||||
}
|
||||
}
|
||||
@@ -24,11 +24,17 @@ namespace TBF.BenchControl.GenericDevices
|
||||
IOperation ReadVolumeOp(ref DoubleBox volume);
|
||||
|
||||
/// <summary>
|
||||
/// Events: volumeDone, Error
|
||||
/// Events: VolumeDone, Error
|
||||
/// </summary>
|
||||
/// <param name="volume">Reference to a variable for the measured volume in l</param>
|
||||
/// <param name="volumeDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadVolumeOp(ref DoubleBox volume, Event volumeDone);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +33,13 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
public double Level { get { return ReadLevel(); } }
|
||||
|
||||
DoubleBox levelBox;
|
||||
double sdev;
|
||||
|
||||
enum CurrentOp
|
||||
{
|
||||
None,
|
||||
ReadLevel,
|
||||
ReadStableLevel,
|
||||
}
|
||||
CurrentOp currentOp;
|
||||
|
||||
@@ -173,6 +175,16 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ReadStableLevelOp(ref DoubleBox levelBox, double sdev)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
this.levelBox = levelBox;
|
||||
this.sdev = sdev;
|
||||
currentOp = CurrentOp.ReadStableLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
|
||||
@@ -84,11 +84,12 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
public double ReadTemperature() { return temperature; } /// Returns temperature in °C
|
||||
|
||||
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 ReadVolumeOp(ref DoubleBox volume) { return new ReadVolumeOp(this, ref volume); }
|
||||
public IOperation ReadStableVolumeOp(ref DoubleBox volume, double sdev) { return new ReadStableVolumeOp(this, ref volume, sdev); }
|
||||
public IOperation ManualReadVolumeOp(ref DoubleBox volume) { return null; }
|
||||
public IOperation ReadTempOp(ref DoubleBox temperature) { return new ReadTempOp(this, ref temperature); }
|
||||
|
||||
public IOperation ReadLevelOp(ref DoubleBox level, Event eventDone) { return new ReadLevelOp(this, ref level, eventDone); }
|
||||
public IOperation ReadVolumeOp(ref DoubleBox volume, Event eventDone) { return new ReadVolumeOp(this, ref volume, eventDone); }
|
||||
public IOperation ReadTempOp(ref DoubleBox temperature, Event eventDone) { return new ReadTempOp(this, ref temperature, eventDone); }
|
||||
|
||||
|
||||
|
||||
@@ -10,11 +10,10 @@ 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
|
||||
DoubleBox level;
|
||||
@@ -25,19 +24,14 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
/// <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 DoubleBox level, Event eventDone)
|
||||
public ReadLevelOp(LevelMeter levelMeter, ref DoubleBox level)
|
||||
{
|
||||
if (levelMeter == null) throw new ArgumentNullException("levelMeter");
|
||||
this.levelMeter = levelMeter;
|
||||
this.level = level;
|
||||
this.eventDone = eventDone;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadLevelOp(LevelMeter levelMeter, ref DoubleBox level)
|
||||
: this(levelMeter, ref level, Event.LevelDone)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
@@ -53,7 +47,7 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
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,58 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
{
|
||||
public class ReadStableVolumeOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadVolumeOp));
|
||||
public override string ToString() { return string.Format("ReadVolumeOp(.,.)"); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly LevelMeter levelMeter;
|
||||
readonly DoubleBox volume;
|
||||
readonly double sdev;
|
||||
|
||||
/// <summary>
|
||||
/// Events: VolumeDone or Error
|
||||
/// </summary>
|
||||
/// <param name="levelMeter">Water volume meter reference</param>
|
||||
/// <param name="volume">Reference to the measured volume variable, value is in l</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadStableVolumeOp(LevelMeter levelMeter, ref DoubleBox volume, double sdev)
|
||||
{
|
||||
if (levelMeter == null) throw new ArgumentNullException("levelMeter");
|
||||
this.levelMeter = levelMeter;
|
||||
this.volume = volume;
|
||||
this.sdev = sdev;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
volume.Val = levelMeter.ReadVolume();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.VolumeDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
volume.Val = levelMeter.ReadVolume();
|
||||
return Event.VolumeDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,10 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
public class ReadVolumeOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadVolumeOp));
|
||||
public override string ToString() { return string.Format("ReadVolumeOp(.,{0},.)", eventDone); }
|
||||
public override string ToString() { return string.Format("ReadVolumeOp(.,.)"); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly LevelMeter levelMeter;
|
||||
readonly Event eventDone;
|
||||
|
||||
/// Measured value
|
||||
DoubleBox volume;
|
||||
@@ -25,19 +24,14 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
/// <param name="levelMeter">Water volume meter reference</param>
|
||||
/// <param name="volume">Reference to the measured volume variable, value is in l</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadVolumeOp(LevelMeter levelMeter, ref DoubleBox volume, Event eventDone)
|
||||
public ReadVolumeOp(LevelMeter levelMeter, ref DoubleBox volume)
|
||||
{
|
||||
if (levelMeter == null) throw new ArgumentNullException("levelMeter");
|
||||
this.levelMeter = levelMeter;
|
||||
this.volume = volume;
|
||||
this.eventDone = eventDone;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadVolumeOp(LevelMeter levelMeter, ref DoubleBox volume)
|
||||
: this(levelMeter, ref volume, Event.VolumeDone)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
@@ -53,7 +47,7 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
public Event Run()
|
||||
{
|
||||
volume.Val = levelMeter.ReadVolume();
|
||||
return eventDone;
|
||||
return Event.VolumeDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
|
||||
+6
-6
@@ -32,13 +32,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
|
||||
{
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
|
||||
ITankWithVolumeMsrmnt tank = outPath.Scale as ITankWithVolumeMsrmnt;
|
||||
if (tank == null)
|
||||
if ((outPath.Scale == null) || !(outPath.Scale is IVolumeMeter))
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_tank_with_volume_measurement);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
IVolumeMeter tank = outPath.Scale as IVolumeMeter;
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
@@ -62,7 +62,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
|
||||
}
|
||||
}
|
||||
|
||||
if (test.Volume >= tank.Capacity * Constants.TankFullFactor)
|
||||
if (test.Volume >= outPath.Scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
|
||||
e.Add(Event.UiCmdStop);
|
||||
@@ -100,7 +100,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
|
||||
///
|
||||
if (test.DoDraining)
|
||||
{
|
||||
switch (DrainTheTank(tank))
|
||||
switch (DrainTheTank(outPath.Scale))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -565,7 +565,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(tank.MeasureVolumeOp(ref volumeBox))
|
||||
.AddOperation(tank.ReadStableVolumeOp(ref volumeBox, test.MassSpread))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -826,7 +826,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
tank != null ? tank.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
|
||||
+9
-9
@@ -36,13 +36,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
|
||||
ITankWithVolumeMsrmnt tank = outPath.Scale as ITankWithVolumeMsrmnt;
|
||||
if (tank == null)
|
||||
if ((outPath.Scale == null) || !(outPath.Scale is IVolumeMeter))
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_tank_with_volume_measurement);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
IVolumeMeter tank = outPath.Scale as IVolumeMeter;
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
@@ -66,7 +66,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
}
|
||||
}
|
||||
|
||||
if (test.Volume > tank.Capacity * Constants.TankFullFactor)
|
||||
if (test.Volume > outPath.Scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
|
||||
e.Add(Event.UiCmdStop);
|
||||
@@ -100,7 +100,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
///
|
||||
if (test.DoDraining)
|
||||
{
|
||||
switch (DrainTheTank(tank))
|
||||
switch (DrainTheTank(outPath.Scale))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -450,7 +450,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(tank.MeasureVolumeOp(ref volumeBox))
|
||||
.AddOperation(tank.ReadStableVolumeOp(ref volumeBox, test.MassSpread))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -715,7 +715,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
tank != null ? tank.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
@@ -775,8 +775,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
///
|
||||
/// Test method simulation
|
||||
///
|
||||
ITankWithVolumeMsrmnt tank = outPath.Scale as ITankWithVolumeMsrmnt;
|
||||
if (tank == null)
|
||||
if ((outPath.Scale == null) || !(outPath.Scale is IVolumeMeter))
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_tank_with_volume_measurement);
|
||||
|
||||
@@ -785,6 +784,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
retListSim1.Add(Event.ConfigurationError);
|
||||
return retListSim1;
|
||||
}
|
||||
IVolumeMeter tank = outPath.Scale as IVolumeMeter;
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
@@ -792,7 +792,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
Event retVal = Event.Done;
|
||||
DoubleBox volumeBox = new DoubleBox();
|
||||
///
|
||||
IOperation msrVolOp = tank.MeasureVolumeOp(ref volumeBox);
|
||||
IOperation msrVolOp = tank.ReadStableVolumeOp(ref volumeBox, test.MassSpread);
|
||||
State.Create(string.Format("{0}({1}) : Water level measurement", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(msrVolOp)
|
||||
|
||||
@@ -56,6 +56,24 @@ namespace TBF.BenchControl.Various.ManualLevelMsrmnt
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ReadStableLevelOp(ref DoubleBox levelBox, double sdev)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
this.levelBox = levelBox;
|
||||
currentOp = CurrentOp.EnterLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ManualReadLevelOp(ref DoubleBox levelBox)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
this.levelBox = levelBox;
|
||||
currentOp = CurrentOp.EnterLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
delegate void EntryFormDlgt(ManualLevelMsrmnt myRef);
|
||||
///
|
||||
|
||||
@@ -13,7 +13,7 @@ using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
|
||||
{
|
||||
public class Tank : TBF.BenchControl.MettlerToledo.TankDraining, IDevice, ITankWithVolumeMsrmnt, IOperation
|
||||
public class Tank : TBF.BenchControl.MettlerToledo.TankDraining, IDevice, IScaleOrTank, IVolumeMeter, IOperation
|
||||
{
|
||||
/// <summary>
|
||||
/// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..."
|
||||
@@ -31,12 +31,16 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
|
||||
public enum CurrentOp
|
||||
{
|
||||
None,
|
||||
MeasureVolume,
|
||||
ReadVolume,
|
||||
ReadStableVolume,
|
||||
ManualReadVolume,
|
||||
}
|
||||
CurrentOp currentOp;
|
||||
DoubleBox volumeBox;
|
||||
double sdev;
|
||||
|
||||
TBF.BenchControl.GenericDevices.ILevelMeter levelMeter;
|
||||
TBF.BenchControl.GenericDevices.ILevelMeter manualLevelMeter;
|
||||
DoubleBox levelBox;
|
||||
IOperation readLevelOp;
|
||||
|
||||
@@ -106,8 +110,9 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
|
||||
|
||||
drainValve2 = TbfComponents.FindComponent(tankCfg.DrainValve2) as IValve;
|
||||
|
||||
manualLevelMeter = new Various.ManualLevelMsrmnt.ManualLevelMsrmnt();
|
||||
levelMeter = TbfComponents.FindComponent(tankCfg.LevelMeasurement) as ILevelMeter;
|
||||
if (levelMeter == null) levelMeter = new Various.ManualLevelMsrmnt.ManualLevelMsrmnt();
|
||||
if (levelMeter == null) levelMeter = manualLevelMeter;
|
||||
|
||||
useCalibTable = LoadCalibrationTable(tankCfg.CalibrationTable);
|
||||
}
|
||||
@@ -303,12 +308,33 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation MeasureVolumeOp(ref DoubleBox volume)
|
||||
public IOperation ReadVolumeOp(ref DoubleBox volume)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
this.volumeBox = volume;
|
||||
readLevelOp = levelMeter.ReadLevelOp(ref levelBox);
|
||||
currentOp = CurrentOp.MeasureVolume;
|
||||
currentOp = CurrentOp.ReadVolume;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ReadStableVolumeOp(ref DoubleBox volume, double sdev)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
this.volumeBox = volume;
|
||||
this.sdev = sdev;
|
||||
readLevelOp = levelMeter.ReadStableLevelOp(ref levelBox, sdev);
|
||||
currentOp = CurrentOp.ReadStableVolume;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ManualReadVolumeOp(ref DoubleBox volume)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
this.volumeBox = volume;
|
||||
readLevelOp = manualLevelMeter.ReadLevelOp(ref levelBox);
|
||||
currentOp = CurrentOp.ManualReadVolume;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -536,7 +536,6 @@
|
||||
<Compile Include="BenchControl\GenericDevices\IDatastreamReader.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\ITankDraining.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\ITankDrainingCfg.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\ITankWithVolumeMsrmnt.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\ITestMethodWith2ndPass.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\IVolumeMeter.cs" />
|
||||
<Compile Include="BenchControl\Hart\Common\Enums.cs" />
|
||||
@@ -668,6 +667,8 @@
|
||||
<Compile Include="BenchControl\Modbus\UltrasoundLevelMeter\LevelMeter.cs" />
|
||||
<Compile Include="BenchControl\Modbus\UltrasoundLevelMeter\LevelMeterCfg.cs" />
|
||||
<Compile Include="BenchControl\Modbus\UltrasoundLevelMeter\ReadLevelOp.cs" />
|
||||
<Compile Include="BenchControl\Modbus\UltrasoundLevelMeter\ReadStableLevelOp.cs" />
|
||||
<Compile Include="BenchControl\Modbus\UltrasoundLevelMeter\ReadStableVolumeOp.cs" />
|
||||
<Compile Include="BenchControl\Modbus\UltrasoundLevelMeter\ReadTempOp.cs" />
|
||||
<Compile Include="BenchControl\Modbus\UltrasoundLevelMeter\ReadVolumeOp.cs" />
|
||||
<Compile Include="BenchControl\Network\Adapter\AdapterInfo.cs" />
|
||||
|
||||
Reference in New Issue
Block a user