Vous êtes sur la page 1sur 46

Application Description  10/2016

Diagnostics in the User


Program with S7-1500
TIA Portal, S7-1500

https://support.industry.siemens.com/cs/ww/en/view/98210758
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
 Siemens AG 2016 All rights reserved

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
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
informa- support the 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.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 2
Table of Contents

Table of Contents
Warranty and liability ................................................................................................... 2
1 Task ..................................................................................................................... 4
1.1 Overview............................................................................................... 4
1.2 Problem description .............................................................................. 5
2 Solution............................................................................................................... 6
2.1 Overview............................................................................................... 6
2.2 Hardware and software components ................................................... 8
2.2.1 Validity .................................................................................................. 8
2.2.2 Components used ................................................................................ 8
3 Basics for System Diagnostics ...................................................................... 11
3.1 Diagnostics instructions ...................................................................... 11
3.2 Error OBs............................................................................................ 11
4 Mode of Operation ........................................................................................... 12
4.1 General overview ............................................................................... 12
4.2 Tag table “ConstDiagnostics” ............................................................. 14
4.3 Global data block “DiagnosticsData” [DB2080] .................................. 14
4.4 Global data block “HmiDB” [DB2081] ................................................. 16
4.5 Function block “DiagStartupPlc” [FB2002] ......................................... 19
4.6 Function block “DiagStartupIoSystem” [FB2001] ............................... 21
 Siemens AG 2016 All rights reserved

4.7 Function block “Diagnostics” [FB2000] .............................................. 23


4.8 Function “CopyToHmiDB” [FC2081] .................................................. 25
4.9 Function “DiagnosticError” [FC2082] ................................................. 26
4.10 Function “PullOrPlugModules” [FC2083] ........................................... 28
4.11 Function “RackOrStationFailure” [FC2086] ........................................ 30
5 Installation and Commissioning .................................................................... 32
5.1 Installing the hardware ....................................................................... 32
5.2 IP / PROFIBUS addresses and device names................................... 33
5.3 Software installation (download) ........................................................ 33
5.4 Setting the PROFIBUS DP address ................................................... 33
5.5 Assign a PROFINET device name ..................................................... 34
5.6 Load project ........................................................................................ 35
5.7 Integrating the application into an existing project ............................. 36
5.7.1 Configuring the diagnostic settings .................................................... 36
5.7.2 Integrating the PLC objects ................................................................ 36
5.7.3 Integrating the HMI elements ............................................................. 39
5.7.4 Expansion of the visualization ............................................................ 40
6 Operating the Application ............................................................................... 42
6.1 Overview............................................................................................. 42
6.2 Representation of the status of the devices ....................................... 43
6.3 Diagnostics at the operator panel ...................................................... 43
6.4 Evaluating the diagnostic information ................................................ 45
7 Links & Literature ............................................................................................ 46
8 History............................................................................................................... 46

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 3
1 Task
1.1 Overview

1 Task
1.1 Overview
Introduction
In automation technology, diagnostics of devices, modules and networks is gaining
importance. Diagnostics with the user program enables determining failed
modules. In the user program, you can then program reactions to diagnostic
alarms, such as stopping your plant at certain diagnostic alarms.

Note It is generally recommended to use the integrated system diagnostics of the


S7-1500 controller (see System diagnostics with S7-1500 and TIA Portal)
whenever diagnostic information is displayed on different visualization devices
and not used in the user program.
Please note that integrated system diagnostics also works in the "STOP" mode
of the S7-1500 controller. Manual diagnostics in the user program does not allow
this.

Overview of the automation task


The figure below provides an overview of the automation task.
 Siemens AG 2016 All rights reserved

Figure 1-1

Controller HMI
Diagnostic
information

PROFINET IE

Fault Fault Fault Fault

IO device 1 IO device 2 IO device 3 IO device n

PROFIBUS DP

Fault Fault

Slave 1 Slave n

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 4
1 Task
1.2 Problem description

Description of the automation task


The automation task consists of monitoring a PROFINET IO and a PROFIBUS DP
IO-system using different network components. The possibility of diagnosing
individual devices and components shall be guaranteed. The user program takes
on system diagnostics. The determined diagnostic information is displayed on an
operator panel.

1.2 Problem description


Requirements of the automation task
The application shall give the programmer an introduction into diagnostics via the
user program.
Apart from integrated system diagnostics, TIA Portal also provides a range of
instructions for diagnostics in the user program. The purpose of this application and
the given example is to describe the functions to system programmers, as well as
how to use the diagnostic instructions and error OBs.
 Siemens AG 2016 All rights reserved

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 5
2 Solution
2.1 Overview

2 Solution
2.1 Overview
Schematic layout
The figure below shows a schematic overview of the most important components of
the solution:
Figure 2-1

STEP 7 S7-1500 TP1200


Diagnostic
information

PROFINET IE

Fault Fault Fault Fault


 Siemens AG 2016 All rights reserved

ET 200SP PN ET 200MP PN ET 200SP PN

PROFIBUS DP

Fault

ET 200SP DP

Setup
The different distributed I/O devices are connected via PROFINET IO or
PROFIBUS DP using an S7-1500 controller. The devices detect the fault at their
modules and send diagnostic data to the allocated controller. The controller
evaluates this diagnostic information in the user program. The operator panel
displays the evaluated information graphically in a view for each IO system, or in a
device view respectively.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 6
2 Solution
2.1 Overview

Topics not covered in this application


 The diagnostics in the user program are not possible for Safety modules.
 This application does not include a description of the integrated system
diagnostics.
 This application does not contain a complete discussion of all diagnostic
options provided by the user program. The extension of the present code by
the user is therefore possible and necessary.
 This application does not include a detailed description of the diagnostic
instructions.

Note For a detailed description of the diagnostic instructions, please refer to the TIA
Portal online help or the
System Manual STEP 7 Professional V13 SP1

 This application does not include a description of the diagnostic instructions of


S7-1200 controllers.

Basic knowledge of these topics is assumed.

Assumed knowledge
 Siemens AG 2016 All rights reserved

Basic knowledge for the following issues is assumed:


 STEP 7 (TIA Portal)
 WinCC (TIA Portal)
 STEP 7 block architecture and programming
 PROFINET IO
 PROFIBUS DP

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 7
2 Solution
2.2 Hardware and software components

