15
https://support.industry.siemens.com/cs/ww/en/view/109482437 Application example 03/2015 Connecting a high number of HMI panels to a SIMOTION controller HMI-ModbusTCP driver V1.2

Application example 03/2015 Connecting a high number of

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Application example 03/2015 Connecting a high number of

https://support.industry.siemens.com/cs/ww/en/view/109482437

Application example 03/2015

Connecting a high number of HMI panels to a SIMOTION controller HMI-ModbusTCP driver V1.2

Page 2: Application example 03/2015 Connecting a high number of

Warranty and liability

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 2

S

iem

en

s A

G 2

01

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

We do not accept any liability for the information contained in this document.

Any claims against us – based on whatever legal reason – resulting from the use of the examples, information, programs, engineering and performance data etc., described in this Application Example shall be excluded. Such an exclusion shall not apply in the case of mandatory liability, e.g. under the German Product Liability Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life, body or health, guarantee for the quality of a product, fraudulent concealment of a deficiency or breach of a condition which goes to the root of the contract (“wesentliche Vertragspflichten”). The damages for a breach of a substantial contractual obligation are, however, limited to the foreseeable damage, typical for the type of contract, except in the event of intent or gross negligence or injury to life, body or health. The above provisions do not imply a change of the burden of proof to your detriment.

Any form of duplication or distribution of these Application Examples or excerpts hereof is prohibited without the expressed consent of the Siemens AG.

Security informa-tion

Siemens provides products and solutions with industrial security functions that support the secure operation of plants, solutions, machines, equipment and/or networks. They are important components in a holistic industrial security concept. With this in mind, Siemens’ products and solutions undergo continuous development. Siemens recommends strongly that you regularly check for product updates.

For the secure operation of Siemens products and solutions, it is necessary to take suitable preventive action (e.g. cell protection concept) and integrate each component into a holistic, state-of-the-art industrial security concept. Third-party products that may be in use should also be considered. For more information about industrial security, visit http://www.siemens.com/industrialsecurity.

To stay informed about product updates as they occur, sign up for a product-specific newsletter. For more information, visit http://support.industry.siemens.com.

Page 3: Application example 03/2015 Connecting a high number of

Table of contents

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 3

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

Table of contents Warranty and liability ................................................................................................... 2

1 Task ..................................................................................................................... 4

1.1 Overview............................................................................................... 4 1.2 Requirements / scenarios..................................................................... 5

2 Solution............................................................................................................... 6

2.1 Overview............................................................................................... 6 2.2 Hardware and software components ................................................... 7 2.2.1 Validity .................................................................................................. 7 2.2.2 Components used ................................................................................ 7

3 Principle of operation ........................................................................................ 8

3.1 General overview ................................................................................. 8 3.2 Functionality ......................................................................................... 9 3.2.1 Parameter description for block fb_HMI_ModbusConnection .............. 9 3.2.2 Constants (in the unit: HMI_ModbusTCP_constants) ........................ 10

4 Installation and commissioning ..................................................................... 11

4.1 Procedure when using fb_HMI_ModbusConnection .......................... 11

5 Performance note ............................................................................................ 14

6 Literature references ....................................................................................... 15

7 Contact person ................................................................................................ 15

8 History............................................................................................................... 15

Page 4: Application example 03/2015 Connecting a high number of

1 Task

1.1 Overview

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 4

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

1 Task

1.1 Overview

Introduction

When using PROFIBUS or Ethernet, the maximum number of panels that can be connected to a SIMOTION control is limited to 5. By using the Modbus-TCP protocol, this article shows how a higher number of panels can be connected to a SIMOTION controller. Panels are connected to SIMOTION via standard Ethernet interfaces or PROFINET interfaces.

All Siemens panels can be used that have at least one Ethernet interface, and support the "Modicon Modbus TCP/IP" data transfer protocol.

Overview of the automation task

