More changes for heat meters testing, DataEntry form completed.
This commit is contained in:
parent
74738ff78c
commit
e3318179c1
@ -44,13 +44,99 @@ namespace Config
|
||||
|
||||
J, /// * 1 Joul
|
||||
kJ, /// 1 kJ = 1000 J
|
||||
Wh, /// 1 Wh = 3600 J
|
||||
kWh, /// 1 kWh = 3600000 J
|
||||
|
||||
Count
|
||||
}
|
||||
|
||||
public class Units
|
||||
public enum Quantity
|
||||
{
|
||||
Number,
|
||||
Volume,
|
||||
Flow,
|
||||
Mass,
|
||||
Temperature,
|
||||
Pressure,
|
||||
Error,
|
||||
Length,
|
||||
Energy,
|
||||
Count,
|
||||
}
|
||||
|
||||
public static class Units
|
||||
{
|
||||
public static double ConvertTo(Unit units, double v)
|
||||
public static Quantity Quantity(Unit units)
|
||||
{
|
||||
switch (units)
|
||||
{
|
||||
case Unit.l:
|
||||
case Unit.m3:
|
||||
case Unit.gal_UK:
|
||||
case Unit.gal_US:
|
||||
return Config.Quantity.Volume;
|
||||
|
||||
case Unit.lph:
|
||||
case Unit.m3ph:
|
||||
return Config.Quantity.Flow;
|
||||
|
||||
case Unit.g:
|
||||
case Unit.kg:
|
||||
case Unit.t:
|
||||
case Unit.lb:
|
||||
return Config.Quantity.Mass;
|
||||
|
||||
case Unit.C:
|
||||
case Unit.F:
|
||||
case Unit.K:
|
||||
return Config.Quantity.Temperature;
|
||||
|
||||
case Unit.Pa:
|
||||
case Unit.hPa:
|
||||
case Unit.mbar:
|
||||
case Unit.kPa:
|
||||
case Unit.bar:
|
||||
case Unit.MPa:
|
||||
case Unit.inHg:
|
||||
return Config.Quantity.Pressure;
|
||||
|
||||
case Unit.Pct:
|
||||
case Unit.Promile:
|
||||
return Config.Quantity.Error;
|
||||
|
||||
case Unit.mm:
|
||||
case Unit.cm:
|
||||
case Unit.m:
|
||||
case Unit.inch:
|
||||
return Config.Quantity.Length;
|
||||
|
||||
case Unit.J:
|
||||
case Unit.kJ:
|
||||
case Unit.Wh:
|
||||
case Unit.kWh:
|
||||
return Config.Quantity.Energy;
|
||||
|
||||
default:
|
||||
return Config.Quantity.Number;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsQuantity(Unit units, Quantity quantity)
|
||||
{
|
||||
return (quantity == Quantity(units));
|
||||
}
|
||||
|
||||
public static bool IsVolume(Unit units) { return IsQuantity(units, Config.Quantity.Volume); }
|
||||
public static bool IsFlow(Unit units) { return IsQuantity(units, Config.Quantity.Flow); }
|
||||
public static bool IsMass(Unit units) { return IsQuantity(units, Config.Quantity.Mass); }
|
||||
public static bool IsTemperature(Unit units) { return IsQuantity(units, Config.Quantity.Temperature); }
|
||||
public static bool IsPressure(Unit units) { return IsQuantity(units, Config.Quantity.Pressure); }
|
||||
public static bool IsError(Unit units) { return IsQuantity(units, Config.Quantity.Error); }
|
||||
public static bool IsLength(Unit units) { return IsQuantity(units, Config.Quantity.Length); }
|
||||
public static bool IsEnergy(Unit units) { return IsQuantity(units, Config.Quantity.Energy); }
|
||||
|
||||
|
||||
public static double ConvertTo(Unit units, double v)
|
||||
{
|
||||
switch (units)
|
||||
{
|
||||
@ -97,6 +183,8 @@ namespace Config
|
||||
/// Energy, internal representation in Joul
|
||||
case Unit.J: return v; /// 1 Joul
|
||||
case Unit.kJ: return 0.001 * v; /// 1 kJ = 1000 J
|
||||
case Unit.Wh: return v / 3600.0; /// 1 Wh = 3600 J
|
||||
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
|
||||
|
||||
default: return v;
|
||||
}
|
||||
@ -149,9 +237,11 @@ namespace Config
|
||||
/// Energy, internal representation in Joul
|
||||
case Unit.J: return v; /// 1 Joul
|
||||
case Unit.kJ: return 1000 * v; /// 1 kJ = 1000 J
|
||||
case Unit.Wh: return 3600 * v; /// 1 Wh = 3600 J
|
||||
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
|
||||
|
||||
default: return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
{
|
||||
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasWMStatesForm
|
||||
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasHeatMtrStatesForm
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
|
||||
public override string ToString()
|
||||
@ -43,6 +43,14 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
|
||||
string[] wmStartStateStr;
|
||||
|
||||
double[] energyStartState;
|
||||
public double EnergyStartState(int wmNr) { return (wmNr >= 0 && wmNr < energyStartState.Length) ? energyStartState[wmNr] : 0; }
|
||||
|
||||
double[] energyEndState;
|
||||
public double EnergyEndState(int wmNr) { return (wmNr >= 0 && wmNr < energyEndState.Length) ? energyEndState[wmNr] : 0; }
|
||||
|
||||
string[] energyStartStateStr;
|
||||
|
||||
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
|
||||
@ -80,6 +88,9 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
wmStartState = new float[Config.Data.WMsCount];
|
||||
wmStartStateStr = new string[Config.Data.WMsCount];
|
||||
wmEndState = new float[Config.Data.WMsCount];
|
||||
energyStartState = new double[Config.Data.WMsCount];
|
||||
energyStartStateStr = new string[Config.Data.WMsCount];
|
||||
energyEndState = new double[Config.Data.WMsCount];
|
||||
wmCycleEndState = new string[Config.Data.WMsCount];
|
||||
|
||||
currentOp = CurrentOp.None;
|
||||
@ -234,7 +245,9 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
{
|
||||
wmStartState[i] = dlg.WMStartState[i];
|
||||
wmStartStateStr[i] = dlg.WMStartStateStr[i];
|
||||
}
|
||||
energyStartState[i] = dlg.EnergyStartState[i];
|
||||
energyStartStateStr[i] = dlg.EnergyStartStateStr[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
|
||||
@ -246,7 +259,8 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
for (int i = 0; i < dlg.WaterMetersCount; i++)
|
||||
{
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
}
|
||||
energyEndState[i] = dlg.EnergyEndState[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
resultSaved = true;
|
||||
|
||||
@ -24,12 +24,13 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public float[] WMStartState;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public readonly string[] WMStartStateStr;
|
||||
public float[] WMEndState;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public float[] WMEndState;
|
||||
public double[] EnergyStartState;
|
||||
public readonly string[] EnergyStartStateStr;
|
||||
public double[] EnergyEndState;
|
||||
|
||||
bool endStates; /// false=start states, true=end states
|
||||
double refVolume;
|
||||
@ -108,6 +109,9 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
|
||||
WMStartState = new float[waterMetersCount];
|
||||
WMStartStateStr = new string[waterMetersCount];
|
||||
|
||||
EnergyStartState = new double[waterMetersCount];
|
||||
EnergyStartStateStr = new string[waterMetersCount];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -137,6 +141,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
ShuffleTextBoxes();
|
||||
|
||||
WMEndState = new float[waterMetersCount];
|
||||
EnergyEndState = new double[waterMetersCount];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -242,6 +247,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
if (endTextBoxes[i].Visible && endTextBoxes[i].Enabled)
|
||||
{
|
||||
WMEndState[i] = Utils.ParseUFloat(endTextBoxes[i].Text);
|
||||
EnergyEndState[i] = Utils.ParseUFloat(energyEndTextBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -253,6 +259,8 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
{
|
||||
WMStartStateStr[i] = startTextBoxes[i].Text;
|
||||
WMStartState[i] = Utils.ParseUFloat(startTextBoxes[i].Text);
|
||||
EnergyStartStateStr[i] = energyStartTextBoxes[i].Text;
|
||||
EnergyStartState[i] = Utils.ParseUFloat(energyStartTextBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1294,7 +1294,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGoldenrod;
|
||||
this.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.ClientSize = new System.Drawing.Size(1292, 613);
|
||||
this.Controls.Add(this.exclamation24);
|
||||
this.Controls.Add(this.startTextBox24);
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IHasHeatMtrStatesForm : IHasWMStatesForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Water meter states on start of test
|
||||
/// </summary>
|
||||
double EnergyStartState(int wmNr);
|
||||
|
||||
/// <summary>
|
||||
/// Water meter states at the end of test
|
||||
/// </summary>
|
||||
double EnergyEndState(int wmNr);
|
||||
}
|
||||
}
|
||||
@ -699,8 +699,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
meterRslt.PulsesMeter = meterRslt.VolumeMeter;
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
|
||||
meterRslt.TestTime = tstRslt.TestTime;
|
||||
|
||||
meterRslt.Energy = meterRslt.EnergyEnd = meterRslt.EnergyStart;
|
||||
if (dataEntryCmpnt is GenericDevices.IHasHeatMtrStatesForm)
|
||||
{
|
||||
meterRslt.EnergyStart = (dataEntryCmpnt as GenericDevices.IHasHeatMtrStatesForm).EnergyStartState(i);
|
||||
meterRslt.EnergyEnd = (dataEntryCmpnt as GenericDevices.IHasHeatMtrStatesForm).EnergyEndState(i);
|
||||
meterRslt.Energy = meterRslt.EnergyEnd - meterRslt.EnergyStart;
|
||||
}
|
||||
meterRslt.RefEnergy = tstRslt.RefEnergy;
|
||||
|
||||
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.Energy, meterRslt.RefEnergy);
|
||||
|
||||
@ -372,6 +372,7 @@
|
||||
<Compile Include="BenchControl\Elde\ValveEx\ValveFactory.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\IBalanceCfg.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\ICalibInfoCfg.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\IHasHeatMtrStatesForm.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\IModbus.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\IBenchInfo.cs" />
|
||||
<Compile Include="BenchControl\GenericDevices\ISimultTestMethod.cs" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user