tbf/TestBenchFramework/BenchControl/Elde/ValveEx/ValveCfg.cs

68 lines
1.9 KiB
C#
Raw Normal View History

2015-06-29 09:26:08 +00:00
///
/// Copyright (c) 2015 Sensus Metering Systems
///
using System.IO;
using System.Collections.Generic;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.ValveEx
{
2015-07-01 14:31:32 +00:00
public class ValveCfg : ComponentCfgBase, IComponentCfg
2015-06-29 09:26:08 +00:00
{
public IComponent GetComponent(IList<IComponent> components) { return new Valve(this, components); }
public IComponentCfgCtrl GetControl() { return new ValveCfgCtrl(); }
///
/// Serialized parameters
///
public int BitPosition; /// Bit-position
///
public ValveExOperation LogicalOp; /// Logical operation between input valves
public bool InvertOutput; /// Invert the output of logical operation
public int InputValvesCount;
public string Input1; /// Input valve 1
public string Input2; /// Input valve 2
public string Input3; /// Input valve 3
public string Input4; /// Input valve 4
public string Input5; /// Input valve 5
/// Private parameterless constructor invoked by all other (public) constructors
ValveCfg()
{
Name = "VEx";
ParentName = string.Empty;
BitPosition = 0;
LogicalOp = ValveExOperation.And;
InvertOutput = false;
InputValvesCount = 2;
Input1 = string.Empty;
Input2 = string.Empty;
Input3 = string.Empty;
Input4 = string.Empty;
Input5 = string.Empty;
}
public ValveCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}, Bit={1}, LogOp.={2}, Inv.Output={3}, #inputs={4}, I1={5}, I2={6}, I3={7}, I4={8}s, I5={9}",
Name,
BitPosition,
(LogicalOp == ValveExOperation.And) ? "AND" : "OR",
InvertOutput ? "yes" : "no",
InputValvesCount,
Input1,
Input2,
Input3,
Input4,
Input5);
}
}
}