In current project there is a safety light grid controlling valve terminal ouputs voltage. One part of the machine is loading mechanism, which runs all the time and loads components when it is necessary. During this operation about 6 mechanical movements are executed in one sequence.
During the cycle, operator puts some parts into the machine and iterrupts signal from safety light grid which producess error mesages from BasMove objects because of missing air pressure at valve terminal.
I would like to suppress these messages when the light grid is interrupted, but I do not how to do that correctly. Is it possible to pause chain or object execution when the grid inactive?
Solved! Go to Solution.
You can pause a chain with _env.ChainControl:=OpconChainControl.PAUSE (and implement OnChainPause with return value OK to continue chain).
But once an object command is started, it cannot be paused. Therefore the chain pause doesn't help you.
The only solution that comes into my mind: if the light grid is interrupted, the BasMoves must be canceled (e.g. implement the method CmdHandlerUnit._manageLightGrid). I would suggest to use BasMove.Unit.Execute:=FALSE to cancel only the BasMoves that are already running. BasMove.Unit.Cancel:=TRUE would cancel also the ones that are currently not running.
Very important is the waiting step in your chains: You cannot use the default implemention with CheckUnitDone or ExecuteUnit. You must explicitly check for ExecState=CANCEL (or ExecState=READY which will be reached after cancel) and then jump back to the start step (or just set Execute again to repeat the command).
When repeating the command, you could get a PreStartCheck error if the cylinder is not in a defined end position. You can prevent this error with one of these settings: