library description 04/2016 diagnostics block with visualization via … · 2016-04-21 · library...

65
https://support.industry.siemens.com/cs/ww/de/view/50897766 Library description 04/2016 Diagnostics block with visualization via HMI or web browser for AS Interface in the TIA Portal AS-Interface

Upload: lamhanh

Post on 19-Aug-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

https://support.industry.siemens.com/cs/ww/de/view/50897766

Library description 04/2016

Diagnostics block with visualization via HMI or web browser for AS Interface in the TIA Portal AS-Interface

Page 2: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

Warranty and Liability

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 2

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Warranty and Liability

Note The application examples are not binding and do not claim to be complete with regard to configuration, equipment or any contingencies. The application examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible for the correct operation of the described products. These application examples do not relieve you of the responsibility of safely and professionally using, installing, operating and servicing equipment. 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 and without prior notice. If there are any deviations between the recommendations provided in this application example and other Siemens publications – e.g. Catalogs – the contents of the other documents shall 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 fundamental contractual obligations (“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 Siemens AG.

Security informa-

tion

Siemens provides products and solutions with industrial security functions that support the secure operation of plants, solutions, machines, equipment and networks.

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. Products and solutions from Siemens are only one part of such a concept.

The customer is responsible for preventing unauthorized access to the customer’s plants, systems, machines and networks. Systems, machines and components should be connected to the company network or the Internet only if and to the extent necessary and if appropriate protective action (e.g., use of firewalls and network segmentation) was taken.

In addition, Siemens’ recommendations regarding appropriate protective action should be followed. For more information about industrial security, visit http://www.siemens.com/industrialsecurity.

Siemens’ products and solutions undergo continuous development to make them even more secure. Siemens strongly recommends to perform updates as they become available and use only the latest product versions. Using versions that are out of date or no longer supported can increase the risk of cyber threats.

To continually stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed under http://www.siemens.com/industrialsecurity.

Page 3: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

Table of Contents

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 3

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Table of Contents Warranty and Liability ................................................................................................. 2

1 Overview ............................................................................................................. 5

1.1 Area of application and utility ............................................................... 5 1.2 Scope of validity ................................................................................... 7 1.3 Available code packages...................................................................... 7 1.4 Documentation guide ........................................................................... 9

2 Function and effect .......................................................................................... 10

2.1 Effect scheme ..................................................................................... 10 2.2 Information on the program blocks ..................................................... 11 2.2.1 Overview of the blocks ....................................................................... 11 2.2.2 The presentation in detail ................................................................... 12 2.2.3 Calling environment ............................................................................ 14 2.2.4 Performance data ............................................................................... 14 2.3 Overview of HMI template .................................................................. 16 2.3.1 The diagnostic screen ........................................................................ 16 2.3.2 The statistics screen ........................................................................... 21 2.4 Overview of the web interface ............................................................ 22 2.4.1 The diagnostic window ....................................................................... 23 2.4.2 The control panel ................................................................................ 26 2.4.3 The statistics screen ........................................................................... 27 2.5 Hardware and software components ................................................. 28

3 The program blocks in detail .......................................................................... 29

3.1 The visualization blocks “AsiHmiVisu“ and “AsiWebVisu“ ................. 29 3.2 The diagnostic block “AsiDiag“ ........................................................... 32 3.3 The raw data of the “AsiDiag“ ............................................................ 35 3.3.1 Overview of diagnostic raw data ........................................................ 35 3.3.2 Overview of statistic raw data ............................................................ 38 3.3.3 The data structure in the instance data block .................................... 39

4 The project example ASI_DIAG_PROJECT ................................................... 45

4.1 Addresses of hardware components .................................................. 45 4.2 Using the STEP 7 project ................................................................... 46 4.3 Operating the STEP 7 project ............................................................ 47

5 The WinCC configuration................................................................................ 48

5.1 Using visualization images ................................................................. 48 5.2 Adjusting the AS-i master selection list .............................................. 50 5.2.1 Changes to the interface .................................................................... 50 5.2.2 The list position entries ....................................................................... 50 5.2.3 Adjusting the text display of the selection list ..................................... 52 5.3 Adjusting the AS-i slaves information ................................................. 55

6 HTML configuration ......................................................................................... 57

6.1 Using websites ................................................................................... 57 6.2 Adjusting the AS-i master information ................................................ 59 6.3 Adjusting the AS-i slave information .................................................. 60 6.4 Adjusting the display texts .................................................................. 60 6.5 Accessing the user-defined websites ................................................. 61

7 The library “ASI_DIAG“ ................................................................................... 62

7.1 Using library blocks ............................................................................ 62 7.2 Initializing the blocks .......................................................................... 63

Page 4: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

Table of Contents

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 4

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

8 References ....................................................................................................... 65

9 History............................................................................................................... 65

Page 5: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

1 Overview

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 5

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

1 Overview

1.1 Area of application and utility

AS interface slaves are connected to a SIMATIC control via gateways or communication modules. In case of service support, an individual evaluation of diagnostic data of AS-i masters and slaves in the STEP 7 user program supports the system operator during troubleshooting, so that a smooth operation can be quickly restored.

To make the AS-i diagnosis easier for the user, the present example contains a number of blocks for a comfortable evaluation and visualization of the diagnostic data:

in the user program: the read AS-i diagnostic data are stored in a data block where they are available for individual further processing.

on HMI panels: the library contains blocks that serve as interface between HMI panel and CPU.

via web browsers: SIMATIC CPUs with a PROFINET interface offer the option to access CPU tags with the help of individually designed websites, provided and made available by the system. The library contains blocks that serve as interface between user defined websites and CPU.

Schematic layout

The following figure shows a possible hardware structure for the application of the STEP 7 blocks:

Figure 1-1

ET 200SP IE/AS-i Link DP/AS-i Link DP/AS-i F-Link

S7-300 + CP 343

HMI-PanelPG

S7-1500

DP/AS-i Link 20E

PROFINET IE

PROFIBUS DP

AS-Interface

Page 6: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

1 Overview

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 6

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

The HMI visualization

The following figure shows the HMI template for the visual diagnosis of the AS-i masters and slaves:

Figure 1-2

The web visualization

The following figure shows the web interface for the visual diagnosis of the AS-i masters and slaves:

Figure 1-3

Page 7: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

1 Overview

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 7

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

1.2 Scope of validity

The AS-i diagnosis has been developed for the following SIMATIC S7 CPUs:

SIMATIC S7-300/400

SIMATIC S7-1500

All current AS-i masters from the SIMATIC product range are supported:

DP/AS-i Link 20E

DP/AS-i LINK Advanced

DP/AS-i F-Link

IE/AS-i LINK PN IO

CP 343-2 (P)

CM AS-i Master ST for ET 200SP (as from Firmware 1.1)

TIA Portal V13 SP 1 Update 7 and WinCC V13 SP1 serve as configuration software.

Note Further information about the hardware and software requirements can be found in chapter 2.5.

1.3 Available code packages

Overview

For this example, the following code packages are provided:

50897766_ASI_DIAG_S7_1500_CODE_TIAV13.zip: This package contains the blocks/ the project for a S7-1500 control.

50897766_ASI_DIAG_S7_x00_CODE_TIAV13.zip: This package contains the blocks/ the project for a S7-300 or S7-400 control.

Both code packages are identical in their function and effect; they were designed and developed for the relevant control only.

Contents of code package

Every code package contains two parts:

1. A STEP 7 building block library ASI_DIAG, containing the relevant blocks for diagnosis and an additional file with user-defined websites for the web server of the CPU. This library is intended for creating own AS-i diagnostic applications.

2. A STEP 7 sample project ASI_DIAG_PROJECT in which the program blocks,

the HMI templates and the web-based AS-i diagnosis are used as an example.

The following charts briefly summarize the components of the code packages:

Page 8: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

1 Overview

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 8

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Table 1-1

Package name Components Application

STEP 7 library ASI_DIAG

Folder ASI_DIAG_LIB:

Relevant program blocks for diagnosis, HMI and web visualizations of an AS-i network

Folder HTML_FILES:

User-specific HTML pages and javascript for the visualization of the diagnostic information and operation of the functions via the web server.

Creation of own diagnostic applications

Integration into already existing projects

Visualization via HTML

Visualization via HMI (copy HMI template from STEP 7 project)

STEP 7 project ASI_DIAG_PROJECT

All blocks relevant for the diagnosis, as well as the HMI and web visualization, are already integrated into the project and fully configured.

Completed STEP 7 project for instant use (possibly requires adjustment of hardware configuration).

Page 9: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

1 Overview

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 9

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

1.4 Documentation guide

This document provides the user with an overview and, if necessary, with detailed descriptions of the library building blocks. Also, short configuration instructions will be given for the following scenarios:

How to use and parameterize the AS-i diagnostic blocks in a project.

How to use the prefabricated visualization masks.

For a comfortable diagnosis of the AS-i slaves and AS-i masters, the prefabricated WinCC projects in connection with the function block “AsiHmiVisu” can be used. This block processes the raw diagnosis data of the AS-i masters and feeds them to a panel.

It is furthermore possible to process the raw diagnosis data in the user program on your own. The supplied visualization capabilities are optional. In this case, some chapters in this document are irrelevant to you.

Those chapters are listed in the following chart:

Table -22

Chapter Visualization HMI panel

Visualization web browser

Processing user program

Chapter 2.3 Overview of HMI template

✓ ✗ ✗

Chapter 2.4 Overview of the web interface

✓ ✗

Chapter 3.1 The visualization blocks "AsiHmiVisu“ and "AsiWebVisu“

✓ ✓ ✗

Chapter 3.2 The diagnostic block "AsiDiag“

✓ ✓ ✓

Chapter 3.4 The raw data of the "AsiDiag“

✗ ✗ ✓

Chapter 4 Working with the project example

✓ ✓ ✗

Chapter 5 The WinCC configuration

✓ ✗ ✓

Chapter 6 The HTML configuration

✗ ✓ ✓

Chapter 7 The library "ASI_DIAG”

✗ ✗ ✓

Chapter 8 References

✓ ✓ ✓

As supporting literature, the listed documents from chapter 8 are recommended in any case.

Page 10: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 10

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

2 Function and effect

2.1 Effect scheme

The following figure schematically illustrates the functionality of the blocks for the AS-i diagnosis:

Figure 2-1

SIMATIC station

User program

Reading & Savingdiagnostic data

HMI Panel

Processing & Display

Webbrowser

Master n

Master 2

AsiDiag

Master 1

ASiHmiVisu

ASiWebVisu

AS-i Master 2

AS-i Master 1

AS-i Master n

Page 11: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 11

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

2.2 Information on the program blocks

2.2.1 Overview of the blocks

The following figure shows the blocks in their entirety. All blocks listed here are integrated into the ASI_DIAG library.

Figure 2-2

HMI-Panel Webbrowser

AsiDiag

AsiHmiVisu AsiWebVisu

WWW

AsiWebInterface

Diagnostic

Visualization

Central diagnostic block

The central block “AsiDiag” ist used for reading out and evaluating the status of the AS interface slaves and masters.

The “AsiDiag” supplies the status bits for each AS interface line (masters and slaves) and stores the diagnostic data in the instance data block.

Per AS-i master, one call of the “AsiDiag” with a separate instance data block is required.

Visualization blocks

To display the diagnostic data in a WinCC environment on a panel and/or in a web browser, the related visualization blocks can be used optionally.

“AsiHmiVisu” for the visualization on a HMI panel

“AsiWebVisu” for the visualization via web.

Note The data exchange between HMI panel and CPU is done via the instance data block of the “AsiHmiVisu”.

With user-defined websites, an instance data block as interface for data exchange is not admissible. Therefore, the web visualization interacts with an external set of tags, which in this example are stored in the global data block “AsiWebInterface” (see chapter on “web blocks”).

Web blocks

STEP 7 saves the user-defined websites as control DB and DB fragments. In the user program, the command “WWW” is used for calling up the encoded and

Page 12: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 12

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

fragmented data blocks and for the interaction between website and STEP 7 user program.

The command “WWW” is part of the standard library of the TIA portal.

Next to the above named diagnostic and visualization blocks, the global data block “AsiWebInterface” is used to access the CPU tags.

2.2.2 The presentation in detail

“AsiDiag“

The following chart shows the block as LAD presentation:

Figure 2-3

The parameters have the following meaning:

Table -21

Type Tag Data type Default value

Meaning

Inp

ut

masterAddress HW_IO or DINT

L#0 S7-1500: HW-ID of AS-i master

S7-x00: Logical address of master module as Long INT e.g. L#1.

asiWebDB DINT L#0 Optional web visualization: Number of instance data block of “AsiWebVisu”.

asiPanelDB DINT L#0 Optional HMI visualization: Number of instance data block of “AsiHmiVisu”.

masterID INT L#0 Device type of As-i master; The following applies

1: IE/AS-i Link Advanced

2: DP/AS-i (F-)Link, CP343-2 (P), DP/AS-I Link (Adv.)

3: ET 200SP -AS-i master

req BOOL 1 Request Bit; on a positive edge at REQ, the block is processed.

Ou

tpu

t

busy BOOL 0 True, if the block is processed.

error BOOL 0 True, if an error occurred.

Page 13: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 13

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

“AsiWebVisu“

The following chart shows the block in LAD presentation:

Figure 2-4

Table 2-2

Type Tag Data type Default value

Meaning

Input/Output

WebInterfaceData

“typeWebInterfaceData“

L#0 Tag set for data exchange between website and CPU.

“AsiHmiVisu“

The following chart shows the block in LAD presentation:

Figure 2-5

The block has no parameters

“WWW“ command

The following figure shows the WWW command in FBD presentation

Figure 2-6

Table 2-3

Type Tag Data type Default value

Meaning

Input CTRL_DB DINT L#0 Number of control data block

Output RET_VAL DWORD 0 Contains an error code in case of an error

Page 14: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 14

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

2.2.3 Calling environment

Overview

The “AsiDiag” has to be called in the cyclic OB 1 and is activated by the parameter input “req” (positive edge).

In this, the trigger of the parameter input can be executed cyclically (e.g. through a clock memory) and/or in an error or cyclic interrupt organization block (OB).

Activating the “AsiDiag” via the error or cyclic interrupt OBs has the advantage, that the block will only be processed in certain situations (error or cyclic interrupt). This action saves an unnecessary processing of the diagnostic block on the cyclic process level.

Note Activate all “AsiDiag” already in the start-up OB (OB 100). This ensures a uniform default state of all “AsiDiag”.

Note The error/cyclic interrupt/start-up OB are active for one cycle only; however, the “AsiDiag” needs more cycles for execution. That is why in these OBs, the block is only initiated (meaning, a positive edge is created at the “req” input). Further processing is done by the cyclic OB 1.

For the visualization, it is sufficient to call up the respective blocks one time in the cyclic process level OB 1. Namely, those are the blocks

For the HMI visualization: “AsiHmiVisu“

For the web visualization:

– “AsiWebVisu“

– “WWW“

2.2.4 Performance data

Number of AS-i master

The visualization requires one “AsiDiag” per AS-i master. Which master stores its data under which instance data block number is stored internally in lists in “AsiHmiVisu” or “AsiWebVisu”.

In the “AsiHmiVisu”, there is room for 255 list entries which means 255 AS-i master or AS-i lines. In the “AsiWebVisu”, the number of list entries is limited to 20 due to lack of performance.

The actual maximum number of “AsiDiag” in the project strongly depends on the general conditions. These include factors such as

CPU used and its computing power

Type of FB calls (restrictions on the number of simultaneously running SFB 52/SFB 53 tasks)

Maximum OB 1 cycle time

Size of the CPUs working memory

Page 15: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 15

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Watchdog timer

To prevent the diagnostic FB from hanging in an infinite loop in case of an error, there is a watchdog timer. It is preset to 400ms.

If these 400ms are exceeded, the program processing aborts.

AS-i performance data

Per AS-i line, up to 62 slaves can be connected which are addressed with the addresses of 1 (A) - 31 (A) and 1B - 31B. According to the specifications, the update time is 5ms for 31 slaves and 10ms at maximum condiguration.

Capacity in load memory

The user-defined websites are coded in data blocks, fragmented, and stored in the CPU load memory. The size of the storage space depends on the content of the websites. The internal load memory of the CPU can be increased via pluggable memory cards.

Restrictions on reading/writing a data set and command interface

Information on the status of the AS-i slaves are requested and read in the library block “AsiDiag” via data sets, or via the commando interface in the respective master. This is done by the system functions SFB 52 (RDREC; read data set) and SFB 53 (WRREC; write data set).

Depending on the CPU type, only a certain number of SFB and therefore “AsiDiag” calls can be processed simultaneously. The number for simultaneous calls varies between four (for smaller CPUs) and eight (for bigger CPUs). More information can be found in the FAQ with the BID:15364459.

Note In most cases, there is no particular need for action; if there is, please observe the procedure given in chapter 7.3.

Page 16: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 16

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

2.3 Overview of HMI template

WinCC provides the possibility to visualize the AS-i network via a panel.

Note All functions described in this chapter only work in conjunction with the function blocks

“AsiDiag“

“AsiHmiVisu“

NOTICE An error-free visualization is only possible, if

1. For every AS-i master involved, a separate “AsiDiag” has been created and all “AsiDiag” have been called up at least once (initialization phase); this can be ensured by calling it up in the start-up OB.

2. For all AS-i masters involved, information (instance data block number and display text) are stored in WinCC.

2.3.1 The diagnostic screen

Layout overview of the AS-i master diagnosis

The diagnostic page clearly and graphically displays the status of the configured AS-i masters and their slaves, thus allowing a comfortable diagnostic overview.

The data required for this are read via the “AsiDiag” from the AS-i master and are prepared by the “AsiHmiVisu”.

The image of the AS-i diagnosis is divided into three areas:

Figure 2-7

1

2

3

4

4

The meaning of each area is illustrated in the following chart:

Page 17: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 17

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Table 2-4

No. Function

1. Selection of the AS-i master; each AS-i master is displayed with its bus.

2. Status of the AS-i master according to AS-i specification.

3. Overview and conditions of the slaves connected to the bus.

4. Menu fields

Selecting the AS-i master

The selection of the AS-i masters is done via a selection list. The following screenshot shows the list with two example entries:

Figure 2-8

In the selection list, only those AS-i masters appear that have previously logged into the “AsiHmiVisu” via the “AsiDiag” with their instance data block number. More information can be found in chapter 3.2.3 (Initialization phase).

Note Please refer to chapter 5 (The WinCC configuration) on how to change the display texts and on how to add additional AS-i masters.

Status of AS-i masters

Information can be read or written via data blocks or command calls from all AS-i master interfaces.

Next to information on connected slaves, the AS-i master also provides separate status flags according to the AS-i specification.

The flags of the selected AS-i masters are read and -depending on the status- highlighted in color in WinCC.

Figure 2-9

The meaning of each status information is illustrated in the following chart:

Table 2-5

Display text Meaning

Auto-addressing enabled The flag indicates, whether auto-addressing is disabled (Bit = 0) or enabled (Bit = 1) by the user.

Offline, no cyclic data exchange.

The flag is set, if the offline phase is active. In the offline phase, the AS-i master does not transmit any cyclic input and output data from or to the slaves. The offline phase is

Page 18: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 18

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Display text Meaning

generally gone through at start-up only and is finished automatically.

Ground fault detected The flag is set, if a connection between the AS-i positive lead and earth, or between AS-i negative lead and earth has been detected.

AS-i master in configuration mode

The flag is set in configuration mode and reset in protected mode

Auto-addressing executable The flag is set, if auto-addressing can be executed (i.e. a failed slave unit can be replaced by a brand new slave unit of the same type, whereby the AS-i address is automatically assigned.).

Slave with address 0 detected

The flag is set, if an AS-i slave with address 0 has been detected

Configuration error The flag is set, if the actual configuration of the slave units at the AS-i cable does not match the set configuration.

Status of slaves

In the area “status of slaves”, an overview of the slaves is displayed. A maximum of 62 slaves (31 A-slaves and 31 B-slaves) can be diagnosed. If a slave with address 0 is detected, an additional diagnostic field for address 0 will be displayed.

The status of the slaves is read via data sets or command calls from the AS-i masters.

With the function “Read_Lists_and_Flags” and -if required- “Read Peripheral Error List”, the following information are read from the AS-i master:

The list of active AS-i slaves (LAS)

The list of detected AS-i slaves (LDS)

The list of planned AS-i slaves (LPS)

The list of peripheral faults of activated AS-i slaves (LPF)

The flags of the AS-i master according to AS-i specification.

For the ET 200SP AS-i master, the following lists are read in addition:

List of multiple addressing

List of failed slaves

List of failed slaves

List of surplus slaves

List of configured ID = A

List of actual ID = A

Page 19: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 19

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

With the help of WinCC, the statuses of the slaves are indicated via various background colors.

Figure 2-10

In this, the following attributions apply:

Table 2-6

Color Meaning

Green The slave has been recognized, configured and activated. It does not signal peripheral errors.

Yellow The slave has been recognized, but not configured and activated.

Orange The slave signals a peripheral error.

Red The slave is configured, but failed.

Gray The slave does not exist and is not configured.

Purple A wrong slave has been inserted. This status is not supported by all AS-i masters. It is available, for example, on the ET 200SP AS-i master.

Dark green The AS-i master has recognized a multiple assignment of this address. This function is not supported by all AS-i masters. This function is available, for example, on the ET 200SP AS-i master.

After clicking on the button “Legend”, this color-coding appears as pop-up window in the WinCC display.

Figure 2-11

Page 20: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 20

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

For every slave, a detailed description (e.g. article number, location, function) can be stored.

By simply clicking on a slave, the stored information as well as the current status will be displayed in clear text in the output field.

Figure 2-12

Note Refer to chapter 5.4 (Adjusting the AS-I slaves information) on how to store additional information on slaves.

Additional states

Next to the states of the AS-i masters and AS-i slaves, errors from the visualization environment are also displayed. This includes messages such as

The connection between CPU and visualization interrupted;

The CPU is stopped;

No data from “AsiHmiVisu”;

The messages are displayed in clear text in the visualization.

The table shows the possible statuses and the cause:

Table 2-7

Message text Trigger

CPU stopped No value change occurs on the meter in the “AsiHmiVisu”.

Missing data from the HMI block

The AS-i Master has not logged into the “AsiHmiVisu” or reports an internal error in the “AsiDiag”. The “AsiHmiVisu” receives no information or faulty information.

No connection to CPU The connection between CPU and panel is interrupted.

As soon as the CPU stops or the data block of the “AsiHmiVisu” no longer provides any data, the statuses of the slaves switch to gray.

Menu fields

The menu field serves to switch languages, to switch screens and to exit runtime.

Note The menu field “AS-i statistics” cannot be selected, if the currently selected AS-i master is a PROFIBUS/ AS-i link or CP 343-2 (masterID=2).

Page 21: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 21

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

2.3.2 The statistics screen

Layout overview of the AS-i master statistics

The statistics screen displays the error counters of the AS-i masters and AS-i slaves. The error counters of the AS-i slaves are visible only with the ET 200SP AS-i master.

The values are read via the “AsiDiag” from the AS-i master and are processed by the “AsiHmiVisu”. The reset buttons reset all error counters of the selected AS-i masters back to zero.

Figure 2-13

Note Further information on the error counters can be found in the manual of the AS-i master.

Page 22: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 22

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

2.4 Overview of the web interface

The combination of HTML and Javascript provides the possibility to create user-defined websites for the PROFINET CPUs and, via them, to diagnose the AS-i network web-based and to execute online functions. All files needed for the presentation (HTML, images, Javascript, etc.) are converted to control DBs and fragmented DBs. The command “WWW” provides a cyclic update of the website.

Note The following blocks are required for all functions described in this chapter:

“AsiDiag“

“AsiWebVisu“

“WWW“

All control DBs and fragmented DBs of the websites

“AsiWebInterface“

NOTICE An error-free visualization is only possible, if

1. For every AS-i master involved, a separate “AsiDiag” has been created and all “AsiDiag” have been called up at least once (initialization phase); this can be ensured by calling it up in the start-up OB.

2. For all AS-i master involved, information (instance data block number and display text) are stored in the XML file.

Page 23: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 23

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

2.4.1 The diagnostic window

Layout overview of the AS-i master diagnosis

The diagnostic page clearly and graphically displays the status of the configured AS-i masters and their slaves, thus allowing a comfortable diagnostic overview.

The data required for this are read from the AS-i master via the “AsiDiag”, processed via the “AsiWebVisu” and made available for the website via the interface “AsiWebInterface”.

The image of the AS-i web diagnosis is divided into three areas:

Figure 2-14

1

2

3

4

The meaning of each area is illustrated in the following chart:

Table 2-8

No. Function

1. Selection of the AS-i master; each AS-i master is displayed with its bus.

2. Status of the AS-i master according to AS-i specification.

3. Overview and conditions of the slaves connected to the bus.

4. Menu fields

Page 24: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 24

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Selecting the AS-i master

The selection of the AS-i master is done via a selection list and is transferred to the CPU via the adjacent button. The current AS-i master is displayed in a text field.

The following screenshot shows the list:

Figure 2-15

Status of AS-i master

Via a data set, information on the AS-i master interface can be read or written.

Next to information on connected slaves, the AS-i master also provides separate status flags according to the AS-i specification.

The flags of the selected AS-i masters are read and -depending on the status- highlighted in color in the web interface.

Figure 2-16

The meaning of every status information corresponds with those of the HMI visualization (see chart 2-6).

Status of slaves

In the area “status of slaves”, an overview of the configured slaves is displayed. A maximum of 62 slaves (31 A-slaves and 31 B-slaves) can be diagnosed. If a slave with address 0 is detected, an additional diagnostic field for address 0 will be displayed.

The status of the slaves is read via a data set from the AS-i master.

With the function “Read_Lists_And_Flags” and, if required, “Read Peripheral Error List”, the following information are read from the AS-i master:

The list of active AS-i slaves (LAS)

The list of detected AS-i slaves (LDS)

The list of planned AS-i slaves (LPS)

The list of peripheral faults of the activated AS-i slaves (LPF)

The flags of the AS-i master according to AS-i specification.

For the ET 200SP AS-i master, the following lists are read in addition:

Page 25: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 25

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

List of multiple addressing

List of failed slaves

List of failed slaves

List of surplus slaves

List of configured ID = A

List of actual ID = A

With the help of Javascript, the statuses of the slaves are indicated via various background colors.

Figure 2-17

The color-coding corresponds to the color-coding of the HMI visualization (see chart 2-7).

For every slave, a detailed description (e.g. article number, location, function) can be stored.

By simply clicking on a slave, the stored information as well as the current status will be displayed in clear text in the output field below the area “status of slaves”.

Figure 2-18

Note Refer to chapter 6.3 (Adjusting the AS-I slaves information) on how to store additional information on slaves.

If the CPU or the AS-i master can no longer be accessed, the statuses of the slaves switch to gray.

Menu fields

The menu field serves for switching pages and languages.

Page 26: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 26

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

2.4.2 The control panel

Note The control panel is only operable with a CM AS-i master for ET 200SP.

Layout overview of the AS-i control panel

For the ET 200SP AS-i master, the TIA portal offers a control panel in online mode, to execute functions directly from the portal. This control panel is recreated in the web interface. The following functions are available:

Change of operation mode

Acceptance of slave configuration

Change of AS-i slave address

Via the interface “AsiWebInterface”, the function commands are transmitted to the user program, processed, and sent to the AS-i master.

The image of the AS-i control panel is divided into three areas:

Figure 2-19

The meaning of each area is illustrated in the following chart:

Table 2-9

No. Function

1. Status of AS-i master and change of operating mode

2. Acceptance of slave configuration

3. Change of AS-i slave address

Page 27: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 27

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

2.4.3 The statistics screen

Note The statistics overview is not operable with a PROFIBUS/ AS-i link or CP 343-2 (P).

Layout overview of the AS-i master statistics

The statistics screen displays the error counters of the AS-i masters and AS-i slaves.

Figure 2-20

The values are read from the AS-i master via the “AsiDiag”, processed via the “AsiWebVisu” and made available for the website via the interface “AsiWebInterface”. The reset buttons reset all error counters of the selected AS-i masters back to zero.

Note Further information on the error counters can be found in the manual of the AS-i master.

Page 28: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

2 Function and effect

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 28

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

2.5 Hardware and software components

Software

These program blocks apply to

STEP 7 V13 SP 1 Update 7

Control

For this example, the following code packages are provided:

50897766_ASI_DIAG_S7_1500_CODE_TIAV13.zip: This package contains the blocks/ the project for a SIMATIC S7-1500 from FW 1.7 onwards.

50897766_ASI_DIAG_S7_x00_CODE_TIAV13.zip: This package contains the blocks/ the project for a

– SIMATIC S7-300 from FW 3.2 onwards

– SIMATIC S7-400 from FW 6.0 onwards

Visualization

The visualization screens of WinCC were optimized for the operating device TP700 Comfort 7 (800 x 480 pixel).

The user-defined websites were designed for Internet Explorer 8 and Firefox 11. Javascript is used for interaction on the website. To use the web visualization properly, Javascript needs to be activated in your browser.

AS-i master

The following AS-i masters are supported:

DP/AS-i Link 20E (6GK1 415-2AA10)

DP/AS-i LINK Advanced single master (6GK1 415-2BA10)

DP/AS-i LINK Advanced double master (6GK1 415-2BA20)

DP/AS-i F-Link (3RK3 141-1CD10 / 3RK3 141-2CD10)

IE/AS-i LINK single master (6GK1 411-2AB10)

IE/AS-i LINK double master (6GK1 411-2AB20)

CP 343-2 (6GK7 343-2AH01-0XA0)

CP 343-2P (6GK7 343-2AH11-0XA0)

ET 200SP AS-i master (from FW 1.1 onwards) (3RK7137-6SA00-0BC1)

Page 29: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 29

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

3 The program blocks in detail This chapter provides a detailed description of the library blocks in terms of core functionality and internal operation sequences.

Also, content and structure of the diagnostic information read from the AS-i master are explained. This knowledge is vital for working without visualization.

3.1 The visualization blocks “AsiHmiVisu“ and “AsiWebVisu“

Note The visualization blocks “AsiHmiVisu” and “AsiWebVisu” are identical in their functionality. Due to their intended use (”AsiHmiVisu for the HMI panel and “AsiWebVisu” for the web interface) they only differ in the type of data processing.

The function blocks “AsiHmiVisu” and “AsiWebVisu” have two important tasks:

Management of configured AS-i master with the corresponding instance data block number.

Supply of data for the images of the AS-i master visualization in WinCC and in the web browser.

The management of the AS-i masters

For the storage of diagnostic information and the status on itself and on its connected slaves, every AS-i master needs the “AsiDiag” with a separate instance data block.

For the visualization in WinCC or in the web browser, the “AsiHmiVisu” or “AsiWebVisu accesses the respective instance data block, reads the information and copies it to its own instance data block.

For the attribution “AS-i master instance data block number“ the visualization blocks manage a master list, to which all “AsiDiag“ logon with the respective instance data block number.

The following screenshot displays the master list with four logged on “AsiDiag” blocks:

Figure 3-1

The master list only displays the “position” of the respective data block number. It does not provide information on the AS-i master itself. In this, the type (IE/AS-i Link, PB/AS-i Link, CP 343-2, ET 200SP) is stored in the respective “asiDiag” instance data block via the input parameter “masterID”.

Page 30: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 30

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Using this list, WinCC and the web page create the display texts of the selection list for the AS-i master diagnostic screen (see chapter 5.3 Adjusting the AS-i master selection list as well as chapter 6.2 Adjusting the AS-i master information).

Note The positions on the master list determine the sequence of the AS-i masters on the selection list in the visualization interfaces.

The AS-i master that has logged into the master list first, also appears in the first position on the selection list.

Data supply of the visualization screens (HMI, Web)

The second task of the visualization blocks is to supply the visualization screens with the desired data.

On the visualization screens, the user has the possibility via a selection list to select an AS-i master that has been configured in STEP 7.

Depending on from which AS-i master data is required, the raw information is taken from the respective “AsiDiag” instance data block in the respective visualization block and is subsequently processed for the display.

Reset after CPU restart

For the removal of old data from the instance data blocks of the “AsiHmiVisu” and “AsiWebVisu” blocks, the block properties of STEP 7 are relied upon.

Via the remanence behavior, it

can be determined, if the instance data shall be reset to load value (not remanent) after every time, the main supply is switched on or switched off and after every time, the CPU has changed from STOP to RUN mode, or if the data shall be kept (remanent).

Via the access mode “standard” of the superordinate function block, only one collective configuration of all instance data is possible. Deactivate the corresponding option box in the properties of the instance data block.

Figure 3-2

Page 31: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 31

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Process

The following procedure shows the visualization, using the example of an HMI panel.

Figure 3-3

The “AsiDiag“ logs into

the „AsiHmiVisu“

one time.

The instance DBno is saved in a free

position of the master list.

WinCC fills theselection list

analogous to themaster list of the

“AsiHmiVisu“

For every instance DBno involved, there is a display

text stored in WinCC; the order of the selection list

corresponds to that of the master list

On the panel, an

AS-i master is selected

from the selection list

The panel transmits the position

to the “AsiHmiVisu“

“AsiHmiVisu“ identifies

the according

instance DBno

from the master list

Master/selection list are identical in terms of

the order of the AS-i masters

“AsiHmiVisu“ reads the

raw data from the

detected instance DB

Slave statuses and master flags are contained

in this; they are read (a)cyclically by the “AsiDiag“

“AsiHmiVisu“ processes

the data for WinCCStatuses of slaves and flags are displayed

.

Page 32: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 32

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

3.2 The diagnostic block “AsiDiag“

The function block “AsiDiag” has two core functions:

Organization of own initialization. The AS-i master logs into the visualization blocks, if desired.

Reading of diagnostic information and flags from the AS.i master. The read data are processed, assorted, and stored in a separate instance data block in the AS-i master.

As every AS-i master supplies different data, it is mandatory to assign a separate instance data block of the “AsiDiag” to every AS-i master.

The initialization phase

The AS-i master is initialized once after calling a block. This is necessary for a later processing for the WinCC/web display as well as for reading the diagnostic information.

If a visualization is desired, the “AsiDiag” logs into the master list of the visualization block in this phase, by storing its instance data block.

The following agreement applies:

Table 3-1

Input parameters Value Reaction of the AS-i master block

AsiWebDB >0 Login to the master list of “AsiWebVisu”.

AsiWebDB 0 No login to “AsiWebVisu”; a visualization via web is not desired.

AsiHmiDB >0 Login to the master list of “AsiHmiVisu”.

AsiHmiDB 0 No login to “AsiHmiVisu”; a visualization via the HMI panel is not desired.

Page 33: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 33

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

The following chart outlines this phase:

Figure 3-4

As-i Master

initialized?Skip initialization phase

IN Parameter AsiWebDB >0

IN Parameter AsiHmiDB >0

Entry into the master list

of “AsiWebVisu“

Entry into the master list

of “AsiHmiVisu“

Master list in

“AsiWebVisu“

Master list in

“AsiHmiVisu“

yes

no

yes

yes

iDBNr

iDBNr

Reading the diagnostic information

The requirement for reading the diagnostic data is the initialization phase and the statement of the type of the AS-i master via the input parameter “masterID”.

There are significant differences between the AS-i masters in how they read diagnostic information and flags from the AS-i master.

With the IE/AS-i link („masterID“ = 1) and ET 200SP AS-i master („masterID“ =3), the reading is done via a single “read data set” command (data set number 84) bzw. (Data set number 92).

PROFIBUS/ AS-i link and CP 343-2 (P) („masterID“ = 2) have a command interface by which acyclic services are processed. The command interface is accessed via the commands “read data set” and “write data set” and with data set number 2.

Note With the PROFIBUS/ AS-i link or CP 343-2 (P), this sequence does not have to be executed separately in the user program, but can also be done via the block “ASI-CTRL”. This block processes the command protocol independently and also allows the parameterization on SIMATIC AS-i masters as well as the reading of information data. Notes on this can be found here:

https://support.automation.siemens.com/WW/view/de/51678777

The ASI_CTRL is already integrated into the “AsiDiag”.

Note Another call of the block “ASI_CTRL” in the rest of the user program is not allowed, because the commands overwrite each other.

The AS-i master is addressed via the input parameter “masterAddress”, which is parameterized with the according hardware identifier. The content of the data set is stored in the instance data block of the AS-i master.

Page 34: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 34

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Reset after CPU restart

For the removal of old data from the instance data blocks “AsiDiag”, the block properties of STEP 7 are relied upon.

Via the remanence behavior, it can be determined, if the instance data shall be reset to load value (not remanent) after every time, the main supply is switched on or switched off and after every time, the CPU has changed from STOP to RUN mode, or if the data shall be kept (remanent).

Via the access mode “standard” of the superordinate function block, only one collective configuration of all instance data is possible. Deactivate the corresponding option box in the properties of the instance data block.

Figure 3-5

The watchdog timer

To prevent the “AsiDiag” from hanging in an infinite loop in case of an error, there is a watchdog timer.

If, due to an error, the program freezes during the processing and the defined delay time (400ms) elapses, the program processing is aborted. This action prevents a program from “being stuck” in an operation sequence.

Processing conditions

Because one cycle does not suffice for the processing of the “AsiDiag”, an integration of the “AsiDiag” in the OB 1 is mandatory.

The function block is equipped with a “req” input parameter, which ensures program processing. It must be triggered by a positive edge, otherwise, the block will not be processed.

In an error or cyclic interrupt OB, this can be done either manually or via a time trigger.

Note Activate all “AsiDiag” already in the start-up OB (OB 100). This ensures a uniform default state of all “AsiDiag”.

Page 35: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 35

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

3.3 The raw data of the “AsiDiag“

To process the diagnostic raw data in the user program, it is necessary to know, which information is provided by the system are where it can be found in the instance data block of the “AsiDiag”.

3.3.1 Overview of diagnostic raw data

Diagnostic data set

The statuses of the slaves and of the AS-i masters are read via data sets or command calls from the AS-i masters.

Depending on the AS-i master, the length of the read diagnostic data varies:

Table 3-2

AS-i master Data length

CM AS-i Master ST for ET 200SP 88 bytes

PROFIBUS/ AS-i Link, CP 343-2 (without LPF) 48 bytes

PROFIBUS/ AS-i Link, CP 343-2 (LPF) 14 bytes

The flags of the AS-i master according to AS-i specification.

2 bytes

With the function “Read_Lists_And_Flags” and, if required, “Read Peripheral Error List”, the following entries are provided:

The list of active AS-i slaves (LAS)

The list of detected AS-i slaves (LDS)

The list of planned AS-i slaves (LPS)

The list of peripheral faults of activated AS-i slaves (LPF)

The flags of the AS-i master according to AS-i specification.

For the ET 200SP AS-i master, the following lists are read in addition:

List of multiple addressing

List of failed slaves

List of failed slaves

List of surplus slaves

List of configured ID = A

List of actual ID = A

Every slave occupies one bit per list, therefore, one list occupies 8 byte of the data read.

Page 36: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 36

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Order of slaves in the lists

With the IE/AS-i Link and CM AS-i Master ST the slaves are addressed in ascending bit address order.

The following attribution applies:

Table 3-3

Slave no Address (Byte x ≙ List start)

0A Byte x, Bit 0

1A Byte x, Bit 1

2A Byte x, Bit 2

… …

8A Byte (x+1), Bit 0

9A Byte (x+1), Bit 1

10A Byte (x+1), Bit 2

… …

0B Byte (x+4), Bit 0

1B Byte (x+4), Bit 1

2B Byte (x+4), Bit 2

… …

8B Byte (x+5), Bit 0

9B Byte (x+5), Bit 1

10B Byte (x+5), Bit 2

With all other AS-i masters, the slaves are addressed in descending bit address order. The following attribution applies:

Table -34

Slave no Address (Byte x ≙ List start)

0A Byte x, Bit 7

1A Byte x, Bit 6

2A Byte x, Bit 5

… …

8A Byte (x+1), Bit 7

9A Byte (x+1), Bit 6

10A Byte (x+1), Bit 5

… …

0B Byte (x+4), Bit 7

1B Byte (x+4), Bit 6

2B Byte (x+4), Bit 5

… …

8B Byte (x+5), Bit 7

9B Byte (x+5), Bit 6

10B Byte (x+5), Bit 5

Page 37: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 37

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Note The exact bit assignment of the lists is described in detail in the manual of the respective AS-i master.

Master flags

The flags of the AS-i master occupy a maximum of two bytes, according to AS-i specification.

Not every AS-i master provides 12 flags (2 byte = 16bit). The chart lists the most common flags:

Table 3-5

Flag Description

KONFIG_OK The flag is set, if the configured SET configuration matches the ACTUAL configuration.

LDS_0 The flag is set, if an AS-i slave with address 0 has been detected

AUTO_ADDR_ASSIGN The flag is set, if auto-addressing is enabled. E.g., AUTO_ADDR_ENABLE = 1 is connected to the AS interface, not a ‘false’ AS-i slave.

AUTO_ADDR_AVAIL The flag is set, if auto-addressing is executed, as soon as a slave with valid configuration is connected to address zero.

OPERATION MODE The flag is set in “configuration mode” and reset in “protected mode”.

NORMAL_OPERATION The flag is set, if the AS-i master is in “protected mode”.

APF (AS-i Power Fail) The flag is set, if the voltage in the AS-i cable is too low, or if a power down has been detected during a data transmission.

OFFLINE_READY The flag is set, if the offline phase is active.

PERIPHERY_OK The flag is set, if no AS-i slave signals a peripheral error.

DATA_EXCHANGE_ ACTIVE

The flag is set, if cyclic data traffic is going on during normal operation.

OFFLINE The flag is set, if the operation mode OFFLINE is supposed to be active, or if it is active already.

AUTO_ADDR_ENABLE The flag indicates, whether auto-addressing is disabled (Bit = 0) or enabled (Bit = 1) by the user.

MP (Master_Power_on) The flag is set after switching on the supply voltage.

GROUND FAULT The flag is set, if the AS-i cable is ground-faulted.

EPROM_OK The flag is set, if the EPROM of the device is okay.

Note The exact bit assignment of the flags is described in detail in the manual of the respective AS-i master.

Page 38: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 38

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

3.3.2 Overview of statistic raw data

Error counter AS-i line

The error counter of the AS-i line for the statistic display is read via a data set from the CM AS-i master ST or IE/AS-i link.

The data set “read AS-i master error counter“ reads AS-i line-specific error counters. The count starts from zero each time, the device is started up.

Table 3-6

Information Meaning

AS-i Power Fail The AS-i voltage supply is missing, too low, or not stable.

Ground fault The slave was connected to the frame ground (earth) from the AS-i cable A or B.

Slave failure After multiple successive timeouts, the slave has been signed out from the list of activated AS-i slaves (LAS).

Missing slave-telegram Absence of slave reply from an existing slave.

Faulty slave-telegram The slave reply of a slave is garbled or distorted.

Peripheral error Replying to Read_Status, the slave signals “Peripheral Fault”.

Protocol error Error in data transfer after CTT1 … 5, e.g. Wrong or missing toggle-bit.

Faulty master telegram The AS-i master detects errors in own send-telegram.

Master telegrams sent Number of master telegrams

This counter counts all telegrams sent by the master, regardless of whether a slave reply has been received or not.

By dividing the absolute values of the error counters by the number of master telegrams, the percentage error and therefore the error frequency can be calculated.

The total number of master telegrams is calculated as follows:

MT_CNT_TOTAL = (MT_CNT_HIGH x MT_CNT_BASE) + MT_CNT_LOW

The error count starts from zero, each time, the device is started up.

Double address available

(only CM AS-i master ST)

Multiple address assignment available

Bit 0 is set (= 1), if at least one double address has been detected.

Duplicate (only CM AS-i master ST)

Double address detected

For multiple assignments of AS-i addresses, the respective bit is set

Error counter AS-i slaves

The error counter of the AS-i slave for the statistic display is read via multiple data sets from the CM AS-i master ST.

The data set “read AS-i slave error counter” reads the slave-specific error counters.

Table -37

Information Meaning

Slave failure After multiple successive timeouts, the slave has been signed out from the list of activated AS-i slaves (LAS).

Page 39: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 39

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Information Meaning

Missing slave telegram Absence of slave reply from an existing slave.

Faulty slave telegram The slave reply of a slave is garbled or distorted.

Peripheral error Replying to Read_Status, the slave signals “Peripheral Fault”.

Protocol error Error in data transfer after CTT1 … 5, e.g. Wrong or missing toggle-bit.

Faulty master telegram The AS-i master detects errors in own send-telegram.

Master telegrams sent Number of master telegrams

This counter counts all telegrams sent by the master, regardless of whether a slave reply has been received or not.

By dividing the absolute values of the error counters by the number of master telegrams, the percentage error and therefore the error frequency can be calculated.

The total number of master telegrams is calculated as follows:

MT_CNT_TOTAL = (MT_CNT_HIGH x MT_CNT_BASE) + MT_CNT_LOW

The error count starts from zero, each time, the device is started up.

3.3.3 The data structure in the instance data block

For the storage of the AS-i master diagnostic data in the function block “AsiDiag”, multiple areas have been declared with the help of data types. This was done due to mismatches in the read data length and in the bit assignment:

Table -38

Tag Data type

statFlagsAsiSlaveDetailVersionIE “typeAsiFlagsDetailVersionStandard“

statFlagsAsiSlaveDetailVersionPB “typeAsiFlagsDetailVersionID2“

statPeripheryFaultAsiSlaveVersionPB “typeAsiSlavePeripheryFaultVersionPB“

statFlagsAsiSlaveDetailVersionET 200SP “typeAsiFlagsDetailVersionID3“

Page 40: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 40

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Structure of “statFlagsAsiSlaveDetailVersionIE“

With the IE/AS-i link, all lists required for the diagnosis (LAS, LDS, LPS, LPF and AS-i master flags) are read with a single call (“Read_Lists_And_Flags“) and are stored in the data area “statFlagsAsiSlaveDetailVersionIE“.

The following figure shows the structure of the 36 Bytes for “statFlagsAsiSlaveDetailVersionIE“:

Figure 3-6

1

2

3

4

5

The following table illustrates the correlation:

Table 3-9

Number Name Description

1 active List of active slaves (LAS)

2 known List of detected slaves (LDS)

3 configured List of planned slaves (LPS)

4 peripherieFault The list of peripheral faults of activated AS-i slaves (LPF)

5 Master Flags

Page 41: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 41

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Structure of “statFlagsAsiSlaveDetailVersionPB“

With the PROFIBUS/ AS-i link and CP 343-2 (P), the lists required for the diagnosis (LAS, LDS, LPS and AS-i master flags) are read via the command “Read_Lists_And_Flags“ and are stored in the data area “statFlagsAsiSlaveDetailVersionPB”.

The following figure shows the structure of the 32 Bytes for “statFlagsAsiSlaveDetailVersionPB“:

Figure 3-7

1

2

3

4

The following table illustrates the correlation:

Table -310

Number Name Description

1 active List of active slaves (LAS)

2 known List of detected slaves (LDS)

3 configured List of planned slaves (LPS)

4 MasterFlags

Page 42: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 42

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Structure of “typeAsiSlavePeripheryFaultVersionPB“

With the PROFIBUS/ AS-i link and the CP 343-2 (P), the missing LPF list is read separately via the command “Read_Peripheral Error List“ and are stored in the data area „statPeripheryFaultAsiSlaveVersionPB“.

Figure 3-8

The following table illustrates the correlation:

Table 3-11

Number Name Description

1 peripheryFault List of active slaves (LAS)

1

Page 43: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 43

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Structure of “typeAsiFlagsDetailVersionID3“

With the CM AS-i master ST, all lists required for the diagnosis are read with a single call (”Read_Lists_And_Flags“) and stored in the data area “statFlagsAsiSlaveDetailVersionET 200SP”.

The following figure shows the structure of the 88 Bytes for “statFlagsAsiSlaveDetailVersionET 200SP“:

Figure 3-9

1

2

3

4

5

6

8

9

10

7

11

Page 44: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

3 The program blocks in detail

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 44

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

The following table illustrates the correlation:

Table 3-12

Number Name Description

1 Master Flags

2 active List of active slaves (LAS)

3 failed List of failed slaves

4 wrong List of wrongly inserted slave

5 known_configured List of surplus slaves

6 ma List of multiple addressing

7 peripheryFault The list of peripheral faults of activated AS-i slaves (LPF)

8 configuredID List of configured ID = A

9 actualID List of actual ID = A

10 known List of detected slaves (LDS)

11 configured List of planned slaves (LPS)

Page 45: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

4 The project example ASI_DIAG_PROJECT

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 45

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

4 The project example ASI_DIAG_PROJECT This chapter shows, how the supplied STEP 7 project “ASI_DIAG_PROJECT“ can be used without the need for modification.

4.1 Addresses of hardware components

The SIMATIC station, the panel and the AS-i components have been configured with the following addresses:

Figure 4-1

Page 46: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

4 The project example ASI_DIAG_PROJECT

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 46

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

4.2 Using the STEP 7 project

Components of the STEP 7 project

The STEP 7 project “ASI_DIAG_PROJECT” contains the following elements:

Blocks to comfortably provide diagnostic information of one or more AS-i master systems for further evaluations in the STEP 7 user program and for the display on an HMI panel or web browser.

HMI templates to visualize the diagnostic information on an HMI panel.

User-defined websites to visualize the diagnostic data via the web server of the CPU.

This project can be found in the download area of this document (see chapter 9).

Installation of STEP 7 project

Note In the following installation manual, it is assumed, that you use the STEP 7 project without any modifications. Changes in the hardware configuration and to the addresses require an adjustment of the WinCC projects (see chapter 5).

To use the STEP 7 project “ASI_DIAG_PROJECT”, the following steps have to be carried out:

1. Adjust your network according to the guidelines chapter 4.1 (Addresses of hardware components).

2. Connect one AS-i network per AS-i master with any AS-i slave.

3. If you do not configure your AS-i slaves in the project directly, the ACTUAL configuration has to be adopted as SET configuration with all AS-i masters. The procedure is described in the respective manual (see chapter 8 References).

4. Unzip the ZIP archive “50897766_ASI_DIAG_S7_x00_CODE_TIAV13.zip“ or “50897766_ASI_DIAG_S7_1500_CODE_TIAV13.zip“ to a directory of your choice.

5. Open the TIA project in the directory “ASI_DIAG_PROJECT”.

6. Check the module address or hardware identifier of your AS-i masters. If they differ from the configured address, the block parameter “masterAddress” of the “AsiDiag” has to be adjusted on every call in the organization blocks.

7. In the project tree, select the controller and load the project to the controller.

8. In the project tree, select the panel and load the project into the component or start the simulation.

.

Page 47: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

4 The project example ASI_DIAG_PROJECT

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 47

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

4.3 Operating the STEP 7 project

In this project example, due to the connection of both, the “AsiWebDB” and the “AsiHmiDB” input, both visualization types are activated.

Visualization via the HMI panel

By loading the HMI project to the panel, the runtime with the start screen is automatically started up.

Figure 4-2

The AS-i master configured in this project have logged into the master list of the “AsiHmiVisu” and appear in the selection list.

Figure 4-3

Select an AS-i master. The diagnostic information of the selected AS-i master will be graphically displayed at the next update.

Visualization via web

All the files required for the visualization have already been converted to data blocks and, upon loading the controller, transmitted to the CPU memory.

Enter the address http://192.168.0.4 into a web browser. The website of the CPU opens. Log on with the following data:

User name: admin

Password: asi

Open the web visualization via “CustomerPages > ASI_DIAG“

Page 48: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

5 The WinCC configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 48

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

5 The WinCC configuration To allow a diagnosis of your own AS-i environment, it is necessary to make adjustments in WinCC. This chapter describes the required, individual adjustment of the HMI templates and the configuration steps in WinCC.

5.1 Using visualization images

To allow a diagnosis of your own AS-i environment, it is necessary to make

adjustments in WinCC.

Connection between CPU and panel

The tag access between CPU and panel is carried out via an HMI connection.

The HMI connection is already contained in the supplied project and can be viewed in the tabular section of the network view on the tab “Connections”. In the table, check the connection parameters and -if necessary- change the address parameters in the inspector window to the requirements of your project.

Figure 5-1

Adjustment of the area pointer

With the area pointer of WinCC, it can be discovered, if the connection to the CPU is established or interrupted.

Under “Connections”, open the tab “Area pointer”. Under “coordination”, change the address of the tags as follows:

%DB <instance data block number of your “AsiHmiVisu“>.DBW738

Figure 5-2

Page 49: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

5 The WinCC configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 49

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Coordinating the tag access

The images for displaying the AS-i line status are controlled via the tags from the instance data block of the “AsiHmiVisu”.

The make the project as flexible as possible for the user, the tags are not directly linked to an address (e.g. DB2.DBW2), but are instead linked indirectly via variable multiplexing.

This means, that the tag address is adjusted to the runtime in relation to the value of the index variable “AsiHmiVisuDB”.

Tag multiplexing has the advantage, that the instance data block number of the “AsiHmiVisu” can be flexibly determined by the user. Instead of adjusting all WinCC tags, it suffices to change the index tag only.

For this, open the tag list. Select the index tag “AsiHmiVisuDB” and, in the tag properties, enter the number of your instance data block for the “AsiHmiVisu” as start value.

Figure 5-3

Page 50: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

5 The WinCC configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 50

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

5.2 Adjusting the AS-i master selection list

In the next step, the WinCC project will be expanded by the number of selectable AS-i master. This requires an adjustment in several places of the project.

The selection of the AS-i masters is done via a selection list. Here, all AS-i masters are displayed, whose “AsiDiag” has logged into the master list of the “AsiHmiVisu”.

NOTICE An error-free visualization is only possible, if

1. For every AS-i master involved, a separate “AsiDiag” has been created and all “AsiDiag” have been called up at least once (initialization phase); this can be ensured by calling it up in the start-up OB).