The following diagram provides an overview of the automation task.

Fig. 1-1

Ethernet

Description of the automation task

With some machines, which are controlled using SIMOTION controllers, there is a requirement to integrate more operator panels or display elements than is possible with the standard panel connection.

Using panels, a higher number of electromechanical operating elements can be replaced. The advantage is the high degree of flexibility, which is facilitated as a result of the fact that the HMI can be freely configured.

Further, panels allow faults and other machine information to be displayed.

The requirement to integrate a high number panels is especially true for plants and machines that extend over wide areas (printing, post-press, modular machines).

Page 5: Application example 03/2015 Connecting a high number of

1 Task

1.2 Requirements / scenarios

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 5

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

1.2 Requirements / scenarios

Requirements as a result of the automation task

Table 1-1

Requirements Explanations

Panel with Ethernet interface and Modicon Modbus TCP/IP protocol

Almost all Siemens panels support the Modicon Modbus TCP/IP protocol

SIMOTION D4x5-2 Firmware >=V4.3

Page 6: Application example 03/2015 Connecting a high number of

2 Solution

2.1 Overview

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 6

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

2 Solution

2.1 Overview

Schematic

The following diagram provides a schematic view of the major components of the solution:

Fig. 2-1

Benefits

The solution described here offers you the following advantages

Eliminates the requirement of additional controllers with a gateway function, which are necessary to connect a higher number of panels

Demarcation between a SIMOTION project and panel project (panel and SIMOTION do not have to be in the same project)

Each panel has its own data structure in SIMOTION. Only one panel project for identical stations in a machine, however each panel has its own data

Demarcation

This application does not include a description of:

HMI configuration

SIMOTION programming

Page 7: Application example 03/2015 Connecting a high number of

2 Solution

2.2 Hardware and software components

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 7

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

Knowledge required

Basic knowledge about SIMOTION Scout and WinCC flexible / WinCC in the TIA Portal are assumed.

2.2 Hardware and software components

2.2.1 Validity

This application is valid for

Scout from V4.4 and higher

At the time that current Siemens HMIs are launched into the market

2.2.2 Components used

The application was created using the following components:

Software components

SIMOTION-Scout V4.4.0.2

TIA-Portal V13 SP1

Sample files and projects

The list below contains all the files, which are in the download file 109482437_LIB_HMI_ModbusTCP_PROJ_v1.2.zip.

Table 2-1

Component Note

Llibrary „LIB_HMI_ModbusTCP“ Contains a function block for the Modbus connection

Unit „Prog_Modbus“ Includes a program example for a function block call

150325_D455_2_Panel_TIA_V13_1_Anwendungs beispiel.zap13

Archived TIA Portal Project

Page 8: Application example 03/2015 Connecting a high number of

3 Principle of operation

3.1 General overview

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 8

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

3 Principle of operation

3.1 General overview

Function block fb_HMI_ModbusConnection is part of the library LIB_HMI_ModbusTCP (in unit: HMI_ModbusTCP_functions) - and is used to connect a higher number of HMI panels to a SIMOTION (as standard, a maximum of five panels can be operated with one SIMOTION). In this case, the HMI communicates with SIMOTION via an emulated Modicon ModbusTCP/IP connection. The scope of the variables to be transferred is limited to bit, integer and real. A maximum address space from MW0 to MW999 is freely available for the variables. Segmentation of the address space between bit, integer and real is realized using constants in the library.

In SIMOTION, every panel has its own data structure. As a consequence, using just one panel configuration in TIA WinCC Advanced V13, it is possible to display different data on the panel. The data structure is assigned to the panel based on the IP address of the panel.

For communication between HMI and SIMOTION, in SIMOTION an array instance of the sHmiModbusDataType structure is created. Bit values, integer values and real values are available as data arrays in the structure. During the runtime, the variables configured in the panel have a direct connection to the values in the structure via function block fb_HMI_ModbusConnection. Each panel has a dedicated index element of structure sHmiModbusDataType.

