Professional Documents
Culture Documents
Solution 2
Program Structure 3
Required Components 6
Installation 7
Copyright Siemens AG 2013 All rights reserved
Norm Considerations 9
History 10
Before using this application example, please read the warning note in
chapter 8 “Operating the Application”.
WARNING
Table of Contents
Warranty and Liability ................................................................................................. 4
1 Task ..................................................................................................................... 6
2 Solution............................................................................................................... 6
3 Program Structure ............................................................................................. 8
4 F Position Encoder ............................................................................................ 9
5 Realizing the Functionalities .......................................................................... 11
5.1 Safe standstill detection ..................................................................... 11
5.2 Safely limited speed (SLS) ................................................................. 14
5.3 Safe position detection ....................................................................... 17
5.3.1 Block description ................................................................................ 17
5.3.2 Modulo consideration ......................................................................... 20
5.4 Safe direction detection ...................................................................... 24
6 Required Components .................................................................................... 26
7 Installation ........................................................................................................ 27
8 Operating the Application ............................................................................... 28
9 Norm Considerations ...................................................................................... 30
Copyright Siemens AG 2013 All rights reserved
10 History............................................................................................................... 32
1 Task
Introduction
For a multitude of industrial application the precise recording of a position is pivotal.
However, detecting a position is always accompanied by a motion of, for example,
cranes, robots or general machine parts. In many cases this can cause dangerous
situations.
Nevertheless, hazards can also occur if a desired position is not reached or a
prohibited position is reached. To avoid these hazards, these position values have
to be safe. This is also the case for position detection and for the subsequent
position processing.
This leads to the question how position detection can be realized whilst keeping
safety in mind.
2 Solution
Options of safe position detection
For the safe detection of a position, SIEMENS drives with integrated safety
functions (for example, SINAMICS G120) offer various applications.
Copyright Siemens AG 2013 All rights reserved
Another option is the use of safe position encoders (below, further referred to as F
position encoders). In combination with a SIMATIC F-CPU, these securely
detected values can be processed further and corresponding responses can be
arranged.
This safety functional example describes the use of such an encoder.
DP Master
F-CPU
DP Slave
F Position
encoder
DP
These issues can be realized, since many F position encoders on the market can
output safe speed and also a safe position.
Each of theses four issues is realized in the included STEP 7 project within a
separate block (F-FB). This modularity permits you to integrate individual blocks
that have been prepared here to your individual STEP 7project and to adjust them
to your automation task.
The emphasis of this function example is the fast integration of an F encoder
(through PROFIBUS) into a STEP 7 project with prepared F blocks. The function
example has therefore a universal character.
Copyright Siemens AG 2013 All rights reserved
Although error states are detected by the prepared F blocks, error handling is not
the emphasis of this function example, this is to say, the error states displayed on
the F blocks have to be processed further by you, for example, to safely switch off
of the actuators.
3 Program Structure
Screenshot
FB17
F_POSITION Save position
detection
FB18
Copyright Siemens AG 2013 All rights reserved
Save direction
DIR detection
Reintegration
Description
Each of the above mentioned functionalities is realized modularly in a separate and
failsafe FB (FB 15-FB 18). These function blocks are called by the F program block
FB “F_MAIN” (FB 1).
In FB “F_MAIN” (FB 1) a reintegration of the encoder is also prepared. The
reintegration is realized through the ACK variable.
Note After the first switch on, the F position encoder may be in passivation (no
exchange of process data). Reintegrate the F position encoder with ACK=1.
A standard user program is not prepared. Only the interrupt alarm OB (OB 35) calls
the F runtime group (F-CALL) as usual.
4 F Position Encoder
General properties
For this function example, an absolute value encoder with DP interface is used.
The encoder manufacturer has to provide the device master data file (GSD) for the
connection to PROFIBUS.
Generally, incremental encoders can also be used. However, in this case, to detect
the position, the encoder has to be referenced to the appropriate position after it
was switched on.
Since the encoder is to be used for safety-relevant applications, it has to be
certified according to IEC 62061, ISO 13849-1 and/or IEC 61508.
The safety-related data of the F position encoder that is to be evaluated by the F-
CPU can have a maximum length of 16 bits.
• Speed
In this example, the addresses start with 7 (see “E address” in HW Config). The
following applies for the table “details encoder manufacturer”: X=7
If you want to, for example, read out the speed safely, load the address EW 11
(due to X+4=11) in the F program.
As shown by the details of the manufacturer in the figure, the following input data is
processed in this STEP 7 project:
• Speed
• Actual value of the number of whole revolutions (multi turn)
• Actual value of the angle (single turn)
The TR encoder supplies a safe bit, which is set at inadmissibly high speed. This
bit (OV_VELO) is also processed in the F program.
The encoder values are accessed through the process image of the inputs (PII).
The block provides the information that the drive connected to the F position
encoder has safely stopped. For this purpose, the current speed, provided safely
by the encoder, is compared with zero (standstill). Since the encoder in standstill
can still output various values in zero (for example, due to the noise of the analog
inputs), you can determine a tolerance value whose range still defines a standstill.
The block detects an error (ERR_STILL=1), if after requesting the safe standstill
and after a tolerance time has lapsed, the value of the current speed is above the
tolerance value defined by the standstill. The error responses, such as, for
example, safe switch off of the actuators, are to be performed by the user.
Q is set if
• REQ_SSTILL = 1 and
• the T_TOL time has lapsed.
Copyright Siemens AG 2013 All rights reserved
Note FB F_TON is a block from the Distributed Safety library. If you use the FB
SSTILL (FB 15) in a separate STEP 7 project, you also have to insert the FB
F_TON in your separate STEP 7 project
(SIMATIC Manager).
The standstill and error detection in network 6 forms the core of the FB SSTILL
(FB 15):
Each of the first two comparators (CMP) on the four AND blocks evaluate the sign of
the current speed (VELO_ACT) and the tolerance value (VELO_TOL).
Each of the third comparator on the four AND blocks compares (depending on the sign)
VELO_ACT with VELO_TOL.
If the condition on all AND blocks is not fulfilled, there is definite standstill (SSTILL=1).
If the condition is fulfilled on one AND block and the tolerance time (Q=1) has lapsed,
then the error bit (ERR_SSTILL=1) is set. The error can be acknowledged with ACK=1.
Variables with the “2K” ending name the two’s complement. This is required for the
sign evaluation of VELO_ACT and VELO_TOL.
Parameter description
FB SLS (FB 16) Input parameters Data type Description
REQ_SLS BOOL 1: SLS request
VELO_ACT INTEGER Current safe speed of the encoder.
Copyright Siemens AG 2013 All rights reserved
Q is set if
Copyright Siemens AG 2013 All rights reserved
• REQ_SLS = 1 and
• the T_TOL time has lapsed.
Note FB F_TON is a block from the Distributed Safety library. If you use the FB SLS
(FB 16) in a separate STEP 7 project, you also have to insert FB F_TON in your
separate STEP 7 project (SIMATIC Manager).
The core of the block is monitoring whether after requesting (REQ_SLS=1) and
after the expiry of the T_TOL tolerance time, the VELO_ACT current speed is
below the configured SLS_SETPOINT limit value.
Each of the first two comparators (CMP) on the four AND blocks evaluate the sign
of the current speed (VELO_ACT) and the tolerance value (VELO_TOL) for the
safely limited speed SLS_SETPOINT.
The third comparator each on the four AND blocks compares (depending on the
sign) VELO_ACT with SLS_SETPOINT.
If the condition is fulfilled on one AND block and the tolerance time (Q=1) has
lapsed, then the error bit (ERR_SLS=1) is set. The error can be acknowledged with
ACK=1.
Danger range
Position value
Copyright Siemens AG 2013 All rights reserved
The start and end position is each clearly determined through the number of whole
revolutions (multi turn) and angles (single turn):
Danger range
Position value
POS_SAFE_MULTI_BEGIN
POS_SAFE_SINGLE_BEGIN
POS_SAFE_MULTI_END
POS_SAFE_SINGLE_END
The appropriate FB F_POSITION (FB 17) block also includes standstill detection.
This is not required for the actual position detection, however, this is dealt with
when discussing the modulo issue.
Parameter description
FB “F_POSITION“ Input parameters Data type Description
(FB 17)
POS_MULTI_ACT INTEGER Current position, specified by the
number of whole revolutions of the
encoder. This value is signed.
POS_SINGLE_ACT INTEGER The current position, specified by the
number of whole revolutions of the
encoder is supplemented by this angle
value (POS_SINGLE_ACT), which
outputs a 360° area (part revolution) as
numerical value.
POS_SAFE_MULTI_ INTEGER The Start of the danger range is clearly
BEGIN (and safely) defined by two numerical
values:
• number of whole revolutions
• part revolution (0 to < 360°)
POS_SAFE_MULTI_BEGIN <
POS_SAFE_MULTI_END
POS_SAFE_SINGLE INTEGER The Start of the danger range is clearly
_BEGIN (and safely) defined by two numerical
values:
• number of whole revolutions
• part revolution (0 to < 360°)
Position value
Copyright Siemens AG 2013 All rights reserved
Ensure that the position detection only takes place in this defined range so that a
counter overflow (modulo jump) does not occur.
For application where the defined value range of the F position encoder is not
sufficient, the modulo jump (transfer from the maximum count to 0 and the other
way around) has to be taken into account.
Detecting the modulo jump is important because the position detection in the F
program is mainly based on mathematical comparison (>, <, =). When comparing
the count (>, <, =), a variation of the count (for the current position), for example,
between 0 and 32767, may lead to a result that does not correspond to the reality
and may cause undesired responses.
The F_POSITION (FB 17) block of the included STEP 7 project, detects this
modulo jump. In the following, it is described how the FB F_POSITION (FB 17)
block performs this.
Note All of the following considerations assume a forward counting direction. The thus
resulting statements can also be performed for a backward counting direction.
Current position
value
Previous position
value
0
t
∆t ∆t
If a modulo jump (at forward counting direction) occurs now, the following applies:
Current position value > previous position value no longer:
Current position
value
Previous
position value
t
∆t ∆t
The following scenarios are not recorded by the FB F_POSITION (FB 17):
• The speed of rotation is so large, that a modulo jump takes place and the
following applies: Current position value > previous position value (at forward
counting direction).
Count (position value)
Current position
value
Previous position
value
t
∆t ∆t
Saving the current actual position value for the next program cycle
The aim of networks 1 to 5 consists of the first saving of the position value to be
able to access it in the next program cycle.
NW Screenshot Explanation
1 The HELP_VAR help variable ensures that
NW1-5 is only run once to save the current
position value for the next program cycle.
2 With POS_MULTI_M the current position value
for the next program cycle is saved.
Copyright Siemens AG 2013 All rights reserved
After the first saving of the current position value for the next program cycle,
networks 2 to 4 are no longer run through. Saving the current position value for the
next program cycle is performed at the end of the block:
Standstill detection
The standstill detection is required since the direction of rotation of the F position
encoder is evaluated for the detection of the modulo jump. The following applies: if
a standstill is detected, there is no evaluation of the direction of rotation.
The standstill evaluation is performed the same as for the FB SSTILL (FB 15).
Modulo evaluation
If the direction of rotation is positive (forward) and the current position is smaller
than the previous position, then a modulo error is reported.
If the direction of rotation is negative (backward) and the current position is larger
than the previous position, then a modulo error is reported.
Copyright Siemens AG 2013 All rights reserved
If VELO_TOL was
indicated as positive
If VELO_TOL was
indicated as negative
The evaluation for the negative direction of rotation (BACK) is performed in the
same way.
You must not use the FB “DIR“ (FB18) for the evaluation of a safe standstill
detection!
WARNING In case of VELO_TOL = 0, the bits FORW und BACK will always be false.
Do not interpret this as a safe standstill!
Set for VELO_TOL a value unequal of zero.
Copyright Siemens AG 2013 All rights reserved
6 Required Components
Hardware components
Component Type MLFB / order information No. Manufacturer
Power supply PS307 5A 6ES7-1BA00-0AA0 1 SIEMENS
S7-CPU, can be used for CPU315F-2DP 6ES7315-6FF01-0AB0 1 SIEMENS
safety applications
Position encoder, can be CDH 75 M SN CDH75M-00003 1 TR Electronic
used for safety applications
Note You can also use similar hardware components. In this case, observe possibly
changed resolutions for the position encoder and that it is approved for safety
relevant tasks.
7 Installation
Note This chapter is only necessary if you wish to set up the offered S7 example
project.
Hardware installation
The respective hardware consists of:
• F-CPU (incl. power supply)
• F encoder
L1
L1
N N F encoder
L+
M
L+
PE M
L+
L+
M DP
M
L+
M
Note The electric wiring of the F encoder can be found in the appropriate manual.
Software installation
No. Action
1 Install STEP 7
2 Install Distributed Safety afterwards
3 To be able to use the S7 project that is also offered,
• download the zip file into a local directory of the Windows Explorer.
• in the SIMATIC Manager go to File -> Retrieve and select the zip file. Follow the
instructions
Password
The password for the STEP 7 project is siemens
The provided STEP 7 project has the inputs and outputs of the offered
failsafe function blocks already switched with actual parameters. On the
one hand there are safe quantities provided by the F position encoder, on
WARNING the other there are flags (and thus non-safe quantities), that can be
controlled through a VAT_1 variable table.
In this way, VAT_1 was only prepared for demonstration purposes, so that
once the F position encoder is integrated on the PROFIBUS DP, you can
quickly get familiar with its functionality. For example, by turning the shaft,
you can directly monitor in VAT_1 how the numerical values (multi turn) for
the revolutions, angle (single turn) and speed are changing.
However, under no circumstances must the STEP 7 project, provided in
this way, be integrated in a real practical application! The flags in this case
have to be replaced, for example, by real signals and individual limit and
tolerance values, and for the process.
Copyright Siemens AG 2013 All rights reserved
9 Norm Considerations
Consideration in accordance with IEC 62061
According to the manufacturer’s details sub-systems 1 and 2 have a SIL (Safety
Integrity Level) CL 3 (claim) each. If sub-system 3 is established in a way so that
there is a SIL CL 3, then the basic requirement for realizing a SIL 3 for the safety
function is fulfilled.
SRCF
SRECS
SIL CL 3 SIL CL 3 SIL CL x
Sub-system 1 Sub-system 2 Sub-system 3
F encoder F-CPU
Copyright Siemens AG 2013 All rights reserved
Depending
on
application
DP
TS: sub-system
PFHTE: Probability of dangerous transmission error for digital communication
processes (here: communication of F-CPU through PROFIBUS).
“TE“ stands for Transmission Error.
The PFHD values are provided by the manufacturers of the components; the PFHTE
-9
value can be included once in the calculation with 10 .
The correlation between PFHD and SIL is available in table 3 of IEC 62061:
Safety integrity level (SIL) Probability of a dangerous failure per hour (PFHD)
3
≥ 10 −8 to < 10
−7
2
≥ 10 −7 to < 10
−6
1
≥ 10 −6 to < 10
−5
(PL) and the safety integrity level (SIL). Therefore, a PL e according to ISO 13849-
1:2006 can be assumed if the SIL 3 is achieved for the safety function.
In this example, this mainly depends on the realization of the SRP/CSResponse.
PL e PL e PL x
SRP/CSDetect SRP/CSEvaluate SRP/CSResponse
PLDetect PLEvaluate PLResponse
The relation between PFHD and SIL can also be found in table 3 of IEC 62061 (see
above).
10 History
Version Date Modification
V 1.0 07/2011 First edition
V 1.0a 07/2013 Additional important note in chapter 5.4
V 1.0b 02/2017 Change I7.0 to I8.0
Copyright Siemens AG 2013 All rights reserved