1 ITempControl moved to GenericDevices, 2 Dummy.TempControl component, 3 TempControl.Easytherm changed to fit ITempControl.

This commit is contained in:
Milan Hanajik
2022-05-13 09:33:03 +02:00
parent 451faf1586
commit 2bae912fa0
10 changed files with 105 additions and 32 deletions
+37
View File
@@ -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 SetRequiredTemperatureOp() { return null; }
}
}
+26
View File
@@ -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<IComponent> 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);
}
}
}