(1) CycleNr renamed to BatchNr (no DB change) and added to results/logs
(2) Safer result items
This commit is contained in:
parent
3e48e4c50c
commit
9bd5fba6dc
@ -136,7 +136,7 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
|
||||
string[] rightColumn = new string[]
|
||||
{
|
||||
unsortedResults[0].CycleNr.ToString(),
|
||||
unsortedResults[0].BatchNr.ToString(),
|
||||
//dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(),
|
||||
string.Format("{0}.{1}.{2} {3}:{4}", dateTime.Year.ToString("D4"),
|
||||
dateTime.Month.ToString("D2"),
|
||||
|
||||
@ -142,7 +142,7 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
|
||||
string[] rightColumn = new string[]
|
||||
{
|
||||
unsortedResults[0].CycleNr.ToString(),
|
||||
unsortedResults[0].BatchNr.ToString(),
|
||||
//dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(),
|
||||
string.Format("{0}.{1}.{2} {3}:{4}", dateTime.Year.ToString("D4"),
|
||||
dateTime.Month.ToString("D2"),
|
||||
|
||||
@ -408,7 +408,7 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
|
||||
//--------------------------------
|
||||
Program.LocalSettings.CycleNr++;
|
||||
Program.LocalSettings.BatchNr++;
|
||||
Program.LocalSettings.Save();
|
||||
|
||||
|
||||
|
||||
@ -725,6 +725,7 @@ namespace TBF.BenchControl.Sequences
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
|
||||
sb.Append(tstRslt.TimeStart);
|
||||
sb.Append(";"); sb.Append(tstRslt.BatchNr);
|
||||
sb.Append(";"); sb.Append(tstRslt.TestName);
|
||||
sb.Append(";"); sb.Append(tstRslt.RepetitionNr);
|
||||
sb.Append(";"); sb.Append("1");
|
||||
|
||||
@ -246,9 +246,10 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
tstRslt.TimeEnd = DateTime.Now;
|
||||
tstRslt.CycleNr = Program.LocalSettings.CycleNr;
|
||||
UpdateTestRsltWithAveragedData(tstRslt);
|
||||
|
||||
tstRslt.TimeEnd = DateTime.Now;
|
||||
tstRslt.BatchNr = Program.LocalSettings.BatchNr;
|
||||
tstRslt.MassStart = 0;
|
||||
tstRslt.MassEnd = 0;
|
||||
tstRslt.MassDiff = 0;
|
||||
@ -276,6 +277,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
tstRslt.TimeDivEnd3 = 0;
|
||||
tstRslt.TimeDivEnd4 = 0;
|
||||
tstRslt.TimeDivEnd5 = 0;
|
||||
|
||||
for (int i = 0; i < Program.WMsCount; i++)
|
||||
{
|
||||
if (sensPath.RegisterReaders[i] != null)
|
||||
|
||||
@ -350,23 +350,24 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
tstRslt.CycleNr = Program.LocalSettings.CycleNr;
|
||||
UpdateTestRsltWithAveragedData(tstRslt);
|
||||
|
||||
tstRslt.BatchNr = Program.LocalSettings.BatchNr;
|
||||
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassDiff = tstRslt.MassEnd - tstRslt.MassStart;
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
tstRslt.Time = cBrd.TTime; /// [s] measurement time
|
||||
tstRslt.FlowMass = 3600.0f * tstRslt.MassDiff / tstRslt.Time; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h]
|
||||
tstRslt.VolumeCTV = 1.00103f * 1000.0f * tstRslt.MassDiff / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
tstRslt.VolumeMaster = ltrPerRefPulse * cBrd.EtPulses(0); /// [l] volume from the master flow meter
|
||||
tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster;
|
||||
/// Corrected master pulses per liter
|
||||
if (tstRslt.VolumeCTV <= float.Epsilon)
|
||||
tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
|
||||
|
||||
if (tstRslt.VolumeCTV <= float.Epsilon)
|
||||
{
|
||||
tstRslt.ErrorMaster = 0.1f;
|
||||
}
|
||||
|
||||
@ -545,23 +545,24 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
tstRslt.CycleNr = Program.LocalSettings.CycleNr;
|
||||
UpdateTestRsltWithAveragedData(tstRslt);
|
||||
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections);
|
||||
|
||||
tstRslt.BatchNr = Program.LocalSettings.BatchNr;
|
||||
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassDiff = tstRslt.MassEnd - tstRslt.MassStart;
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
tstRslt.Time = cBrd.TTime; /// [s] measurement time
|
||||
tstRslt.FlowMass = 3600.0f * tstRslt.MassDiff / tstRslt.Time; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h]
|
||||
tstRslt.VolumeCTV = 1.00103f * 1000.0f * tstRslt.MassDiff / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
tstRslt.VolumeMaster = ltrPerRefPulse * cBrd.EtPulses(0); /// [l] volume from the master flow meter
|
||||
tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster;
|
||||
/// Corrected master pulses per liter
|
||||
if (tstRslt.VolumeCTV <= float.Epsilon)
|
||||
tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
|
||||
|
||||
if (tstRslt.VolumeCTV <= float.Epsilon)
|
||||
{
|
||||
tstRslt.ErrorMaster = 0.1f;
|
||||
}
|
||||
@ -569,6 +570,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
{
|
||||
tstRslt.ErrorMaster = 100 * (tstRslt.VolumeMaster - tstRslt.VolumeCTV) / tstRslt.VolumeCTV;
|
||||
}
|
||||
|
||||
tstRslt.TimeDivStart0 = 0;
|
||||
tstRslt.TimeDivStart1 = 0;
|
||||
tstRslt.TimeDivStart2 = 0;
|
||||
|
||||
@ -464,22 +464,23 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
tstRslt.CycleNr = Program.LocalSettings.CycleNr;
|
||||
UpdateTestRsltWithAveragedData(tstRslt);
|
||||
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassDiff = tstRslt.MassEnd - tstRslt.MassStart;
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
tstRslt.Time = cBrd.TTime; /// [s] measurement time
|
||||
tstRslt.FlowMass = 3600.0f * tstRslt.MassDiff / tstRslt.Time; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h]
|
||||
tstRslt.VolumeCTV = 1.00103f * 1000.0f * tstRslt.MassDiff / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
tstRslt.VolumeMaster = ltrPerRefPulse * cBrd.EtPulses(0); /// [l] volume from the master flow meter
|
||||
tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster;
|
||||
/// Corrected master pulses per liter
|
||||
|
||||
tstRslt.BatchNr = Program.LocalSettings.BatchNr;
|
||||
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassDiff = tstRslt.MassEnd - tstRslt.MassStart;
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
tstRslt.Time = cBrd.TTime; /// [s] measurement time
|
||||
tstRslt.FlowMass = 3600.0f * tstRslt.MassDiff / tstRslt.Time; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h]
|
||||
tstRslt.VolumeCTV = 1.00103f * 1000.0f * tstRslt.MassDiff / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
tstRslt.VolumeMaster = ltrPerRefPulse * cBrd.EtPulses(0); /// [l] volume from the master flow meter
|
||||
tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
|
||||
|
||||
if (tstRslt.VolumeCTV <= float.Epsilon)
|
||||
{
|
||||
tstRslt.ErrorMaster = 0.1f;
|
||||
|
||||
@ -211,36 +211,38 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
tstRslt.TimeEnd = DateTime.Now;
|
||||
tstRslt.CycleNr = Program.LocalSettings.CycleNr;
|
||||
UpdateTestRsltWithAveragedData(tstRslt);
|
||||
tstRslt.MassStart = 0;
|
||||
tstRslt.MassEnd = 0;
|
||||
tstRslt.MassDiff = 0;
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
tstRslt.Time = cBrd.TTime; /// [s] measurement time
|
||||
tstRslt.FlowMass = 0; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h]
|
||||
tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.VolumeMaster = ltrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
|
||||
tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume / 1000.0f); /// Convert the flow to [m3/h]
|
||||
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
|
||||
tstRslt.TimeEnd = DateTime.Now;
|
||||
tstRslt.BatchNr = Program.LocalSettings.BatchNr;
|
||||
tstRslt.MassStart = 0;
|
||||
tstRslt.MassEnd = 0;
|
||||
tstRslt.MassDiff = 0;
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
tstRslt.Time = cBrd.TTime; /// [s] measurement time
|
||||
tstRslt.FlowMass = 0; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h]
|
||||
tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.VolumeMaster = ltrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
|
||||
tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume / 1000.0f); /// Convert the flow to [m3/h]
|
||||
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
/// Corrected master pulses per liter
|
||||
tstRslt.ErrorMaster = 0.0f; /// Cannot be determined without the collected water mass measurement
|
||||
tstRslt.TimeDivStart0 = 0;
|
||||
tstRslt.TimeDivStart1 = 0;
|
||||
tstRslt.TimeDivStart2 = 0;
|
||||
tstRslt.TimeDivStart3 = 0;
|
||||
tstRslt.TimeDivStart4 = 0;
|
||||
tstRslt.TimeDivStart5 = 0;
|
||||
tstRslt.TimeDivEnd0 = 0;
|
||||
tstRslt.TimeDivEnd1 = 0;
|
||||
tstRslt.TimeDivEnd2 = 0;
|
||||
tstRslt.TimeDivEnd3 = 0;
|
||||
tstRslt.TimeDivEnd4 = 0;
|
||||
tstRslt.TimeDivEnd5 = 0;
|
||||
tstRslt.ErrorMaster = 0.0f; /// Cannot be determined without the collected water mass measurement
|
||||
tstRslt.TimeDivStart0 = 0;
|
||||
tstRslt.TimeDivStart1 = 0;
|
||||
tstRslt.TimeDivStart2 = 0;
|
||||
tstRslt.TimeDivStart3 = 0;
|
||||
tstRslt.TimeDivStart4 = 0;
|
||||
tstRslt.TimeDivStart5 = 0;
|
||||
tstRslt.TimeDivEnd0 = 0;
|
||||
tstRslt.TimeDivEnd1 = 0;
|
||||
tstRslt.TimeDivEnd2 = 0;
|
||||
tstRslt.TimeDivEnd3 = 0;
|
||||
tstRslt.TimeDivEnd4 = 0;
|
||||
tstRslt.TimeDivEnd5 = 0;
|
||||
|
||||
for (int i = 0; i < Program.WMsCount; i++)
|
||||
{
|
||||
if (sensPath.RegisterReaders[i] != null)
|
||||
|
||||
@ -349,22 +349,23 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
tstRslt.CycleNr = Program.LocalSettings.CycleNr;
|
||||
UpdateTestRsltWithAveragedData(tstRslt);
|
||||
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassDiff = tstRslt.MassEnd - tstRslt.MassStart;
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
tstRslt.Time = cBrd.TTime; /// [s] measurement time
|
||||
tstRslt.FlowMass = 3600.0f * tstRslt.MassDiff / tstRslt.Time; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h]
|
||||
tstRslt.VolumeCTV = 1.00103f * 1000.0f * tstRslt.MassDiff / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
tstRslt.VolumeMaster = ltrPerRefPulse * cBrd.EtPulses(0); /// [l] volume from the master flow meter
|
||||
tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster;
|
||||
/// Corrected master pulses per liter
|
||||
|
||||
tstRslt.BatchNr = Program.LocalSettings.BatchNr;
|
||||
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassDiff = tstRslt.MassEnd - tstRslt.MassStart;
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
tstRslt.Time = cBrd.TTime; /// [s] measurement time
|
||||
tstRslt.FlowMass = 3600.0f * tstRslt.MassDiff / tstRslt.Time; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h]
|
||||
tstRslt.VolumeCTV = 1.00103f * 1000.0f * tstRslt.MassDiff / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
tstRslt.VolumeMaster = ltrPerRefPulse * cBrd.EtPulses(0); /// [l] volume from the master flow meter
|
||||
tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
|
||||
|
||||
if (tstRslt.VolumeCTV <= float.Epsilon)
|
||||
{
|
||||
tstRslt.ErrorMaster = 0.0f;
|
||||
|
||||
@ -332,21 +332,23 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
tstRslt.CycleNr = Program.LocalSettings.CycleNr;
|
||||
UpdateTestRsltWithAveragedData(tstRslt);
|
||||
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassDiff = tstRslt.MassEnd - tstRslt.MassStart;
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
tstRslt.Time = cBrd.TTime; /// [s] measurement time
|
||||
tstRslt.FlowMass = 3600.0f * tstRslt.MassDiff / tstRslt.Time; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h]
|
||||
tstRslt.VolumeCTV = 1.00103f * 1000.0f * tstRslt.MassDiff / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
tstRslt.VolumeMaster = ltrPerRefPulse * cBrd.EtPulses(0); /// [l] volume from the master flow meter
|
||||
tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
|
||||
|
||||
tstRslt.BatchNr = Program.LocalSettings.BatchNr;
|
||||
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections);
|
||||
tstRslt.MassDiff = tstRslt.MassEnd - tstRslt.MassStart;
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
tstRslt.Time = cBrd.TTime; /// [s] measurement time
|
||||
tstRslt.FlowMass = 3600.0f * tstRslt.MassDiff / tstRslt.Time; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h]
|
||||
tstRslt.VolumeCTV = 1.00103f * 1000.0f * tstRslt.MassDiff / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
tstRslt.VolumeMaster = ltrPerRefPulse * cBrd.EtPulses(0); /// [l] volume from the master flow meter
|
||||
tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
|
||||
|
||||
if (tstRslt.VolumeCTV <= float.Epsilon)
|
||||
{
|
||||
tstRslt.ErrorMaster = 0.1f;
|
||||
|
||||
@ -7,7 +7,7 @@ namespace TBF.Entities
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual int CycleNr { get; set; }
|
||||
public virtual int BatchNr { get; set; }
|
||||
public virtual MetersKind MetersKind { get; set; }
|
||||
public virtual IList<MeterTestResult> Meters { get; set; }
|
||||
public virtual IList<MeterTestResult> CombinedMeters { get; set; }
|
||||
|
||||
@ -12,15 +12,44 @@ namespace TBF.Forms
|
||||
public readonly string Name; /// Name-s of all items must be unique
|
||||
public readonly string ClmnHeaderText; /// Text printed in the column header
|
||||
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
public delegate string PrintDlgt(Entities.MeterTestResult meterTestResult);
|
||||
public readonly PrintDlgt Print;
|
||||
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
public delegate string PrintDlgt(Entities.MeterTestResult meterTestResult);
|
||||
|
||||
private readonly PrintDlgt printDlgt;
|
||||
|
||||
public bool CanPrintSingle { get { return (printDlgt != null); } }
|
||||
|
||||
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
|
||||
public string Print(Entities.MeterTestResult meterTestResult)
|
||||
{
|
||||
string str = printDlgt(meterTestResult);
|
||||
return (str == null) ? string.Empty : str;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
public delegate string PrintCombinedDlgt(Entities.MeterTestResult largeMeterTestResult,
|
||||
Entities.MeterTestResult smallMeterTestResult,
|
||||
Entities.MeterTestResult combinedMeterTestResult);
|
||||
public readonly PrintCombinedDlgt PrintCombined;
|
||||
private readonly PrintCombinedDlgt printCombinedDlgt;
|
||||
|
||||
public bool CanPrintCombined { get { return (printCombinedDlgt != null); } }
|
||||
|
||||
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
|
||||
public string PrintCombined(Entities.MeterTestResult largeMeterTestResult,
|
||||
Entities.MeterTestResult smallMeterTestResult,
|
||||
Entities.MeterTestResult combinedMeterTestResult)
|
||||
{
|
||||
string str = printCombinedDlgt(largeMeterTestResult, smallMeterTestResult, combinedMeterTestResult);
|
||||
return (str == null) ? string.Empty : str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// Public constructor
|
||||
@ -29,12 +58,11 @@ namespace TBF.Forms
|
||||
{
|
||||
Name = name;
|
||||
ClmnHeaderText = clmnHeaderText;
|
||||
Print = printDlgt;
|
||||
PrintCombined = printCombinedDlgt;
|
||||
this.printDlgt = printDlgt;
|
||||
this.printCombinedDlgt = printCombinedDlgt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Static list of all available items
|
||||
public static readonly IList<ResultItemSpec> AllItems;
|
||||
|
||||
@ -48,8 +76,8 @@ namespace TBF.Forms
|
||||
(x, y, z) => x.TestResult.TestName));
|
||||
AllItems.Add(new ResultItemSpec("Procedure name", Strings.Procedure, x => x.TestResult.ProcedureName,
|
||||
(x, y, z) => x.TestResult.ProcedureName));
|
||||
AllItems.Add(new ResultItemSpec("Tets cycle number", "Cycel nr.", x => x.TestResult.CycleNr.ToString(),
|
||||
(x, y, z) => x.TestResult.CycleNr.ToString()));
|
||||
AllItems.Add(new ResultItemSpec("Batch number", "Batch nr.", x => x.TestResult.BatchNr.ToString(),
|
||||
(x, y, z) => x.TestResult.BatchNr.ToString()));
|
||||
|
||||
/// Target values
|
||||
AllItems.Add(new ResultItemSpec("Q from", Strings.Q_from_m3h, x => x.TestResult.Qfrom.ToString("F3"),
|
||||
@ -102,8 +130,8 @@ namespace TBF.Forms
|
||||
(x, y, z) => (z.Passed ? Strings.Passed + "|Green" : Strings.Failed + "|Red")));
|
||||
|
||||
/// Single water meters only results
|
||||
AllItems.Add(new ResultItemSpec("Serial Nr", "s/n", x => x.SerialNr, (x, y, z) => z.SerialNr));
|
||||
AllItems.Add(new ResultItemSpec("End state", "End state", x => x.EndState, (x, y, z) => z.EndState));
|
||||
AllItems.Add(new ResultItemSpec("Serial Nr", "s/n", x => x.SerialNr, null));
|
||||
AllItems.Add(new ResultItemSpec("End state", "End state", x => x.EndState, null));
|
||||
AllItems.Add(new ResultItemSpec("Pulses", "Pulses", x => x.PulsesMeter.ToString(), null));
|
||||
AllItems.Add(new ResultItemSpec("Reference pulses", "Ref.pulses", x => x.PulsesMaster.ToString(), null));
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ namespace TBF.Forms
|
||||
currentlyAvailableItems = new List<ResultItemSpec>();
|
||||
foreach (var item in ResultItemSpec.AllItems)
|
||||
{
|
||||
if (!GetSelectedItems().Contains(item) && (combined ? (item.PrintCombined != null) : (item.Print != null)))
|
||||
if (!GetSelectedItems().Contains(item) && (combined ? item.CanPrintCombined : item.CanPrintSingle))
|
||||
{
|
||||
currentlyAvailableItems.Add(item);
|
||||
availableResultsListBox.Items.Add(item.Name);
|
||||
|
||||
@ -57,7 +57,7 @@ namespace TBF
|
||||
[XmlElementAttribute("LastProcedure")]
|
||||
public string LastProcedureName;
|
||||
|
||||
public int CycleNr;
|
||||
public int BatchNr;
|
||||
|
||||
public int RightPaneHorizSplitterDistance;
|
||||
|
||||
@ -165,7 +165,7 @@ namespace TBF
|
||||
testBenches[i] = ls.testBenches[i];
|
||||
LastBenchName = ls.LastBenchName;
|
||||
LastProcedureName = ls.LastProcedureName;
|
||||
CycleNr = ls.CycleNr;
|
||||
BatchNr = ls.BatchNr;
|
||||
|
||||
MainWndLeft = ls.MainWndLeft;
|
||||
MainWndTop = ls.MainWndTop;
|
||||
|
||||
@ -9,7 +9,8 @@ namespace TBF.Mappings
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.CycleNr);
|
||||
Map(x => x.BatchNr)
|
||||
.Column("CycleNr");
|
||||
Map(x => x.MetersKind);
|
||||
HasMany(x => x.Meters)
|
||||
.Cascade.All();
|
||||
|
||||
@ -269,13 +269,14 @@ namespace TBF.Screens
|
||||
string str;
|
||||
if (combined)
|
||||
{
|
||||
str = (item.PrintCombined == null) ? string.Empty : item.PrintCombined(testRslt.Meters[2 * mtr - 2],
|
||||
testRslt.Meters[2 * mtr - 1],
|
||||
testRslt.CombinedMeters[mtr - 1]);
|
||||
str = item.CanPrintCombined ? item.PrintCombined(testRslt.Meters[2 * mtr - 2],
|
||||
testRslt.Meters[2 * mtr - 1],
|
||||
testRslt.CombinedMeters[mtr - 1])
|
||||
: string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
str = (item.Print == null) ? string.Empty : item.Print(testRslt.Meters[mtr - 1]);
|
||||
str = item.CanPrintSingle ? item.Print(testRslt.Meters[mtr - 1]) : string.Empty;
|
||||
}
|
||||
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
@ -346,9 +347,9 @@ namespace TBF.Screens
|
||||
{
|
||||
foreach (var tr in trs)
|
||||
{
|
||||
string str = (item.PrintCombined == null || tr == null) ? string.Empty : item.PrintCombined(tr.Meters[2 * mtr - 2],
|
||||
tr.Meters[2 * mtr - 1],
|
||||
tr.CombinedMeters[mtr - 1]);
|
||||
string str = (!item.CanPrintCombined || tr == null) ? string.Empty : item.PrintCombined(tr.Meters[2 * mtr - 2],
|
||||
tr.Meters[2 * mtr - 1],
|
||||
tr.CombinedMeters[mtr - 1]);
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
@ -371,7 +372,7 @@ namespace TBF.Screens
|
||||
{
|
||||
foreach (var tr in trs)
|
||||
{
|
||||
string str = (item.Print == null || tr == null) ? string.Empty : item.Print(tr.Meters[mtr - 1]);
|
||||
string str = (!item.CanPrintSingle || tr == null) ? string.Empty : item.Print(tr.Meters[mtr - 1]);
|
||||
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user