2.2 Hardware and software components


2.2.1 Validity

The application was tested with


 STEP 7 V13 SP1
 S7-1500 V1.8

2.2.2 Components used

The application was created with the following components:


It is recommended to use the TIA Selection Tool for configuring the hardware:
http://www.siemens.com/tia-selection-tool

Note A list of the hardware and software products used can also be found in the
“98210758_User_defined_diagnostics_PRODUCTS_v21.zip” file in the archive.
Use the TIA Selection Tool for this.
 Siemens AG 2016 All rights reserved

Hardware components
Table 2-1
Component Qty Article number Note
CPU 1516-3 PN/DP 1 6ES7516-3AN00-0AB0 Alternatively, any
other CPU S7-1500
can be used.
Memory Card, 1 6ES7954-8LE02-0AA0
12 Mbytes
Digital input, 1 6ES7521-1BL00-0AB0 Diagnostics can be
DI 32x24VDC HF configured
Front connector, screw- 2 6ES7592-1AM00-0XB0
type terminal, 40-pin
Digital output, 1 6ES7522-1BL00-0AB0 Diagnostics can be
DQ 32x24VDC/0.5A ST configured
Analog input, 1 6ES7531-7KF00-0AB0 Diagnostics can be
AI 8xU/I/RTD/TC ST configured
Front connectors, 1 6ES7592-1BM00-0XB0
Push-in technology, 40-pin

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 8
2 Solution
2.2 Hardware and software components

Component Qty Article number Note


IM 155-5 PN ST 1 6ES7155-5AA00-0AB0 ET 200MP
Digital input, 1 6ES7521-1BL00-0AB0 Diagnostics can be
DI 32x24VDC HF configured
Digital output, 1 6ES7522-1BL00-0AB0 Diagnostics can be
DQ 32x24VDC/0.5A ST configured
Analog input, 1 6ES7531-7KF00-0AB0 Diagnostics can be
AI 8xU/I/RTD/TC ST configured
Front connector, screw- 2 6ES7592-1AM00-0XB0
type terminal, 40-pin
Front connectors, 1 6ES7592-1BM00-0XB0
Push-in technology, 40-pin
IM 155-6 PN ST incl. 1 6ES7155-6AA00-0BN0 ET 200SP
server module, incl. bus
adapter 2xRJ45
DI 8x24VDC HF 1 6ES7131-6BF00-0CA0 Diagnostics can be
configured
DQ 8x24VDC/0.5A HF 1 6ES7132-6BF00-0CA0 Diagnostics can be
configured
AQ 4xU/I ST 1 6ES7135-6HD00-0BA1 Diagnostics can be
configured
 Siemens AG 2016 All rights reserved

BU-type A0, 16 push-in, 1 6ES7193-6BP00-0DA0


2 feed terminals separated
(digital/analog,
max.24VDC/10A)
BU-type A0, 16 push-in, 2 6ES7193-6BP00-0BA0
2 feed terminals bridged
(digital/analog,
24VDC/10A)
IM 155-6 PN ST incl. 1 6ES7155-6AA00-0BN0 ET 200SP
server module, incl. bus
adapter 2xRJ45
DI 16x24VDC ST 1 6ES7131-6BH00-0BA0 Diagnostics can be
configured
BU-type A0, 16 push-in, 1 6ES7193-6BP00-0DA0
2 feed terminals separated
(digital/analog,
max.24VDC/10A)

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 9
2 Solution
2.2 Hardware and software components

Component Qty Article number Note


IM 155-6 DP HF 1 6ES7155-6BA00-0CN0 ET 200SP DP
incl. server module,
incl. DP connector
DI 8x24VDC HF 1 6ES7131-6BF00-0CA0 Diagnostics can be
configured
AI 4xRTD/TC HF 1 6ES7134-6JD00-0CA1 Diagnostics can be
configured
BU-type A0, 16 push-in, 1 6ES7193-6BP00-0DA0
2 feed terminals separated
(digital/analog,
max.24VDC/10A)
BU-type A0, 16 push-in, 2 6ES7193-6BP00-0BA0
2 feed terminals bridged
(digital/analog,
24VDC/10A)
TP1200 Comfort 1 6AV2124-0MC01-0AX0
CU240E-2 PN-F 1 6SL3244-0BB13-1FA0 Antrieb G120
PM340 1 6SL3210-1SB14-0UA0 Powermodul

Software components
Table 2-2
 Siemens AG 2016 All rights reserved

Component Qty Article number Note


STEP 7 1 6ES7822-1..03-..
Professional
V13 SP1 Update 7
WinCC Advanced 1 6AV210.-....3-0
V13 SP1 Update 7

Sample files and projects


The following list includes all files and projects that are used in this example.
Table 2-3
Component Note
98210758_User_defined_diagnostics_DOKU_v23_en.pdf This document.
98210758_User_defined_diagnostics_CODE_v23.zip This zip file contains the
STEP 7 project.
98210758_User_defined_diagnostics_PRODUCTS_v22.zip The zip file contains:
TIA Selection Tool file with
hardware and software
products.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 10
3 Basics for System Diagnostics
3.1 Diagnostics instructions

3 Basics for System Diagnostics


In the SIMATIC environment the diagnostics of devices and modules are
summarized in the expression “system diagnostics”. The monitoring functions are
automatically derived from the hardware configuration.
All SIMATIC products have integrated diagnostics functions that you can use for
detecting and repairing faults. The components automatically report operational
faults and supply additional detailed information. System-wide diagnostics can
minimize unscheduled downtimes.

3.1 Diagnostics instructions


There is a structure for data records with diagnostic information which applies for
all manufacturers. In STEP 7, the following instructions are available for diagnosing
a device in the user program.
Table 3-1
Instruction Description
RD_SINFO Read out start information of the current OBs
RT_INFO Reading Runtime statistics (not part of this application)
LED Read LED status
Get_IM_Data Reading identification and maintenance data
 Siemens AG 2016 All rights reserved

GET_NAME Read out the name of the module


GetStationInfo Reading information of an IO device
DeviceStates Reading the module information state in an IO system
ModuleStates Reading the module state information of a module
GEN_DIAG Reading diagnostic information (not part of this application)
GET_DIAG Reading diagnostic information (not part of this application)

3.2 Error OBs


