FB_XpsuMain - General Information

Overview

Type:

Function block

Available as of:

V1.0.4.0

Inherits from:

-

Implements:

-

Functional Description

The function block FB_XpsuMain evaluates the diagnostics codes decoded by the function block FB_XpsuDiag. Based on the diagnostics codes, the function block performs calculations that let you track and manage maintenance and service life requirements (for example, due dates for proof tests or replacements) for the XPSU safety module itself as well as connected equipment such as sensors, command devices, and actuators. The function block provides counters for the number of remaining cycles:

  • Counters for remaining cycles of the safety-related input channels: One cycle corresponds to one activation of a safety-related input channel.

  • Counters for remaining cycles of the safety-related outputs: One cycle corresponds to one activation of a safety-related output.

  • Counter for remaining cycles of the safety module itself: Once cycle corresponds to one transition from the defined safe state to the defined non-safe state of the XPSU safety module.

NOTE: Refer to the user guide of your XPSU safety module for details on the use of the terms activation and deactivation, and on the defined safe state.

The counters allow you to monitor the number of operations of equipment connected to the XPSU safety module as a function of the cycles of the safety-related inputs and the safety-related outputs.

NOTE: The present documents refers to the number of “cycles of the safety-related input channels” and the number of “cycles of the safety-related outputs” as defined above. Whether or not this corresponds to the number of cycles of the equipment connected depends on the definition of a cycle for such equipment. For example, if a device connected to a safety-related input counts one “off-on” and one “on-off” operation as two separate cycles, this corresponds to one cycle of the safety-related input (one activation) of the XPSU safety module.

Typical scenarios for managing the counters include replacements of input devices or output devices as well as a replacement of the XPSU safety module itself. If you replace the XPSU safety module and activate a new XPSU safety module via the input i_xNewModuleActive, the counter for the total number of cycles is reset to zero. Since a replacement of the XPSU safety module may not necessitate a replacement of the connected equipment, the values of the counters for the safety-related inputs and the safety-related outputs retain the values at the time of the replacement. If you need to replace connected equipment or add further equipment, you can reset the corresponding counters to zero.

In addition, the function block can be used to monitor and manage the due dates of proof tests required for the safety-related function and/or the equipment used to implement it.

Both function blocks FB_XpsuMain and FB_XpsuDiag must be called in the same task cycle.

In order to evaluate the diagnostics code received from the function block FB_XpsuDiag, the function block FB_XpsuMain needs to be activated by setting the value at its input i_xEnable to TRUE. If the value at the input i_xEnable is set to FALSE, the diagnostics codes are no longer evaluated and the outputs of the function block are set to their default values.

The input i_dwStatus is connected to the output q_dwStatus of the function block FB_XpsuDiag. The input i_xValid is connected to the output q_xValid of the function block FB_XpsuDiag.

The function block receives the diagnostics information serving as the basis for the calculations via its input i_dwStatus.

Configuration of the Function Block

To be able to calculate the remaining number of cycles of the safety-related inputs, the safety-related outputs and the safety module itself, the function block requires the following information:

  • The safety-related inputs and the safety-related outputs to be monitored.

  • The maximum number of cycles for each safety-related input, each safety-related output and the XPSU safety module itself. These values are taken as the start values and decreased by each cycle detected by the function block FB_XpsuDiag.

NOTE: Cycles may not be detected if activation and deactivation occur too fast or if several inputs switch at the same time. Refer to General Considerations for details.

The required information is provided in the form of data structures connected to the corresponding inputs of the function block. These data structures map the hardware implementation, that is, the input devices/sensors connected to the safety-related inputs and the actuators connected to the safety-related outputs of the XPSU safety module:

  • The structure ST_InputControl is provided for the counters for the cycles of the safety-related inputs. The structure configures the input channels (CH+ (or CH- in the case of XPSUAK and XPSUAT)) of the safety-related inputs of the XPSU safety module to which the input devices/sensors are connected. An array of this structure with the length of six has to be connected to the input i_astControlInp.

  • The structure ST_DevControl is provided for the counters for the safety-related outputs and for the counter for the XPSU safety module itself.
    • The structure has to be connected to the input i_stControlProc (counter for the cycles of the XPSU safety module itself).

    • An array of the structure with the length of 13 has to be connected to the input i_astControlOut (counters for the cycles of the safety-related outputs).

The structure ST_RemainNumOp provides the information on the remaining number of cycles for the safety-related inputs, the safety-related outputs, and the XPSU safety module itself. This structure has to be connected to the output q_stRemainNumOp of the function block.

NOTE: To keep the counters from being reset, declare the related variables as persistent variables. See Persistent Variables for details.

The output q_xOpExceeded is set toTRUE if at least one structure element of the structure ST_RemainNumOp has the value 0. This means that no cycles are left for the corresponding safety-related input, safety-related output, or the XPSU safety module itself. The value at the output q_wExceededId indicates the affected safety-related input or safety-related output, or the XPSU safety module itself.

The output q_udiNumOpSystem provides the total number of cycles of the XPSU safety module.

Proof Tests

Safety-related functions and the hardware used for their implementation require proof tests at specific intervals. The function block lets you track and manage such proof test. The date and time of the proof test are set via the input i_dtTestIntervalRef. The interval between consecutive proof tests is set via the input i_udiTestInterv. After having performed a proof test, confirm this with a rising edge at the input i_xTestExecuted. The confirmed date for the first proof test is available at the output q_datTestStart. The due date for the next proof test is provided at the output q_datNextProof. The function block provides time stamps of the last ten proof tests in an array at the output q_adtProofTests.

If you add or replace an XPSU safety module, confirm this with a rising edge at the input i_xNewModuleActive. This confirmation also resets the time stamp array, enters the time stamp in the first array element, and updates the value at the output q_datTestStart.

The value TRUE at the output q_xTestIntervViol indicates that the specified interval has been exceeded, that is, the proof test has not been performed on schedule.

Proof test time stamps can also be loaded from an external proof test array, for example, if the XPSU safety module is connected to a different controller. Such arrays can, for example, originate from an HMI application. To load an external time stamp array, set the input i_xSaveBProofTest to TRUE. As a result, the array connected to the input i_adtProofTests is read and copied to the internal array.

If the value at the output q_xActive is TRUE, the function block is activated. The outputs q_xError and q_wErrorId provide information on detected errors.

Interface

Input

Data type

Description

i_xEnable

BOOL

TRUE activates the function block.

i_dwStatus

DWORD

Connect this input to the output q_dwStatus of the function block FB_XpsuDiag.

The function block processes this status information and writes the data to the structures connected to the outputs.

i_xValid

BOOL

Connect this input to the output q_xValid of the function block FB_XpsuDiag.

i_stControlProc

ST_DevControl

The structure ST_DevControl connected to this input sets the maximum number of cycles for the XPSU safety module itself. The structure element xReset can be used to reset the corresponding counter.

i_astControlInp

ARRAY[1..6] OF ST_InputControl

The array of the structure ST_InputControl connected to this input configures the safety-related inputs of the XPSU safety module. It identifies the connected input channels of the safety-related inputs and sets the maximum number of cycles for the safety-related inputs. The structure element xReset can be used to reset the corresponding counters.

i_astControlOut

ARRAY[1..13] OF ST_DevControl

The array of the structure ST_DevControl connected to this input configures the safety-related outputs of the XPSU safety module. It identifies the connected safety-related outputs and sets the maximum number of cycles for the corresponding relay contacts. The structure element xReset can be used to reset the corresponding counters.

The number of 13 array elements corresponds to the maximum of the seven safety-related outputs that an XPSU safety module can have plus six safety-related outputs provided by an XPSUEP extension module.

i_dtTestIntervalRef

DATE_AND_TIME

Date and time of the proof test to be performed (reference to the controller time).

i_udiTestInterv

UDINT

Proof test interval. Specify the number of days between consecutive proof tests.

i_xNewModuleActive