2. For all AS-i masters involved, information (instance data block number and display text) are stored in WinCC.

5.2.1 Changes to the interface

Per default settings, the selection list can manage up to eight AS-i master. If more devices are managed, the limits have to be adjusted.

Figure 5-4

5.2.2 The list position entries

Every AS-i master is represented by a tag (”AsiDiagInstDBMasterx”), which points to a position in the master list of the “AsiHmiVisu”.

As described in chapter 3.1 , the AS-i master blocks log into the master list via their instance data block number. The list position tags in WinCC refer to this information.

The assignment between list position tags in WinCC and the master list needs to be as follows:

Page 51: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

5 The WinCC configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 51

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Figure 5-5

Masterliste „AsiHmiVisu“Angemeldete AS-i Master

Variablen in WinCCListenplatzvariablen

For the first positions in the master list, the according tags have already been integrated into WinCC. If you have more AS-i master, you need to create more list position tags.

Open “HMI tags” in WinCC. For a better overview, sort the column “Name” alphabetically by clicking on the column header. By this, the five list position tags are listed in a row.

Figure 5-6

The easiest way to insert new list position tags is the following one:

Select the line with the already configured tags and duplicate it with “Copy&Paste”. WinCC adds the tag at the end of the tag chart and automatically designates it with the next sequence number. All you have to do is to increment the address by two further bytes.

