///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using log4net;
namespace TBF.BenchControl.Elde
{
class StopFlowRegulationOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(StopFlowRegulationOp));
public override string ToString() { return string.Format("StopFlowRegulationOp(.)"); }
/// Set by the constructor
readonly ControlBoardDev controlBoard;
readonly int flowMeterNr;
///
/// Stop the previous control board operation (diverter, gate, etc.)
/// Events: None or PreviousStopped
///
/// Control board component reference
public StopFlowRegulationOp(ControlBoardDev controlBoardDev, OutputPath outputPath)
{
if (controlBoardDev == null) throw new ArgumentNullException("controlBoardDev");
this.controlBoard = controlBoardDev;
if (outputPath.FlowMeter == null) throw new ArgumentNullException("Flow meter is missing");
flowMeterNr = outputPath.FlowMeter.Idx1;
log.Debug(this.ToString());
}
void SendStopFlowRegulationCommand()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(Command.Stop, flowMeterNr, 0, 0, 0, StopDevs.RegValveRegulation);
}
/// Start this operation
public void Start()
{
SendStopFlowRegulationCommand();
}
/// Run this operation
/// Event.FlowRegulationStopped
public Event Run()
{
return Event.FlowRegulationStopped;
}
/// Stop this operation
public void Stop()
{
}
}
}