Skip to main content

SF_ModeSelector

Tip

The version of the function block as described here corresponds to the latest version of the function block in Version list of function blocks.

Applicable safety standards

SF_ModeSelector is a certified PLCopen function block. For detailed information about applied standards, see "PLCopen – Technical Committee 5 – Safety Software".

Important

The requirements listed in the standards must be fulfilled by the user.

Interface description

This function block selects the system operation mode, such as manual, automatic, semi-automatic, etc.

Name

Data Type

Initial Value

Description, parameter values

Activate

BOOL

FALSE

General input parameters

S_Mode0

SAFEBOOL

FALSE

Variable or constant.

Input 0 of the mode selection switch

FALSE: Mode 0 is not requested by the operator

TRUE: Mode 0 is requested by the operator.

S_Mode1

SAFEBOOL

FALSE

Variable or constant.

Input 0 of the mode selection switch

FALSE: Mode 1 is not requested by the operator

TRUE: Mode 1 is requested by the operator.

S_Mode2

SAFEBOOL

FALSE

Variable or constant.

Input 2 of the mode selection switch

FALSE: Mode 2 is not requested by the operator

TRUE: Mode 2 is requested by the operator.

S_Mode3

SAFEBOOL

FALSE

Variable or constant.

Input 3 of the mode selection switch

FALSE: Mode 3 is not requested by the operator

TRUE: Mode 3 is requested by the operator.

S_Mode4

SAFEBOOL

FALSE

Variable or constant.

Input 4 of the mode selection switch

FALSE: Mode 4 is not requested by the operator

TRUE: Mode 4 is requested by the operator.

S_Mode5

SAFEBOOL

FALSE

Variable or constant.

Input 5 of the mode selection switch

FALSE: Mode 5 is not requested by the operator

TRUE: Mode 5 is requested by the operator.

S_Mode6

SAFEBOOL

FALSE

Variable or constant.

Input 6 of the mode selection switch

FALSE: Mode 6 is not requested by the operator

TRUE: Mode 6 is requested by the operator.

S_Mode7

SAFEBOOL

FALSE

Variable or constant.

Input 7 of the mode selection switch

FALSE: Mode 7 is not requested by the operator

TRUE: Mode 7 is requested by the operator.

S_Unlock

SAFEBOOL

FALSE

Variable or constant.

Locks the selected mode.

FALSE: The current S_ModeXSel output is locked, and therefore a change of any S_ModeX input does not lead to a change at the S_ModeXSel output, even in the case of a rising edge of the Set mode.

TRUE: The selected S_ModeXSel is not locked; a change of the mode selection is possible

S_SetMode

SAFEBOOL

FALSE

Variable (or constant FALSE, in case AutoSetMode = TRUE)

Sets the selected mode.

Operator confirms the setting of a mode. Any change to a new S_ModeX = TRUE leads to S_AnyModeSel/S_ModeXSel = FALSE, only a rising SetMode trigger edge will then result in a new S_ModeXSel = TRUE.

AutoSetMode

BOOL

FALSE

Constant

Parameterizes the confirmation mode.

FALSE: A change of mode must be confirmed by the operator via SetMode.

TRUE: A valid change of the S_ModeX input to another S_ModeX automatically leads to S_ModeXSel without operator confirmation via SetMode (as long as it is not locked by S_Unlock).

ModeMonitorTime

TIME

T#0

Constant

Maximum time allowed for changing the selection input.

The ModeMonitorTime caution note must be observed.

Reset

BOOL

FALSE

General input parameters

ModeMonitorTime

For developers in Extended Level: The ModeMonitorTime input has to be set to a constant value. This means that the value must not be changed for the calls.

Table 24. VAR_OUTPUT

Name

Data Type

Initial Value

Description, parameter values

Ready

SAFEBOOL

FALSE

General output parameters

S_Mode0Sel

SAFEBOOL

FALSE

Indicates that mode 0 is selected and confirmed.

FALSE: Mode 0 is not selected or not active.

TRUE: Mode 0 is selected and active.

S_Mode1Sel

SAFEBOOL

FALSE

Indicates that mode 1 is selected and confirmed.

FALSE: Mode 1 is not selected or not active.

TRUE: Mode 1 is selected and active.

S_Mode2Sel

SAFEBOOL

FALSE

Indicates that mode 2 is selected and confirmed.

FALSE: Mode 2 is not selected or not active.

TRUE: Mode 2 is selected and active.

S_Mode3Sel

SAFEBOOL

FALSE

Indicates that mode 3 is selected and confirmed.

FALSE: Mode 3 is not selected or not active.

TRUE: Mode 3 is selected and active.

S_Mode4Sel

SAFEBOOL

FALSE

Indicates that mode 4 is selected and confirmed.

FALSE: Mode 4 is not selected or not active.

TRUE: Mode 4 is selected and active.

S_Mode5Sel

SAFEBOOL

FALSE

Indicates that mode 5 is selected and confirmed.

FALSE: Mode 5 is not selected or not active.

TRUE: Mode 5 is selected and active.

S_Mode6Sel

SAFEBOOL

FALSE

Indicates that mode 6 is selected and confirmed.

FALSE: Mode 6 is not selected or not active.

TRUE: Mode 6 is selected and active.

S_Mode7Sel

SAFEBOOL

FALSE

