diff --git a/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs b/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs
index 16a63de6a..cbe3879ac 100644
--- a/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs
+++ b/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs
@@ -47,6 +47,12 @@ namespace TBF.BenchControl.TestMethods.Adjustment
modelessDlg.Show();
}
+ void CloseWMErrorsForm()
+ {
+ UiBridge.Bridge.OnCloseModelessForm(this, null);
+ modelessDlg = null;
+ }
+
///
/// Adjustment method sequence
///
@@ -321,10 +327,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment
//------------------------------------------------
if (mode == Config.Entities.DebugMode.Simulate)
{
- /// TODO: Reimplement
- //tstRslt = MakeSimulated(test, 1, simulatedError);
- simulatedError *= 0.6f;
-
State.Create(string.Format("{0}({1}) : Simulating the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
@@ -332,8 +334,16 @@ namespace TBF.BenchControl.TestMethods.Adjustment
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
- if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
- if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
+ if (e.Contains(Event.Error))
+ {
+ retVal = Event.Error;
+ goto stopTest;
+ }
+ if (TestAndLogUiCmdStop(test,e))
+ {
+ retVal = Event.UiCmdStop;
+ goto stopTest;
+ }
}
while (!e.Contains(Event.TimerExpired));
}
@@ -365,9 +375,18 @@ namespace TBF.BenchControl.TestMethods.Adjustment
//--------------------------------
switch (ReadRegistersTempPressAmbient(measureOperations, true))
{
- case Event.Error: { retVal = Event.Error; goto stopTest; }
- case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
- case Event.MeasurementCompleted: goto one_test_completed;
+ case Event.Error:
+ {
+ retVal = Event.Error;
+ goto stopTest;
+ }
+ case Event.UiCmdStop:
+ {
+ retVal = Event.UiCmdStop;
+ goto stopTest;
+ }
+ case Event.MeasurementCompleted:
+ break;
}
RefFreq.Val = cBrd.ReferenceFreq;
@@ -377,113 +396,134 @@ namespace TBF.BenchControl.TestMethods.Adjustment
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
}
- /// Measurement loop - end
+ /// Measurement loop - end
+ }
- one_test_completed:
+ one_test_completed:
- //------------------------------------------------
- Bridge.OnActivity(this, Strings.Adjustment_in_progress);
- //------------------------------------------------
+ //------------------------------------------------
+ Bridge.OnActivity(this, Strings.Adjustment_in_progress);
+ //------------------------------------------------
- TestEndTime = DateTime.Now;
+ TestEndTime = DateTime.Now;
- /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
- if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
+ /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
+ if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
- ///
- /// Populate TestResult data entity with data
- ///
- Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
+ ///
+ /// Populate TestResult data entity with data
+ ///
+ Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
- if (tstRslt != null)
- {
- UpdateTempPressDensAmb(tstRslt);
+ if (tstRslt != null)
+ {
+ UpdateTempPressDensAmb(tstRslt);
- /// Main results
- tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
- tstRslt.StartTime = TestStartTime;
- tstRslt.EndTime = TestEndTime;
- tstRslt.FlowSetTime = flowSetTime;
- tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
- tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
- tstRslt.MassStartRaw = 0;
- tstRslt.MassStart = 0;
- tstRslt.MassEndRaw = 0;
- tstRslt.MassEnd = 0;
- tstRslt.FlowMass = 0; /// [kg/h]
- tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
- tstRslt.Buoyancy = Config.Formulas.Buoyancy();
- tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
- tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
- tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
- tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// Corrected master pulses per liter
- 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
+ /// Main results
+ tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
+ tstRslt.StartTime = TestStartTime;
+ tstRslt.EndTime = TestEndTime;
+ tstRslt.FlowSetTime = flowSetTime;
+ if (mode == Config.Entities.DebugMode.Simulate)
+ {
+ tstRslt.TestTime = tstRslt.TestData.TargetTime;
+ tstRslt.PulsesMaster = Convert.ToDouble(tstRslt.TestData.TargetVolume / LtrPerRefPulse);
+ }
+ else
+ {
+ tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
+ tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
+ }
+ tstRslt.MassStartRaw = 0;
+ tstRslt.MassStart = 0;
+ tstRslt.MassEndRaw = 0;
+ tstRslt.MassEnd = 0;
+ tstRslt.FlowMass = 0; /// [kg/h]
+ tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
+ tstRslt.Buoyancy = Config.Formulas.Buoyancy();
+ tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
+ tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
+ tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
+ tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// Corrected master pulses per liter
+ 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
- tstRslt.FlowMean = (float)RefFlowStat.Average;
- tstRslt.FlowStart = (float)RefFlowStat.First;
- tstRslt.FlowEnd = (float)RefFlowStat.Last;
- tstRslt.FlowMin = (float)RefFlowStat.Min;
- tstRslt.FlowMax = (float)RefFlowStat.Max;
+ tstRslt.FlowMean = (float)RefFlowStat.Average;
+ tstRslt.FlowStart = (float)RefFlowStat.First;
+ tstRslt.FlowEnd = (float)RefFlowStat.Last;
+ tstRslt.FlowMin = (float)RefFlowStat.Min;
+ tstRslt.FlowMax = (float)RefFlowStat.Max;
- tstRslt.DiverterStart = 0;
- tstRslt.DiverterEnd = 0;
- tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0;
- tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, false, 0, 0) : 0;
+ tstRslt.DiverterStart = 0;
+ tstRslt.DiverterEnd = 0;
+ tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0;
+ tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, false, 0, 0) : 0;
+ for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
+ {
+ if (!test.IsPartCompatible(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)
+ {
+ meterRslt.RegReaderType = (int)regReader.RegisterReaderType;
+ meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
+ meterRslt.VolumeStart = 0; /// liter
+ meterRslt.VolumeEnd = 0; /// liter
+
+ if (mode == Config.Entities.DebugMode.Simulate)
+ {
+ meterRslt.PulsesMeter = tstRslt.VolumeCTV * (1.0 + (i - 5) * 0.001);
+ meterRslt.PulsesMaster = tstRslt.PulsesMaster;
+ meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse;
+ meterRslt.VolumeRef = tstRslt.VolumeCTV;
+ meterRslt.TestTime = tstRslt.TestTime;
+ }
+ else
+ {
+ meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses);
+ meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses);
+ meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter
+ meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter
+ meterRslt.TestTime = cBrd.ImpulseTime(i + 1);
+ }
+
+ meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
+ meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.VolumeCTV, tstRslt.TestTime) + test.Uncertainty)
+ && (meterRslt.Error <= test.GetErrLimHi(tstRslt.VolumeCTV, tstRslt.TestTime) - test.Uncertainty);
+ meterRslt.TestDone = true;
+ tstRslt.TestDone = true;
+ }
+ }
+
+ tstRslt.Components = Results.Entities.Components
+ .UpdateList(BatchRslts.ComponentsList,
+ new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
+ (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
+ inPath.Pump != null ? inPath.Pump.Name : string.Empty,
+ outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
+ outPath.Scale != null ? outPath.Scale.Name : string.Empty,
+ outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
+ outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
+
+ /// Update water meter error flags
+ if (ErrorFlagsComp != null)
+ {
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
- if (!test.IsPartCompatible(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)
- {
- meterRslt.RegReaderType = (int)regReader.RegisterReaderType;
- meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
- meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses);
- meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses);
- meterRslt.VolumeStart = 0; /// liter
- meterRslt.VolumeEnd = 0; /// liter
- meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter
- meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter
- meterRslt.TestTime = cBrd.ImpulseTime(i + 1);
- meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
- meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.VolumeCTV, tstRslt.TestTime) + test.Uncertainty)
- && (meterRslt.Error <= test.GetErrLimHi(tstRslt.VolumeCTV, tstRslt.TestTime) - test.Uncertainty);
- meterRslt.TestDone = true;
- tstRslt.TestDone = true;
- }
- }
-
- tstRslt.Components = Results.Entities.Components
- .UpdateList(BatchRslts.ComponentsList,
- new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
- (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
- inPath.Pump != null ? inPath.Pump.Name : string.Empty,
- outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
- outPath.Scale != null ? outPath.Scale.Name : string.Empty,
- outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
- outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
-
- /// Update water meter error flags
- if (ErrorFlagsComp != null)
- {
- for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
+ if (BatchRslts.WaterMeters[i] != null)
{
- if (BatchRslts.WaterMeters[i] != null)
- {
- BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts);
- }
+ BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts);
}
}
+ }
- /// Update results
- Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt));
- }
- /// Add data - end
+ /// Update results
+ Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt));
}
+ /// Add data - end
/// Update modeless dialog error information
@@ -520,6 +560,11 @@ namespace TBF.BenchControl.TestMethods.Adjustment
stopTestWOStoppingDivGateEtc:
+ if (modelessDlg is GenericDevices.IHasCompleted && !(modelessDlg as GenericDevices.IHasCompleted).Completed)
+ {
+ CloseWMErrorsForm();
+ }
+
return new List { retVal };
}
}
diff --git a/TBF/BenchControl/TestMethods/Adjustment/Factory.cs b/TBF/BenchControl/TestMethods/Adjustment/Factory.cs
index c29252287..b673f49f6 100644
--- a/TBF/BenchControl/TestMethods/Adjustment/Factory.cs
+++ b/TBF/BenchControl/TestMethods/Adjustment/Factory.cs
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
public IComponentCfg DefaultConfig()
{
- return new TestMethodCfg(this.GetType().Namespace.Substring(29) +".Single", this);
+ return new TestMethodCfg(this.GetType().Namespace.Substring(29), this);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
diff --git a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm.cs b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm.cs
index 389e133bf..eddcd626c 100644
--- a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm.cs
+++ b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm.cs
@@ -67,6 +67,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
completed = false;
+ StartForceCloseHandler();
+
/// Attach to 'AdjustmentInProgress' handler
UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
{
diff --git a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm12.cs b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm12.cs
index 75bf87415..550e21319 100644
--- a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm12.cs
+++ b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm12.cs
@@ -72,6 +72,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
completed = false;
+ StartForceCloseHandler();
+
/// Attach to 'AdjustmentInProgress' handler
UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
{
diff --git a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm24.cs b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm24.cs
index e010e027c..3c03525ff 100644
--- a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm24.cs
+++ b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm24.cs
@@ -76,6 +76,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
completed = false;
+ StartForceCloseHandler();
+
/// Attach to 'AdjustmentInProgress' handler
UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
{
@@ -202,8 +204,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
for (int i = 0; i < waterMetersCount; i++)
{
- if (!disabled[i])
- {
+ if ((i < MaxWMsCount) && (!disabled[i]))
+ {
PaintOne(graphics, rects[i], error[i], errLimLo, errLimHi);
}
}
diff --git a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm48.cs b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm48.cs
index 06b0949d9..55be86860 100644
--- a/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm48.cs
+++ b/TBF/BenchControl/TestMethods/Adjustment/WMErrorsForm48.cs
@@ -86,6 +86,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
completed = false;
+ StartForceCloseHandler();
+
/// Attach to 'AdjustmentInProgress' handler
UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
{
@@ -212,8 +214,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
for (int i = 0; i < waterMetersCount; i++)
{
- if (!disabled[i])
- {
+ if ((i < MaxWMsCount) && (!disabled[i]))
+ {
PaintOne(graphics, rects[i], error[i], errLimLo, errLimHi);
}
}
diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs
index 7f349855e..2f41c44ce 100644
--- a/TBF/Properties/AssemblyInfo.cs
+++ b/TBF/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("2.18.1441.0")]
-[assembly: AssemblyFileVersion("2.18.1441.0")]
+[assembly: AssemblyVersion("2.18.1454.0")]
+[assembly: AssemblyFileVersion("2.18.1454.0")]