Within the structure, every array index of the structure variables corresponds to the corresponding flag (a bit memory) word of the HMI variables

CAUTION (Float variables may only refer to even flags (bit memory) words!). For example: Float (real) – range hmi_data[1].ar32RealDataDWord[400..499]

"Variable_Real_400" (%MW400) hmi_data[1].ar32RealDataDWord[400]

It is not permissible that index hmi_data[1].ar32RealDataDWord[401] is used.

"Variable_Real_402" (%MW402) hmi_data[1].ar32RealDataDWord[402]

The constants in the unit HMI_ModbusTCP_constants of the library are used to define possible address range:

BIT_DATAWORD_START and BIT_DATAWORD_END Bit range

INT_DATAWORD_START and INT_DATAWORD_END Int range

REAL_DATAWORD_START and REAL_DATAWORD_END Real range

The possible value range is 0-999.

CAUTION It is not permissible that the ranges overlap, and there must be a minimum address gap of 100 words between the address ranges.

Note If this general constraint is not observed, then an appropriate error message is output via output variable i32error at function block fb_HMI_ModbusConnection during the runtime.

Page 9: Application example 03/2015 Connecting a high number of

3 Principle of operation

3.2 Functionality

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 9

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

3.2 Functionality

An instance of FB fb_HMI_ModbusConnection is called in the background. The FB waits for incoming TCP connections. If a panel attempts to establish a connection, a check is made as to whether the IP address of the panel exists in the array instance of structure sHmiModbusConfigStateData. If the IP address exists, then the connection request is accepted by the function block, and the corresponding HMI data structure is linked with this panel. A connection is not established if the IP address of the panel attempting to make the connection is not included in this list.

The maximum number panels is specified in constant MAXNUMBEROFMODBUSCONNECTIONS.

If there is an existing connection between HMI and SIMOTION, the panel can send variable write/read requests to the SIMOTION.

For read access operations outside the address area defined in SIMOTION, then a value of "0 panel" is returned to the panel.

Write access operations to a memory location outside the address area defined in SIMOTION are ignored.

The TCP/IP connection is closed if the connection panel <-> SIMOTION is a disconnected.

The connection is also closed if TCP/IP communication errors occur, or for time

tConnectionTimeOut (FB input variable) a panel has not attempted to access

variables in SIMOTION.

3.2.1 Parameter description for block fb_HMI_ModbusConnection

VAR_INPUT

ui16LokalPortNumber : UINT:=502; // local port number

tConnectionTimeOut : TIME:=t#5s; // connection Timeout

boAcknowledge : BOOL; // acknowledge

VAR_INOUT

sHmiData : ARRAY[1..MAXNUMBEROFMODBUSCONNECTIONS] OF sHmiModbusDataType; // HMI-Data

sHmiConfigState : ARRAY[1..MAXNUMBEROFMODBUSCONNECTIONS] OF sHmiModbusConfigStateData;//Config/State

VAR_OUTPUT

i32error : DINT; // error number

// 1: Receive-Buffer overflow

// 2: error at _tcpCloseConnection (16#FFFFFFFD)

// 3: Bit-Int-range conflict (change constants for the range sizes)

// 4: Bit-Real-range conflict (change constants for the range sizes)

// 5: Int-Real-range conflict (change constants for the range sizes)

// 6: range overrun at Bit-data-read

// 7: range overrun at Int-data-read

// 8: range overrun at Real-data-read

// 9: INT or BIT-variable in REAL-address area

//10xxx: Real- variable with odd address

// (xxx: address of the variable in the Panel)

Structure sHmiModbusDataType

asBitDataWord :ARRAY[BIT_DATAWORD_START..BIT_DATAWORD_END]OF aboBitDataStruct ; // Bit data

ai16IntDataWord:ARRAY[INT_DATAWORD_START..INT_DATAWORD_END] OF INT ; // Integer data