BOOL

A rising edge at this input confirms that an XPSU safety module has been added or replaced.

Results

  • The array with the proof test time stamps connected to the output q_adtProofTests is reset.

  • A time stamp is written to the first array element of the array with the proof test time stamps connected to the output q_adtProofTests (to confirm commissioning and first proof test of the XPSU safety module).

  • The value at the output q_datTestStart is updated.

i_xTestExecuted

BOOL

A rising edge at this input confirms that a proof test has been performed.

Results:

  • A time stamp is added to the first array element of the array with the proof test time stamps connected to the output q_adtProofTests. The existing time stamps are moved by one position in the array (first in, first out (FIFO))

  • The due date of the next proof test is provided at the output q_datNextProof.

i_xSaveBProofTests

BOOL

A rising edge at this input triggers reading of the time stamps from the proof test array connected to the input i_adtProofTests. Refer to the description of the input i_adtProofTests for details.

i_adtProofTests

ARRAY[1..10] OF DATE_AND_TIME

Input for connecting an external proof test array containing proof test time stamps which originate, for example, from an HMI application.

Output

Data type

Description

q_xActive

BOOL

If the value at this output is TRUE, the function block is being executed.

q_xError

BOOL

If the value at this output isTRUE, the function block has detected an error. Refer to q_wErrorId for details.

q_wErrorId

WORD

Provides information on detected errors. Error codes are listed in the section Error Codes.

q_datTestStart

DATE

Date value of the first proof test after activation of a new XPSU safety module via the input i_xNewModuleActive.

q_datNextProof

DATE

Due date for the next proof test.

q_xTestIntervViol

BOOL

If the value at this output is TRUE, the proof test interval has been exceeded.

q_xOpExceeded

BOOL

If the value at this output is TRUE, the number of remaining cycles is 0 for at least one of the monitored safety-related inputs or safety-related outputs, or for the XPSU safety module itself.

q_wExceededId

WORD

ID of the safety-related input, or the safety-related output, or the XPSU safety module itself that has exceeded the maximum number of cycles. Format:
  • For inputs: 16#101n

  • For outputs: 16#102n

  • For module: 16#100n

Refer to Output q_wExceededId for details.

q_adtProofTests

ARRAY[1..10] OF DATE_AND_TIME

Array of time stamps of the last ten proof tests performed. The first array element contains the latest time stamp (FIFO).

q_udiNumOpSystem

UDINT

Number of cycles of the XPSU safety module itself. The value is reset to zero if a new XPSU safety module is activated via the input i_xNewModuleActive.

q_stRemainNumOp

ST_RemainNumOp

Number of remaining cycles for each monitored safety-related input, for each safety-related output, and for the XPSU safety module itself, written to the structure ST_RemainNumOp.

Error Codes

If the function block detects an error, the output q_xError is set to TRUE and an error code is provided at the output q_wErrorId.

Error code

Description

16#1003

The proof test interval value at the input i_udiTestInterv is invalid. The value must be greater than zero.

16#1004

A new XPSU safety module has not yet been activated via the input i_xNewModuleActive (no first proof test confirmed). The error code is also generated when the function block is started for the first time via the input i_xEnable.

16#105n

Invalid configuration of safety-related input in the structure ST_InputControl. “n” is a number from 1 to 6 which indicates the number of the affected structure (corresponds to the affected safety-related input). Refer to ST_InputControl for details on the parameters.

Output q_wExceededId

If no cycles remain for a safety-related input, or for a safety-related output, or for the XPSU safety module itself, the value at the output q_xOpExceeded is set to TRUE. The value at the output q_wExceededId identifies the affected safety-related input, or safety-related output, or the XPSU safety module itself.

ID

Description

16#1005

Remaining number of cycles for the XPSU safety module itself is 0.

16#1011

Remaining number of cycles for the safety-related input defined in the first element of the structure ST_InputControl is 0.

16#1012

Remaining number of cycles for the safety-related input defined in the second element of the structure ST_InputControl is 0.

16#1013

