52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
///
|
|
/// 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()
|
|
{
|
|
}
|
|
}
|
|
}
|