7 stater machine: query examples, Stater machine: query examples, Architecture: the applicationtemplate in detail – Lenze PLC Designer ApplicationTemplate (PLC Designer R3-x) User Manual

Page 89

Advertising
background image

Lenze · ApplicationTemplate · 1.3 EN - 04/2013

89

Architecture: The ApplicationTemplate in detail

Displaying the states of the state machine - FB L_EATP_SMAccess

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

9.6

Displaying the states of the state machine - FB L_EATP_SMAccess

The Statemachine FUP method serves to display the current state of the state machine from a

module application (MAP).



L_EATP_SMAccess

( 126)

• In the ApplicationTemplate, every machine module features one module application for which

an instance of this block with the SMAccess instance name is created.

• The Statemachine FUP method calls the instance of the L_EATP_SMAccess(SMAccess) block.

9.7

Stater machine: Query examples

This section shows (by the use of program examples) how...

• ...to access the state machine.
• ...to query the states.

Objective/call

Example

Querying the current state

• IF condition

• Module's intrinsic/subordinated

module status enquiry by method

IF baseChannelGetActualState (MM_Address:= ) =
L_EATP_SMStates.Manual THEN

// Do something if Statemachine is in state MANUAL

END_IF

• IF condition

• Query the module's intrinsic

status

IF StateMachine.xActStateIsAutomatic THEN

// Do something if Statemachine is in state AUTOMATIC

END_IF

• CASE instruction

• Module's intrinsic/subordinated

module status enquiry by method

CASE baseChannelGetActualState (MM_Address:= ) OF

L_EATP_SMStates.Ready:

// Do something if Statemachine is in state READY

;

L_EATP_SMStates.Service:

// Do something else if Statemachine is in state SERVICE

L_EATP_SMStates.Quickstop:

// Do something else if Statemachine is in state
QUICKSTOP

;

END_CASE

Querying an active warning

• IF condition

• Query the module's intrinsic

warning

IF StateMachine.xWarning THEN

// Do something if warning is active

ELSE

// Do something else if warning is not active

END_IF

Querying the setpoint state of the master

• IF condition

• Based on signals with eSetState

signal

IF StateMachine.xActStateIsAutomatic THEN

IF StateMachine.eSetState = L_EATP_SMStates.Ready
THEN

// Do something if actual state is AUTOMATIC and set
state to READY

;

END_IF

END_IF

Enabling state transition from "Init" to "Ready" (initialisation completed)

SMEnableIitToReady (xValue := TRUE);

Advertising