59 lines
1.6 KiB
C#
59 lines
1.6 KiB
C#
///
|
|
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using log4net;
|
|
using TBF.Boxes;
|
|
|
|
namespace TBF.Rig.Modbus.WaterAnalyzer
|
|
{
|
|
public class ReadConductivityOp : IOperation
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(ReadConductivityOp));
|
|
public override string ToString() { return string.Format("ReadLevelOp(.,.)"); }
|
|
|
|
/// Set by the constructor
|
|
readonly Analyzer analyzer;
|
|
|
|
/// Measured value
|
|
FloatBox conductivity; /// [uS/cm] electrical conductivity of water
|
|
|
|
/// <summary>
|
|
/// Events: LevelDone or Error
|
|
/// </summary>
|
|
/// <param name="analyzer">Water level meter reference</param>
|
|
/// <param name="conduct">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 ReadConductivityOp(Analyzer analyzer, ref FloatBox conduct)
|
|
{
|
|
if (analyzer == null) throw new ArgumentNullException("analyzer");
|
|
this.analyzer = analyzer;
|
|
this.conductivity = conduct;
|
|
|
|
log.Debug(this.ToString());
|
|
}
|
|
|
|
|
|
/// <summary>Start this operation</summary>
|
|
public void Start()
|
|
{
|
|
conductivity.Val = analyzer.ReadConductivity();
|
|
}
|
|
|
|
/// <summary>Run this operation</summary>
|
|
/// <returns>
|
|
/// Event.ConductivityDone
|
|
/// </returns>
|
|
public Event Run()
|
|
{
|
|
conductivity.Val = analyzer.ReadConductivity();
|
|
return Event.ConductivityDone;
|
|
}
|
|
|
|
/// <summary>Stop this operation</summary>
|
|
public void Stop()
|
|
{
|
|
}
|
|
}
|
|
}
|