In STEP 7, the following error organization blocks (OBs) are available for
evaluating error events:
Table 3-2
Error OB Description
Diagnostic interrupt The operating system of the S7-1500 CPU calls the diagnostic interrupt OB, if a
OB diagnostics-capable module detects a change of your diagnostic status.
(OB82)
Pulling/plugging the The operating system of the S7-1500 CPU calls the pulling/plugging OB, if a
OB configured and non-activated module or submodule of the distributed I/O is
(OB83) pulled or plugged.
Module rack error OB The operating system of the S7-1500 CPU calls the module rack error OB if a
(OB86) DB master system or PROFINET IO system, or a DP slave or IO device fails or
returns.

Note For more detailed information on the instructions and the error OB, please refer
to the TIA Portal online help.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 11
4 Mode of Operation
4.1 General overview

4 Mode of Operation
4.1 General overview
Program overview
The graphic below shows the program structure of the entire STEP 7 project.
Figure 4-1

DiagStartup
GEO2LOG
Plc
Startup

DiagStartup
Module
IoSystem
States

Main
Diagnostics Diagnostics Diagnostics Device
Data States
 Siemens AG 2016 All rights reserved

CopyTo
Get_Name
HmiDB

Diagnostic LOG2GEO
Diagnostic
error
interrupt Error

ShowDiag
Pull or plug PullOrPlug LED
of modules Modules

Rack or RackOr
station Station
failure Failure

Data blocks User program System blocks

The following table describes all blocks of the user program.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 12
4 Mode of Operation
4.1 General overview

The user program consists of the following blocks:

Table 4-1
Symbolic name Description
DiagnosticsData The global data block includes the diagnostic information of
[DB2080] the controller and the IO systems.
HmiDB The data block serves as interface for the visualization.
[DB2081]
Startup The startup OB calls the function block “DiagStartupPlc”. For
[OB100] each IO system, the OB calls the function block
“DiagStartupIoSystem” and transfers the block to the hardware
ID of the IO system.
DiagStartupIoSystem Using the “GEO2LOG” instruction, the function block
[FB2001] determines the hardware ID of device and modules from the
slot. The “Get_Name” instruction reads the device name. The
instructions “ModuleStates” and “DeviceStates” read the
status of the modules and devices.
DiagStartupPlc Using the “GEO2LOG” instruction, the function block
[FB2002] determines the hardware ID of the modules from the slot. The
instructions “ModuleStates” and “DeviceStates” read the
status of the modules and devices.
MainDiagnostics The cycle OB calls the “Diagnostics” function block and
 Siemens AG 2016 All rights reserved

[OB123] transfers the structures of global data block “DiagnosticsData”


to the block.
Diagnostics The function block provides the data for the visualization. It
[FB2000] uses the “LED” instruction to evaluate the status of the error
LED of the controller.
CopyToHmiDB The function copies the diagnostic information to the “HmiDB”.
[FC2081]
Diagnostic error interrupt The diagnostic interrupt OB calls the “DiagnosticError”
[OB82] function.
DiagnosticError The function evaluates the diagnostic information of OB82.
[FC2082]
Pull or plug of modules The pulling/plugging OB calls the “PullOrPlugModules”
[OB83] function.
PullOrPlugModules The function evaluates the diagnostic information of OB83.
[FC2083]
Rack or station failure The module rack failure OB calls the “RackOrStationFailure”
[OB86] function.
RackOrStationFailure The function evaluates the diagnostic information of OB86.
[FC2086]

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 13
4 Mode of Operation
4.2 Tag table “ConstDiagnostics”

4.2 Tag table “ConstDiagnostics”


Overview
Tag table “ConstDiagnostics” defines the constants that describe the error state
and the size of the diagnostic structure.
The figure below shows the globally defined constants:
Figure 4-2
 Siemens AG 2016 All rights reserved

4.3 Global data block “DiagnosticsData” [DB2080]


Overview
The figure below shows the structure of global data block “DiagnosticsData”.
Figure 4-3

The “DiagnosticsData” data block stores the hardware ID and the diagnostic
information of the controller and the IO systems.
For a better overview, the individual tags of the components were combined into
the following data types.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 14
4 Mode of Operation
4.3 Global data block “DiagnosticsData” [DB2080]

plc [typePlc]
The data type includes the information of controller and local modules.
Table 4-2
Tag name Data type Start Meaning
value
actualConfigured Int - Number of configured
CentralModules local modules
errorState Bool - Error state TRUE, in
the event of an error in
the plant.
slot Array - See slot [typeModul]
[1..MAX_MODULES_LOCAL]
of “typeModul”

slot [typeModul]
The data type includes the information of one module.
Table 4-3
Tag name Data type Start Meaning
value
 Siemens AG 2016 All rights reserved

slotLaddr HW_IO - Hardware ID for the


module (system data
type)
slotErrorState Bool - Error state of module

ioSystem [typeIoSystem]
The data type includes the information of an IO system.
Table 4-4
Tag name Data type Start Meaning
value
ioSystemId UINT - ID of IO system
ioSystemError Bool - Error state TRUE, in
the event of an error in
the IO system
firstDevice Int - Number of the first
device in the IO
system
lastDevice Int - Number of the last
device in the IO
system
actualConfigured Int - Number of configured
Devices devices
device Array - See
[1..MAX_DEVICES_SYSTEM] device [typeDevice]
of “typeDevice”

Note The array index of the “device” tag corresponds to the device number.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 15
4 Mode of Operation
4.4 Global data block “HmiDB” [DB2081]

device [typeDevice]
The data type includes the information of a device.
Table 4-5
Tag name Data type Start Meaning
value
laddr HW_DEVICE - Hardware ID for the
module (system data
type)
name String[50] - Name of device
errorState USInt - Status of the device
Possible status (see
6.2 Representation of
the status of the
devices)
error Bool - Error state TRUE, in
the event of an error at
the device
nextDevice Int - Number of the next
device
actualConfigured Int - Number of configured
 Siemens AG 2016 All rights reserved

Modules modules
slot Array - See slot [typeModul]
[1..MAX_MODULES_DEVICE]
of “typeModul”

Note The array index of the “slot” tag corresponds to the device number.

4.4 Global data block “HmiDB” [DB2081]


Overview
The figure below shows the structure of global data block “HmiDB”.
Figure 4-4