Figure 5-7

You also have the possibility to create a new tag. Please note that the tag name corresponds to the form “AsiDiagInstDBMasterx“ and that the tag address refers to the next list position in the master list.

Page 52: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

5 The WinCC configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 52

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

5.2.3 Adjusting the text display of the selection list

Functional diagram

The display texts of the AS-i master in the selection list are dynamically managed via the text lists “Master” and “Master_Name”.

While the order of the selection list is determined via the “master” text list, the text list “Master_Name” manages the fitting display text for every occurring instance data block number.

Behind every line of the “Master” text list, there is the WinCC tag “AsiDiagInstDBMasterx“, which references to an entry of the master list of the “AsiHmiVisu” and therefore contains the instance data block number as information.

With the text list “Master_Name”, the fitting display text is output for every occurring instance data block number.

Both text lists are dynamically interconnected between each other and, during runtime, provide the display of the AS-i master in the correct order and the correct text in the selection list.

Example:

Diagnostic data of an IE/AS-i link are to be read and displayed.

For this, an “AsiDiag” with instance data block number 7 has been called in the OB 1 and parameterized accordingly.

Figure 5-8

The block is processed by a positive flank at the “req” input; it goes through the initialization phase and first logs into the master list of the “AsiHmiVisu” with the instance data block number 7.

