Bug fix: Updating water meter results in case of a test with parts, copes also with single meters/multiple lines.

This commit is contained in:
Milan Hanajik 2016-06-30 14:02:25 +02:00
parent 799fda63e9
commit ac1bdbe476
11 changed files with 43 additions and 53 deletions

View File

@ -298,12 +298,11 @@ namespace TBF.BenchControl.TestMethods.Adjustment
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0f; /// Cannot be determined without the collected water mass measurement
int from = (test.Part == 0) ? 0 : (test.Part - 1);
int to = (test.Part == 0) ? (BatchRslts.WMPositionsCount - 1) : (test.Part - 1);
///
for (int i = from; i <= to; i++)
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i];
if (meterRslt != null && regReader != null)

View File

@ -394,12 +394,11 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
int from = (test.Part == 0) ? 0 : (test.Part - 1);
int to = (test.Part == 0) ? (BatchRslts.WMPositionsCount - 1) : (test.Part - 1);
///
for (int i = from; i <= to; i++)
{
Results.Entities.MeterTestRslt mainMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundMain);
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
Results.Entities.MeterTestRslt mainMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundMain);
Results.Entities.MeterTestRslt auxMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundAux);
for (int isAux = 0; isAux <= 1; isAux++) /// 0=main, 1=aux

View File

@ -570,12 +570,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
int from = (test.Part == 0) ? 0 : (test.Part - 1);
int to = (test.Part == 0) ? (BatchRslts.WMPositionsCount - 1) : (test.Part - 1);
///
for (int i = from; i <= to; i++)
{
Results.Entities.MeterTestRslt mainMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundMain);
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
Results.Entities.MeterTestRslt mainMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundMain);
Results.Entities.MeterTestRslt auxMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundAux);
for (int isAux = 0; isAux <= 1; isAux++) /// 0=main, 1=aux

View File

@ -526,12 +526,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
int from = (test.Part == 0) ? 0 : (test.Part - 1);
int to = (test.Part == 0) ? (BatchRslts.WMPositionsCount - 1) : (test.Part - 1);
///
for (int i = from; i <= to; i++)
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
BenchControl.Elde.FixedStartRegisterReader.RegisterReader regReader =
sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader;

View File

@ -536,12 +536,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
int from = (test.Part == 0) ? 0 : (test.Part - 1);
int to = (test.Part == 0) ? (BatchRslts.WMPositionsCount - 1) : (test.Part - 1);
///
for (int i = from; i <= to; i++)
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
Results.Entities.MeterTestRslt mainMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundMain);
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
Results.Entities.MeterTestRslt mainMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundMain);
Results.Entities.MeterTestRslt auxMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundAux);
for (int isAux = 0; isAux <= 1; isAux++) /// 0=main, 1=aux

View File

@ -525,12 +525,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
int from = (test.Part == 0) ? 0 : (test.Part - 1);
int to = (test.Part == 0) ? (BatchRslts.WMPositionsCount - 1) : (test.Part - 1);
///
for (int i = from; i <= to; i++)
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
BenchControl.Elde.FixedStartRegisterReader.RegisterReader regReader =
sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader;

View File

@ -273,12 +273,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0; /// Cannot be determined without a mass measurement
int from = (test.Part == 0) ? 0 : (test.Part - 1);
int to = (test.Part == 0) ? (BatchRslts.WMPositionsCount - 1) : (test.Part - 1);
///
for (int i = from; i <= to; i++)
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i];
WaterMeters.iPerl.WaterMeter iPerl = regReader as WaterMeters.iPerl.WaterMeter;

View File

@ -503,11 +503,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
int from = (test.Part == 0) ? 0 : (test.Part - 1);
int to = (test.Part == 0) ? (BatchRslts.WMPositionsCount - 1) : (test.Part - 1);
///
for (int i = from; i <= to; i++)
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i];
WaterMeters.iPerl.WaterMeter iPerl = regReader as WaterMeters.iPerl.WaterMeter;

View File

@ -324,12 +324,11 @@ namespace TBF.BenchControl.TestMethods.LeakTest
tstRslt.ConstMaster = 0; /// Convert the flow to [m3/h]
tstRslt.ErrorMaster = 0;
int from = (test.Part == 0) ? 0 : (test.Part - 1);
int to = (test.Part == 0) ? (BatchRslts.WMPositionsCount - 1) : (test.Part - 1);
///
for (int i = from; i <= to; i++)
{
if (StateMachine.Procedure.MetersKind == MetersKind.Single)
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
if (StateMachine.Procedure.MetersKind == MetersKind.Single)
{
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);

View File

@ -238,12 +238,11 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
tstRslt.ConstMaster = 0; /// Convert the flow to [m3/h]
tstRslt.ErrorMaster = 0;
int from = (test.Part == 0) ? 0 : (test.Part - 1);
int to = (test.Part == 0) ? (BatchRslts.WMPositionsCount - 1) : (test.Part - 1);
///
for (int i = from; i <= to; i++)
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
if (StateMachine.Procedure.MetersKind == MetersKind.Single)
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
if (StateMachine.Procedure.MetersKind == MetersKind.Single)
{
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);

View File

@ -267,7 +267,7 @@ namespace TBF
if (combined) return wmNr1;
int wmPartSize = (wmNr1 - 1) / Config.Data.LineSize + 1;
int wmPartSize = 1 + (wmNr1 - 1) / Config.Data.LineSize;
return wmPartSize;
}