The data block stores the data for the visualization. For a better overview, the
individual tags of the components were combined into the following data types.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 16
4 Mode of Operation
4.4 Global data block “HmiDB” [DB2081]

showPlc [typeShowPlc]
The data type includes the information of controller and local modules for the
visualization.
Table 4-6
Tag name Data type Start Meaning
value
diagnosisLoaded Bool - TRUE when the PLC
screen is displayed at
the HMI
errorState Bool - Error state TRUE
when an error has
occurred in the plant
slot Array - See
[1..MAX_MODULES_LOCAL] slot [typeShowModul]
of “typeShowModul”

slot [typeShowModul]
The data type includes the information of one module.
Table 4-7
Tag name Data type Start Meaning
 Siemens AG 2016 All rights reserved

value
slotUsed Bool - TRUE, if a module is
configured at the slot
slotErrorState Bool - Error state TRUE in
the event of an error at
the module

showIoSystem [typeShowIoSystem]
The data type includes the information of an IO system.
Table 4-8
Tag name Data type Start Meaning
value
device Array - See
[1..MAX_DEVICES_SYSTEM] device
of “typeShowDevice” [typeShowDevice]

Note The array index of the “device” tag corresponds to the device number.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 17
4 Mode of Operation
4.4 Global data block “HmiDB” [DB2081]

device [typeShowDevice]
The data type includes the information of a device.
Table 4-9
Tag name Data type Start Meaning
value
stationNumber UInt - Device number
name String[50] - Name of device
errorState USInt - Status of the device
Possible status (see
6.2 Representation of
the status of the
devices)
slot Array - See
[1..MAX_MODULES_DEVICE] slot [typeShowModul]
of “typeShowModul”

Note The array index of the “slot” tag corresponds to the device number.

showActIoSystem [typeShowActIoSystem]
 Siemens AG 2016 All rights reserved

The data type contains tags for controlling the display as well as the information of
the selected IO system and the selected device.
Table 4-10
Tag name Data type Start Meaning
value
diagnosisLoaded Bool - TRUE when IO
system overview is
displayed at the HMI
actIoSystem Int 1 Index of the selected
IO system
actDeviceIndex Int - Index of the selected
device
copyModule Bool - Set at the HMI when
States the details view of a
device is selected
resetStates Bool - Set at the HMI using
the “Reset” button.
This resets the stored
error state.
device Array - See device
[1..MAX_DEVICES_SYSTEM] [typeShowDevice]
of “typeShowDevice”
actDevice “typeShowDevice” - See device
[typeShowDevice]

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 18
4 Mode of Operation
4.5 Function block “DiagStartupPlc” [FB2002]

4.5 Function block “DiagStartupPlc” [FB2002]


This function block already determines the hardware ID of the local components
when the controller is started, in order to avoid additional load on the running
process.

Interfaces
Figure 4-5 Call in “Startup [OB100]” for the controller

Table 4-11
Type Parameter Data type Description
 Siemens AG 2016 All rights reserved

InOut plc “typePlc” Diagnostic data of the controller and


respective local modules
Output status Int Return value of the system function for
which the error has occurred
instructionError Int Indicates where an error has occurred:
1 = DeviceStates PN
2 = GetName PN
3 = ModuleStates PN
4 = DeviceStates DP
5 = GetName DP
6 = ModuleStates DP

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 19
4 Mode of Operation
4.5 Function block “DiagStartupPlc” [FB2002]

Function description
This block is used for automatically determining the hardware ID of the local
components with the “GEO2LOG” instruction by means of the slot information. A
tag of system data type “GEOADDR” is used for writing the slot information new
prior to each call of the instruction.
The hardware IDs are stored in the respective structure in global data block
“DiagnosticsData”.
Additionally, it performs the first diagnosis of the configured local components.

The following figure shows the principle program sequence of the function block.

Figure 4-6

Start/Stop

Set slot
information of
local module x
 Siemens AG 2016 All rights reserved

GEO2LOG
Read HW ID
of local module

No
Last module

Yes
ModuleStates
Read state of
modules

Evaluate and save


state of modules

Start/Stop

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 20
4 Mode of Operation
4.6 Function block “DiagStartupIoSystem” [FB2001]

4.6 Function block “DiagStartupIoSystem” [FB2001]


This function block already determines the hardware ID of the components of an IO
system when the controller is started, in order to avoid additional load on the
running process.

Interfaces
Figure 4-7 Call in “Startup [OB100]” for IO system 1 and IO system 2
 Siemens AG 2016 All rights reserved

Table 4-12
Type Parameter Data type Description
Input ioSystemHwId HW_IOSYSTEM Hardware ID of the IO system
InOut ioSystem “typeIoSystem” Diagnostic data of the IO system
Output status Int Return value of the system function for
which the error has occurred
instructionError Int Indicates where an error has occurred:
1 = DeviceStates PN
2 = GetName PN
3 = ModuleStates PN
4 = DeviceStates DP
5 = GetName DP
6 = ModuleStates DP
errorIndex Int Device index for which an error occurs

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 21
4 Mode of Operation
4.6 Function block “DiagStartupIoSystem” [FB2001]

Function description
This block is used for automatically determining the hardware ID of the
components of an IO system with the “GEO2LOG” instruction by means of the slot
information. A tag of system data type “GEOADDR” is used for writing the slot
information new prior to each call of the instruction.
The “GET_NAME” instruction additionally reads the names of the PROFIBUS DP
slaves and PROFINET IO devices.
Hardware IDs and names are stored in the respective structure in global data block
“DiagnosticsData”.
Additionally, it performs the first diagnosis of the configured components of an IO
system.

The following figure shows the principle program sequence of the function block.

Figure 4-8

Start/Stop

DeviceStates
 Siemens AG 2016 All rights reserved

Read state of Set slot Set slot


configured devices information information
of device x device y module x

DeviceStates
Read state of GEO2LOG GEO2LOG
existing device Read HW ID HW ID
of device Read module

DeviceStates No
Read state of GET_NAME
faulty devices Read device Last module
name
Yes
LOG2GEO
Read number ModuleStates
Evaluate and save
of IO system Read state of
diagnosis modules

Evaluation
PROFIBUS DP or Determine index of first
Evaluate and save
PROFINET IO and last device and
number of devices state of modules