Position 1 of the master list has thus been occupied by the number 7.

In the tag chart of WinCC, tags have been defined for the first positions of the “AsiHmiVisu” master list (”AsiDiagInstDBMaster1...6”), which refer to the respective address of the master list (Position 1...6).

For this example, the HMI tag “AsiDiagInstDBMaster1” contains the instance data block number of the IE/AS-i link (”7“).

By internal linking, the text lists “Master” and “Master_Name” allow finding the fitting display text.

Page 53: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

5 The WinCC configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 53

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Figure 5-9

Platz in der Auswahlliste0: Platz 1 Variable „AsiDiagInstDB1“1: Platz 2 Variable „AsiDiagInstDB2“…

Variable „AsiDiagInstDB1“ = 7

Anzeigetext in der Auswahl-liste: „IE/Asi Link“

Integration of additional AS-i masters into the selection list

The text list “Master” defines the number of AS-i masters appearing in the selection list. Accordingly, every AS-i master must have its own entry in the text list. In case you have less AS-i masters, redundant entries have to be deleted. With more AS-i masters, the list has to be expanded.

For this, open the text list “Master”.

Figure 5-10

Page 54: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

5 The WinCC configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 54

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

To add additional AS-i masters, select the last entry in the text list, duplicate it via Copy&Paste and increment the entry under “Value”. The column “Value” corresponds to the order in the selection list and at the same time reflects the list positions in the master list of the “AsiHmiVisu”.