ar32RealDataDWord:ARRAY[REAL_DATADWORD_START..REAL_DATADWORD_END]OF REAL ; // Real_Data

Page 10: Application example 03/2015 Connecting a high number of

3 Principle of operation

3.2 Functionality

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 10

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

Structure Struktur aboBitDataStruct

aboBitDataStruct : ARRAY[0..15] OF BOOL; // 16 bit data

Structure sHmiModbusConfigStateData

boConnected : BOOL; // connection state

aui8PanelAddress : ARRAY [0..3] OF USINT; // Panel IP address

3.2.2 Constants (in the unit: HMI_ModbusTCP_constants)

BIT_DATAWORD_START : INT:=0; // begin of bit value word addresses

BIT_DATAWORD_END : INT:=99; // end of bit value word addresses

INT_DATAWORD_START : INT:=200; // begin of integer value word addresses

INT_DATAWORD_END : INT:=299; // end of integer value word addresses

REAL_DATAWORD_START : INT:=400; // begin of real value word addresses

REAL_DATAWORD_END : INT:=499; // begin of real value word addresses

MAXNUMBEROFMODBUSCONNECTIONS : INT:=20; // max number of panels

MODBUSRECEIVEBUFFERLENGTH : DINT:=1000; // receive buffer length

Page 11: Application example 03/2015 Connecting a high number of

4 Installation and commissioning

4.1 Procedure when using fb_HMI_ModbusConnection

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 11

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

4 Installation and commissioning

4.1 Procedure when using fb_HMI_ModbusConnection

1. Importing library LIB_HMI_ModbusTCP into a SIMOTION project

2. If necessary, adapt the device type under "<Library>/Properties/TPs/TOs"

3. If necessary modify the constants for the number panels and the address ranges in unit HMI_ModbusTCP_constants of library LIB_HMI_ModbusTCP; in the example shown, a maximum of 20 panels can be connected; bit variables have the address range MW0 to 99, integer variables have the address range MW200 to 299, real variables have the address range MW400 to 499; (see Fig. 4-1)

Fig. 4-1

4. Creating an array instance of the structure sHmiModbusDataType (see Fig. 4-1)

5. Creating an array instance of structure sHmiModbusConfigStateData; preassignment of the IP addresses for the assignment, panel HMI data structure; in the example shown, the panel with IP address "192.168.214.100" is assigned HMI data structure hmi_data[1] - and the panel with IP address "192.168.214.150", HMI data structure hmi_data[5] (see Fig. 4.1.2)

6. Creating an instance of structure fb_HMI_ModbusConnection (see Fig. 4-1)

Fig. 4-2

Page 12: Application example 03/2015 Connecting a high number of

4 Installation and commissioning

4.1 Procedure when using fb_HMI_ModbusConnection

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 12

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

7. Calling instance of fb_HMI_ModbusConnection in a program of the background task, and transferring array instances from sHmiModbusDataType and sHmiModbusConfigStateData to the function block (see Fig. 4-3)

Fig. 4-3

8. Creating a panel in the TIA Portal

9. Creating a Modbus connection. The "Port" number must correspond to the value of the FB input variable ui16LokalPortNumber. The IP address of the SIMOTION interface, where the panel is connected, must be entered as "Server address". All of the other settings should be taken from Fig. 4-4.

Fig. 4-4

10. Creating variables in the panel configuration. Depending on the data type, the variable addresses must be located in the ranges defined in SIMOTION. The variables created in this way can be used in the HMI configuration. (see Fig. 4-5)

Page 13: Application example 03/2015 Connecting a high number of

4 Installation and commissioning

4.1 Procedure when using fb_HMI_ModbusConnection

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 13

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

Fig. 4-5

Examples for connecting HMI variables (see Fig. 4-5) with the values in structure variables hmi_data[x] type sHmiModbusDataType, when IP address "192.168.214.100" is set at the panel:

"Variable_bit_0_0" is connected with hmi_data[1].asBitDataWord[0][0]

"Variable_bit_0_5" is connected with hmi_data[1].asBitDataWord[0][5]

"Variable_bit_50_0" is connected with hmi_data[1].asBitDataWord[50][0]

"Variable_Int_200" is connected with hmi_data[1].ai16IntDataWord[200]

"Variable_Int_210" is connected with hmi_data[1].ai16IntDataWord[210]

"Variable_Int_211" is connected with hmi_data[1].ai16IntDataWord[211]

"Variable_Real_420" is connected with hmi_data[1].ar32RealDataDWord[420]

"Variable_Real_422" is connected with hmi_data[1].ar32RealDataDWord[422]

"Variable_Real_452" is connected with hmi_data[1].ar32RealDataDWord[452]

"Variable_Real_460" is connected with hmi_data[1].ar32RealDataDWord[460]

Examples for connecting HMI variables (see Fig. 4-5) with the values in structure variables hmi_data[x] type sHmiModbusDataType, when IP address "192.168.214.150" is set at the panel:

"Variable_bit_0_0" is connected with hmi_data[5].asBitDataWord[0][0]

"Variable_bit_0_5" is connected with hmi_data[5].asBitDataWord[0][5]

"Variable_bit_50_0" is connected with hmi_data[5].asBitDataWord[50][0]

"Variable_Int_200" is connected with hmi_data[5].ai16IntDataWord[200]

"Variable_Int_210" is connected with hmi_data[5].ai16IntDataWord[210]

"Variable_Int_211" is connected with hmi_data[5].ai16IntDataWord[211]

"Variable_Real_420" is connected with hmi_data[5].ar32RealDataDWord[420]

"Variable_Real_422" is connected with hmi_data[5].ar32RealDataDWord[422]

"Variable_Real_452" is connected with hmi_data[5].ar32RealDataDWord[452]

"Variable_Real_460" is connected with hmi_data[5].ar32RealDataDWord[460]

Page 14: Application example 03/2015 Connecting a high number of

5 Performance note

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 14

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

5 Performance note When creating variables, if at all possible set "Cyclic in operation" or "Cyclic when using" sensing type in order to keep the communication load low.

It is recommended to set the refresh times of variables in TIA WinCC Advanced to not less than 500ms.

Refresh cycles of 100 ms are possible. Depending on the runtime of the background task of SIMOTION, under certain circumstances this refresh time cannot be maintained.

The maximum number of panels connected to a SIMOTION controller depends on the TCP/IP resources that are available. If the user is using TCP/IP communication for other functions, then the number of possible panels is correspondingly reduced.

The following table shows the maximum communication resources available depending on the hardware platform.

Table 5-1

SIMOTION CPU (client) Number of communication connections

C2xx 45

D410 45

D410-2 45

D4x5 75

D4x5-2 75

P3x0 40

Page 15: Application example 03/2015 Connecting a high number of

6 Literature references

Connecting a high number of HMI panels to a SIMOTION controller Entry ID: 109482437, V1.2, 03/2015 15

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

6 Literature references Table 6-1

Topic

\1\ Siemens Industry Online Support

https://support.industry.siemens.com

\2\ https://support.industry.siemens.com/cs/ww/en/view/109482437https://support.industry.siemens.com/cs/wwde/Beitrags-ID

\3\

7 Contact person

Siemens AG

Digital Factory

Factory Automation

Production Machines

Application Center

DF FA PMA APC

Frauenauracher Str. 80

D-91056 Erlangen, Germany

Fax: +49 9131-98-1297

mailto: [email protected]

8 History

Table 8-1

Version Date Revision

V1.0 02/2015 First Edition

V1.1 03/2015 Moving parameter constants into their own source

V1.2 03/.2015 Adapting the communication, also when using for comfort panels