251 lines
8.4 KiB
C#
251 lines
8.4 KiB
C#
///
|
|
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Xml.Serialization;
|
|
using TBF.BenchControl.Generic;
|
|
|
|
namespace TBF.BenchControl.Elde.FlowMeterDewa
|
|
{
|
|
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibRangesCfg, IChildComponentCfg
|
|
{
|
|
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
|
|
public override XmlSerializer GetSerializer() { return Serializer; }
|
|
|
|
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new FlowMeterCfgCtrl(); }
|
|
|
|
///
|
|
/// Serialized parameters
|
|
///
|
|
public string Flowmeter1; /// Flowmeter component name or string.Empty
|
|
public string Flowmeter2; /// - ' ' -
|
|
public string Flowmeter3; /// - ' ' -
|
|
|
|
public double Temp1Lo; /// 4x zero means the range is disabled
|
|
public double Temp1Hi;
|
|
public double Press1Lo;
|
|
public double Press1Hi;
|
|
|
|
public double Temp2Lo; /// 4x zero means the range is disabled
|
|
public double Temp2Hi;
|
|
public double Press2Lo;
|
|
public double Press2Hi;
|
|
|
|
public double Temp3Lo; /// 4x zero means the range is disabled
|
|
public double Temp3Hi;
|
|
public double Press3Lo;
|
|
public double Press3Hi;
|
|
|
|
public double Temp4Lo; /// 4x zero means the range is disabled
|
|
public double Temp4Hi;
|
|
public double Press4Lo;
|
|
public double Press4Hi;
|
|
|
|
public double Temp5Lo; /// 4x zero means the range is disabled
|
|
public double Temp5Hi;
|
|
public double Press5Lo;
|
|
public double Press5Hi;
|
|
|
|
/// Calibration info serialized parameters displayed in Metrology tab page
|
|
public string CalibCertificateNr;
|
|
public string CalibCertificate1;
|
|
public string CalibCertificate2;
|
|
public string CalibCertificate3;
|
|
public string CalibCertificate4;
|
|
public string CalibCertificate5;
|
|
public DateTime CalibDate;
|
|
public DateTime CalibDate1;
|
|
public DateTime CalibDate2;
|
|
public DateTime CalibDate3;
|
|
public DateTime CalibDate4;
|
|
public DateTime CalibDate5;
|
|
public DateTime CalibValidDate;
|
|
public DateTime CalibValidDate1;
|
|
public DateTime CalibValidDate2;
|
|
public DateTime CalibValidDate3;
|
|
public DateTime CalibValidDate4;
|
|
public DateTime CalibValidDate5;
|
|
|
|
|
|
public bool RangeEnabled(int rangeIx1)
|
|
{
|
|
switch (rangeIx1)
|
|
{
|
|
default:
|
|
case 0: return !(RangeEnabled(1) || RangeEnabled(2) || RangeEnabled(3) || RangeEnabled(4) || RangeEnabled(5));
|
|
case 1: return (Temp1Lo != 0) || (Temp1Hi != 0) || (Press1Lo != 0) || (Press1Hi != 0);
|
|
case 2: return (Temp2Lo != 0) || (Temp2Hi != 0) || (Press2Lo != 0) || (Press2Hi != 0);
|
|
case 3: return (Temp3Lo != 0) || (Temp3Hi != 0) || (Press3Lo != 0) || (Press3Hi != 0);
|
|
case 4: return (Temp4Lo != 0) || (Temp4Hi != 0) || (Press4Lo != 0) || (Press4Hi != 0);
|
|
case 5: return (Temp5Lo != 0) || (Temp5Hi != 0) || (Press5Lo != 0) || (Press5Hi != 0);
|
|
}
|
|
}
|
|
|
|
public double GetTempLo(int rangeIx1)
|
|
{
|
|
switch (rangeIx1)
|
|
{
|
|
default:
|
|
case 0: return 5.0; /// °C
|
|
case 1: return Temp1Lo;
|
|
case 2: return Temp2Lo;
|
|
case 3: return Temp3Lo;
|
|
case 4: return Temp4Lo;
|
|
case 5: return Temp5Lo;
|
|
}
|
|
}
|
|
|
|
public double GetTempHi(int rangeIx1)
|
|
{
|
|
switch (rangeIx1)
|
|
{
|
|
default:
|
|
case 0: return 95.0; /// °C
|
|
case 1: return Temp1Hi;
|
|
case 2: return Temp2Hi;
|
|
case 3: return Temp3Hi;
|
|
case 4: return Temp4Hi;
|
|
case 5: return Temp5Hi;
|
|
}
|
|
}
|
|
|
|
public double GetPressLo(int rangeIx1)
|
|
{
|
|
switch (rangeIx1)
|
|
{
|
|
default:
|
|
case 0: return 0; /// bar
|
|
case 1: return Press1Lo;
|
|
case 2: return Press2Lo;
|
|
case 3: return Press3Lo;
|
|
case 4: return Press4Lo;
|
|
case 5: return Press5Lo;
|
|
}
|
|
}
|
|
|
|
public double GetPressHi(int rangeIx1)
|
|
{
|
|
switch (rangeIx1)
|
|
{
|
|
default:
|
|
case 0: return 16.0; /// bar
|
|
case 1: return Press1Hi;
|
|
case 2: return Press2Hi;
|
|
case 3: return Press3Hi;
|
|
case 4: return Press4Hi;
|
|
case 5: return Press5Hi;
|
|
}
|
|
}
|
|
|
|
public string GetCalibCertificate(int rangeIx1)
|
|
{
|
|
switch (rangeIx1)
|
|
{
|
|
default:
|
|
case 0: return CalibCertificateNr;
|
|
case 1: return CalibCertificate1;
|
|
case 2: return CalibCertificate2;
|
|
case 3: return CalibCertificate3;
|
|
case 4: return CalibCertificate4;
|
|
case 5: return CalibCertificate5;
|
|
}
|
|
}
|
|
|
|
public void SetCalibCertificate(int rangeIx1, string certificate)
|
|
{
|
|
switch (rangeIx1)
|
|
{
|
|
default:
|
|
case 0: CalibCertificateNr = certificate; return;
|
|
case 1: CalibCertificate1 = certificate; return;
|
|
case 2: CalibCertificate2 = certificate; return;
|
|
case 3: CalibCertificate3 = certificate; return;
|
|
case 4: CalibCertificate4 = certificate; return;
|
|
case 5: CalibCertificate5 = certificate; return;
|
|
}
|
|
}
|
|
|
|
public DateTime GetCalibDate(int rangeIx1)
|
|
{
|
|
switch (rangeIx1)
|
|
{
|
|
default:
|
|
case 0: return CalibDate;
|
|
case 1: return CalibDate1;
|
|
case 2: return CalibDate2;
|
|
case 3: return CalibDate3;
|
|
case 4: return CalibDate4;
|
|
case 5: return CalibDate5;
|
|
}
|
|
}
|
|
|
|
public void SetCalibDate(int rangeIx1, DateTime calibDate)
|
|
{
|
|
switch (rangeIx1)
|
|
{
|
|
default:
|
|
case 0: CalibDate = calibDate; return;
|
|
case 1: CalibDate1 = calibDate; return;
|
|
case 2: CalibDate2 = calibDate; return;
|
|
case 3: CalibDate3 = calibDate; return;
|
|
case 4: CalibDate4 = calibDate; return;
|
|
case 5: CalibDate5 = calibDate; return;
|
|
}
|
|
}
|
|
|
|
public DateTime GetCalibValidDate(int rangeIx1)
|
|
{
|
|
switch (rangeIx1)
|
|
{
|
|
default:
|
|
case 0: return CalibValidDate;
|
|
case 1: return CalibValidDate1;
|
|
case 2: return CalibValidDate2;
|
|
case 3: return CalibValidDate3;
|
|
case 4: return CalibValidDate4;
|
|
case 5: return CalibValidDate5;
|
|
}
|
|
}
|
|
|
|
public void SetCalibValidDate(int rangeIx1, DateTime calibValidDate)
|
|
{
|
|
switch (rangeIx1)
|
|
{
|
|
default:
|
|
case 0: CalibValidDate = calibValidDate; return;
|
|
case 1: CalibValidDate1 = calibValidDate; return;
|
|
case 2: CalibValidDate2 = calibValidDate; return;
|
|
case 3: CalibValidDate3 = calibValidDate; return;
|
|
case 4: CalibValidDate4 = calibValidDate; return;
|
|
case 5: CalibValidDate5 = calibValidDate; return;
|
|
}
|
|
}
|
|
|
|
|
|
/// Private parameterless constructor invoked by all other (public) constructors
|
|
FlowMeterCfg()
|
|
{
|
|
Name = "FlowMeterDewa";
|
|
ParentName = "CB";
|
|
}
|
|
|
|
public FlowMeterCfg(IComponentFactory factory)
|
|
: this()
|
|
{
|
|
this.Factory = factory;
|
|
}
|
|
|
|
public string ToString(int i)
|
|
{
|
|
return string.Format("Name={0}, Parent={1}, {2} {3} {4}",
|
|
Name,
|
|
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
|
Flowmeter1,
|
|
Flowmeter2,
|
|
Flowmeter3);
|
|
}
|
|
}
|
|
}
|