Every line of the text list is linked with a tag of the type “AsiDiagInstDBMasterx”, which, as mentioned, represents a list position of the master list and contains the instance data block number of the logged in AS-i master as information.

Select the column “Text” in the line just inserted and assign the next available list position tag. Figure 5-11

Defining the text display for the selection list

In the user program of STEP 7, an “AsiDiag” call with a separate instance data block is required for every AS-i master. For all AS-i master, write down the respective number of the instance data block generated by STEP 7.

Now, open the text list “Master_name”. Here, the instance data block numbers are assigned to the text to be displayed. In the column “Value”, correct the number and enter the respective display text into “Text”.

Figure 5-12

For further entries, select an empty line and add new entries via the context menu. The column “Value” is automatically incremented by WinCC.

Page 55: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

5 The WinCC configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 55

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

5.3 Adjusting the AS-i slaves information

Similar to the AS-i master, user-defined information can also be stored for the AS-i slaves. During runtime, they appear in an output field by clikcing with the mouse on a slave.

For this, a main list “Slave_Description” and several slave sublists “Slave_NW_X” are configured in WinCC. For the slaves of an AS-i master, the sublists manage the information. The text list “Slave_Description” coordinates the sublist of the AS-i slaves belonging to an AS-i master (referenced via its instance data block number).

