You are on page 1of 20

Reading out the

S7-1500 CPU Alarm


using "Get_Alarm"
and sending it to an
Alarm System
Siemens
TIA Portal, S7-1500, OPC UA Client Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/109748168 Support
Warranty and Liability

Warranty and Liability

Note The Application Examples are not binding and do not claim to be complete regarding the
circuits shown, equipping and any eventuality. The Application Examples do not represent
customer-specific solutions. They are only intended to provide support for typical
applications. You are responsible for ensuring that the described products are used
correctly. These Application Examples do not relieve you of the responsibility to use safe
practices in application, installation, operation and maintenance. When using these
Application Examples, you recognize that we cannot be made liable for any
damage/claims beyond the liability clause described. We reserve the right to make
changes to these Application Examples at any time without prior notice.
If there are any deviations between the recommendations provided in these Application
Examples and other Siemens publications – e.g. Catalogs – the contents of the other
documents have priority.

We do not accept any liability for the information contained in this document.
Any claims against us – based on whatever legal reason – resulting from the use of
the examples, information, programs, engineering and performance data etc.,
described in this Application Example shall be excluded. Such an exclusion shall
not apply in the case of mandatory liability, e.g. under the German Product Liability
Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life,
body or health, guarantee for the quality of a product, fraudulent concealment of a
deficiency or breach of a condition which goes to the root of the contract
(“wesentliche Vertragspflichten”). The damages for a breach of a substantial
contractual obligation are, however, limited to the foreseeable damage, typical for
 Siemens AG 2017 All rights reserved

the type of contract, except in the event of intent or gross negligence or injury to
life, body or health. The above provisions do not imply a change of the burden of
proof to your detriment.
Any form of duplication or distribution of these Application Examples or excerpts
hereof is prohibited without the expressed consent of the Siemens AG.

Security Siemens provides products and solutions with industrial security functions that support the
informa- secure operation of plants, systems, machines and networks.
tion In order to protect plants, systems, machines and networks against cyber threats, it is
necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial
security concept. Siemens’ products and solutions only form one element of such a
concept.
Customer is responsible to prevent unauthorized access to its plants, systems, machines
and networks. Systems, machines and components should only be connected to the
enterprise network or the internet if and to the extent necessary and with appropriate
security measures (e.g. use of firewalls and network segmentation) in place.
Additionally, Siemens’ guidance on appropriate security measures should be taken into
account. For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.

Siemens’ products and solutions undergo continuous development to make them more
secure. Siemens strongly recommends to apply product updates as soon as available and
to always use the latest product versions. Use of product versions that are no longer
supported, and failure to apply latest updates may increase customer’s exposure to cyber
threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security
RSS Feed under http://www.siemens.com/industrialsecurity.

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 2
Table of Contents

Table of Contents
Warranty and Liability ................................................................................................. 2
1 Introduction ........................................................................................................ 4
1.1 Overview............................................................................................... 4
1.2 Mode of operation ................................................................................ 4
1.3 Prerequisites ........................................................................................ 5
1.4 "Get_Alarm” basics............................................................................... 5
2 Engineering ........................................................................................................ 6
2.1 Hardware configuration ........................................................................ 6
2.2 Components used ................................................................................ 6
2.3 Programming of TIA Portal project ....................................................... 7
2.4 Configuring the OPC UA server of the S7-1500 .................................. 7
3 Operating the Application Example ................................................................. 8
3.1 Receiving pending alarms in PLC_1 using "Get_Alarm" and
sending it to PLC_2. ............................................................................. 9
3.2 Reading out of the received alarms ................................................... 12
3.2.1 Reading out of the received alarms in TIA Portal .............................. 12
3.2.2 Reading out of the received alarms via web server ........................... 13
3.2.3 Reading out of the received alarms via the OPC UA Client............... 14
3.3 Acknowledgement of the received alarm ........................................... 16
3.3.1 Acknowledgement of the received alarm in TIA Portal ...................... 16
 Siemens AG 2017 All rights reserved

3.3.2 Acknowledgement of received alarm using the OPC UA client ......... 18


4 Annex ................................................................................................................ 19
4.1 Service and support ........................................................................... 19
4.2 Links and literature ............................................................................. 20
4.3 Change documentation ...................................................................... 20

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 3
1 Introduction

1 Introduction (0…x)

1.1 Overview
Since the publication of TIA Portal V14 you can directly read out alarms from the
alarm server of the S7-1500 PLC using the "Get_Alarm" instruction. These alarms
can be sent to higher-level alarm system (e.g. PC, PLC).

1.2 Mode of operation


