Skip to main content

startMode

Short Summary

This method starts the currently selected operation mode if all safety requirements are met.

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

Parameters

NameTypeCommentKind
nodeCNM_OpModeHandlingInterfaces.INodeoptionally: a specified node in the tree that is not the subtree (if 0, the rootNode will be adressed)input

Code

Declaration

METHOD startMode :CNM_ReturnTypes.SingleExecutionResult
VAR_INPUT
(* optionally: a specified node in the tree that is not the subtree (if 0, the rootNode will be adressed) *)
node : CNM_OpModeHandlingInterfaces.INode := 0;
END_VAR
VAR
apiNode :INodeApi;
END_VAR

Implementation

IF ( THIS^.safetyRelease ) AND_THEN (THIS^.root.nodeState <> CNM_ReturnTypes.SingleExecutionState.BUSY) THEN
THIS^.modeControlGlobal.stop := FALSE;
THIS^.root.enableStepping := FALSE;
THIS^.pause := FALSE;
THIS^.runMode := TRUE;
startMode := CNM_ReturnTypes.SingleExecutionResult.SUCCESS;
ELSE
startMode := CNM_ReturnTypes.SingleExecutionResult.ABORTED;
END_IF