Both text lists are dynamically linked with each other and provide the display of the AS-i slave information during runtime.

Accordingly, every AS-i master, whose slaves are to display information, must have its own entry in the text list “Slave_Description”.

Changes in the main list

Open the text lists under “Text and graphic lists” and select the text list “Slave_Description”.

For two AS-i lines, the entries in the main list have already been defined and the slave sublists have been created. Should you have less AS-i masters, you can delete the redundant entries. With more, the list has to be expanded or corrected.

Correct the column “Value”. For this, use the numbers of the instance data blocks for the AS-i masters from your STEP 7 project. Figure 5-13

For further entries, select the last entry and add additional entries via Copy&Paste. Adjust the column “Value”. If you want to use an already existing slave sublist for this AS-i master as well, select it in the column “Text”. Otherwise, leave the “Text” column as it is, since a new slave sublist has to be created first.

Inserting a new slave sublist

For a new slave sublist, switch to the text list overview and select the last slave sublist “Slave_NW_x”. Insert a new list via Copy&Paste. WinCC automatically increments the index x.

Switch back to the “Slave_Description” and change the entry column in the line you just added.

Page 56: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

5 The WinCC configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 56

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Changes in the sublists

Per AS-i master, one sublist can be created to save user-defined information about the AS-i slaves. After specification, an AS-i line can manage up to 62 slaves (among which 31 are A slaves and 31 B slaves). Since in the column “Value”, WinCC only expects integers, the slaves cannot be addressed with A or B. Therefore, the following assignments have been defined:

