Dummy.Balance component added

This commit is contained in:
Milan Hanajik 2016-12-09 11:24:18 +01:00
parent 6f599d55c5
commit 6df36659ab
6 changed files with 106 additions and 3 deletions

View File

@ -0,0 +1,73 @@
///
/// Copyright (c) 2016 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
namespace TBF.BenchControl.Dummy.Balance
{
public class Component : ComponentBase, GenericDevices.IBalance, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString()
{
return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
}
public Component()
{
}
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
log.Debug(this.ToString());
}
public int BalanceNr { get { return 0; } }
public double Capacity { get { return 10000.0; } }
public bool IsEmpty(double mass) { return true; }
public bool IsEmpty() { return true; }
public string Format { get { return "F3"; } }
public int EmptyTimeSec { get { return 5; } }
public float BuoyancyTemp { get { return 20.0f; } }
public float BuoyancyPress { get { return 1.013f; } }
public float BuoyancyHumi { get { return 50.0f; } }
public IOperation TaringOp(ref TBF.Boxes.DoubleBox tara)
{
tara.Val = 0;
return this;
}
public IOperation ReadMassOp(ref TBF.Boxes.DoubleBox mass)
{
mass.Val = 0;
return this;
}
public IOperation ReadStableMassOp(ref TBF.Boxes.DoubleBox mass, int readingsCount, double maxSpread, bool method)
{
mass.Val = 0;
return this;
}
/// <summary>Start this operation</summary>
public void Start()
{
}
/// <summary>Run this operation</summary>
public Event Run()
{
return Event.BalanceDone;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
}
}
}

View File

@ -0,0 +1,27 @@
///
/// Copyright (c) 2016 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs.NameOnly;
namespace TBF.BenchControl.Dummy.Balance
{
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { }
public IComponent DummyComponent() { return new Component(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(23), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
}
}
}

View File

@ -10,7 +10,7 @@ namespace TBF.BenchControl.GenericDevices
/// <summary>
/// Basic balance functions
/// </summary>
public interface IBalance : IDevice, IComponent
public interface IBalance : IComponent
{
/// <summary>
/// Balance number: 0-based index required for communication with the Elde component

View File

@ -30,7 +30,8 @@ namespace TBF.BenchControl
Factories.Add(new DataEntry.Standard12.EntryFormFactory());
Factories.Add(new DataEntry.Standard24.EntryFormFactory());
Factories.Add(new DataEntry.Standard48.EntryFormFactory());
Factories.Add(new Elde.Diverter.DiverterFactory());
Factories.Add(new Dummy.Balance.Factory());
Factories.Add(new Elde.Diverter.DiverterFactory());
Factories.Add(new Elde.FixedStartRegisterReader.RegisterReaderFactory());
Factories.Add(new Elde.FlowMeter.FlowMeterFactory());
Factories.Add(new Elde.FlowMeterTwins.FlowMeterFactory());

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2016 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;

View File

@ -366,6 +366,8 @@
<DependentUpon>DatabaseCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\DB\SensusOracle\DatabaseFactory.cs" />
<Compile Include="BenchControl\Dummy\Balance\Component.cs" />
<Compile Include="BenchControl\Dummy\Balance\Factory.cs" />
<Compile Include="BenchControl\Elde\Diverter\Handlers.cs" />
<Compile Include="BenchControl\Elde\PressureMeterInternal\PressureMeter.cs" />
<Compile Include="BenchControl\Elde\PressureMeterInternal\PressureMeterCfg.cs" />