diff --git a/Results/Entities/TestRslt.cs b/Results/Entities/TestRslt.cs
index 1c5aa53a3..158b9fe0c 100644
--- a/Results/Entities/TestRslt.cs
+++ b/Results/Entities/TestRslt.cs
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using Common;
+using Config.Entities;
namespace Results.Entities
{
@@ -246,10 +247,17 @@ namespace Results.Entities
public virtual float TempLimHi() { return TestData.TempLimHi; }
public virtual bool Evaluate() { return TestData.Evaluate; }
public virtual Publish Publish() { return (Publish)TestData.Publish; }
+
+ public virtual bool TestCollected { get; set; } /// Not mapped to DB - just help method to Collect
+ public virtual bool TestMeasured { get; set; } /// Not mapped to DB - just help method to Collect
+
public TestRslt()
{
+ TestCollected = false;
+ TestMeasured = false;
+
MethodClass = string.Empty;
Remark = string.Empty;
}
@@ -390,6 +398,9 @@ namespace Results.Entities
Counter3 = src.Counter3;
Counter4 = src.Counter4;
Counter5 = src.Counter5;
+
+ TestCollected = src.TestCollected;
+ TestMeasured = src.TestMeasured;
}
/// Wrapper
@@ -428,7 +439,7 @@ namespace Results.Entities
public virtual string ToString(int i)
{
- return string.Format("TestRslt: Part={0} RepetitionNr={1} TestDone={2} Remark={3} StartTime={4} EndTime={5} FlowSetTime={6} TestTime={7} PulsesMaster={8} ConstMaster={9} MassStartRaw={10} MassStart={11} MassEndRaw={12} MassEnd={13} DensityIn={14} DensityOut={15} DensityDiv={16} MassOfEvapWaater={17} FlowMass={18} FlowVolume={19} VolumeCTV={20} VolumeMaster={21} ErrorMaster={22} DiverterStart={85} DiverterEnd={86} ErrorFlags={23} InfoFlags={24} AmbTempMean={25} AmbTempStart={26} AmbTempEnd={27} AmbTempMin={28} AmbTempMax={29} AmbPressMean={30} AmbPressStart={31} AmbPressEnd={32} AmbPressMin={33} AmbPressMax={34} AmbHumiMean={35} AmbHumiStart={36} AmbHumiEnd={37} AmbHumiMin={38} AmbHumiMax={39} PressUpMean={40} PressUpStart={41} PressUpEnd={42} PressUpMin={43} PressUpMax={44} PressDownMean={45} PressDownStart={46} PressDownEnd={47} PressDownMin={48} PressDownMax={49} PressDeltaMean={50} PressDeltaStart={51} PressDeltaEnd={52} PressDeltaMin={53} PressDeltaMax={54} TempUpMean={55} TempUpStart={56} TempUpEnd={57} TempUpMin={58} TempUpMax={59} TempDownMean={60} TempDownStart={61} TempDownEnd={62} TempDownMin={63} TempDownMax={64} TempDivMean={65} TempDivStart={66} TempDivEnd={67} TempDivMin={68} TempDivMax={69} FlowMean={70} FlowStart={71} FlowEnd={72} FlowMin={73} FlowMax={74} Custom1={75} Custom2={76} Custom3={77} Custom4={78} Custom5={79} Custom6={80} Custom7={81} Custom8={82} Custom9={83} Custom10={84}",
+ return string.Format("TestRslt: Part={0} RepetitionNr={1} TestDone={2} Remark={3} StartTime={4} EndTime={5} FlowSetTime={6} TestTime={7} PulsesMaster={8} ConstMaster={9} MassStartRaw={10} MassStart={11} MassEndRaw={12} MassEnd={13} DensityIn={14} DensityOut={15} DensityDiv={16} MassOfEvapWaater={17} FlowMass={18} FlowVolume={19} VolumeCTV={20} VolumeMaster={21} ErrorMaster={22} DiverterStart={85} DiverterEnd={86} ErrorFlags={23} InfoFlags={24} AmbTempMean={25} AmbTempStart={26} AmbTempEnd={27} AmbTempMin={28} AmbTempMax={29} AmbPressMean={30} AmbPressStart={31} AmbPressEnd={32} AmbPressMin={33} AmbPressMax={34} AmbHumiMean={35} AmbHumiStart={36} AmbHumiEnd={37} AmbHumiMin={38} AmbHumiMax={39} PressUpMean={40} PressUpStart={41} PressUpEnd={42} PressUpMin={43} PressUpMax={44} PressDownMean={45} PressDownStart={46} PressDownEnd={47} PressDownMin={48} PressDownMax={49} PressDeltaMean={50} PressDeltaStart={51} PressDeltaEnd={52} PressDeltaMin={53} PressDeltaMax={54} TempUpMean={55} TempUpStart={56} TempUpEnd={57} TempUpMin={58} TempUpMax={59} TempDownMean={60} TempDownStart={61} TempDownEnd={62} TempDownMin={63} TempDownMax={64} TempDivMean={65} TempDivStart={66} TempDivEnd={67} TempDivMin={68} TempDivMax={69} FlowMean={70} FlowStart={71} FlowEnd={72} FlowMin={73} FlowMax={74} Custom1={75} Custom2={76} Custom3={77} Custom4={78} Custom5={79} Custom6={80} Custom7={81} Custom8={82} Custom9={83} Custom10={84} TestMeasured={85} TestCollected={86}",
Part, RepetitionNr, TestDone, Remark, StartTime, EndTime, FlowSetTime, TestTime,
PulsesMaster, ConstMaster, MassStartRaw, MassStart, MassEndRaw, MassEnd,
DensityIn, DensityLine, DensityDiv, MassOfEvapWater, Qdetected, Flow,
@@ -444,7 +455,7 @@ namespace Results.Entities
TempDivMean, TempDivStart, TempDivEnd, TempDivMin, TempDivMax,
FlowMean, FlowStart, FlowEnd, FlowMin, FlowMax,
Custom1, Custom2, Custom3, Custom4, Custom5, Custom6, Custom7, Custom8, Custom9, Custom10,
- DiverterStart, DiverterEnd);
+ DiverterStart, DiverterEnd, TestMeasured, TestCollected);
}
@@ -586,6 +597,8 @@ namespace Results.Entities
writer.Write(Counter3);
writer.Write(Counter4);
writer.Write(Counter5);
+ writer.Write(TestMeasured);
+ writer.Write(TestCollected);
}
public virtual void ReadBinary(BinaryReader reader, IList testDatas)
@@ -727,6 +740,8 @@ namespace Results.Entities
Counter3 = reader.ReadInt32();
Counter4 = reader.ReadInt32();
Counter5 = reader.ReadInt32();
+ TestMeasured = reader.ReadBoolean();
+ TestCollected = reader.ReadBoolean();
}
}
}
diff --git a/TBF/Rig/DataEntry/StandartCameraPurchaseOrder/EntryForm.cs b/TBF/Rig/DataEntry/StandartCameraPurchaseOrder/EntryForm.cs
index d91447a33..96ea9e4a9 100644
--- a/TBF/Rig/DataEntry/StandartCameraPurchaseOrder/EntryForm.cs
+++ b/TBF/Rig/DataEntry/StandartCameraPurchaseOrder/EntryForm.cs
@@ -205,6 +205,7 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
public IOperation ShowTestCollectFormOp(IRegReader[] regReaders, double volumeRef, double errLimLo,
double errLimHi)
{
+ if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.TestBothStates;
this.regReaders = regReaders;
this.refVolume = refVolume;
diff --git a/TBF/Rig/Sequences/MainSeq.cs b/TBF/Rig/Sequences/MainSeq.cs
index b0e80bae6..de6b93b18 100644
--- a/TBF/Rig/Sequences/MainSeq.cs
+++ b/TBF/Rig/Sequences/MainSeq.cs
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
+using System.Net;
using log4net;
using NHibernate;
using Common;
@@ -1248,24 +1249,7 @@ namespace TBF.Rig.Sequences
//ON THE END run collector process if is actual (defined and actual process supports it)
if (testFinished && collector != null && collectDataAfterTests)
{
- IProcedureCameraCollect collectorParent = collector as IProcedureCameraCollect;
- collectorParent.DefineParentProcess(StateMachine.Procedure);
- ITestMethod testMethodCollector = collector as ITestMethod;
-
- if (testMethodCollector != null &&
- testMethodCollector.CanTest(StateMachine.Procedure.MetersKind))
- {
- try
- {
- log.InfoFormat("Test single {0}: Execute(., {1}, {2})", test.Name, repetNr,
- true);
- e = testMethodCollector.Execute(test, repetNr, true);
- }
- catch (Exception exception)
- {
- log.ErrorFormat("Read ", exception);
- }
- }
+ e = RunCollector(collector, test, repetNr);
}
if (testMethod.DoTransitions())
@@ -1336,6 +1320,33 @@ namespace TBF.Rig.Sequences
/// Update batch results, determine whether watermeters passed all required tests
///
+ State.Create("MainSeq : Collector")
+ .AddOperation(checkUiOp)
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (e.Contains(Event.UiCmdStop)) goto stop;
+ } while (false);
+
+ //--------------------------------
+ {
+ TBF.Rig.Generic.IComponent collector =
+ TbfComponents.FindFirstSequenceComponentImpl();
+ //ON THE END run collector process if is actual (defined and actual process supports it)
+ if (collector != null)
+ {
+ for (int i = 0; i < StateMachine.TestInstances.Length; i++)
+ {
+ int testIx = i;
+ Test test = StateMachine.TestInstances[testIx].Test;
+ int repetNr = StateMachine.TestInstances[testIx].Repetition;
+ e = RunCollector(collector, test, repetNr);
+ }
+ }
+ }
+
+
/// Determine the end of the last test and save it as the batch end time
DateTime lastTestEndTime = DateTime.MinValue;
if (BatchRslts.Batch.TestRslts != null)
@@ -1628,6 +1639,32 @@ namespace TBF.Rig.Sequences
return;
}
+ private static IList RunCollector(IComponent collector, Test test, int repetNr)
+ {
+ IProcedureCameraCollect collectorParent = collector as IProcedureCameraCollect;
+ collectorParent.DefineParentProcess(StateMachine.Procedure);
+ ITestMethod testMethodCollector = collector as ITestMethod;
+
+ IList e = null;
+ if (testMethodCollector != null &&
+ testMethodCollector.CanTest(StateMachine.Procedure.MetersKind))
+ {
+ try
+ {
+ log.InfoFormat("Test single {0}: Execute(., {1}, {2})", test.Name, repetNr,
+ true);
+ e = testMethodCollector.Execute(test, repetNr, true);
+ log.DebugFormat("Collector with name: {0} done with Events:{1} ", test.Name, e);
+ }
+ catch (Exception exception)
+ {
+ log.ErrorFormat("Read ", exception);
+ }
+ }
+
+ return e;
+ }
+
bool IsApprovedByLegalizator()
{
diff --git a/TBF/Rig/Sequences/MainSeqUtils.cs b/TBF/Rig/Sequences/MainSeqUtils.cs
index 68720e837..efa0d247f 100644
--- a/TBF/Rig/Sequences/MainSeqUtils.cs
+++ b/TBF/Rig/Sequences/MainSeqUtils.cs
@@ -663,6 +663,14 @@ namespace TBF.Rig.Sequences
testRslt.RepetitionNr == oriTstRslt.RepetitionNr)
{
testRslt.CopyContentFrom(oriTstRslt);
+
+ if (testRslt.TestDone)
+ {
+ //Question is waht behaviour is beter, but i will start again measurments
+ testRslt.TestMeasured = true;
+ testRslt.TestCollected = true;
+ }
+
break;
}
}
diff --git a/TBF/Rig/TestMethods/StandingStartMassCollectionAdvance/StandingStartMassCollectionAdvanceSeq.cs b/TBF/Rig/TestMethods/StandingStartMassCollectionAdvance/StandingStartMassCollectionAdvanceSeq.cs
index 8744b9349..09fad7557 100644
--- a/TBF/Rig/TestMethods/StandingStartMassCollectionAdvance/StandingStartMassCollectionAdvanceSeq.cs
+++ b/TBF/Rig/TestMethods/StandingStartMassCollectionAdvance/StandingStartMassCollectionAdvanceSeq.cs
@@ -1205,8 +1205,10 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.VolumeCTV, tstRslt.TestTime) + test.Uncertainty)
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.VolumeCTV, tstRslt.TestTime) - test.Uncertainty)
&& (tstRslt.ErrorFlags == 0);
- meterRslt.TestDone = true;
- tstRslt.TestDone = true;
+ meterRslt.TestDone = false;
+ tstRslt.TestDone = false;
+ tstRslt.TestMeasured = true;
+ tstRslt.TestCollected = false;
}
}
}
diff --git a/TBF/Rig/TestMethods/StandingStartMassCollectionAdvanceCollect/StandingStartMassCollectionAdvanceCollectSeq.cs b/TBF/Rig/TestMethods/StandingStartMassCollectionAdvanceCollect/StandingStartMassCollectionAdvanceCollectSeq.cs
index a555d2210..ccc2efebe 100644
--- a/TBF/Rig/TestMethods/StandingStartMassCollectionAdvanceCollect/StandingStartMassCollectionAdvanceCollectSeq.cs
+++ b/TBF/Rig/TestMethods/StandingStartMassCollectionAdvanceCollect/StandingStartMassCollectionAdvanceCollectSeq.cs
@@ -7,10 +7,8 @@ using System.IO;
using log4net;
using Common;
using Config.Entities;
-using TBF.Boxes;
using TBF.Resources;
using TBF.Rig.GenericDevices;
-using TBF.Rig.Network.RestAPI;
using TBF.Rig.Sequences;
using TBF.UiBridge;
@@ -46,8 +44,20 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
public IList Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
Common.DebugMode debugLevel)
{
-
IList e; /// Events from currently running operations
+ string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
+ Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
+
+ if (tstRslt != null &&
+ ((tstRslt.TestCollected && tstRslt.TestMeasured) ||
+ !tstRslt.TestMeasured)
+ )
+ {
+ //skip this
+ return new List();
+ }
+
+
int waterMetersCount = Math.Min(BenchInfo.WaterMetersCount, sensPath.RegisterReaders.Length);
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
@@ -65,11 +75,10 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath));
- string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
log.DebugFormat("Start the test - testName: {0}, test -> name: {1} -> Repeats: {2} -> repetitionNr: {3}", testName, test.Name, test.Repeats, repetitionNr);
-
- Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
+ /// Test if
+
///
/// Enter water meter begin states and read the start mass at the same time
///
@@ -202,6 +211,10 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.VolumeCTV, tstRslt.TestTime) + test.Uncertainty)
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.VolumeCTV, tstRslt.TestTime) - test.Uncertainty)
&& (tstRslt.ErrorFlags == 0);
+
+ meterRslt.TestDone = true;
+ tstRslt.TestDone = true;
+ tstRslt.TestCollected = true;
}
}
}
diff --git a/TBF/UiBridge/TestCompletedEventArgs.cs b/TBF/UiBridge/TestCompletedEventArgs.cs
index 2dc74b914..e84cb0821 100644
--- a/TBF/UiBridge/TestCompletedEventArgs.cs
+++ b/TBF/UiBridge/TestCompletedEventArgs.cs
@@ -2,7 +2,6 @@
/// Copyright (c) 2013-2016 Sensus Metering Systems
///
using System;
-using Config.Entities;
namespace TBF.UiBridge
{