Indicates that mode 7 is selected and confirmed.

FALSE: Mode 7 is not selected or not active.

TRUE: Mode 7 is selected and active.

S_AnyModeSel

SAFEBOOL

FALSE

Indicates that one of the 8 modes is selected and confirmed.

FALSE: No S_ModeX is selected.

TRUE: One of the 8 S_ModeX is selected and active.

Error

BOOL

FALSE

General output parameters

DiagCode

WORD

16#0000

Diagnostic codes



Figure 58. Function block: SF_ModeSelector
Function block: SF_ModeSelector


Functional description

This function block block selects the system operation mode, such as manual, automatic, semi-automatic, etc. When starting the controller, it should be assumed that the machine is in a safe mode. When starting the machine, the transition to the mode set by the mode selector must be initiated by a device input (e.g. START button of the machine).

The activation of the FB following the default state is the ModeChanged state. This is also the safe state of the FB, where all S_ModeXSel and S_AnyModeSel are FALSE.

. When the FB is in the ModeChanged state:
  • The new S_ModeX input must be confirmed with a rising S_SetMode trigger edge (in case AutoSetMode = FALSE), which leads to a new S_ModeXSel output.

  • The new S_ModeX input automatically leads to an S_ModeXSel output (in case AutoSetMode = TRUE).

  • Such a transition from state 8005 to 8000 is valid only if one S_ModeX input is TRUE. As long as all S_ModeX are FALSE, the FB remains in state 8005, even if S_SetMode triggers.

The transition from ModeChanged to ModeSelected state, that is S_SetMode is set by the operator, is not monitored by a timer.

When the FB is in the ModeSelected state, the simultaneous occurrence of a new S_ModeX input (higher priority) and the NOT S_Unlock signal (lower priority) leads to the ModeChanged state.

The S_ModeX input parameters which are not used for mode selection should be assigned the default value FALSE to simplify the verification of the program.

Caution

The AutoSetMode input should be activated only if it is guaranteed that no hazard can occur when the S-PLC is started.

Status diagram

Figure 59. Status diagram: SF_Modeselector
Status diagram: SF_Modeselector


Tip

Note: The transition from any state to the Idle state, initiated by Activate = FALSE, is not shown. In every case, these transitions have the highest priority.

Typical timing diagrams

Figure 60. Timing diagram 1: SF_ModeSelector
Timing diagram 1: SF_ModeSelector


Figure 61. Timing diagram 2: SF_ModeSelector, error condition 2 for mode inputs
Timing diagram 2: SF_ModeSelector, error condition 2 for mode inputs


Figure 62. Timing diagram 3: SF_ModeSelector
Timing diagram 3: SF_ModeSelector


Error detection

. The FB detects when none of the mode inputs is selected. This invalid condition is detected after the ModeMonitorTime expires:
  • Which restarts at each falling trigger edge of an S_ModeX input

  • Which is then in the ModeChanged state, which follows the activation of the FB.

In contrast, the FB directly detects whether or not more than one S_ModeX input is selected at the same time.

A static reset condition is detected when the FB is in either error state C001 or C002.

Error behavior

In the case of an error event, the S_ModeXSel and S_AnyModeSel outputs are set to the safe state (FALSE). The DiagCode input displays the relevant error code and the Error output is set to TRUE.

An error must be detected with the rising trigger edge of the Reset BOOL input. The FB switches from an Error state to the ModeChanged state.

FB-specific status and error codes

Table 25. FB-specific error codes

DiagCode

Statue Name

Status description and output setting

16#C001

Error

Short-circuit

The FB detects that two or more S_ModeX are TRUE (for example, short-circuiting of lines).

Ready = TRUE

Error = TRUE

S_AnyModeSel = FALSE

All S_ModeXSel = FALSE

16#C002

Error

Open-circuit

The FB detects that all S_ModeX are FALSE. The time interval following a falling S_ModeX trigger edge exceeds the ModeMonitorTime (for example, short-circuiting of lines)

Ready = TRUE

Error = TRUE

S_AnyModeSel = FALSE

All S_ModeXSel = FALSE

16#C003

Reset Error 1

Static reset signal detected in status C001.

Ready = TRUE

Error = TRUE

S_AnyModeSel = FALSE

All S_ModeXSel = FALSE

16#C004

Reset Error 2

Static reset signal detected in status C002.

Ready = TRUE

Error = TRUE

S_AnyModeSel = FALSE

All S_ModeXSel = FALSE



Table 26. FB-specific status codes (no error)

DiagCode

Statue Name

Status description and output setting

16#0000

Idle

The function block is not active (basic state).

Ready = FALSE

Error = FALSE

S_AnyModeSel = FALSE

All S_ModeXSel = FALSE

16#8005

ModeChanged

Status after activation or when S_ModeX has changed (except locked) or after reset of an error status

Ready = TRUE

Error = FALSE

S_AnyModeSel = FALSE

All S_ModeXSel = FALSE

16#8000

ModeSelected

Valid mode selection, but not yet locked.

Ready = TRUE

Error = FALSE

S_AnyModeSel = TRUE

S_ModeXSel = Selected X is TRUE; others are FALSE

16#8004

ModeLocked

Valid mode selection is locked.

Ready = TRUE

Error = FALSE

S_AnyModeSel = TRUE

S_ModeXSel = Selected X is TRUE; others are FALSE