The incoming and outgoing alarms of the S7-1500 PLC_1 are read out and
acquired and saved in a "alarmStorage" data block in PLC_1. Afterwards you can
send these alarms from PLC_1 with the "TSEND_C" instruction as string to PLC_2.
The alarms are received on the PLC_2 with the "TRCV_C" instruction and stored in
a "rcvdStorage" data block. The alarms received via "Get_Alarm" can be read out
via OPC UA Client.
Figure 1-1

S7-1500 (PLC_1) S7-1500 (PLC_2)

Get_Alarm TSEND_C TRCV_C


 Siemens AG 2017 All rights reserved

„currRecord“ „alarmStorage“ „#sendStruct“ „#trcvStruct“ „rcvdStorage“


(0…x) (0…x)
(alarmData)

(SGetAlarm) (rcvGetAlarm)

Request Response Request Response

OPC Server OPC Server

OPC Client
You can use the "Get_Alarm” instruction for the following PLC alarms of the
S7-1500:
 Program_Alarm
 System diagnostics
 Standard Motion Control
 Security (e.g. wrong login)
 SINUMERIK
 GRAPH
 ProDiag

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 4
1 Introduction

1.3 Prerequisites
The following requirements must be met when using the "Get_Alarm" instruction:
 TIA Portal V14
 S7-1500 PLC as of firmware V2.0

The following setting is recommended for the use of "Get_Alarm":


Enable the "Central alarm management in the PLC" property in the hardware
configuration of the S7-1500 PLC. This property is enabled by default for new
projects.
Figure 1-2

Note If you do not enable the PLC property "Central alarm management in the PLC" in
the hardware configuration, only the IDs of the alarm text fields will be output
 Siemens AG 2017 All rights reserved

instead of the alarm texts.

1.4 "Get_Alarm” basics


The basics on the "Get_Alarm" instruction can be found in the same application
example in the documentation:
“109748168_Grundlagen_Get_Alarm_DOC_V10_en.pdf”.
This file can be found on the entry page of the application example
https://support.industry.siemens.com/cs/ww/en/view/109748168

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 5
2 Engineering

2 Engineering
2.1 Hardware configuration
The following figure shows the hardware with which it was tested.
Figure 2-1

STEP 7 S7-1500 PLC_1 S7-1500 PLC_2

Alarm
PROFINET IE

Alarm Alarm
 Siemens AG 2017 All rights reserved

ET 200MP PN ET 200SP PN

2.2 Components used


This application example was created with the following hardware and software
components:
Table 2-1
Component Numbe Article number Note
r
CPU 1516-3 PN/DP 1 6ES7 516-3AN01-0AB0 PLC_1 with
firmware V2.1
CPU 1513-1 PN 1 6ES7 513-1AL01-0AB0 PLC_2
IM 155-5 PN ST 1 6ES7155-5AA00-0AB0 ET 200MP
– DI 32x24VDC HF 1 6ES7 521-1BL00-0AB0 -
– DQ 32x24VDC/0.5A 1 6ES7 522-1BL00-0AB0 -
ST
– AI 8xU/I/RTD/TC ST 1 6ES7 531-7KF00-0AB0 -
IM 155-6 PN ST 1 6ES7 155-6AU00-0BN0 ET 200SP
– DI 8x24VDC ST 1 6ES7 131-6BF00-0BA0 -
– DQ 8x24VDC/0.5A ST 1 6ES7 132-6BF00-0BA0 -
– AQ 4xU/I ST 1 6ES7 135-6HD00-0BA1 -
– Server module 1 6ES7 193-6PA00-0AA0 -
STEP 7 Professional V14 SP1 1 6ES7822-1..04-.. -
OPC UA Expert 1 https://www.unified- Version 1.4.1
automation.com/ Free Download

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 6
2 Engineering

This application example consists of the following components:


Table 2-2
Component File name
Basic documentation 109748168_Grundlagen_Get_Alarm_DOC_V10_de.pdf
Project documentation 109748168_Get_Alarm_DOC_V10_de.pdf
STEP 7 project 109748168_Get_Alarm_PROJ_V10.zip

2.3 Programming of TIA Portal project


The enclosed STEP 7 project does not require any further configuration and can be
operated.

Note This STEP 7 project was created on the basis of the “program example for
Get_Alarm & Ack_Alarms" example in the online help of "STEP 7 Professional
V14 SP1".
The acknowledgement of the alarm and reading out of alarms received using
Get_Alarm via the “UaExpert” OPC UA client in this application example, are not
included in the online help.

The configuration of the OPC UA server can be found in chapter 2.4.


 Siemens AG 2017 All rights reserved

