2014-07-28 07:54:35 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using log4net;
|
2014-07-31 15:04:09 +00:00
|
|
|
|
using TBF.Boxes;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
namespace TBF.BenchControl.Elde.FlowMeter
|
|
|
|
|
|
{
|
|
|
|
|
|
public class FlowMeter : Generic.IComponent, GenericDevices.IFlowMeter
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Info: StartMassMeasurement() and "Balance response = .., Mass = ..."
|
|
|
|
|
|
/// Warn: Start measurement when busy is true
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
|
{
|
2014-09-10 10:05:49 +00:00
|
|
|
|
return string.Format("FlowMeter({0},{1})", Name, Idx1);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void ResetStaticProperties() { }
|
|
|
|
|
|
|
|
|
|
|
|
FlowMeterCfg flowMeterCfg;
|
|
|
|
|
|
public Generic.IComponentCfg Cfg { get { return flowMeterCfg; } }
|
|
|
|
|
|
|
|
|
|
|
|
public string Name { get { return flowMeterCfg.Name; } }
|
2014-09-10 10:05:49 +00:00
|
|
|
|
public int Idx1 { get { return flowMeterCfg.Idx1; } }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
public IList<Entities.MeasurementCorrection> Corrections { get { return flowMeterCfg.Corrections; } }
|
|
|
|
|
|
|
|
|
|
|
|
public readonly ControlBoardDev ControlBoard;
|
|
|
|
|
|
|
|
|
|
|
|
readonly float nominalFlow;
|
|
|
|
|
|
public float NominalFlow { get { return nominalFlow; } }
|
|
|
|
|
|
|
|
|
|
|
|
public FlowMeter(FlowMeterCfg cfg, IList<Generic.IComponent> components)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (cfg == null) throw new ArgumentNullException("cfg");
|
|
|
|
|
|
this.flowMeterCfg = cfg;
|
|
|
|
|
|
|
|
|
|
|
|
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
|
|
|
|
|
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
|
|
|
|
|
|
|
|
|
|
|
nominalFlow = cfg.NominalFlow;
|
2014-09-10 10:05:49 +00:00
|
|
|
|
ControlBoard.EtCalib[Idx1] = NominalFlow;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
/// Prepare data for SendCalibData() control board component method
|
|
|
|
|
|
|
|
|
|
|
|
log.Debug(this.ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Events: FlowDone, Error
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="flow">Reference to a variable for the flow in Bar</param>
|
|
|
|
|
|
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
|
|
|
|
|
|
public IOperation ReadFlowOp(ref FloatBox flow)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new ReadFlowOp(this, ref flow);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Events: flowDone, Error
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="flow">Reference to a variable for the flow in Bar</param>
|
|
|
|
|
|
/// <param name="flowDone">Event returned when measurement done</param>
|
|
|
|
|
|
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
|
|
|
|
|
|
public IOperation ReadFlowOp(ref FloatBox flow, Event flowDone)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new ReadFlowOp(this, ref flow, flowDone);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|