stopMode
Short Summary
This method stops the currently running operation mode. If the immediately flag is set, the current operation mode will be aborted and the machine will execute a fast stop. If it is not set, the stop request flag for all nodes will be set and the operation modes should exit with a defined state.
Example
CASE step OF
0: // choose and set mode
IF (handler.setMode(automaticMode) = SUCCESS ) THEN
step := 1;
END_IF
1: // start mode
IF (handler.startMode() = SUCCESS) THEN
step := 2;
END_IF
2: // stop mode if requested
IF ( stopRequested ) THEN
IF ( handler.stopMode() = SUCCESS ) THEN
step := 0;
END_IF
END_IF
END_CASE
- Return type: CNM_ReturnTypes.SingleExecutionState
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| immediately | BOOL | if this flag is set, the current operation mode will be aborted and the machine will execute a fast stop | input |
Code
Declaration
METHOD stopMode : CNM_ReturnTypes.SingleExecutionState
VAR_INPUT
(* if this flag is set, the current operation mode will be aborted and the machine will execute a fast stop *)
immediately :BOOL := FALSE;
END_VAR
Implementation
stopMode := CNM_ReturnTypes.SingleExecutionState.BUSY;
IF ( immediately ) THEN
THIS^.stopImmediateRequired := TRUE;
THIS^.runMode := FALSE;
THIS^.root.handleNodeRequest(execute := TRUE, request := THIS^.requests.stopImmediate);
IF ((stopMode := THIS^.root.nodeState) = CNM_ReturnTypes.SingleExecutionState.SUCCESS) THEN
THIS^.root.handleNodeRequest(execute := FALSE, request := THIS^.requests.stopImmediate);
END_IF
ELSE
THIS^.modeControlGlobal.stop := TRUE;
IF ((stopMode := THIS^.root.nodeState) = CNM_ReturnTypes.SingleExecutionState.SUCCESS) THEN
THIS^.runMode := FALSE;
END_IF
END_IF