If you do not use the included STEP 7 project but create your own project, carry out
the required configuration steps from the chapter “Program example for Get_Alarm
& Ack_Alarms".
https://support.industry.siemens.com/cs/ww/en/view/109747136/94225071243

2.4 Configuring the OPC UA server of the S7-1500


The OPC UA server of the S7-1500 is disabled by default.
If you do not use the STEP 7 project included but want to create your own project,
you have to plan and configure the OPC UA Server.
The configuration steps required can be found in the documentation in chapter 2.1
"Configuring the OPC UA Servers of the S7-1500" in the "OPC UA .NET Client for
the SIMATIC S7-1500 OPC UA Server" application example.
https://support.industry.siemens.com/cs/ww/en/view/109737901

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 7
3 Operating the Application Example

3 Operating the Application Example


This chapter shows you how to commission and operate the application example.

Load the prepared STEP 7 project into your controller. Proceed as follows:
1. Download the "109748168_Get_Alarm_PROJ_V10.zip" file onto your hard
drive.
The download can be found on the entry page of the application example
https://support.industry.siemens.com/cs/ww/en/view/109748168
2. Extract the zipped download file.
3. Navigate to "Get_Alarm" in the unzipped folder. The STEP 7 project is located
in this folder.
siemens.com
4. Open the STEP 7 project by double-clicking on the "Get_Alarm.ap14" file.
5. Select the “PLC_1” or “PLC_2” folder in the project tree and click the
“Download to device” button in the toolbar.

The STEP 7 project contains the following UseCases:


 Receiving pending alarms in PLC_1 using "Get_Alarm" and sending it to
PLC_2.
 Reading out of the received alarms
 Acknowledgement of the received alarm
 Siemens AG 2017 All rights reserved

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 8
3 Operating the Application Example

3.1 Receiving pending alarms in PLC_1 using "Get_Alarm"


and sending it to PLC_2.
In order to receive pending alarms in PLC_1 and to send it to PLC_2, proceed as
follows:
1. Connect online:
a. Select the “PLC_1” folder in the project tree and click the “Go online”
button in the toolbar.
b. Select the “PLC_2” folder in the project tree and click the “Go online”
button in the toolbar.

2. Establish connection: You have to establish the connection between PLC_1


and PLC_2 in the following sequence:
a. Set the tags “TRCV_C.start” and “TRCV_C.comControl" to "TRUE” in the
“SLI_gDB_trcv_GAA” DB of the PLC_2.
Figure 3-1
 Siemens AG 2017 All rights reserved

b. Set the “TSEND_C.comControl” tag to "TRUE” in the “SLI_gDB_GAlarm”


DB of PLC_1.
Figure 3-2

3. Generate alarms: Create one or several alarms as follows:


a. Drag a module to the ET200SP
b. Cause a wire break at the ET200MP input channel.
c. Generate a ProgDiag alarm in the “SLI_gDB_testAlarm_GAA” DB of the
PLC_1 by setting the monitor tags “startPump” and “closeValue” to TRUE.

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 9
3 Operating the Application Example

Figure 3-3

4. Start "Get_Alarm": Set the "GetAlarm.start" tag to "TRUE" in the


"SLI_gDB_GAlarm" DB of the PLC_1.
Figure 3-4
 Siemens AG 2017 All rights reserved

Note The "GetAlarm.start" tag is automatically reset after its processing in the user
program.

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 10
3 Operating the Application Example

Once you have started the "Get_Alarm" instruction, the following steps are carried
out in the background:
a. The "Get_Alarm" instruction is called in "OperateMode = 1" and then goes
to "OperateMode = 2".
b. New alarms are received with the "AlarmData" data type, saved in the
"alarmStorage" storage array and sent to PLC_2 via the "TSEND_C"
instruction.
Figure 3-5

Note The storage array for the “alarmStorage” alarms can store a maximum of 16
alarms in this project. If you want to change the storage size you have to adjust
the respective array size and the maximum value "maxPosition".
 Siemens AG 2017 All rights reserved

c. The new alarm is received using the "TRCV_C" instruction in PLC_2 and
saved in "SLI_gDB_trcv_GAA" DB in the "rcvdStorage" storage array.
Figure 3-6

