Zmeny urobene v ST pri testovani kamery
This commit is contained in:
@@ -74,7 +74,10 @@ namespace TBF.BenchControl.Cameras.IdcCamera
|
||||
{
|
||||
get
|
||||
{
|
||||
if (measurements.Count < 1 || wm_nrBegin >= measurements.Count) return 0;
|
||||
if (measurements.Count < 1 || wm_nrBegin >= measurements.Count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return measurements[measurements.Count - 1].angle - measurements[wm_nrBegin].angle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace TBF.BenchControl.Elde
|
||||
#if FUZHOU300
|
||||
if ((FMFreq == null) || (FMFreq.Length != 6))
|
||||
{
|
||||
if (index == 0) FMFreq = new float[6] { power, 0, 0, 0, 0, 0 };
|
||||
if (index == 0) FMFreq = new float[6] { power, 0, 0, 0, 0, 0 };
|
||||
else if (index == 1) FMFreq = new float[6] { 0, power, 0, 0, 0, 0 };
|
||||
else if (index == 2) FMFreq = new float[6] { 0, 0, power, 0, 0, 0 };
|
||||
else if (index == 3) FMFreq = new float[6] { 0, 0, 0, power, 0, 0 };
|
||||
@@ -139,9 +139,9 @@ namespace TBF.BenchControl.Elde
|
||||
FMFreq[index] = power;
|
||||
}
|
||||
#else
|
||||
if (index == 0) FMFreq = new float[2] { power, 0 };
|
||||
if (index == 0) FMFreq = new float[2] { power, 0 };
|
||||
else if (index == 1) FMFreq = new float[2] { 0, power };
|
||||
else FMFreq = new float[2] { 0, 0 };
|
||||
else FMFreq = new float[2] { 0, 0 };
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -161,7 +161,11 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
if (cfg == null) throw new ArgumentNullException("cfg");
|
||||
this.controlBoardCfg = cfg;
|
||||
#if FUZHOU300
|
||||
FMFreq = new float[6] { 0, 0, 0, 0, 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300=6
|
||||
#else
|
||||
FMFreq = new float[2] { 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300=6
|
||||
#endif
|
||||
emergencyStop = false;
|
||||
previousEmergencyStop = false;
|
||||
}
|
||||
|
||||
+40
-102
@@ -17,19 +17,9 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
|
||||
IList<Event> e; /// Events from currently running operations
|
||||
Event retVal = Event.Done;
|
||||
|
||||
//--------------------------------
|
||||
State.Create("RoiDetection : Starting the detection sequence")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.StopPreviousOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) goto stop;
|
||||
}
|
||||
while (!e.Contains(Event.PreviousStopped));
|
||||
|
||||
processDataLoggingOp = null;
|
||||
|
||||
//====================================
|
||||
/// Start the test, initialize test results
|
||||
@@ -38,13 +28,14 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
|
||||
tstRslt.DoNotEvaluate = true;
|
||||
tstRslt.DoNotPublish = true;
|
||||
|
||||
|
||||
//====================================
|
||||
// Transition or SetRoute - Start
|
||||
//====================================
|
||||
switch (Transition(transitionStart, TransitionContext.TestStart))
|
||||
{
|
||||
case Event.Error: goto error;
|
||||
case Event.UiCmdStop: goto stop;
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
@@ -58,7 +49,7 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) goto stop;
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
@@ -70,8 +61,10 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) goto stop;
|
||||
if (e.Contains(Event.RegulValveTimeOut)) goto error;
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.RegulValveTimeOut)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.Next)) goto flow_set;
|
||||
}
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
@@ -98,106 +91,51 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
if (e.Contains(Event.UiCmdStop)) goto stop;
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.CameraBusy));
|
||||
|
||||
if (e.Contains(Event.CameraOpFailed)) goto error; /// TODO: resolve in some other way
|
||||
if (e.Contains(Event.CameraOpFailed))
|
||||
{
|
||||
retVal = Event.Error;
|
||||
Bridge.OnActivity(this, Strings.Detection_failed);
|
||||
goto stopTest;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Detection_completed);
|
||||
//------------------------------------------------
|
||||
State.Create("RoiDetection : Stopping the pump")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
|
||||
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) goto stop;
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
|
||||
//--------------------------------
|
||||
State.Create("RoiDetection : Stopping diverter, gate, etc.")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.StopPreviousOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) goto stop;
|
||||
}
|
||||
while (!e.Contains(Event.PreviousStopped));
|
||||
stopTest:
|
||||
|
||||
///----------------------///
|
||||
/// Quit this sequence ///
|
||||
///----------------------///
|
||||
|
||||
/// Stop the pump
|
||||
State.Create("RoiDetection : Detection of ROI-s completed -> Stopping the pump")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
|
||||
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet) || ((inPath.Pump is GenericDevices.IPumpFM) && !e.Contains(Event.TurnPumpOnOffDone)));
|
||||
|
||||
/// Transition or SetRoute - End
|
||||
switch (Transition(transitionStop, TransitionContext.TestEnd))
|
||||
State.Create("FlyingStartCollectionMethod : Stopping diverter, gate, etc.")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.StopPreviousOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
case Event.Error: goto error;
|
||||
case Event.UiCmdStop: goto stop;
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.PreviousStopped));
|
||||
|
||||
/// Transition sequence at the end of test
|
||||
/// Prevent overwriting 'retVal' in case it was set to non-default value earlier
|
||||
switch (Transition(transitionStop, TransitionContext.TestEnd))
|
||||
{
|
||||
case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
|
||||
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
|
||||
}
|
||||
|
||||
/// Create the return value: a list with one event Event.Done
|
||||
IList<Event> retval = new List<Event>();
|
||||
retval.Add(Event.Done);
|
||||
return retval;
|
||||
|
||||
//====================================
|
||||
stop:
|
||||
cBrd.SetFMFreq(0, 0); /// Stop FM controlled pumps
|
||||
State.Create("RoiDetection : User selected STOP -> Closing the valves")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
|
||||
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
IList<Event> retval2 = new List<Event>();
|
||||
retval2.Add(Event.UiCmdStop);
|
||||
return retval2;
|
||||
|
||||
//====================================
|
||||
error:
|
||||
cBrd.SetFMFreq(0, 0); /// Stop FM controlled pumps
|
||||
State.Create("RoiDetection : ERROR -> Closing the valves")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
|
||||
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
IList<Event> retval3 = new List<Event>();
|
||||
retval3.Add(Event.Error);
|
||||
return retval3;
|
||||
}
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retList = new List<Event>();
|
||||
retList.Add(retVal);
|
||||
return retList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
|
||||
/// float timeSec = 3600.0f * timeHr;
|
||||
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
|
||||
int totalPulses = (int)(test.Volume / ltrPerRefPulse);
|
||||
|
||||
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this);
|
||||
|
||||
int repetitionNr = 1; /// First test: repetitionNr=1
|
||||
@@ -134,13 +134,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.RegulValveTimeOut)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.RegulValveTimeOut)) { log.Warn("FlowSetTimeout"); retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.Next)) goto flow_set;
|
||||
}
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
|
||||
flow_set:
|
||||
|
||||
int time = StateMachine.Time;
|
||||
float currentFlow = refFlow.Val;
|
||||
|
||||
|
||||
@@ -429,6 +429,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Detection failed.
|
||||
/// </summary>
|
||||
internal static string Detection_failed {
|
||||
get {
|
||||
return ResourceManager.GetString("Detection_failed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Detection threshold [%].
|
||||
/// </summary>
|
||||
|
||||
@@ -844,4 +844,7 @@
|
||||
<data name="WMState" xml:space="preserve">
|
||||
<value>State:</value>
|
||||
</data>
|
||||
<data name="Detection_failed" xml:space="preserve">
|
||||
<value>Detection failed</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user