(1) State of the RegulValve checked after ValveMove (#, position, ...), (2) RFID results are saved only when SimultWithPrevious == true.
This commit is contained in:
parent
1278a2365d
commit
6e2bf48b43
@ -469,6 +469,7 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
|
||||
public Retv WriteLogsToDisk(Results.Entities.Batch batch)
|
||||
{
|
||||
#if IPERLST
|
||||
if (logger == null) return Retv.Error;
|
||||
|
||||
try
|
||||
@ -723,7 +724,7 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
log.ErrorFormat("Results not saved to disk: {0}", exc.Message);
|
||||
return Retv.Error;
|
||||
}
|
||||
|
||||
#endif
|
||||
return Retv.OK; /// OK
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,20 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
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
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly RegulValve regulValve;
|
||||
@ -72,6 +86,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
positionReached = false;
|
||||
expireTime = StateMachine.Time + timeout;
|
||||
log.InfoFormat("Start(): RV#={0}, reqPosLo={1}%, reqPosHi={2}%", regulValveNr, posLoPct.ToString("F1"), posHiPct.ToString("F1"));
|
||||
opState = OpState.MoveToPosition;
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
@ -82,7 +97,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (firstRun)
|
||||
if (opState == OpState.MoveToPosition)
|
||||
{
|
||||
if (posLoPct > posHiPct || (!regulValve.IsCoax && posLoPct == posHiPct) ||
|
||||
posLoPct > 100.0f || posHiPct < 0)
|
||||
@ -96,41 +111,57 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
RegulValveMode.TargetPosition,
|
||||
new float[2] { posLoPct, posHiPct },
|
||||
regulValve.StableTime);
|
||||
opState = OpState.CheckState;
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
if (positionReached) return Event.PositionReached;
|
||||
if (positionReached) return Event.PositionReached;
|
||||
|
||||
float positionPct = controlBoard.RValvePosition(regulValveNr);
|
||||
log.WarnFormat("Run(): RV#={0}, actPos={1}%", regulValveNr, positionPct.ToString("F1"));
|
||||
float positionPct = controlBoard.RValvePosition(regulValveNr);
|
||||
log.WarnFormat("Run(): RV#={0}, actPos={1}%", regulValveNr, positionPct.ToString("F1"));
|
||||
|
||||
if (posLoPct >= posHiPct || posLoPct >= 100.0f || posHiPct <= 0)
|
||||
{
|
||||
return Event.OpArgumentError;
|
||||
}
|
||||
else if (posLoPct <= positionPct && positionPct <= posHiPct)
|
||||
{
|
||||
positionReached = true;
|
||||
return Event.PositionReached;
|
||||
}
|
||||
else if (StateMachine.Time > expireTime)
|
||||
{
|
||||
return Event.RegulValveTimeOut;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.None;
|
||||
}
|
||||
}
|
||||
if (opState == OpState.CheckState)
|
||||
{
|
||||
if (regulValveNr == CoaxValveNr && ((ulong)controlBoard.StatusP & (ulong)StatusP.CoaxRegValveBusy) == 0)
|
||||
{
|
||||
opState = OpState.MoveToPosition;
|
||||
return Event.None;
|
||||
}
|
||||
else if (posLoPct <= positionPct && positionPct <= posHiPct)
|
||||
{
|
||||
positionReached = true;
|
||||
return Event.PositionReached;
|
||||
}
|
||||
else if ((regulValveNr < 6) && (controlBoard.RegulValveState(regulValveNr) != RegulValveState.DacValueRegul))
|
||||
{
|
||||
opState = OpState.MoveToPosition; /// Resend move command again in the next run
|
||||
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>
|
||||
public void Stop()
|
||||
{
|
||||
if (!regulValve.IsCoax)
|
||||
{
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.Stop,
|
||||
new float[2] { posLoPct, posHiPct }, regulValve.StableTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -545,7 +545,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
CommCompletedHandler = 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));
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||
/// Author: Milan Hanajík
|
||||
///
|
||||
using System;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user