After the transfer of the data record (#trcvStruct) to PLC_2, the


communication connection is continuously monitored and the "TRCV_C"
instruction is ready to receive new alarms.

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 11
3 Operating the Application Example

3.2 Reading out of the received alarms


You have three options to read out received alarms via "Get_Alarm":
 In the TIA Portal
 Using the PLC web server
 Using OPC UA client via "UaExpert".

3.2.1 Reading out of the received alarms in TIA Portal

In order to read out the received alarms in PLC_1 in the TIA Portal, proceed as
follows:
1. Select the “PLC_1” folder in the project tree and click the “Go online” button in
the toolbar.
2. Open the “alarmStorage” storage array in the “SLI_gDB_GAalarm” DB in which
the alarms are copied. The alarms can be seen in the respective array [Array
0…15] in “alarm > AlarmText”.
Figure 3-7
 Siemens AG 2017 All rights reserved

In order to read out the received alarms in PLC_2 in the TIA Portal, proceed as
follows:
1. Select the “PLC_2” folder in the project tree and click the “Go online” button in
the toolbar.
2. Open the “GetAlarm” watch table and click on the “Monitor all” button.
Figure 3-8

3. Or open the “rcvdStorage” storage array in “SLI_gDB_trcv_GAA” DB in which


the alarms are copied. You can see the alarms in the respective array [Array
0…15] in “AlarmText”.

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 12
3 Operating the Application Example

Figure 3-9

3.2.2 Reading out of the received alarms via web server

In order to read out the received alarms via the web server in PLC_1, proceed as
follows:
1. Call the IP address of the PLC_1 (in the example: 192.168.0.1) in a browser of
your choice.
2. Open the "Alarms" in the project tree.
Figure 3-10
 Siemens AG 2017 All rights reserved

In order to read out the received alarms via the web server in PLC_2, proceed as
follows:
1. Call the IP address of the PLC_2 (in the example: 192.168.0.2) in a browser of
your choice.
2. Open the "GetAlarm" watch tables in the project tree.
Figure 3-11

Note For the watch table to be displayed in the web server, you have to enable it first
in the hardware configuration of the S7-1500 PLC "Web server > User
management" property.

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 13
3 Operating the Application Example

Figure 3-12

3.2.3 Reading out of the received alarms via the OPC UA Client

In order to the OPC "UaExpert" UA Client, the following is assumed:


 "UaExpert" is installed on your PC. UaExpert Download
 OPC UA server is enabled in PLC_1 and PLC_2.
 Siemens AG 2017 All rights reserved

 The STEP 7 project is loaded in the controller.

In order to read out the received alarms in PLC_1 via the OPC "UaExpert" UA
Client, proceed as follows:
1. Start "UaExpert" by double clicking it.

2. Click on the "Add Server" button.


In the dialog, double-click on "< Double click to Add Server… >" in the
"Custom Discovery” list area.

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 14
3 Operating the Application Example

3. In the dialog that follows, enter the URL of the OPC UA server of the PLC_1 (in
the example: opc.tcp://192.168.0.1) and click "OK".

4. Select a detected endpoint of the OPC UA server to which you want to


establish a connection. (e.g.: SIMATIC.S7-1500.OPC-UAServer:PLC1 – None
-None)
Since no user is stored in this application example, the “Anonymous” field in
“Authentication Settings” is enabled.
5. Set the "Connect Automatically" check box and confirm it using “OK”.
6. Accept the server certificate in the dialog that follows, by setting the "Accept
the server certificate temporarily for this session" check box and then clicking
"Continue".
You are connected with the OPC UA server of the PLC_1.
7. Navigate to "Root > Objects > PLC_1 > DataBlocksGlobal >
SLI_gDB_GAalarm > GetAlarm > alarmStorage > [0..15]” in the "Address
Space" of the server and drag the “Alarmtext” tag in the "Data Access View"
area using drag-and-drop.
8. You can monitor the alarms in the "Data Access View" area in the “Value”
column.
Figure 3-13
 Siemens AG 2017 All rights reserved

If you read out the received alarms in PLC_2, perform the steps just as for PLC_1
but for PLC_2.
Enter the URL of the OPC UA servers of the PLC_2 (opc.tcp://192.168.0.2).
Navigate to "Root > Objects > PLC_2 > DataBlocksGlobal > SLI_gDB_trcv_GAA >
GetAlarm > rcvdStorage > [0..15]” in the "Address Space" of the server and drag
the “Alarmtext” tag in the "Data Access View" area using drag-and-drop.

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 15
3 Operating the Application Example

Figure 3-14

3.3 Acknowledgement of the received alarm


You can acknowledge the received alarm in PLC_2 and send the acknowledgment
bit using the “TSEND_C” instruction to PLC_1. PLC_1 receives the
acknowledgement bit via “TRCV_C”.
 Siemens AG 2017 All rights reserved

3.3.1 Acknowledgement of the received alarm in TIA Portal

In order to acknowledge the received alarm in TIA Portal in PLC_2 and to send the
acknowledgment bit to PLC_1, proceed as follows:

1. Establish connection: You have to establish the connection between PLC_1


and PLC_2 in the following sequence:
a. Set the “start” and “comControl" tags to "TRUE” in the
“SLI_gDB_TRCV_C_AckBit” DB of PLC_1.
Figure 3-15

b. Set the "comControl" tag in the “SLI_gDB_TSEND_C_AckBit” DB of the


PLC_2 to "TRUE”.

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 16
3 Operating the Application Example

Figure 3-16

2. Acknowledge alarm: Set the "executeAck" tag in the


“SLI_gDB_TSEND_C_AckBit” DB of the PLC_2 to "TRUE”. The
acknowledgement bit is set in PLC_2.
Figure 3-17
 Siemens AG 2017 All rights reserved

3. The acknowledgment bit is sent to PLC_1, the alarm is acknowledged and the
alarm is displayed as acknowledged.
Select the “PLC_1” folder in the project tree and click the “Receive alarms”
button in the toolbar in order to see the acknowledged alarms in PLC_1. The
alarms are listed in the “Diagnostics”, “Alarm display" tab.
Figure 3-18

4. Eliminate the fault. The alarm is deleted in the alarm display.


5. Reset the acknowledgement bit in PLC_2, by changing the "executeAck" tag to
"FALSE".

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 17
3 Operating the Application Example

3.3.2 Acknowledgement of received alarm using the OPC UA client

In order to acknowledge the received alarm via the OPC "UaExpert" UA Client and
to send acknowledgment bit to PLC_1, proceed as follows:

1. Connect the PLC_1 and PLC_2 as follows Establish connection


2. Perform the steps in “Read out alarm using OPC UA client“ up to step [7], but
for PLC_2.
3. Navigate to "Root > Objects > PLC_2 > DataBlocksGlobal >
SLI_gDB_TSEND_C_AckBit > AckAlarm” in the "Address Space" of the server
4. Drag the “executeAck” tag in the "Data Access View" area using drag-and-
drop.
5. Set the “executeAck” tag in the “Value” column by double-clicking TRUE. The
acknowledgement bit is set in PLC_2.
6. The acknowledgment bit is sent to PLC_1, the alarm is acknowledged and the
alarm is displayed as acknowledged.
Select the “PLC_1” folder in the project tree and click the “Receive alarms”
button in the toolbar in order to see the acknowledged alarms in PLC_1. The
alarms are listed in the "Diagnostics > Alarm display" tab.
Figure 3-19
 Siemens AG 2017 All rights reserved

7. Eliminate the fault. The alarm is deleted in the alarm display.


8. Reset the acknowledgement bit in PLC_2, by changing the "executeAck" tag to
"FALSE".

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 18
4 Annex

4 Annex
4.1 Service and support
Industry Online Support
Do you have any questions or need support?
Siemens Industry Online Support offers access to our entire service and support
know-how as well as to our services.
Siemens Industry Online Support is the central address for information on our
products, solutions and services.
Product information, manuals, downloads, FAQs and application examples – all
information is accessible with just a few mouse clicks at
https://support.industry.siemens.com

Technical Support
Siemens Industry's Technical Support offers quick and competent support
regarding all technical queries with numerous tailor-made offers
– from basic support right up to individual support contracts.
Please address your requests to the Technical Support via the web form:
www.siemens.en/industry/supportrequest

Service offer
 Siemens AG 2017 All rights reserved

Our service offer comprises, among other things, the following services:
 Product Training
 Plant Data Services
 Spare Parts Services
 Repair Services
 On Site and Maintenance Services
 Retrofit and Modernization Services
 Service Programs and Agreements
Detailed information on our service offer is available in the Service Catalog:
https://support.industry.siemens.com/cs/sc

Industry Online Support app


Thanks to the "Siemens Industry Online Support" app, you will get optimum
support even when you are on the move. The app is available for Apple iOS,
Android and Windows Phone:
https://support.industry.siemens.com/cs/ww/en/sc/2067

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 19
4 Annex

4.2 Links and literature


Table 4-1
No. Topic
\1\ Siemens Industry Online Support
https://support.industry.siemens.com
\2\ Link to the entry page of the application example
https://support.industry.siemens.com/cs/ww/en/view/109748168
\3\ STEP 7 Professional V14 SP1 – System Manual
https://support.industry.siemens.com/cs/ww/en/view/109747136
\4\ Homepage of OPC UA Expert
https://www.unified-automation.com/

4.3 Change documentation


Table 4-2
Version Date Modification
V1.0 09/2017 First version
 Siemens AG 2017 All rights reserved

Get_Alarm
Entry ID: 109748168, V1.0, 09/2017 20

You might also like