Refactorization : BenchControl -> Rig
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Uni.Diverter
|
||||
{
|
||||
public class DiverterCfg : ComponentCfgBase, IChildComponentCfg, GenericDevices.ICalibInfoCfg, IRouteBasedDrawingItem
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(DiverterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Component> cmpntEntities)
|
||||
{
|
||||
return new DiverterCfgCtrl();
|
||||
}
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int DivNr1 { get; set; } /// 1..5
|
||||
public int BitNr { get; set; } /// 0..127
|
||||
public bool Inverted { get; set; } /// When true the diverter function is inverted: 0 = to the tank, 1 = off
|
||||
public int AdcNr; /// 0..15(?), number of the analog input
|
||||
public int AdcValueToSink; /// 0..1023
|
||||
public int AdcValueToTank; /// 0..1023
|
||||
public int StartingLevel; /// 0..100 in %, threshold for the ADC value to start the test
|
||||
public int ThresholdLo; /// 0..100 in %, threshold for low level when diverter transition time is measured
|
||||
public int ThresholdHi; /// 0..100 in %, threshold for high level when diverter transition time is measured
|
||||
public int DfltSwithTimeStartMs; /// Default diverter transition time 'start' or 'to tank' in ms
|
||||
public int DfltSwithTimeEndMs; /// Default diverter transition time 'end' or 'to sink' in ms
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
public string CalibCertificateNr { get; set; }
|
||||
public DateTime CalibDate { get; set; }
|
||||
public DateTime CalibValidDate { get; set; }
|
||||
|
||||
/// Schematic drawing info
|
||||
public Shape Shape { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public Sz Sz { get; set; }
|
||||
public Orient Orient { get; set; }
|
||||
public bool Flip { get; set; }
|
||||
public int LblX { get; set; }
|
||||
public int LblY { get; set; }
|
||||
public Orient LblOrient { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
[XmlIgnore]
|
||||
public IList<GEdge> EdgesToSet { get; set; }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
DiverterCfg()
|
||||
{
|
||||
GNodes = new List<GNode>();
|
||||
EdgesToSet = new List<GEdge>();
|
||||
}
|
||||
|
||||
public DiverterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Shape = Shape.Div;
|
||||
Sz = Sz.M;
|
||||
|
||||
Factory = factory;
|
||||
Name = "Div";
|
||||
ParentName = "UniCB";
|
||||
DivNr1 = 1;
|
||||
BitNr = 0;
|
||||
AdcNr = 5; /// Div1: AdcNr=5 , Div2: AdcNr=6
|
||||
AdcValueToSink = 100;
|
||||
AdcValueToTank = 500;
|
||||
StartingLevel = 50;
|
||||
ThresholdLo = 10;
|
||||
ThresholdHi = 90;
|
||||
DfltSwithTimeStartMs = 1;
|
||||
DfltSwithTimeEndMs = 1;
|
||||
CalibCertificateNr = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, Nr={2}, Bit={3}, ADC#={4}, ADC2Sink={5}, ADC2Tank={6}, Gate={7}%, Lo={8}%, Lo={9}%",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
DivNr1,
|
||||
BitNr,
|
||||
AdcNr,
|
||||
AdcValueToSink,
|
||||
AdcValueToTank,
|
||||
StartingLevel,
|
||||
ThresholdLo,
|
||||
ThresholdHi);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user