diff --git a/TBF/Rig/Dummy/TempControl/Component.cs b/TBF/Rig/Dummy/TempControl/Component.cs new file mode 100644 index 000000000..133c6b4ef --- /dev/null +++ b/TBF/Rig/Dummy/TempControl/Component.cs @@ -0,0 +1,37 @@ +/// +/// Copyright (c) 2022 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using log4net; +using Config.Entities; +using TBF.Rig.GenericDevices; +using TBF.Boxes; + +namespace TBF.Rig.Dummy.TempControl +{ + public class Component : ComponentBase, ITempControl + { + private static readonly ILog log = LogManager.GetLogger(typeof(Component)); + public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); } + + public bool MsrmntAvailable { get { return true; } } + public double MeasuredVal { get { return ReadTemperature(); } } + public double MsrdValLimLo { get { return 5.0; } } + public double MsrdValLimHi { get { return 95.0; } } + public string MsrdFormat { get { return "{0:F1} C"; } } + public Common.Unit MsrdUnit { get { return Common.Unit.C; } } + public string AltString { get { return string.Empty; } } + + public Component() { } + public Component(Generic.IComponentCfg cfg) : base(cfg) { log.FatalFormat("{0} initialized: {1}", Name, this); } + public override void Initialize() { } + + public double ReadTemperature() { return 25.0; } + public bool SetTemperatureSetpoint(double reqTempC) { return true; } + + public IOperation ReadTempOp(ref DoubleBox temp) { return null; } + public IOperation ReadTempOp(ref DoubleBox temp, Event tempDone) { return null; } + public IOperation SetTemperatureSetpointOp(double temperature) { return null; } + } +} diff --git a/TBF/Rig/Dummy/TempControl/Factory.cs b/TBF/Rig/Dummy/TempControl/Factory.cs new file mode 100644 index 000000000..ab58bb9db --- /dev/null +++ b/TBF/Rig/Dummy/TempControl/Factory.cs @@ -0,0 +1,26 @@ +/// +/// Copyright (c) 2022 Sensus Slovensko a.s. +/// +using System.Collections.Generic; +using TBF.Rig.Generic; +using TBF.Rig.Configs.NameOnly; + +namespace TBF.Rig.Dummy.TempControl +{ + public class Factory : IComponentFactory + { + public string ClassName { get { return GetType().Namespace.Substring(8); } } + public override string ToString() { return ClassName; } + + public IComponent DummyComponent() { return new Component(); } + + public IComponent GetComponent(IComponentCfg cfg, IList components) { return new Component(cfg); } + + public IComponentCfg DefaultConfig() { return new TestMethodCfg(GetType().Namespace.Substring(14), this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this); + } + } +} diff --git a/TBF/Rig/TbfComponents.cs b/TBF/Rig/TbfComponents.cs index 620e8418e..39b3a0552 100644 --- a/TBF/Rig/TbfComponents.cs +++ b/TBF/Rig/TbfComponents.cs @@ -50,7 +50,8 @@ namespace TBF.Rig Factories.Add(new Dummy.Diverter.Factory()); Factories.Add(new Dummy.FlowMeter.Factory()); Factories.Add(new Dummy.RegulValve.Factory()); - Factories.Add(new Dummy.Valve.Factory()); + Factories.Add(new Dummy.TempControl.Factory()); + Factories.Add(new Dummy.Valve.Factory()); Factories.Add(new Elde.Diverter.DiverterFactory()); Factories.Add(new Elde.FlowMeter.FlowMeterFactory()); Factories.Add(new Elde.FlowMeterDewa.Factory()); diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index b68f87bfa..ed8049141 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -601,6 +601,8 @@ + +