Slave 1 – 31: The slaves are addressed in WinCC with the respective address (1…31).

Slave 1B – 31B: The slaves are addressed with the value: [Address] + 32. A

slave with address 2B therefore has the value [2] + 32 = 34 in WinCC.

Open a sublist and enter the slave number under “Value”. Under “Text”, enter the accompanying text.

Page 57: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

6 HTML configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 57

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

6 HTML configuration To allow a diagnosis of your own AS-i environment, the websites have to be adjusted to your hardware configuration. This chapter describes the required individual adjustments:

6.1 Using websites

Note The websites as well as the required files are coded and fragmented as data blocks.

Changes in these files always require a regeneration of the web data blocks.

The exact procedure can be found in the manual of the CPU.

Overview of editable parameters

The information of the slaves, the designation, the addressing and the image of the AS-i master, as well as the display texts for tool tips and legends are controlled via XML files.

The following XML files are used:

Table 6-1

File name Responsible for...

SlavesX.xml Slave information (e.g. MLFB, place of use etc.)

Master.xml Display text in the AS-i master selection list

Building block address of AS-i master

Path information of AS-i master screen

Texte_de.xml

Texte_en.xml

Tooltip texts

Status display texts

Page 58: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

6 HTML configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 58

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Structure of an XML file

The structure of an XML file is specified and must not be altered.

An XML file consists of multiple elements, which are headed by a root element.

Every element is integrated into the XML structure via a start <> and end tag and can be equipped with specific attributes for meta-information.

Taking the XML file Master.xml as an example, this structure presents itself as

follows:

Figure 6-1

Table 6-2

Structure element Description

<Infos> </Infos> Root element: outer element of XML structure

<Master id=“1“> </Master> First element; additional attribute for clear identification.

<DB_Nr> </DB_Nr> Second child element of <Master>

1 Text content of child element

The following specific characteristics must be considered:

Every XML element must have a start tag and an end tag,

XML differs between lower case and upper case letters (e.g. <DB_NR> cannot be closed with </db_nr>).

An XML structure must be headed by a single root element only.

Umlauts and special characters are not allowed in XML and require special formatting.

Page 59: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

6 HTML configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 59

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

6.2 Adjusting the AS-i master information

