Uni.FlowMetersInParallel enabled, CB.Uni.OutputMessage supports parallel flow meters, etc, ver. 3.1.1794
This commit is contained in:
parent
62913cf68f
commit
a2a3d5940e
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("3.1.1792.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.1792.0")]
|
||||
[assembly: AssemblyVersion("3.1.1794.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.1794.0")]
|
||||
|
||||
@ -48,7 +48,7 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
/// Command
|
||||
message[4] = GetCommand(action);
|
||||
message[5] = action.IsStart() ? GetStartParams(action) : action.IsStop() ? GetStopParams(action) : (byte)0;
|
||||
message[6] = (arguments.DivId <= 0) ? (byte)0 : (byte)(arguments.DivId - 1);
|
||||
message[6] = (byte)(((arguments.DivId <= 0) ? 0 : (arguments.DivId - 1)) + ((arguments.FlowMId > 7) ? arguments.FlowMId : 0));
|
||||
|
||||
int totalPulsesCount = (arguments.TotalPulsesCount < 0) ? 0 : arguments.TotalPulsesCount;
|
||||
message[7] = (byte)(totalPulsesCount & 0xFF);
|
||||
@ -130,7 +130,7 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
|
||||
static byte GetStartParams(Action action)
|
||||
{
|
||||
int param = action.FlowMId & (int)StartParam.EtalonMask;
|
||||
int param = (action.FlowMId <= 7) ? action.FlowMId : 0;
|
||||
|
||||
if (action.IsDivUsed) param |= (int)StartParam.DiverterStart;
|
||||
if (action.IsSyncMethod) param |= (int)StartParam.SynchroMethod;
|
||||
|
||||
@ -52,6 +52,7 @@ namespace TBF.Rig
|
||||
Factories.Add(new Dummy.RegValve.Factory());
|
||||
Factories.Add(new Dummy.Valve.Factory());
|
||||
Factories.Add(new Uni.FlowMeter.Factory());
|
||||
Factories.Add(new Uni.FlowMetersInParallel.Factory());
|
||||
Factories.Add(new Hart.Common.Factory());
|
||||
Factories.Add(new Hart.Nivotrack.Factory());
|
||||
Factories.Add(new Keithley.Multimeter_2010_RS232.Factory()); /// Keithley.Multimeter_2010_RS232
|
||||
|
||||
@ -8,7 +8,7 @@ namespace TBF.Rig.Uni.Diverter
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "Diverter"; } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(12); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new Diverter(); }
|
||||
|
||||
@ -8,14 +8,14 @@ namespace TBF.Rig.Uni.FlowMeter
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "FlowMeter"; } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(12); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new FlowMeter(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new FlowMeter(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new FlowMeterCfg(this); }
|
||||
public IComponentCfg DefaultConfig() { return new FlowMeterCfg(this, "I"); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
|
||||
@ -271,14 +271,14 @@ namespace TBF.Rig.Uni.FlowMeter
|
||||
GNodes = new List<GNode>();
|
||||
}
|
||||
|
||||
public FlowMeterCfg(IComponentFactory factory)
|
||||
public FlowMeterCfg(IComponentFactory factory, string name)
|
||||
: this()
|
||||
{
|
||||
Shape = Shape.FlowM;
|
||||
Sz = Sz.M;
|
||||
|
||||
Factory = factory;
|
||||
Name = "I";
|
||||
Name = name;
|
||||
ParentName = "UniCB";
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
@ -8,14 +8,14 @@ namespace TBF.Rig.Uni.FlowMetersInParallel
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "FlowMetersInParallel"; } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(12); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new FlowMeter(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new FlowMeter(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new FlowMeterCfg(this); }
|
||||
public IComponentCfg DefaultConfig() { return new FlowMeterCfg(this, "I11+I12"); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
|
||||
@ -121,10 +121,27 @@ namespace TBF.Rig.Uni.FlowMetersInParallel
|
||||
nominalFlow = 0;
|
||||
flowMetersCount = 0;
|
||||
flowMetersBitfield = 0;
|
||||
if (flowMeter1 != null) { nominalFlow += flowMeter1.NominalFlow; flowMetersBitfield |= (8 << flowMeter1.Idx1); flowMetersCount++; }
|
||||
if (flowMeter2 != null) { nominalFlow += flowMeter2.NominalFlow; flowMetersBitfield |= (8 << flowMeter2.Idx1); flowMetersCount++; }
|
||||
if (flowMeter3 != null) { nominalFlow += flowMeter3.NominalFlow; flowMetersBitfield |= (8 << flowMeter3.Idx1); flowMetersCount++; }
|
||||
|
||||
if (flowMeter1 != null)
|
||||
{
|
||||
nominalFlow += flowMeter1.NominalFlow;
|
||||
flowMetersBitfield |= (4 << flowMeter1.Idx1);
|
||||
flowMetersCount++;
|
||||
}
|
||||
if (flowMeter2 != null)
|
||||
{
|
||||
nominalFlow += flowMeter2.NominalFlow;
|
||||
flowMetersBitfield |= (4 << flowMeter2.Idx1);
|
||||
flowMetersCount++;
|
||||
}
|
||||
if (flowMeter3 != null)
|
||||
{
|
||||
nominalFlow += flowMeter3.NominalFlow;
|
||||
flowMetersBitfield |= (4 << flowMeter3.Idx1);
|
||||
flowMetersCount++;
|
||||
}
|
||||
if (flowMetersCount == 0) throw new Exception("Missing flowmeters");
|
||||
|
||||
ltrPerPulse = nominalFlow / (flowMetersCount * 7200.0); /// Nominal freq. is flowMetersCount * 2000 Hz (2000, 4000 or 6000 Hz)
|
||||
|
||||
refFreq = new double[4];
|
||||
|
||||
@ -61,13 +61,13 @@ namespace TBF.Rig.Uni.FlowMetersInParallel
|
||||
GNodes = new List<GNode>();
|
||||
}
|
||||
|
||||
public FlowMeterCfg(IComponentFactory factory)
|
||||
public FlowMeterCfg(IComponentFactory factory, string name)
|
||||
: this()
|
||||
{
|
||||
Shape = Shape.FlowM;
|
||||
Sz = Sz.M;
|
||||
|
||||
Name = "I11+I12";
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = "UniCB";
|
||||
InitializeAll();
|
||||
@ -122,9 +122,9 @@ namespace TBF.Rig.Uni.FlowMetersInParallel
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return Flowmeter1;
|
||||
case 1: return Flowmeter2;
|
||||
case 2: return Flowmeter3;
|
||||
case 0: return string.IsNullOrEmpty(Flowmeter1) ? "---" : Flowmeter1;
|
||||
case 1: return string.IsNullOrEmpty(Flowmeter2) ? "---" : Flowmeter2;
|
||||
case 2: return string.IsNullOrEmpty(Flowmeter3) ? "---" : Flowmeter3;
|
||||
case 3: return MsrdFormat;
|
||||
case 4: return MsrdUnit.ToDescription();
|
||||
case 5: return MsrdValLimLo.ToString();
|
||||
@ -156,6 +156,7 @@ namespace TBF.Rig.Uni.FlowMetersInParallel
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
double ddummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
@ -165,6 +166,12 @@ namespace TBF.Rig.Uni.FlowMetersInParallel
|
||||
case 4:
|
||||
if (ParamValues(i).Contains(str)) return true;
|
||||
break;
|
||||
case 3:
|
||||
return true;
|
||||
case 5:
|
||||
case 6:
|
||||
if (TBF.Utils.TryParseUDouble(str, out ddummy)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
|
||||
@ -8,7 +8,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "RegValve"; } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(12); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new RegValve(); }
|
||||
|
||||
@ -8,7 +8,7 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "RegValveAnalog"; } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(12); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new RegValve(); }
|
||||
|
||||
@ -8,7 +8,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "RegValveTandem"; } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(12); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new RegValveTandem(); }
|
||||
|
||||
@ -143,10 +143,9 @@ namespace TBF.UI.Process
|
||||
SetpOrient = Orient.R,
|
||||
};
|
||||
|
||||
var flowmeter = new TBF.Rig.Uni.FlowMeter.FlowMeterCfg(new TBF.Rig.Uni.FlowMeter.Factory())
|
||||
var flowmeter = new TBF.Rig.Uni.FlowMeter.FlowMeterCfg(new TBF.Rig.Uni.FlowMeter.Factory(), "I")
|
||||
{
|
||||
Id = 5,
|
||||
Name = "I",
|
||||
MsrdFormat = "{0:F3} m2/h",
|
||||
MsrdUnit = Common.Unit.m3ph,
|
||||
Shape = Shape.FlowM,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user