No No
Last device Last device

Yes Yes

Start/Stop

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 22
4 Mode of Operation
4.7 Function block “Diagnostics” [FB2000]

4.7 Function block “Diagnostics” [FB2000]


The function block reacts to the entries made at the HMI and provides the required
diagnostic information to the visualization.

Interfaces
Figure 4-9 Call in “MainDiagnostics [OB123]”
 Siemens AG 2016 All rights reserved

Table 4-13
Type Parameter Data type Description
Input firstCycleInit Bool TRUE in the first cycle
InOut plc “typePlc” Diagnostic data of the controller
and respective local modules
showPlc “typeShowPlc” Diagnostic data of the controller
and its local modules for
visualization
ioSystem Array Diagnostic data of the IO
[1..MAX_SYSTEM] systems
of “typeIoSystem”
showIoSystem Array Diagnostic data of the IO
[1..MAX_SYSTEM] systems for the visualization
of “typeShowIoSystem”
showActIoSystem “typeShowActIoSystem” Diagnostic data of the selected
IO system for visualization

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 23
4 Mode of Operation
4.7 Function block “Diagnostics” [FB2000]

Function description
In the first program cycle, the function block copies the diagnostic information
determined during startup into the “HmiDB”.
The function block uses the “LED” instruction to cyclically evaluate the status of the
error LED of the controller. In the event of a failure (LED status = 4), the error state
of the controller is set. It checks whether an error exists in an IO system.
The function block reacts to the entries made at the HMI. On demand, it resets the
stored error state and supplies the visualization with the requested data, such as:
 Diagnostic information of controller and local modules
 Diagnostic information of the IO system
 Diagnostic information of the devices and their modules

The following figure shows the principle program sequence of the function block.
Figure 4-10

Start/Stop

Copying the diagnostic


information in the first
 Siemens AG 2016 All rights reserved

cycle in HmiDB

Read and store


LED status PLC
error LED

Evaluate and store


IO system state

Reset
saved
error state

CopyToHmiDB
Copy diagnostic
information

Start/Stop

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 24
4 Mode of Operation
4.8 Function “CopyToHmiDB” [FC2081]

4.8 Function “CopyToHmiDB” [FC2081]


The function copies the diagnostic data of the controller or a device from data block
“Diagnostics data” to the “HmiDB”.

Interfaces
Figure 4-11 Call in the program

Table 4-14
Type Parameter Data type Description
Input deviceIndex Int Index (device number) of a device.
(0 for PLC)
InOut plc “typePlc” Diagnostic data of the controller
and respective local modules
showPlc “typeShowPlc” Diagnostic data of the controller
and its local modules for
 Siemens AG 2016 All rights reserved

visualization
ioSystem “typeIoSystem” Diagnostic data of the IO system
showIoSystem “typeShowIoSystem” Diagnostic data of the IO system
for visualization

Function description
The function copies the determined diagnostic information into the “HmiDB”.

The following figure shows the principle program sequence of the function block.
Figure 4-12

Start/Stop

PLC
PLC / Device?

Device
Copy diagnostic Copy diagnostic
information of the PLC information
devices in HmiDB in HmiDB

Start/Stop

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 25
4 Mode of Operation
4.9 Function “DiagnosticError” [FC2082]

4.9 Function “DiagnosticError” [FC2082]


The function evaluates the start information of error OB
“Diagnostic error interrupt [OB82]” and stores the information in global data
block“DiagnosticsData”.

Interfaces
Figure 4-13 Call in “Diagnostic error interrupt [OB82]”
 Siemens AG 2016 All rights reserved

Table 4-15
Type Parameter Data type Description
Input ioState Word State of the hardware object
laddr HW_ANY Hardware ID of the hardware
object which has triggered the
diagnostic interrupt
channel UInt Channel number
multiError Bool TRUE, if there is more than one
error
InOut plc “typePlc” Diagnostic data of the controller
and respective local modules
showPlc “typeShowPlc” Diagnostic data of the controller
and its local modules for
visualization
ioSystem Array[1..MAX_SYSTEM] Diagnostic data of the IO system
of “typeIoSystem”
showIoSystem Array[1..MAX_SYSTEM] Diagnostic data of the IO system
of “typeShowIoSystem” for visualization
showActIoSystem “typeShowActIoSystem” Diagnostic data of the selected
IO system for visualization

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 26
4 Mode of Operation
4.9 Function “DiagnosticError” [FC2082]

Function description
The function determines the geographic address (slot information) of the failed
module from the hardware ID using the “LOG2GEO” instruction. The slot
information is stored in a local tag of system data type “GEOADDR”.
The function evaluates the state of the hardware object separately for controller
and IO system.
In the event of an error in the IO system, the index of the IO system is determined
using the IO system number. From the slot information of the local tag, the device
and slot index, needed for storing the diagnostic information at the appropriate
location, is determined.

The following figure shows the principle program sequence of the function block.
Figure 4-14

Start/Stop

LOG2GEO
Determine
slot information
 Siemens AG 2016 All rights reserved

PLC
Area

PROFINET
PROFIBUS

Determine index of
IO system

IO_State IO_State
evaluate and save evaluate and save

CopyToHmiDB CopyToHmiDB
Copy diagnostic Copy diagnostic
information information

Start/Stop

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 27
4 Mode of Operation
4.10 Function “PullOrPlugModules” [FC2083]

4.10 Function “PullOrPlugModules” [FC2083]


The function evaluates the start information of error OB
“Pull or plug of modules [OB83]” and stores the information in global data block
“DiagnosticsData”.

Interfaces
Figure 4-15 Call in “Pull or plug of modules [OB83]”
 Siemens AG 2016 All rights reserved

Table 4-16
Type Parameter Data type Description
Input laddr HW_IO Hardware ID of the respective
module
eventClass Byte Event
B#16#38: (sub-) module plugged
B#16#39: (sub-) module pulled
or not accessible
faultId Byte Error code
InOut plc “typePlc” Diagnostic data of the controller
and respective local modules
showPlc “typeShowPlc” Diagnostic data of the controller
and its local modules for
visualization
ioSystem Array[1..MAX_SYSTEM] Diagnostic data of the IO system
of “typeIoSystem”
showIoSystem Array[1..MAX_SYSTEM] Diagnostic data of the IO system
of “typeShowIoSystem” for visualization
showActIoSystem “typeShowActIoSystem” Diagnostic data of the selected
IO system for visualization

