183 lines
5.8 KiB
C#
183 lines
5.8 KiB
C#
///
|
|
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using log4net;
|
|
using Config.Entities;
|
|
using Dirichlet.Numerics;
|
|
using TBF.BenchControl.Generic;
|
|
using TBF.BenchControl.GenericDevices;
|
|
|
|
namespace TBF.BenchControl.ControlBoard.New
|
|
{
|
|
public class CBoard : ComponentBase, IControlBoard
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(CBoard));
|
|
public override string ToString() { return string.Format("CBoard({0})", Cfg.ToString(1)); }
|
|
|
|
readonly CBoardCfg cBoardCfg;
|
|
|
|
public OutputPath Devices
|
|
{
|
|
set { devices = value; }
|
|
get { return devices; }
|
|
}
|
|
OutputPath devices;
|
|
|
|
public CBoard()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Constructor
|
|
/// </summary>
|
|
public CBoard(Generic.IComponentCfg cfg)
|
|
: base(cfg)
|
|
{
|
|
cBoardCfg = cfg as CBoardCfg;
|
|
|
|
}
|
|
|
|
public void InitializeComponent(object thirdPartyComponent, UInt128 valvesToInvert, double[] tankCapacities)
|
|
{
|
|
this.valvesToInvert = valvesToInvert;
|
|
this.benchModelRoute = valvesToInvert;
|
|
}
|
|
|
|
|
|
public void Initialize() { }
|
|
public void RunDeviceBefore() { }
|
|
public void RunDeviceAfter() { }
|
|
public void StopDevice() { }
|
|
public void StopDevice2() { }
|
|
|
|
|
|
///
|
|
/// IControlBoard interface
|
|
///
|
|
|
|
/// <summary>
|
|
/// Route: 128-bit word representing the current state of all valves and pumps
|
|
/// </summary>
|
|
public UInt128 Route { get { return benchModelRoute; } }
|
|
UInt128 benchModelRoute;
|
|
UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
|
|
readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
|
|
|
|
public UInt64 DigitalInputs { get { return 0; } }
|
|
|
|
public double RefFrequency { get { return 0; } }
|
|
public double RefFlow { get { return 0; } }
|
|
|
|
///
|
|
/// Last test result
|
|
///
|
|
public int RefPulses { get { return 0; } }
|
|
public double TestTime { get { return 1.0; } }
|
|
public int RefPulsesWM(int wmNr1) { return (wmNr1 > 0 && wmNr1 <= Config.Data.WMsCount) ? 0 : 0; }
|
|
public int PulsesWM(int wmNr1) { return (wmNr1 > 0 && wmNr1 <= Config.Data.WMsCount) ? 0 : 0; }
|
|
public double TestTimeWM(int wmNr1) { return (wmNr1 > 0 && wmNr1 <= Config.Data.WMsCount) ? 1.0 : 1.0; }
|
|
|
|
|
|
public void UpdateUI(string sParam, int iParam, double value) { }
|
|
public void ClearProcessValues() { }
|
|
|
|
public UInt128 SetValves(UInt128 valvesToOpen, UInt128 valvesToClose, IList<BuiltIn.ValveEx.Valve> extendedValves)
|
|
{
|
|
return routeMask;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Open one valve and/or close one valve.
|
|
/// Events: ValvesSet
|
|
/// </summary>
|
|
/// <param name="valveOpen">Valve to be opened</param>
|
|
/// <param name="valveClose">Valve to be closed</param>
|
|
/// <returns>Created operation</returns>
|
|
public IOperation SetValvesOp(IValve valveOpen, IValve valveClose)
|
|
{
|
|
return new BuiltIn.SetValvesOp(this, valveOpen, valveClose);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Open and/or close multiple valves.
|
|
/// Events: ValvesSet
|
|
/// </summary>
|
|
/// <param name="valvesOpen">A list of valves to be opened</param>
|
|
/// <param name="valvesClose">A list of valves to be closed</param>
|
|
/// <returns>Created operation</returns>
|
|
public IOperation SetValvesOp(IList<IValve> valvesOpen, IList<IValve> valvesClose)
|
|
{
|
|
return new BuiltIn.SetValvesOp(this, valvesOpen, valvesClose);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Open start/stop valve.
|
|
/// Events: ValvesSet, ValvesBusy, Error
|
|
/// </summary>
|
|
/// <returns>Created operation</returns>
|
|
public IOperation OpenStartValveOp()
|
|
{
|
|
return new BuiltIn.SetValvesOp(this, true, devices);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Close start/stop valve.
|
|
/// Events: ValvesSet, ValvesBusy, Error
|
|
/// </summary>
|
|
/// <returns>Created operation</returns>
|
|
public IOperation CloseStartValveOp()
|
|
{
|
|
return new BuiltIn.SetValvesOp(this, false, devices);
|
|
}
|
|
|
|
public float ValveOpenCloseTime { get { return 0.1f; } }
|
|
|
|
|
|
public IOperation SetFlowOp(double reqrdFlowLo, double reqrdFlowHi, TBF.Boxes.DoubleBox measuredFlow, int timeout)
|
|
{
|
|
return null; /// TODO
|
|
}
|
|
|
|
public IOperation StopFlowRegulationOp()
|
|
{
|
|
return null; /// TODO
|
|
}
|
|
|
|
/// <summary>
|
|
/// Start a test, Events: MeasurementStarted
|
|
/// </summary>
|
|
/// <param name="iParam">Int32 parameter 1</param>
|
|
/// <param name="dParam1">Double parameter 1 (alternative lower flow limit)</param>
|
|
/// <param name="dParam2">Double parameter 2 (alternative upper flow limit)</param>
|
|
/// <returns>Operation</returns>
|
|
public IOperation StartTestOp(Test test, int iParam = 0, double dParam1 = 0, double dParam2 = 0)
|
|
{
|
|
return null; /// TODO
|
|
}
|
|
|
|
public IOperation QueryMeasurementEndOp()
|
|
{
|
|
return null; /// TODO
|
|
}
|
|
|
|
public IOperation StopMeasurementOp()
|
|
{
|
|
return null; /// TODO
|
|
}
|
|
|
|
public IOperation ReadDiverterTransitionOp(bool isStart, Sequences.Statistics plotter, int batchNr, string testName, int repetition)
|
|
{
|
|
return null; /// TODO
|
|
}
|
|
|
|
public IOperation StopPreviousOp()
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|