NOTICE An error-free visualization is only possible, if

1. For every AS-i master involved, a separate “AsiDiag” has been created and all “AsiDiag” have been called up at least once (initialization phase); this can be ensured by calling it up in the start-up OB).

2. For all AS-i master involved, information (instance data block number and display text) are stored in the XML file.

To diagnose your AS-i network, the instance data block number of the AS-i master must be correctly stored in the XML file Master.xml.

1. In the directory “ASI_DIAG_PROJECT“ > „HTML_FILES“, all the files required for the user-defined websites are contained.

2. Select the XML file Master.xml and open it with an editor, for example, Notepad. As an example, two AS-i master are entered here.

3. If required, add additional masters with the same structure as the existing ones, or delete redundant ones.

Changing the instance data block number

Change the instance data block number within the child element <DB_NR> according to your standards.

Adjusting the AS-i master display

The child element <Name> contains the name of the AS-i master on the web interface and <Image> the path information for the AS-i master image.

Alter these child elements according to your needs and save the XML file.

Note The images ./MasterX.gif are in the HTML directory.

If you want to use another image than the default one, be sure that this image is placed and integrated with the correct path information (starting from the HTML directory).

Page 60: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

6 HTML configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 60

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

6.3 Adjusting the AS-i slave information

Similar to the AS-i master, user-defined information can also be stored for the AS-i slaves. Those appear in an output field by clicking with the mouse on a slave.

The slave information is stored in the XML file SlavesX.xml, wherein the “X”

stands for the respective master.

The assignment is analogous to the master list of the “AsiWebVisu“ (see chapter 3.1.2 The management of the AS-I masters):

Table 6-3

XML file name Master

Slaves0.xml Master 1

Slaves1.xml Master 2

Slaves2.xml Master 3

For every slave, there is a separate element reserved, which can be clearly assigned to a slave via the attribute “id”.

The following classification applies:

Table 6-4

Id area Slave:

id = “1“ to id = “31“ slave 1 to slave 31

id = “32” Slave 0

id = “33“ to id = “63“ slave 1B to slave 31B

Alter these slave information according to your needs and save the XML file.

Note Elements which are not used must not be deleted, but have to be defined with a blank string (e.g. <Slave id = “4”></Slave>).

6.4 Adjusting the display texts

The tool tip texts and the status texts in the web visualization are likewise controlled via a XML file (Texte_xx.xml) and can be adjusted, if required.

The element <Tooltip> contains the splitted tool tip text, which appears when the mouse is moved over a slave button.

In the element <Statustext>, the display texts for the various slave statuses are stored.

Alter these elements according to your needs and save the XML file.

Page 61: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

6 HTML configuration

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 61

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

6.5 Accessing the user-defined websites

By loading the web blocks into the CPU and by activating the web server, you have the possibility to access the default or user-defined websites.

The following manual illustrates the procedure:

1. Make sure that the controller and the PC share a joint ethernet network or are directly connected to each other via a common ethernet cable.

2. Open a web browser and the the URL “http://<IP address of CPU>. The introduction page of the web server opens.

3. To perform specific actions in the CPU or to write tags into the CPU, you have to log into the web server. For this example, enter the name: siemens and as password: asi.

4. In the navigation menu, switch to “Customer pages”. The web browser calls up the page, which provides access to the default page of the user-defined web application. Click on the link. The start page of the AS-i diagnosis is opened in a separate window.

Page 62: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

7 The library “ASI_DIAG“

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 62

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

7 The library “ASI_DIAG“

7.1 Using library blocks

This chapter describes how the library ASI_DIAG is integrated into STEP 7 and

how the blocks are integrated into the user program.

Overview of blocks

To integrate the diagnostic functions described in this document into your own STEP 7 project, the following blocks are required.

“AsiDiag“

“AsiHmiVisu“ (optional for the HMI visualization)

“AsiWebVisu“, “AsiWebInterface“, “WWW“ (optional for web visualization)

User-defined data types

These blocks are included in the STEP 7 block library ASI_DIAG. This library can

be found in the download area of this document (see chapter 8).

Requirements for using the blocks

The use of the blocks from the library requires that a STEP 7 project with the respective hardware configuration exists.

In addition, you should ensure that

the diagnostic interrupts for the AS-i masters and, if necessary, auto-addressing are activated.

the respective error OBs or cyclic interrupts are integrated into the project.

the web servers are activated, should you desire a web visualization.

a user account with the appropriate rights has been created.

The HTML files from the directory “ASI_DIAG” > “HTML_FILES” have been accordingly adjusted and coded into data blocks via the TIA portal.

Opening the library

The library file ASI_DIAG.ap13 is in the directory “ASI_DIAG” > “ASI_DIAG_LIB”.

1. Open your TIA project in the project view.

2. Open the library file via the palette “Global library” and the symbol “Open global library”.

3. Per Drag&Drop, drag the required blocks into the block directory of your configured CPU.

4. Also, drag the data types used into the appropriate directory of your configured CPU.

Page 63: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

7 The library “ASI_DIAG“

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 63

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

7.2 Initializing the blocks

By using a call, the following manual shows how to integrate the library blocks into your project and parameterize them.

Calling the “AsiDiag” blocks

If more than one AS interface line shall be diagnosed in a project, a separate “AsiDia” with a specific instance data block is required for every single line.

All “AsiDiag” blocks are called in the organization block OB 1. For the processing, the “req” input requires a connection with a positive edge. This trigger can be executed in the error or cyclic interrupt OBs.

Note Activate all “AsiDiag” already in the start-up OB (OB 100). This ensures a uniform default state of all “AsiDiag” (initialization phase).

Note The diagnostic data are read from the modules via SFB 52/SFB 53 (read/write data set). Depending on the CPU type, only a certain number of SFB calls can be processed simultaneously. More information can be found in the FAQ with the BID:15364459.

Changing the remanence properties

To delete old data from the instance data blocks of the block (”AsiDiag“, “AsiHmiVisu“, “AsiWebVisu“), after loss of current supply or a stopped CPU, the remanent behaviour has to be switched to “not remanent”.

De-select the corresponding attribute in the properties of the instance data block.

Figure 7-1

Page 64: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

7 The library “ASI_DIAG“

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 64

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

Calling the optional visualization blocks

If you desire a visualization, you have to additionally call the visualization blocks in the OB 1.

For the HMI visualization: “AsiHmiVisu“ (optional for the HMI visualization)

For the web visualization: “AsiWebVisu“, “AsiWebInterface“ and “WWW“.

Parameterizing the blocks

The function block “AsiHmiVisu” has no parameters and is called in the organization blocks without further changes.

The command “WWW” initializes the web server of the CPU and synchronizes user-defined websites with the user program in the CPU. As input parameter, this command requires the data block which describes the user-defined websites (Web-Control-DB).

As input and output parameter, the “AsiWebVisu” requires a set of tags of the data type “typeAsiWebInterface”. For this, you can create a global data block with a tag of this type. The latter one you can connect with a parameter of the “AsiWebVisu”.

The “AsiDiag” has input and output parameters. Connect them according to your standards.

Page 65: Library description 04/2016 Diagnostics block with visualization via … · 2016-04-21 · Library description 04/2016 Diagnostics block with visualization via HMI or web browser

8 References

ASI_DIAG Entry-ID: 50897766, V1.0, 04/2016 65

S

iem

en

s A

G 2

01

6 A

ll ri

gh

ts r

ese

rve

d

8 References Table 9-1

Topic Title

\1\ Siemens Industry Online Support

http://support.industry.siemens.com

\2\ Download page of the entry https://support.industry.siemens.com/cs/ww/de/view/50897766

\3\ Manual ET 200SP AS-i master

Technical manual CM AS-i master ST for SIMATIC ET 200SP

https://support.industry.siemens.com/cs/ww/de/view/71756485

\4\ Manual IE/AS-i Link PN IO Manual SIMATIC NET IE/AS-INTERFACE LINK PN IO

https://support.industry.siemens.com/cs/ww/de/view/22712154

\5\ Manual DP/AS-I Link Advanced

Manual DP/AS-Interface Link Advanced

https://support.industry.siemens.com/cs/ww/de/view/22710305

\6\ Manual DP/AS-i Link 20E Manual DP/AS-Interface Link 20E after v3.0 https://support.industry.siemens.com/cs/ww/de/view/33563718

\7\ Manual DP/AS-i F-Link Manual AS-Interface AS-i safe DP / AS-i F-Link V1.0

https://support.industry.siemens.com/cs/ww/de/view/24196041

\8\ Manual CP343-2 (P) Manual CP 343-2 / CP 343-2 P AS-Interface Master

https://support.industry.siemens.com/cs/ww/de/view/5581657

\9\ System manual AS-i System manual AS-Interface

https://support.industry.siemens.com/cs/ww/de/view/26250840

\10\ Manuals AS-i slaves Manual of AS-Interface slaves

http://support.automation.siemens.com/WW/view/de/10805898/133300

\11\ System manual TIA V13 SP1 System manual TIA V13 SP 1

https://support.industry.siemens.com/cs/de/de/view/109011420

9 History Table 10-1

Version Date Modifications

V1.0 03/2016 First version