Polled error code:


B#16#54: IO submodule plugged and matches the configured submodule
B#16#61: Module plugged, module type OK

Note Further error codes of error OB “Pull or plug of modules [OB83]”


(pulling/plugging OB) are available in the TIA Portal online help.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 28
4 Mode of Operation
4.10 Function “PullOrPlugModules” [FC2083]

Function description
The function determines the geographic address (slot information) of the failed
module from the hardware ID using the “LOG2GEO” instruction. The slot
information is stored in a local tag of system data type “GEOADDR”.
The function evaluates the event and the error code separately for controller and
IO system.
In the event of an error in the IO system, the index of the IO system is determined
using the IO system number. From the slot information of the local tag, the device
and slot index, needed for storing the diagnostic information at the appropriate
location, is determined.

If a module is plugged, the function determines the current state of the modules of
the device using the “ModuleStates” instruction.

The following figure shows the principle program sequence of the function block.
Figure 4-16

Start/Stop
 Siemens AG 2016 All rights reserved

LOG2GEO
Determine
slot information

PLC
Area

PROFINET
PROFIBUS

Determine index of
IO system

yes ModuleStates
Module plugged Determine state of
the modules
no

Error codes and alarms Error codes and alarms


evaluate and save evaluate and save

CopyToHmiDB CopyToHmiDB
Copy diagnostic Copy diagnostic
information information

Start/Stop

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 29
4 Mode of Operation
4.11 Function “RackOrStationFailure” [FC2086]

4.11 Function “RackOrStationFailure” [FC2086]


The function evaluates the start information of error OB
“Rack or station failure [OB86]” and stores the information in global data
block“DiagnosticsData”.

Interfaces
Figure 4-17 Call in “Rack or station failure [OB86]”
 Siemens AG 2016 All rights reserved

Table 4-17
Type Parameter Data type Description
Input laddr HW_IO Hardware ID of the faulty
hardware object
eventClass Byte Event
B#16#38: going event
B#16#39: coming event
faultId Byte Error code
InOut plc “typePlc” Diagnostic data of the controller
and respective local modules
showPlc “typeShowPlc” Diagnostic data of the controller
and its local modules for
visualization
ioSystem Array[1..MAX_SYSTEM] Diagnostic data of the IO system
of “typeIoSystem”
showIoSystem Array[1..MAX_SYSTEM] Diagnostic data of the IO system
of “typeShowIoSystem” for visualization
showActIoSystem “typeShowActIoSystem” Diagnostic data of the selected
IO system for visualization

Polled error code:


B#16#C4: Failure/return of a DP slave
B#16#CB: Failure/return of a PROFINET IO device

Note Further events and error codes of error OB “Rack or station failure [OB86]”
(module rack error OB) are available in the TIA Portal online help.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 30
4 Mode of Operation
4.11 Function “RackOrStationFailure” [FC2086]

Function description
The function determines the geographic address (slot information) of the failed
module from the hardware ID using the “LOG2GEO” instruction. The slot
information is stored in a local tag of system data type “GEOADDR”.
The function evaluates the event and the error code separately for controller and
IO system.
In the event of an error in the IO system, the index of the IO system is determined
using the IO system number. From the slot information of the local tag, the device
and slot index, needed for storing the diagnostic information at the appropriate
location, is determined.
When a device returns with failure, the block determines the current state of the
modules of the device using the “ModuleStates” instruction.

The following figure shows the principle program sequence of the function block.
Figure 4-18

Start/Stop

LOG2GEO
 Siemens AG 2016 All rights reserved

Determine
slot information

PLC
Area

PROFINET
PROFIBUS
GEO2LOG
Determine index of
Determine
IO system hardware ID

ModuleStates
yes
Returned Determine state of
the modules
no

Event and error code Event and error code


evaluate and save evaluate and save

CopyToHmiDB CopyToHmiDB
Copy diagnostic Copy diagnostic
information information

Start/Stop

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 31
5 Installation and Commissioning
5.1 Installing the hardware

5 Installation and Commissioning


5.1 Installing the hardware
The figure below shows the hardware configuration of the application.
Figure 5-1

L+ M L+ M L+ M L+ M L+ M

SIMATIC HMI
SIMATIC DI DQ AI
TP1200
CPU 1516 32x24VDC 32x24VDC 8xU/I/RTD/TC
Comfort

PN PN DP 1 19 PN PN

Simulation
Drahtbruch
PROFINET / IE

L+ M L+ M L+ M L+ M
 Siemens AG 2016 All rights reserved

SIMATIC DI DQ AI
IM 155-5 PN 32x24VDC 32x24VDC 8xU/I/RTD/TC

PN PN

L+ M L+ M L+ M L+ M L N

SIMATIC DI DQ AQ SINAMIC
IM 155-6 PN 8x24VDC 8x24VDC 4xU/I G120

PN PN PN PN

L+ M L+ M L+ M L+ M L+ M

SIMATIC DI AI SIMATIC DI
IM 155-6 DP 8x24VDC 4xRTD/TC IM 155-6 PN 16x24VDC

DP PN PN

PROFIBUS DP

Note The setup guidelines of the devices must generally be followed.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 32
5 Installation and Commissioning
5.2 IP / PROFIBUS addresses and device names

5.2 IP / PROFIBUS addresses and device names


In the example below, the following device numbers, IP / PROFIBUS addresses
and device names are used:

Table 5-1
Component Device IP PROFIBUS Device name
number Address address
SIMATIC CPU 1516 0 192.168.0.1 2 PLC_1
SIMATIC IM 155-6 PN 1 192.168.0.2 ET200SP_1
SIMATIC IM 155-5 PN 2 192.168.0.3 ET200MP_2
SIMATIC IM 155-6 PN 10 192.168.0.10 ET200SP_10
SINAMICS G120 30 192.168.0.30 Drive_1
SIMATIC HMI TP1200 - 192.168.0.4 TP1200
SIMATIC IM 155-6 DP - - 8 Slave_8

5.3 Software installation (download)


 Siemens AG 2016 All rights reserved

Note At this point, it is assumed that the necessary software has been installed on
your computer and that you are familiar with the software.

5.4 Setting the PROFIBUS DP address


