Refactorization : BenchControl -> Rig
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Metering Systems
|
||||
///
|
||||
using log4net;
|
||||
|
||||
namespace TBF.Rig.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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user