Remaining number of cycles for the safety-related input defined in the third element of the structure ST_InputControl is 0.

16#1014

Remaining number of cycles for the safety-related input defined in the fourth element of the structure ST_InputControl is 0.

16#1015

Remaining number of cycles for the safety-related input defined in the fifth element of the structure ST_InputControl is 0.

16#1016

Remaining number of cycles for the safety-related input defined in the sixth element of the structure ST_InputControl is 0.

16#1021

Remaining number of cycles for the safety-related output defined in the first element of the structure ST_DevControl connected to the input i_astControlOut is 0.

16#1022

Remaining number of cycles for the safety-related output defined in the second element of the structure ST_DevControl connected to the input i_astControlOut is 0.

16#1023

Remaining number of cycles for the safety-related output defined in the third element of the structure ST_DevControl connected to the input i_astControlOut is 0.

16#1024

Remaining number of cycles for the safety-related output defined in the fourth element of the structure ST_DevControl connected to the input i_astControlOut is 0.

16#1025

Remaining number of cycles for the safety-related output defined in the fifth element of the structure ST_DevControl connected to the input i_astControlOut is 0.

16#1026

Remaining number of cycles for the safety-related output defined in the sixth element of the structure ST_DevControl connected to the input i_astControlOut is 0.

16#1027

Remaining number of cycles for the safety-related output defined in the seventh element of the structure ST_DevControl connected to the input i_astControlOut is 0.

16#1028

Remaining number of cycles for the safety-related output defined in the eighth element of the structure ST_DevControl connected to the input i_astControlOut is 0.

16#1029

Remaining number of cycles for the safety-related output defined in the ninth element of the structure ST_DevControl connected to the input i_astControlOut is 0.

16#102A

Remaining number of cycles for the safety-related output defined in the tenth element of the structure ST_DevControl connected to the input i_astControlOut is 0.

16#102B

Remaining number of cycles for the safety-related output defined in the eleventh element of the structure ST_DevControl connected to the input i_astControlOut is 0.

16#102C

Remaining number of cycles for the safety-related output defined in the twelfth element of the structure ST_DevControl connected to the input i_astControlOut is 0.

16#102D

Remaining number of cycles for the safety-related output defined in the thirteenth element of the structure ST_DevControl connected to the input i_astControlOut is 0.

Persistent Variables

Certain variables for the function block need to be declared as persistent variables so that they are not re-initialized after a controller restart.

Procedure for adding the instance paths of the contained persistent values to the list of persistent variables:

Step

Action

1

In the Application tree under the Application node, add the [Persistent Variables] object.

2

Open the editor, right-click and select Add all instance paths.

This adds the following persistent global variables to the list:

Variable

Data IDs Output at q_wExceededIdType

Default Value

Description

R_udiCountSystem

UDINT

0

Total number of cycles of the XPSU safety module itself.

R_audiCountInp

ARRAY[1..6] OF UDINT

0 (1)

Remaining number of cycles of the safety-related inputs.

The array size of six covers the maximum number of safety-related inputs that an XPSU safety module can provide.

R_udiCountProc

UDINT

0

Remaining number of cycles of the XPSU safety module itself.

R_audiCountOut

ARRAY[1..13] OF UDINT

0 (1)

Remaining number of cycles of the safety-related outputs.

The array size of 13 covers the maximum number of safety-related outputs that an XPSU safety module with an XPSUEP extension module can provide.

R_adtProof

ARRAY[1..10] OF DATE_AND_TIME

DT#1970-1-1-0:0:0.0 (1)

Array for the time stamps of the last ten proof tests (first in, first out).

R_datTestStart

DATE

D#1970-1-1

Time stamp of the first proof test performed for a new XPSU safety module after confirmation via the input i_xNewModuleActive.

(1) The default value refers to each element of the array

The input i_xNewModuleActive of the function block FB_XpsuMain lets you reset R_udiCountProc to zero if an XPSU safety module is installed. The other counters are reset at the inputs of the function blocks via the corresponding reset bits in the structure elements.