In order for the controller to be able to communicate with the PROFIBUS device,
the PROFIBUS DP address must be set at the interface module of ET 200SP via
the DIL switch.

Note Further information is available in Setting the PROFIBUS DP address.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 33
5 Installation and Commissioning
5.5 Assign a PROFINET device name

5.5 Assign a PROFINET device name


In order for all PROFINET devices to be able to communicate with each other, a
PROFINET device name must be assigned. The configured IP addresses of the
devices are automatically transferred when downloading the project.

Table 5-2: Instruction – PROFINET in TIA Portal


No. Action Notes
1. Start the TIA Portal and open the -
example project.

2. Open “Devices & Network” and


activate the “Network view”.
Use the right mouse button to
click on the PROFINET
connection line and select
“Assign device name”.
 Siemens AG 2016 All rights reserved

3. In this window you assign the


PROFINET device names to all 1
of the devices.
1. Select the “PROFINET
device name”.
2. In the list, you select the
device you wish to assign
the PROFINET device name
to.
3. Click on “Assign name” 2

4. Repeat step 3 until all devices


have a PROFINET device name.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 34
5 Installation and Commissioning
5.6 Load project

5.6 Load project


The software example is available on the HTML page from which you downloaded
this document.
Table 5-3
No. Action Notes
1. Unzip the code folder
„98210758_User_defined_diagnostics_CODE
_v21.zip” into a directory of your choice.
2. Open the “DiagnoseAWP_V21.ap13” project
with TIA Portal.
3. In the project tree, select the “PLC_1” folder of
the controller and in the toolbar you click on
the “Download to device” button.
 Siemens AG 2016 All rights reserved

4. In the project tree, select the “TP1200” folder


of the operator panel and in the toolbar you
click on the “Download to device” button.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 35
5 Installation and Commissioning
5.7 Integrating the application into an existing project

5.7 Integrating the application into an existing project


The application described here can be fully integrated into your project. The
necessary steps are described below.

5.7.1 Configuring the diagnostic settings

For each module of your project you can enable the module-specific diagnostic
settings separately.
The following diagnostic settings are possible, for example:
 No supply voltage L+
 Wire break
 Short circuit to ground
 etc.

Note Information, on how to configure the diagnostic settings is available in the


application example at System diagnostics with S7-1500 and TIA Portal in
Chapter 5.
 Siemens AG 2016 All rights reserved

5.7.2 Integrating the PLC objects

In order to copy the objects of the application, you either open this application
parallel to your project, or you open this application as a reference project for your
project.

Table 5-4
No. Action
1. In “PLC_1 > PLC tags” you copy the “Diagnostics” folder into your project.
2. In “PLC_1 > PLC data types” you copy the “Diagnostics” folder into your project.
3. In “PLC_1 > Program blocks” you copy the “Diagnostics” folder into your project.
4. If your project already contains error OBs, copy the networks of the error OBs of
the application into your respective error OBs. Please ensure that the position of
the inserted code may affect the program sequence.
Then you delete the error OBs OB82, OB83 and OB86 of the application.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 36
5 Installation and Commissioning
5.7 Integrating the application into an existing project

No. Action
5. Adjusting constants to your project
Open the user constants in “PLC tags > Diagnostics > ConstDiagnostics”
Using the user constants you adjust the diagnostics application to your project. To
do so, change the following constants:
1. Optional: if you wish to save storage space, adjust the
MAX_DEVICES_SYSTEM constant to the highest device number in your
project. In der visualization, a maximum of 256 devices is displayed.
2. Adjust the MAX_SYSTEM constant to the number of IO systems in your
project.
3. Create new constants for further IO systems.
For example, “IO_SYSTEM3 Int 3 ” etc.
These constants are used in the next step as index for the IO system.

1
 Siemens AG 2016 All rights reserved

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 37
5 Installation and Commissioning
5.7 Integrating the application into an existing project

No. Action
6. Adjusting “Startup [OB100]” to the project
1. Open startup OB “Startup [OB100]”
2. Open the system constants in “PLC tags > Default tag table”
3. Divide the editing section vertically
4. Assign the hardware ID of the IO system
(data type: Hw_IoSystem) from the system constants to the “ioSystemHwId”
input of function block “DiagStartupIoSystem”.
5. Assign the diagnostic structure of an IO system of data block
“DiagnosticsData” to the “ioSystem” parameter.
Please note that each IO system receives its own index
6. If necessary, add further instances of function block “DiagStartupIoSystem”
into startup OB “Startup [OB100]” and repeat steps 4 and 5.
For each IO system, an instance of function block “DiagStartupIoSystem”
must be available.

2 1

3
 Siemens AG 2016 All rights reserved

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 38
5 Installation and Commissioning
5.7 Integrating the application into an existing project

5.7.3 Integrating the HMI elements

This chapter describes how to integrate the entire HMI application.


Table 5-5
No. Action
1. In “TP1200 > HMI tags” you copy the “Diagnostic” folder into your HMI project.
2. Open the HMI tag table “Tag table_Diagnostic” and set the HMI connection of
your HMI in the “Connection” column.

3. In “TP1200 > Scripts > VB scripts” you copy the “Diagnostic” folder into your HMI
project.
4. In “TP1200 > Screen management > Pop-up screens” you copy the
“Pop-up_OverviewModules” screen into your HMI project.
5. In “TP1200 >Screens > 001_Application” you copy the screens
“Topic_001.0_PLC”, “Topic_002.0_IO_System” and “Topic_003.0_Messages” into
your HMI project.
 Siemens AG 2016 All rights reserved

6. In the properties of the screens you select your template, or no template


respectively.
7. Link the screens to your already existing screens.
8. In “TP1200” you open “Text and graphic lists”. Adjust the “Text_list_IO_System”
text list to the number of your IO systems. The text list is used for selecting the
IO system in the “Topic_002.0_IO_System” screen.

Note You can also copy the entire HMI from the example and integrate the HMI
application into it.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 39
5 Installation and Commissioning
5.7 Integrating the application into an existing project

5.7.4 Expansion of the visualization

Note The visualization of the application shows the devices with device number 1 to
256. If your device numbers are within this range, you can skip this chapter.

Note If you wish to display more than 256 devices in your visualization, the number of
devices must be a multiple of 64, since 64 devices are displayed in the
visualization per page.

