63 lines
1.7 KiB
C#
63 lines
1.7 KiB
C#
///
|
|
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using log4net;
|
|
|
|
namespace TBF.BenchControl.ControlBoard.Legacy
|
|
{
|
|
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 CBoard controlBoard;
|
|
readonly int flowMeterNr;
|
|
|
|
/// <summary>
|
|
/// Stop the previous control board operation (diverter, gate, etc.)
|
|
/// Events: None or PreviousStopped
|
|
/// </summary>
|
|
/// <param name="controlBoardDev">Control board component reference</param>
|
|
public StopFlowRegulationOp(CBoard controlBoardDev)
|
|
{
|
|
if (controlBoardDev == null) throw new ArgumentNullException("controlBoardDev");
|
|
this.controlBoard = controlBoardDev;
|
|
|
|
if (controlBoardDev.Devices.FlowMeter == null) throw new ArgumentNullException("Flow meter is missing");
|
|
flowMeterNr = controlBoardDev.Devices.FlowMeter.Idx1;
|
|
|
|
log.Debug(this.ToString());
|
|
}
|
|
|
|
|
|
void SendStopFlowRegulationCommand()
|
|
{
|
|
controlBoard.SyncRoute();
|
|
controlBoard.SendCommand(Command.Stop, flowMeterNr, 0, 0, 0, StopDevs.RegValveRegulation);
|
|
}
|
|
|
|
|
|
/// <summary>Start this operation</summary>
|
|
public void Start()
|
|
{
|
|
SendStopFlowRegulationCommand();
|
|
}
|
|
|
|
|
|
/// <summary>Run this operation</summary>
|
|
/// <returns>Event.FlowRegulationStopped</returns>
|
|
public Event Run()
|
|
{
|
|
return Event.FlowRegulationStopped;
|
|
}
|
|
|
|
|
|
/// <summary>Stop this operation</summary>
|
|
public void Stop()
|
|
{
|
|
}
|
|
}
|
|
}
|