Enthalpy calculation (1st ver.), heat meters path modifications (incl. UI)
This commit is contained in:
parent
a7571a6bb7
commit
fa2896d755
@ -10,8 +10,56 @@ namespace Config.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string TempWarm { get; set; }
|
||||
public virtual string TempCold { get; set; }
|
||||
|
||||
public virtual string TempWarmRef { get; set; }
|
||||
public virtual string TempColdRef { get; set; }
|
||||
|
||||
public virtual string TempBath1 { get; set; }
|
||||
public virtual string TempBath2 { get; set; }
|
||||
public virtual string TempBath3 { get; set; }
|
||||
public virtual string TempBath4 { get; set; }
|
||||
|
||||
public virtual string TempWarm1 { get; set; }
|
||||
public virtual string TempWarm2 { get; set; }
|
||||
public virtual string TempWarm3 { get; set; }
|
||||
public virtual string TempWarm4 { get; set; }
|
||||
public virtual string TempWarm5 { get; set; }
|
||||
public virtual string TempWarm6 { get; set; }
|
||||
public virtual string TempWarm7 { get; set; }
|
||||
public virtual string TempWarm8 { get; set; }
|
||||
public virtual string TempWarm9 { get; set; }
|
||||
public virtual string TempWarm10 { get; set; }
|
||||
public virtual string TempWarm11 { get; set; }
|
||||
public virtual string TempWarm12 { get; set; }
|
||||
public virtual string TempWarm13 { get; set; }
|
||||
public virtual string TempWarm14 { get; set; }
|
||||
public virtual string TempWarm15 { get; set; }
|
||||
public virtual string TempWarm16 { get; set; }
|
||||
public virtual string TempWarm17 { get; set; }
|
||||
public virtual string TempWarm18 { get; set; }
|
||||
public virtual string TempWarm19 { get; set; }
|
||||
public virtual string TempWarm20 { get; set; }
|
||||
|
||||
public virtual string TempCold1 { get; set; }
|
||||
public virtual string TempCold2 { get; set; }
|
||||
public virtual string TempCold3 { get; set; }
|
||||
public virtual string TempCold4 { get; set; }
|
||||
public virtual string TempCold5 { get; set; }
|
||||
public virtual string TempCold6 { get; set; }
|
||||
public virtual string TempCold7 { get; set; }
|
||||
public virtual string TempCold8 { get; set; }
|
||||
public virtual string TempCold9 { get; set; }
|
||||
public virtual string TempCold10 { get; set; }
|
||||
public virtual string TempCold11 { get; set; }
|
||||
public virtual string TempCold12 { get; set; }
|
||||
public virtual string TempCold13 { get; set; }
|
||||
public virtual string TempCold14 { get; set; }
|
||||
public virtual string TempCold15 { get; set; }
|
||||
public virtual string TempCold16 { get; set; }
|
||||
public virtual string TempCold17 { get; set; }
|
||||
public virtual string TempCold18 { get; set; }
|
||||
public virtual string TempCold19 { get; set; }
|
||||
public virtual string TempCold20 { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
@ -30,10 +78,159 @@ namespace Config.Entities
|
||||
{
|
||||
HeatMetersPath result = new HeatMetersPath(name, itemNr);
|
||||
|
||||
result.TempWarm = TempWarm;
|
||||
result.TempCold = TempCold;
|
||||
result.TempWarmRef = TempWarmRef;
|
||||
result.TempColdRef = TempColdRef;
|
||||
|
||||
result.TempBath1 = TempBath1;
|
||||
result.TempBath2 = TempBath2;
|
||||
result.TempBath3 = TempBath3;
|
||||
result.TempBath4 = TempBath4;
|
||||
|
||||
result.TempWarm1 = TempWarm1;
|
||||
result.TempWarm2 = TempWarm2;
|
||||
result.TempWarm3 = TempWarm3;
|
||||
result.TempWarm4 = TempWarm4;
|
||||
result.TempWarm5 = TempWarm5;
|
||||
result.TempWarm6 = TempWarm6;
|
||||
result.TempWarm7 = TempWarm7;
|
||||
result.TempWarm8 = TempWarm8;
|
||||
result.TempWarm9 = TempWarm9;
|
||||
result.TempWarm10 = TempWarm10;
|
||||
result.TempWarm11 = TempWarm11;
|
||||
result.TempWarm12 = TempWarm12;
|
||||
result.TempWarm13 = TempWarm13;
|
||||
result.TempWarm14 = TempWarm14;
|
||||
result.TempWarm15 = TempWarm15;
|
||||
result.TempWarm16 = TempWarm16;
|
||||
result.TempWarm17 = TempWarm17;
|
||||
result.TempWarm18 = TempWarm18;
|
||||
result.TempWarm19 = TempWarm19;
|
||||
result.TempWarm20 = TempWarm20;
|
||||
|
||||
result.TempCold1 = TempCold1;
|
||||
result.TempCold2 = TempCold2;
|
||||
result.TempCold3 = TempCold3;
|
||||
result.TempCold4 = TempCold4;
|
||||
result.TempCold5 = TempCold5;
|
||||
result.TempCold6 = TempCold6;
|
||||
result.TempCold7 = TempCold7;
|
||||
result.TempCold8 = TempCold8;
|
||||
result.TempCold9 = TempCold9;
|
||||
result.TempCold10 = TempCold10;
|
||||
result.TempCold11 = TempCold11;
|
||||
result.TempCold12 = TempCold12;
|
||||
result.TempCold13 = TempCold13;
|
||||
result.TempCold14 = TempCold14;
|
||||
result.TempCold15 = TempCold15;
|
||||
result.TempCold16 = TempCold16;
|
||||
result.TempCold17 = TempCold17;
|
||||
result.TempCold18 = TempCold18;
|
||||
result.TempCold19 = TempCold19;
|
||||
result.TempCold20 = TempCold20;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Returns a temperature component name
|
||||
public virtual string GetTempWarm(int i)
|
||||
{
|
||||
if (i == 0) return TempWarm1;
|
||||
else if (i == 1) return TempWarm2;
|
||||
else if (i == 2) return TempWarm3;
|
||||
else if (i == 3) return TempWarm4;
|
||||
else if (i == 4) return TempWarm5;
|
||||
else if (i == 5) return TempWarm6;
|
||||
else if (i == 6) return TempWarm7;
|
||||
else if (i == 7) return TempWarm8;
|
||||
else if (i == 8) return TempWarm9;
|
||||
else if (i == 9) return TempWarm10;
|
||||
else if (i == 10) return TempWarm11;
|
||||
else if (i == 11) return TempWarm12;
|
||||
else if (i == 12) return TempWarm13;
|
||||
else if (i == 13) return TempWarm14;
|
||||
else if (i == 14) return TempWarm15;
|
||||
else if (i == 15) return TempWarm16;
|
||||
else if (i == 16) return TempWarm17;
|
||||
else if (i == 17) return TempWarm18;
|
||||
else if (i == 18) return TempWarm19;
|
||||
else if (i == 19) return TempWarm20;
|
||||
else return null;
|
||||
}
|
||||
|
||||
/// Returns a temperature component name
|
||||
public virtual string GetTempCold(int i)
|
||||
{
|
||||
if (i == 0) return TempCold1;
|
||||
else if (i == 1) return TempCold2;
|
||||
else if (i == 2) return TempCold3;
|
||||
else if (i == 3) return TempCold4;
|
||||
else if (i == 4) return TempCold5;
|
||||
else if (i == 5) return TempCold6;
|
||||
else if (i == 6) return TempCold7;
|
||||
else if (i == 7) return TempCold8;
|
||||
else if (i == 8) return TempCold9;
|
||||
else if (i == 9) return TempCold10;
|
||||
else if (i == 10) return TempCold11;
|
||||
else if (i == 11) return TempCold12;
|
||||
else if (i == 12) return TempCold13;
|
||||
else if (i == 13) return TempCold14;
|
||||
else if (i == 14) return TempCold15;
|
||||
else if (i == 15) return TempCold16;
|
||||
else if (i == 16) return TempCold17;
|
||||
else if (i == 17) return TempCold18;
|
||||
else if (i == 18) return TempCold19;
|
||||
else if (i == 19) return TempCold20;
|
||||
else return null;
|
||||
}
|
||||
|
||||
/// Sets a temperature component name
|
||||
public virtual void SetTempWarm(int i, string cmpntName)
|
||||
{
|
||||
if (i == 0) TempWarm1 = cmpntName;
|
||||
else if (i == 1) TempWarm2 = cmpntName;
|
||||
else if (i == 2) TempWarm3 = cmpntName;
|
||||
else if (i == 3) TempWarm4 = cmpntName;
|
||||
else if (i == 4) TempWarm5 = cmpntName;
|
||||
else if (i == 5) TempWarm6 = cmpntName;
|
||||
else if (i == 6) TempWarm7 = cmpntName;
|
||||
else if (i == 7) TempWarm8 = cmpntName;
|
||||
else if (i == 8) TempWarm9 = cmpntName;
|
||||
else if (i == 9) TempWarm10 = cmpntName;
|
||||
else if (i == 10) TempWarm11 = cmpntName;
|
||||
else if (i == 11) TempWarm12 = cmpntName;
|
||||
else if (i == 12) TempWarm13 = cmpntName;
|
||||
else if (i == 13) TempWarm14 = cmpntName;
|
||||
else if (i == 14) TempWarm15 = cmpntName;
|
||||
else if (i == 15) TempWarm16 = cmpntName;
|
||||
else if (i == 16) TempWarm17 = cmpntName;
|
||||
else if (i == 17) TempWarm18 = cmpntName;
|
||||
else if (i == 18) TempWarm19 = cmpntName;
|
||||
else if (i == 19) TempWarm20 = cmpntName;
|
||||
}
|
||||
|
||||
/// Sets a temperature component name
|
||||
public virtual void SetTempCold(int i, string cmpntName)
|
||||
{
|
||||
if (i == 0) TempCold1 = cmpntName;
|
||||
else if (i == 1) TempCold2 = cmpntName;
|
||||
else if (i == 2) TempCold3 = cmpntName;
|
||||
else if (i == 3) TempCold4 = cmpntName;
|
||||
else if (i == 4) TempCold5 = cmpntName;
|
||||
else if (i == 5) TempCold6 = cmpntName;
|
||||
else if (i == 6) TempCold7 = cmpntName;
|
||||
else if (i == 7) TempCold8 = cmpntName;
|
||||
else if (i == 8) TempCold9 = cmpntName;
|
||||
else if (i == 9) TempCold10 = cmpntName;
|
||||
else if (i == 10) TempCold11 = cmpntName;
|
||||
else if (i == 11) TempCold12 = cmpntName;
|
||||
else if (i == 12) TempCold13 = cmpntName;
|
||||
else if (i == 13) TempCold14 = cmpntName;
|
||||
else if (i == 14) TempCold15 = cmpntName;
|
||||
else if (i == 15) TempCold16 = cmpntName;
|
||||
else if (i == 16) TempCold17 = cmpntName;
|
||||
else if (i == 17) TempCold18 = cmpntName;
|
||||
else if (i == 18) TempCold19 = cmpntName;
|
||||
else if (i == 19) TempCold20 = cmpntName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,6 @@ namespace Config.Entities
|
||||
public virtual string Sensor18 { get; set; }
|
||||
public virtual string Sensor19 { get; set; }
|
||||
public virtual string Sensor20 { get; set; }
|
||||
#if IPERLST
|
||||
public virtual string Sensor21 { get; set; }
|
||||
public virtual string Sensor22 { get; set; }
|
||||
public virtual string Sensor23 { get; set; }
|
||||
@ -56,7 +55,6 @@ namespace Config.Entities
|
||||
public virtual string Sensor38 { get; set; }
|
||||
public virtual string Sensor39 { get; set; }
|
||||
public virtual string Sensor40 { get; set; }
|
||||
#endif
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
@ -96,7 +94,6 @@ namespace Config.Entities
|
||||
result.Sensor18 = Sensor18;
|
||||
result.Sensor19 = Sensor19;
|
||||
result.Sensor20 = Sensor20;
|
||||
#if IPERLST
|
||||
result.Sensor21 = Sensor21;
|
||||
result.Sensor22 = Sensor22;
|
||||
result.Sensor23 = Sensor23;
|
||||
@ -117,7 +114,7 @@ namespace Config.Entities
|
||||
result.Sensor38 = Sensor38;
|
||||
result.Sensor39 = Sensor39;
|
||||
result.Sensor40 = Sensor40;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -144,7 +141,6 @@ namespace Config.Entities
|
||||
else if (i == 17) return Sensor18;
|
||||
else if (i == 18) return Sensor19;
|
||||
else if (i == 19) return Sensor20;
|
||||
#if IPERLST
|
||||
else if (i == 20) return Sensor21;
|
||||
else if (i == 21) return Sensor22;
|
||||
else if (i == 22) return Sensor23;
|
||||
@ -165,7 +161,6 @@ namespace Config.Entities
|
||||
else if (i == 37) return Sensor38;
|
||||
else if (i == 38) return Sensor39;
|
||||
else if (i == 39) return Sensor40;
|
||||
#endif
|
||||
else return null;
|
||||
}
|
||||
|
||||
@ -192,7 +187,6 @@ namespace Config.Entities
|
||||
else if (i == 17) Sensor18 = cmpntName;
|
||||
else if (i == 18) Sensor19 = cmpntName;
|
||||
else if (i == 19) Sensor20 = cmpntName;
|
||||
#if IPERLST
|
||||
else if (i == 20) Sensor21 = cmpntName;
|
||||
else if (i == 21) Sensor22 = cmpntName;
|
||||
else if (i == 22) Sensor23 = cmpntName;
|
||||
@ -213,7 +207,6 @@ namespace Config.Entities
|
||||
else if (i == 37) Sensor38 = cmpntName;
|
||||
else if (i == 38) Sensor39 = cmpntName;
|
||||
else if (i == 39) Sensor40 = cmpntName;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,8 +14,58 @@ namespace Config.Mappings
|
||||
Id(x => x.Id);
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.TempWarm);
|
||||
Map(x => x.TempCold);
|
||||
|
||||
Map(x => x.TempWarmRef);
|
||||
Map(x => x.TempColdRef);
|
||||
|
||||
Map(x => x.TempBath1);
|
||||
Map(x => x.TempBath2);
|
||||
Map(x => x.TempBath3);
|
||||
Map(x => x.TempBath4);
|
||||
|
||||
#pragma warning disable
|
||||
Map(x => x.TempWarm1);
|
||||
if (Config.Data.WMsCount >= 2) Map(x => x.TempWarm2);
|
||||
if (Config.Data.WMsCount >= 3) Map(x => x.TempWarm3);
|
||||
if (Config.Data.WMsCount >= 4) Map(x => x.TempWarm4);
|
||||
if (Config.Data.WMsCount >= 5) Map(x => x.TempWarm5);
|
||||
if (Config.Data.WMsCount >= 6) Map(x => x.TempWarm6);
|
||||
if (Config.Data.WMsCount >= 7) Map(x => x.TempWarm7);
|
||||
if (Config.Data.WMsCount >= 8) Map(x => x.TempWarm8);
|
||||
if (Config.Data.WMsCount >= 9) Map(x => x.TempWarm9);
|
||||
if (Config.Data.WMsCount >= 10) Map(x => x.TempWarm10);
|
||||
if (Config.Data.WMsCount >= 11) Map(x => x.TempWarm11);
|
||||
if (Config.Data.WMsCount >= 12) Map(x => x.TempWarm12);
|
||||
if (Config.Data.WMsCount >= 13) Map(x => x.TempWarm13);
|
||||
if (Config.Data.WMsCount >= 14) Map(x => x.TempWarm14);
|
||||
if (Config.Data.WMsCount >= 15) Map(x => x.TempWarm15);
|
||||
if (Config.Data.WMsCount >= 16) Map(x => x.TempWarm16);
|
||||
if (Config.Data.WMsCount >= 17) Map(x => x.TempWarm17);
|
||||
if (Config.Data.WMsCount >= 18) Map(x => x.TempWarm18);
|
||||
if (Config.Data.WMsCount >= 19) Map(x => x.TempWarm19);
|
||||
if (Config.Data.WMsCount >= 20) Map(x => x.TempWarm20);
|
||||
|
||||
Map(x => x.TempCold1);
|
||||
if (Config.Data.WMsCount >= 2) Map(x => x.TempCold2);
|
||||
if (Config.Data.WMsCount >= 3) Map(x => x.TempCold3);
|
||||
if (Config.Data.WMsCount >= 4) Map(x => x.TempCold4);
|
||||
if (Config.Data.WMsCount >= 5) Map(x => x.TempCold5);
|
||||
if (Config.Data.WMsCount >= 6) Map(x => x.TempCold6);
|
||||
if (Config.Data.WMsCount >= 7) Map(x => x.TempCold7);
|
||||
if (Config.Data.WMsCount >= 8) Map(x => x.TempCold8);
|
||||
if (Config.Data.WMsCount >= 9) Map(x => x.TempCold9);
|
||||
if (Config.Data.WMsCount >= 10) Map(x => x.TempCold10);
|
||||
if (Config.Data.WMsCount >= 11) Map(x => x.TempCold11);
|
||||
if (Config.Data.WMsCount >= 12) Map(x => x.TempCold12);
|
||||
if (Config.Data.WMsCount >= 13) Map(x => x.TempCold13);
|
||||
if (Config.Data.WMsCount >= 14) Map(x => x.TempCold14);
|
||||
if (Config.Data.WMsCount >= 15) Map(x => x.TempCold15);
|
||||
if (Config.Data.WMsCount >= 16) Map(x => x.TempCold16);
|
||||
if (Config.Data.WMsCount >= 17) Map(x => x.TempCold17);
|
||||
if (Config.Data.WMsCount >= 18) Map(x => x.TempCold18);
|
||||
if (Config.Data.WMsCount >= 19) Map(x => x.TempCold19);
|
||||
if (Config.Data.WMsCount >= 20) Map(x => x.TempCold20);
|
||||
#pragma warning restore
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -36,7 +36,6 @@ namespace Config.Mappings
|
||||
if (Config.Data.WMsCount >= 18) Map(x => x.Sensor18);
|
||||
if (Config.Data.WMsCount >= 19) Map(x => x.Sensor19);
|
||||
if (Config.Data.WMsCount >= 20) Map(x => x.Sensor20);
|
||||
#if IPERLST
|
||||
if (Config.Data.WMsCount >= 21) Map(x => x.Sensor21);
|
||||
if (Config.Data.WMsCount >= 22) Map(x => x.Sensor22);
|
||||
if (Config.Data.WMsCount >= 23) Map(x => x.Sensor23);
|
||||
@ -57,7 +56,6 @@ namespace Config.Mappings
|
||||
if (Config.Data.WMsCount >= 38) Map(x => x.Sensor38);
|
||||
if (Config.Data.WMsCount >= 39) Map(x => x.Sensor39);
|
||||
if (Config.Data.WMsCount >= 40) Map(x => x.Sensor40);
|
||||
#endif
|
||||
#pragma warning restore
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,23 +10,45 @@ namespace TBF.BenchControl
|
||||
{
|
||||
public int ItemNr;
|
||||
public string Name;
|
||||
public ITempMeter TempWarm;
|
||||
public ITempMeter TempCold;
|
||||
|
||||
public ITempMeter TempMeterWarmRef;
|
||||
public ITempMeter TempMeterColdRef;
|
||||
|
||||
public ITempMeter TempMeterBath1;
|
||||
public ITempMeter TempMeterBath2;
|
||||
public ITempMeter TempMeterBath3;
|
||||
public ITempMeter TempMeterBath4;
|
||||
|
||||
public ITempMeter[] TempMetersWarm;
|
||||
public ITempMeter[] TempMetersCold;
|
||||
|
||||
/// Constructor from name, the rest is empty
|
||||
public HeatMetersPath(string name, int itemNr)
|
||||
{
|
||||
ItemNr = itemNr;
|
||||
Name = name;
|
||||
}
|
||||
TempMetersWarm = new ITempMeter[Config.Data.WMsCount];
|
||||
TempMetersCold = new ITempMeter[Config.Data.WMsCount];
|
||||
}
|
||||
|
||||
/// Constructor from data entity
|
||||
public HeatMetersPath(Config.Entities.HeatMetersPath entity, IList<BenchControl.Generic.IComponent> components)
|
||||
: this(entity.Name, entity.ItemNr)
|
||||
{
|
||||
TempWarm = TbfComponents.FindComponent(entity.TempWarm, components) as ITempMeter;
|
||||
TempCold = TbfComponents.FindComponent(entity.TempCold, components) as ITempMeter;
|
||||
}
|
||||
TempMeterWarmRef = TbfComponents.FindComponent(entity.TempWarmRef, components) as ITempMeter;
|
||||
TempMeterColdRef = TbfComponents.FindComponent(entity.TempColdRef, components) as ITempMeter;
|
||||
|
||||
TempMeterBath1 = TbfComponents.FindComponent(entity.TempBath1, components) as ITempMeter;
|
||||
TempMeterBath2 = TbfComponents.FindComponent(entity.TempBath2, components) as ITempMeter;
|
||||
TempMeterBath3 = TbfComponents.FindComponent(entity.TempBath3, components) as ITempMeter;
|
||||
TempMeterBath4 = TbfComponents.FindComponent(entity.TempBath4, components) as ITempMeter;
|
||||
|
||||
for (int i = 0; i < Config.Data.WMsCount; i++)
|
||||
{
|
||||
TempMetersWarm[i] = (ITempMeter)TbfComponents.FindComponent(entity.GetTempWarm(i), components);
|
||||
TempMetersCold[i] = (ITempMeter)TbfComponents.FindComponent(entity.GetTempCold(i), components);
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
@ -0,0 +1,93 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.Operations
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements Eoperation to calculate (accumulate) enthalpies of heat meters
|
||||
///
|
||||
/// Events: Event.None (always)
|
||||
/// </summary>
|
||||
public class EnthalpyCalculationOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(EnthalpyCalculationOp));
|
||||
public override string ToString() { return string.Format("EnthalpyCalculationOp(.,{0})", path.Name); }
|
||||
|
||||
///
|
||||
/// Private fields
|
||||
///
|
||||
HeatMetersPath path;
|
||||
double[] enthalpy;
|
||||
|
||||
int lastRefPulses;
|
||||
|
||||
|
||||
public static EnthalpyCalculationOp GetOp(double[] enthalpy, HeatMetersPath path)
|
||||
{
|
||||
try
|
||||
{
|
||||
EnthalpyCalculationOp op = new EnthalpyCalculationOp(enthalpy, path);
|
||||
return op;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Failed to create 'EnthalpyCalculationOp' operation: {0}", exc.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructors, optional argument is a timer name (you can create more then one timer)
|
||||
/// </summary>
|
||||
public EnthalpyCalculationOp(double[] enthalpy, HeatMetersPath path)
|
||||
{
|
||||
if (enthalpy == null) throw new Exception("enthalpy[] array missing");
|
||||
this.enthalpy = enthalpy;
|
||||
|
||||
if (path == null) throw new Exception("path argument in EnthalpyCalculationOp constructor");
|
||||
if (path.TempMetersWarm == null) throw new Exception("path.TempMetersWarm argument in EnthalpyCalculationOp constructor");
|
||||
if (path.TempMetersCold == null) throw new Exception("path.TempMetersCold argument in EnthalpyCalculationOp constructor");
|
||||
}
|
||||
|
||||
/// <param name="obj">Time period (TimeSpan)</param>
|
||||
public void Start()
|
||||
{
|
||||
lastRefPulses = BenchControl.Sequences.ProcessData.RefPulses;
|
||||
for (int i = 0; i < enthalpy.Length; i++) enthalpy[i] = 0;
|
||||
}
|
||||
|
||||
public Event Run()
|
||||
{
|
||||
AccumulateEnthalpy();
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
AccumulateEnthalpy();
|
||||
}
|
||||
|
||||
private void AccumulateEnthalpy()
|
||||
{
|
||||
/// Calculate # of reference pulses
|
||||
int newRefPulses = BenchControl.Sequences.ProcessData.RefPulses;
|
||||
int deltaPulses = newRefPulses - lastRefPulses;
|
||||
lastRefPulses = newRefPulses;
|
||||
|
||||
/// Calculate volume [l]
|
||||
float deltaVolume = (float)deltaPulses * BenchControl.Sequences.ProcessData.LtrPerRefPulse;
|
||||
|
||||
for (int i = 0; i < enthalpy.Length; i++)
|
||||
{
|
||||
if (path.TempMetersWarm[i] != null && path.TempMetersCold[i] != null)
|
||||
{
|
||||
enthalpy[i] += deltaVolume * (path.TempMetersWarm[i].ReadTemperature() - path.TempMetersCold[i].ReadTemperature());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -31,9 +31,9 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
public static Results.BatchResults BatchRslts;
|
||||
|
||||
|
||||
public static IRegisterReader[] RegisterReaders;
|
||||
///
|
||||
public static double[] Enthalpy; /// Heat meters support
|
||||
///
|
||||
static ProcessData()
|
||||
{
|
||||
///
|
||||
@ -41,7 +41,8 @@ namespace TBF.BenchControl.Sequences
|
||||
/// RegisterReader[i] where i = 0..Config.Data.WMsCount-1 may be null and should always be tested
|
||||
///
|
||||
RegisterReaders = new IRegisterReader[Config.Data.WMsCount];
|
||||
}
|
||||
Enthalpy = new double[Config.Data.WMsCount]; /// Heat meters support
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -49,10 +50,11 @@ namespace TBF.BenchControl.Sequences
|
||||
/// </summary>
|
||||
protected void ClearProcessValues()
|
||||
{
|
||||
for (int i = 0; i < RegisterReaders.Length; i++)
|
||||
for (int i = 0; i < Config.Data.WMsCount; i++)
|
||||
{
|
||||
if (RegisterReaders[i] != null) RegisterReaders[i].Clear();
|
||||
}
|
||||
Enthalpy[i] = 0; /// Heat meters support
|
||||
}
|
||||
|
||||
RefPulses = 0;
|
||||
RefFreq.Clear();
|
||||
|
||||
@ -307,6 +307,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbientTemp, AmbientPressure, AmbientHumidity) : null)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(Operations.EnthalpyCalculationOp.GetOp(Enthalpy, heatMetersPath))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
|
||||
|
||||
31
TestBenchFramework/Resources/Strings.Designer.cs
generated
31
TestBenchFramework/Resources/Strings.Designer.cs
generated
@ -3400,7 +3400,16 @@ namespace TBF.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to T cold.
|
||||
/// Looks up a localized string similar to T bath.
|
||||
/// </summary>
|
||||
internal static string T_bath {
|
||||
get {
|
||||
return ResourceManager.GetString("T_bath", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to T lo..
|
||||
/// </summary>
|
||||
internal static string T_cold {
|
||||
get {
|
||||
@ -3408,6 +3417,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to T lo. ref..
|
||||
/// </summary>
|
||||
internal static string T_cold_ref {
|
||||
get {
|
||||
return ResourceManager.GetString("T_cold_ref", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to T div..
|
||||
/// </summary>
|
||||
@ -3481,7 +3499,7 @@ namespace TBF.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to T warm.
|
||||
/// Looks up a localized string similar to T hi..
|
||||
/// </summary>
|
||||
internal static string T_warm {
|
||||
get {
|
||||
@ -3489,6 +3507,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to T hi. ref..
|
||||
/// </summary>
|
||||
internal static string T_warm_ref {
|
||||
get {
|
||||
return ResourceManager.GetString("T_warm_ref", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Target flow high [m3/h]:.
|
||||
/// </summary>
|
||||
|
||||
@ -1442,7 +1442,7 @@
|
||||
<value>Heat meter sensors</value>
|
||||
</data>
|
||||
<data name="T_cold" xml:space="preserve">
|
||||
<value>T cold</value>
|
||||
<value>T lo.</value>
|
||||
</data>
|
||||
<data name="T_inlet" xml:space="preserve">
|
||||
<value>T inlet</value>
|
||||
@ -1451,7 +1451,7 @@
|
||||
<value>T outlet</value>
|
||||
</data>
|
||||
<data name="T_warm" xml:space="preserve">
|
||||
<value>T warm</value>
|
||||
<value>T hi.</value>
|
||||
</data>
|
||||
<data name="New_heat_meters_path_name" xml:space="preserve">
|
||||
<value>PHeat</value>
|
||||
@ -1501,4 +1501,13 @@
|
||||
<data name="Short_description" xml:space="preserve">
|
||||
<value>Short description</value>
|
||||
</data>
|
||||
<data name="T_bath" xml:space="preserve">
|
||||
<value>T bath</value>
|
||||
</data>
|
||||
<data name="T_cold_ref" xml:space="preserve">
|
||||
<value>T lo. ref.</value>
|
||||
</data>
|
||||
<data name="T_warm_ref" xml:space="preserve">
|
||||
<value>T hi. ref.</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -413,6 +413,7 @@
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\Modbus\QuidoRS\Factory.cs" />
|
||||
<Compile Include="BenchControl\Modbus\QuidoRS\SetOutputsOp.cs" />
|
||||
<Compile Include="BenchControl\Operations\EnthalpyCalculationOp.cs" />
|
||||
<Compile Include="BenchControl\Output\FileWriters\Basic\FactoryCompound.cs" />
|
||||
<Compile Include="BenchControl\Output\FileWriters\Basic\FactorySingle.cs" />
|
||||
<Compile Include="BenchControl\Output\FileWriters\Enhanced\FactoryCompound.cs" />
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.BenchControl;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.UiControls
|
||||
@ -17,9 +21,13 @@ namespace TBF.UiControls
|
||||
enum Column
|
||||
{
|
||||
Name,
|
||||
Twarm,
|
||||
Tcold,
|
||||
FixedColumnsCount,
|
||||
TwarmRef,
|
||||
TcoldRef,
|
||||
Tbath1,
|
||||
Tbath2,
|
||||
Tbath3,
|
||||
Tbath4,
|
||||
FixedColumnsCount,
|
||||
}
|
||||
readonly int fixedColumnsCount = (int)Column.FixedColumnsCount;
|
||||
|
||||
@ -46,11 +54,33 @@ namespace TBF.UiControls
|
||||
SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
|
||||
SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
|
||||
|
||||
IList<ITempMeter> tempMeters = new List<ITempMeter>();
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (cmpnt is ITempMeter) tempMeters.Add(cmpnt as ITempMeter);
|
||||
}
|
||||
|
||||
/// ListViewEx columns
|
||||
TBF.LocalSettings ls = Program.LocalSettings;
|
||||
Columns.Add(Strings.Name, (ls.HeatMetersColumnCount > (int)Column.Name) ? ls.HeatMetersColumnWidths[(int)Column.Name] : 60 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
Columns.Add(Strings.T_warm, (ls.HeatMetersColumnCount > (int)Column.Twarm) ? ls.HeatMetersColumnWidths[(int)Column.Twarm] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
Columns.Add(Strings.T_cold, (ls.HeatMetersColumnCount > (int)Column.Tcold) ? ls.HeatMetersColumnWidths[(int)Column.Tcold] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
Columns.Add(Strings.Name, (ls.HeatMetersColumnCount > 0) ? ls.HeatMetersColumnWidths[0] : 60 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
Columns.Add(Strings.T_warm_ref, (ls.HeatMetersColumnCount > 1) ? ls.HeatMetersColumnWidths[1] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
Columns.Add(Strings.T_cold_ref, (ls.HeatMetersColumnCount > 2) ? ls.HeatMetersColumnWidths[2] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
Columns.Add(string.Format("{0} {1}", Strings.T_bath, 1), (ls.HeatMetersColumnCount > 3) ? ls.HeatMetersColumnWidths[3] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
Columns.Add(string.Format("{0} {1}", Strings.T_bath, 2), (ls.HeatMetersColumnCount > 4) ? ls.HeatMetersColumnWidths[4] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
Columns.Add(string.Format("{0} {1}", Strings.T_bath, 3), (ls.HeatMetersColumnCount > 5) ? ls.HeatMetersColumnWidths[5] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
Columns.Add(string.Format("{0} {1}", Strings.T_bath, 4), (ls.HeatMetersColumnCount > 6) ? ls.HeatMetersColumnWidths[6] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
|
||||
int clmn = (int)Column.FixedColumnsCount;
|
||||
for (int i = 0; i < Config.Data.WMsCount; i++)
|
||||
{
|
||||
Columns.Add(string.Format("{0} {1}", Strings.T_warm, i + 1), (ls.MetersColumnCount > clmn) ? ls.MetersColumnWidths[clmn] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
clmn++;
|
||||
}
|
||||
for (int i = 0; i < Config.Data.WMsCount; i++)
|
||||
{
|
||||
Columns.Add(string.Format("{0} {1}", Strings.T_cold, i + 1), (ls.MetersColumnCount > clmn) ? ls.MetersColumnWidths[clmn] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
clmn++;
|
||||
}
|
||||
|
||||
/// Temperatures, pressures
|
||||
ComboBox tWarmCBox = new ComboBox();
|
||||
@ -64,14 +94,15 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
|
||||
editors = new Control[fixedColumnsCount];
|
||||
editors = new Control[fixedColumnsCount + 2 * Config.Data.WMsCount];
|
||||
///
|
||||
editors[(int)Column.Name] = new TextBox(); /// Name
|
||||
editors[(int)Column.Twarm] = tWarmCBox;
|
||||
editors[(int)Column.Tcold] = tColdCBox;
|
||||
///
|
||||
for (int i = 0; i < editors.Length; i++)
|
||||
for (int i = 1; i < editors.Length; i++)
|
||||
{
|
||||
editors[i] = new ComboBox();
|
||||
(editors[i] as ComboBox).Items.Add("---");
|
||||
foreach (var t in tempMeters) (editors[i] as ComboBox).Items.Add(t.Name);
|
||||
editors[i].Visible = false;
|
||||
parent.Controls.Add(editors[i]);
|
||||
}
|
||||
@ -102,8 +133,23 @@ namespace TBF.UiControls
|
||||
BenchControl.HeatMetersPath path = new BenchControl.HeatMetersPath(entity, parent.TbfComponents);
|
||||
|
||||
ListViewItem lvi = new ListViewItem(entity.Name);
|
||||
lvi.SubItems.Add(path.TempWarm != null ? path.TempWarm.Cfg.Name : "---");
|
||||
lvi.SubItems.Add(path.TempCold != null ? path.TempCold.Cfg.Name : "---");
|
||||
lvi.SubItems.Add(path.TempMeterWarmRef != null ? path.TempMeterWarmRef.Cfg.Name : "---");
|
||||
lvi.SubItems.Add(path.TempMeterColdRef != null ? path.TempMeterColdRef.Cfg.Name : "---");
|
||||
|
||||
lvi.SubItems.Add(path.TempMeterBath1 != null ? path.TempMeterBath1.Cfg.Name : "---");
|
||||
lvi.SubItems.Add(path.TempMeterBath2 != null ? path.TempMeterBath2.Cfg.Name : "---");
|
||||
lvi.SubItems.Add(path.TempMeterBath3 != null ? path.TempMeterBath3.Cfg.Name : "---");
|
||||
lvi.SubItems.Add(path.TempMeterBath4 != null ? path.TempMeterBath4.Cfg.Name : "---");
|
||||
|
||||
for (int i = 0; i < Config.Data.WMsCount; i++)
|
||||
{
|
||||
lvi.SubItems.Add(path.TempMetersWarm[i] != null ? path.TempMetersWarm[i].Cfg.Name : "---");
|
||||
}
|
||||
|
||||
for (int i = 0; i < Config.Data.WMsCount; i++)
|
||||
{
|
||||
lvi.SubItems.Add(path.TempMetersCold[i] != null ? path.TempMetersCold[i].Cfg.Name : "---");
|
||||
}
|
||||
|
||||
lvi.Tag = entity;
|
||||
|
||||
@ -116,9 +162,22 @@ namespace TBF.UiControls
|
||||
|
||||
entity.Name = lvi.Text;
|
||||
|
||||
entity.TempWarm = lvi.SubItems[(int)Column.Twarm].Text;
|
||||
entity.TempCold = lvi.SubItems[(int)Column.Tcold].Text;
|
||||
}
|
||||
entity.TempWarmRef = lvi.SubItems[(int)Column.TwarmRef].Text == "---" ? null : lvi.SubItems[(int)Column.TwarmRef].Text;
|
||||
entity.TempColdRef = lvi.SubItems[(int)Column.TcoldRef].Text == "---" ? null : lvi.SubItems[(int)Column.TcoldRef].Text;
|
||||
|
||||
entity.TempBath1 = lvi.SubItems[(int)Column.Tbath1].Text == "---" ? null : lvi.SubItems[(int)Column.Tbath1].Text;
|
||||
entity.TempBath2 = lvi.SubItems[(int)Column.Tbath2].Text == "---" ? null : lvi.SubItems[(int)Column.Tbath2].Text;
|
||||
entity.TempBath3 = lvi.SubItems[(int)Column.Tbath3].Text == "---" ? null : lvi.SubItems[(int)Column.Tbath3].Text;
|
||||
entity.TempBath4 = lvi.SubItems[(int)Column.Tbath4].Text == "---" ? null : lvi.SubItems[(int)Column.Tbath4].Text;
|
||||
|
||||
for (int i = 0; i < Config.Data.WMsCount; i++)
|
||||
{
|
||||
int j = (int)Column.FixedColumnsCount + i;
|
||||
entity.SetTempWarm(i, lvi.SubItems[j].Text == "---" ? null : lvi.SubItems[j].Text);
|
||||
int k = (int)Column.FixedColumnsCount + Config.Data.WMsCount + i;
|
||||
entity.SetTempCold(i, lvi.SubItems[k].Text == "---" ? null : lvi.SubItems[k].Text);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
|
||||
Loading…
Reference in New Issue
Block a user