The following description shows an expansion to 320 devices:


Table 5-6
No. Action
1. Open the HMI tag table “TagTable_DeviceModul”.
According to tag “DeviceModule_256” you create new tags “DeviceModule_257”
to “DeviceModule_320” with the respective start values 257 to 320.
 Siemens AG 2016 All rights reserved

2. The structure of the tags in the HMI tag table "TagTable_Diagnostic" automatically
adapts to the structure of the plc variables.
The lowest array index in the HMI is 0, as opposed to 1 in the PLC program.
Requirement: the tags already exist in the controller.
This only requires changing the PLC constant “MAX_DEVICES_SYSTEM” to
“320” (see Integrating the PLC point 5).

3. Open HMI tag table “TagTable_Multiplex”.


Change the maximum of the range of tag “SiteIndex1” from 3 to 4.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 40
5 Installation and Commissioning
5.7 Integrating the application into an existing project

No. Action
4. Open HMI tag table “TagTable_Multiplex”.
Expand multiplex tags “Field1” to “Field64” using the respective tags at index 4.

5. Open HMI tag table “TagTable_Multiplex”.


Expand multiplex tags “ErrorState1” to “ErrorState64” using the respective tags at
index 4.
 Siemens AG 2016 All rights reserved

Note If you wish to display fewer devices, you can reduce the number of devices in the
same way as well.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 41
6 Operating the Application
6.1 Overview

6 Operating the Application


6.1 Overview
The picture below shows the user interface of the operator panel.
Figure 6-1

Slide-in screen navigation

PLC overview IO system devices overview Alarms view


 Siemens AG 2016 All rights reserved

Reset saved state


Device pop-up details view
Display next 64 devices

Display previous 64 devices

Selecting the IO system

Close pop-up

The “Topic” screen shows the start screen of the application.


The slide-in screen is used for screen navigation.
The “PLC” screen shows the diagnostic information of the controller and its
modules.
The “IO-Systems” screen shows the configured PROFINET IO devices of the
selected IO system. The IO system can be selected via a symbolic input field. Click
on “Next Site” to display the next 64 devices, click on “Prev Site” to display the
previous 64 devices. In the visualization, the devices with device number 1 to 256
can be displayed. Clicking on “Reset” deletes the saved state of the devices.
Clicking on a device opens the pop-up screen with the details view of the device.
The view shows the diagnostic information of the modules of a device, the index of
the IO system, the device number, and the device name. Click on the “close”
button to close the pop-up screen again.
The “Alarms” screen shows the alarms window with the messages.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 42
6 Operating the Application
6.2 Representation of the status of the devices

6.2 Representation of the status of the devices


The devices can have a different status. The table below shows the representation
and meaning of the status.

Table 6-1
Status Representation Meaning
1 Device OK

2 Device faulty

3 Device lost connection

12 Device was faulty

13 Device had lost connection


 Siemens AG 2016 All rights reserved

6.3 Diagnostics at the operator panel


Diagnostic “missing module at ET200SP_1”
For diagnosing the failure, please proceed as follows.

Table 6-2
No. Action Notes
1. Drag module DQ16 to
ET200SP_1 slot 2.
2. 1. Open the “IO Systems” 1
screen at the operator 3
panel.
2. Select “IO System 1”.
The screen indicates
the failure at the
device with device
number 1.
3. For detailed
information on the
failure, please click on
the button of device 1.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 43
6 Operating the Application
6.3 Diagnostics at the operator panel

No. Action Notes


3. The pop-up screen with the
details view of device 1
opens. The view shows an
error at slot 2, the index of
the IO system, the device
number, and the device
name.
Clicking on “close” closes
the pop-up screen.

4. Reinsert the module into


slot 2.
The symbol of device 1
turns green with an orange
frame. This means that the
device had failed and the
fault has been removed.
 Siemens AG 2016 All rights reserved

Clicking on “Reset” deletes


the saved state and the
frame turns black again.

5. Open the “Alarms” screen


to have the alarm for the
failure displayed.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 44
6 Operating the Application
6.4 Evaluating the diagnostic information

6.4 Evaluating the diagnostic information


Using an example, this chapter illustrates where diagnostic information can be
found in the event of an error. Polling this information in your program now enables
you to program specific reactions to certain failures in your plant.

Evaluating the diagnostic information “missing module at ET200SP_1”


The diagnostic information of the failure is available in the following locations.

Table 6-3
No. Action Notes
1. Drag module DQ16 to
ET200SP_1 slot 2.
2. The failure is stored in
2 1
global data block
“DiagnosticsData”. The
data block can be
interpreted in the following
way: 3

1. Open global data block


“DiagnosticsData” in
 Siemens AG 2016 All rights reserved

the TIA Portal.


4
2. Click on the “Monitor
all” button.

3. Open the folder


5
“ioSystem >
ioSystem[1]”. The
error state of the IO
system is displayed
6
here.
4. Open the folder
“device > device[1]”.
Error state and the
name of the devices
are displayed here.
5. Open the folder “slot >
slot[2]”.
An error at slot 2 is
displayed here.

Note For further failures, you can also proceed as described above.

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 45
7 Links & Literature

7 Links & Literature


Table 7-1
Topic Title
\1\ Siemens Industry http://support.industry.siemens.com
Online Support
\2\ Download page of https://support.industry.siemens.com/cs/ww/en/view/9821075
the entry 8
\3\ System https://support.industry.siemens.com/cs/ww/en/view/68011497
diagnostics with
S7-1500 and TIA
Portal
\4\ STEP 7 https://support.industry.siemens.com/cs/ww/en/view/109011420
Professional
V13 SP1 System
Manual
\5\ S7-1500 System https://support.industry.siemens.com/cs/ww/en/view/59191792
Manual

History
 Siemens AG 2016 All rights reserved

8
Table 8-1
Version Date Modifications
V1.0 09/2014 First version
V2.0 04/2015 New version with evaluation of the errors in the error OBs
V2.1 04/2016 New version with SINAMICS G120 and structured HMI tags
V2.2 07/2016 New version: Change of the error evaluation
V2.3 10/2016 New version: Small error correction

Diagnostics in the User Program with S7‑1500


Entry ID: 98210758, V2.3, 10/2016 46

Vous aimerez peut-être aussi