(1) State of the RegulValve checked after ValveMove (#, position, ...), (2) RFID results are saved only when SimultWithPrevious == true.
This commit is contained in:
@@ -469,6 +469,7 @@ namespace TBF.BenchControl.DB.SensusOracle
|
|||||||
|
|
||||||
public Retv WriteLogsToDisk(Results.Entities.Batch batch)
|
public Retv WriteLogsToDisk(Results.Entities.Batch batch)
|
||||||
{
|
{
|
||||||
|
#if IPERLST
|
||||||
if (logger == null) return Retv.Error;
|
if (logger == null) return Retv.Error;
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -723,7 +724,7 @@ namespace TBF.BenchControl.DB.SensusOracle
|
|||||||
log.ErrorFormat("Results not saved to disk: {0}", exc.Message);
|
log.ErrorFormat("Results not saved to disk: {0}", exc.Message);
|
||||||
return Retv.Error;
|
return Retv.Error;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return Retv.OK; /// OK
|
return Retv.OK; /// OK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,20 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
return string.Format("SetRegulValvePositionOp({0},{1},{2})", regulValve.Name, posLoPct, posHiPct);
|
return string.Format("SetRegulValvePositionOp({0},{1},{2})", regulValve.Name, posLoPct, posHiPct);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int CoaxValveNr = 7; /// Coax. valve has number 7
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Internal states of this operation
|
||||||
|
///
|
||||||
|
enum OpState
|
||||||
|
{
|
||||||
|
Idle = 0,
|
||||||
|
MoveToPosition, /// Send commend to move to position
|
||||||
|
CheckState, /// Check RV state by reading statos word
|
||||||
|
MovingToPosition, /// Command passed OK, RV is moving to a position
|
||||||
|
}
|
||||||
|
OpState opState;
|
||||||
|
|
||||||
/// Set by the constructor
|
/// Set by the constructor
|
||||||
readonly ControlBoardDev controlBoard;
|
readonly ControlBoardDev controlBoard;
|
||||||
readonly RegulValve regulValve;
|
readonly RegulValve regulValve;
|
||||||
@@ -72,6 +86,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
positionReached = false;
|
positionReached = false;
|
||||||
expireTime = StateMachine.Time + timeout;
|
expireTime = StateMachine.Time + timeout;
|
||||||
log.InfoFormat("Start(): RV#={0}, reqPosLo={1}%, reqPosHi={2}%", regulValveNr, posLoPct.ToString("F1"), posHiPct.ToString("F1"));
|
log.InfoFormat("Start(): RV#={0}, reqPosLo={1}%, reqPosHi={2}%", regulValveNr, posLoPct.ToString("F1"), posHiPct.ToString("F1"));
|
||||||
|
opState = OpState.MoveToPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Run this operation</summary>
|
/// <summary>Run this operation</summary>
|
||||||
@@ -82,7 +97,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public Event Run()
|
public Event Run()
|
||||||
{
|
{
|
||||||
if (firstRun)
|
if (opState == OpState.MoveToPosition)
|
||||||
{
|
{
|
||||||
if (posLoPct > posHiPct || (!regulValve.IsCoax && posLoPct == posHiPct) ||
|
if (posLoPct > posHiPct || (!regulValve.IsCoax && posLoPct == posHiPct) ||
|
||||||
posLoPct > 100.0f || posHiPct < 0)
|
posLoPct > 100.0f || posHiPct < 0)
|
||||||
@@ -96,41 +111,57 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
RegulValveMode.TargetPosition,
|
RegulValveMode.TargetPosition,
|
||||||
new float[2] { posLoPct, posHiPct },
|
new float[2] { posLoPct, posHiPct },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
|
opState = OpState.CheckState;
|
||||||
return Event.None;
|
return Event.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (positionReached) return Event.PositionReached;
|
if (positionReached) return Event.PositionReached;
|
||||||
|
|
||||||
float positionPct = controlBoard.RValvePosition(regulValveNr);
|
float positionPct = controlBoard.RValvePosition(regulValveNr);
|
||||||
log.WarnFormat("Run(): RV#={0}, actPos={1}%", regulValveNr, positionPct.ToString("F1"));
|
log.WarnFormat("Run(): RV#={0}, actPos={1}%", regulValveNr, positionPct.ToString("F1"));
|
||||||
|
|
||||||
if (posLoPct >= posHiPct || posLoPct >= 100.0f || posHiPct <= 0)
|
if (opState == OpState.CheckState)
|
||||||
{
|
{
|
||||||
return Event.OpArgumentError;
|
if (regulValveNr == CoaxValveNr && ((ulong)controlBoard.StatusP & (ulong)StatusP.CoaxRegValveBusy) == 0)
|
||||||
}
|
{
|
||||||
else if (posLoPct <= positionPct && positionPct <= posHiPct)
|
opState = OpState.MoveToPosition;
|
||||||
{
|
return Event.None;
|
||||||
positionReached = true;
|
}
|
||||||
return Event.PositionReached;
|
else if (posLoPct <= positionPct && positionPct <= posHiPct)
|
||||||
}
|
{
|
||||||
else if (StateMachine.Time > expireTime)
|
positionReached = true;
|
||||||
{
|
return Event.PositionReached;
|
||||||
return Event.RegulValveTimeOut;
|
}
|
||||||
}
|
else if ((regulValveNr < 6) && (controlBoard.RegulValveState(regulValveNr) != RegulValveState.DacValueRegul))
|
||||||
else
|
{
|
||||||
{
|
opState = OpState.MoveToPosition; /// Resend move command again in the next run
|
||||||
return Event.None;
|
return Event.None;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
opState = OpState.MovingToPosition;
|
||||||
|
return Event.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (StateMachine.Time > expireTime)
|
||||||
|
{
|
||||||
|
return Event.RegulValveTimeOut;
|
||||||
|
}
|
||||||
|
else if (opState == OpState.MovingToPosition)
|
||||||
|
{
|
||||||
|
if (posLoPct <= positionPct && positionPct <= posHiPct)
|
||||||
|
{
|
||||||
|
positionReached = true;
|
||||||
|
return Event.PositionReached;
|
||||||
|
}
|
||||||
|
return Event.None;
|
||||||
|
}
|
||||||
|
return Event.None;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Stop this operation</summary>
|
/// <summary>Stop this operation</summary>
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
if (!regulValve.IsCoax)
|
|
||||||
{
|
|
||||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.Stop,
|
|
||||||
new float[2] { posLoPct, posHiPct }, regulValve.StableTime);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -545,7 +545,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
|||||||
CommCompletedHandler = null;
|
CommCompletedHandler = null;
|
||||||
AllCompletedHandler = null;
|
AllCompletedHandler = null;
|
||||||
|
|
||||||
UpdateRfidCommResult(tests); /// TODO: Pass the test info in a correct way
|
if (multiTestParams != null && multiTestParams.Count > 0 && multiTestParams[0].SimultWithPrevious)
|
||||||
|
{
|
||||||
|
UpdateRfidCommResult(tests); /// TODO: Pass the test info in a correct way
|
||||||
|
}
|
||||||
|
|
||||||
TBF.UiBridge.Bridge.OnTestCompleted(this, new TBF.UiBridge.TestCompletedEventArgs(StateMachine.Tests[0].Name, 0));
|
TBF.UiBridge.Bridge.OnTestCompleted(this, new TBF.UiBridge.TestCompletedEventArgs(StateMachine.Tests[0].Name, 0));
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2015 Sensus Metering Systems
|
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||||
/// Author: Milan Hanajík
|
/// Author: Milan Hanajík
|
||||||
///
|
///
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
Reference in New Issue
Block a user