simatic modbus/tcp connection of sentron pac … · simatic s7 simatic modbus/tcp connection of...

39
SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual

Upload: phunghanh

Post on 23-Apr-2018

354 views

Category:

Documents


10 download

TRANSCRIPT

Page 1: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

SIMATIC

Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU

Manual

Page 2: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

SIMATIC S7

SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU

Manual

Edition 1.2

Preface, table of contents

Product description 1

Commissioning 2

Blocks 3

Licensing 4

Diagnostics 5

Application example 6

Appendices

References

Page 3: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Safety notices

!

!

!

This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent damage to property. The notices are highlighted by a warning triangle, and are presented according to degree of danger as follows: __________________________________________________________________

Danger

indicates that death, severe personal injury, or considerable property damage will occur if the proper precautions are not taken. __________________________________________________________________ __________________________________________________________________

Warning

indicates that death, severe personal injury, or considerable property damage may occur if the proper precautions are not taken. __________________________________________________________________ __________________________________________________________________

Caution

indicates that minor personal injury or property damage can occur if the proper precautions are not taken. __________________________________________________________________ __________________________________________________________________

Note

highlights important information on the product, using the product, or part of the documentation that is of particular importance.

__________________________________________________________________

Qualified personnel

A device may only be commissioned and operated by qualified personnel . For the purpose of the safety information in this manual, "qualified personnel" are persons who are authorized to commission, ground, and label equipment, systems, and circuits in accordance with established safety standards.

Proper use

!

Trademarks

Please observe the following:

_________________________________________________________________________

Warning

Siemens products may only be used for the applications described in the catalog and in the relevant technical documentation and in combination with third-party devices and components recommended or approved by Siemens.

Proper transport, storage, installation, assembly, as well as operation and maintenance are required to ensure that the product operates safely and without any problems.

SIMATIC and SIMATIC NET are registered trademarks of SIEMENS AG.

The remaining designations in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.

Copyright Siemens AG 2012 All Rights Reserved

The reproduction, transmission, or use of this document or its contents is not permitted without express written authority. Violation of this rule can lead to claims for damage compensation. All rights, including rights created by patent grant or registration of a utility model or design, are reserved. Siemens AG Industry Sector Industry Automation Division Industrial Automation Systems Factory Automation I IA AS FA WF FTH 1 P.O. Box 23 55, D- 90713 Fürth

Disclaimer of liability

We have reviewed the contents of this publication to ensure consistency with the hardware and software described. Since variance cannot be precluded entirely, we cannot guarantee full consistency However, the information in this publication is reviewed regularly and any necessary corrections are included in subsequent editions. Suggestions for improvement are welcome.

Technical data subject to change.

Page 4: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Preface

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

1

Preface

Purpose of the Manual

The information in this manual allows you to set up and put in operation the connection between a CPU with integrated PN interface and several PAC devices using Modbus/TCP.

Contents of the Manual

This manual describes the function of the Modbus function block and its parameterization.

The manual contains the following topics:

• Product description

• Commissioning

• Description of the blocks

• Licensing

• Diagnostics

• Application sample

Scope of the Manual

This manual is valid for the following software:

• SIMATIC Modbus/TCP 20 SENTRON PAC (6AV6676-6MA30-0AX0) V1.1.1

• SIMATIC Modbus/TCP 100 SENTRON PAC (6AV6676-6MA30-1AX0) V1.1.1

• SIMATIC Modbus/TCP 512 SENTRON PAC (6AV6676-6MA30-3AX0) V1.1.1

The software contains the following blocks:

Blocks From version

FC 99 „UDP_MSG_BUILDER“ 1.0

FB 99 „UDP_LOGGER“ 1.0

FB 109 „MB_PAC16“ 1.0

FB 110 „MB_PAC32“ 1.0

FB 111 „MB_PAC94“ 1.0

FB 103 „TCP_COMM“ 4.0

DB 4 „UDP_DATA“ 1.0

Note

This manual contains a description of the FBs that was valid at the time the manual was published.

Page 5: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Preface

Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

2

Additional Sources of Information

All further information regarding the PN-CPUs and the IM 151-8 PN/DP CPU (installation, commissioning, etc.) can be found in the manual:

SIEMENS SIMATIC S7-300 CPU 31xC and CPU 31x: Installation Operating Instructions A5E00105491-07

SIEMENS SIMATIC S7-300 CPU 31xC und CPU 31x, Technical Specifications Manual A5E00105474-07

SIEMENS SIMATIC S7-400 S7-400 Automation System: Installation Operating Instructions A5E00850740-01

SIEMENS SIMATIC S7-400 S7-400 Automation System, CPU Specifications Manual A5E00850745-06

SIEMENS SIMATIC Distributed I/O ET 200S Interface Module IM151-8 PN/DP CPU Operating Instructions A5E02049033-01 SIEMENS

Product information on CPU315-2 PN/DP, 6ES7315-2EH13-0AB0 CPU315F-2 PN/DP, 6ES7315-2FH13-0AB0 CPU317-2 PN/DP, 6ES7317-2EK13-0AB0 CPU317F-2 PN/DP, 6ES7317-2FK13-0AB0 CPU319-3 PN/DP, 6ES7318-3EL00-0AB0 CPU319F-3 PN/DP, 6ES7318-3FL00-0AB0 A5E01103134-03

Page 6: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Preface

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3

For information on PAC devices, please refer to the following manuals:

SIEMENS SENTRON SENTRON PAC3200 Power Monitoring Device Manual A5E01168664A-04 For further information on STEP 7, please refer to the following manuals:

SIEMENS SIMATIC Software Basic Software for S7 and M7 STEP 7 User Manual C79000-G7000-C502-..

SIEMENS SIMATIC Software System Software for S7-300/400 System and Standard Functions Reference Manual C79000-G7000-C503-02

Additional Questions

If you have further questions regarding the use of the FBs described in this manual, which are not answered in this document, please contact your Siemens partner who supplied you with this function blocks.

Terminology This document uses the term PN-CPU. The description applies to the PN CPUs of the series 300, 400 and for the IM 151-8 PN/DP CPU.

The term PAC device is also used and applies the PAC3200 and PAC4200.

Scope of Application

The function blocks described in this manual establishes a connection between a PN CPU and the PAC devices.

Page 7: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Table of contents

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

i

Table of contents

1 Product description ............................... ........................................................................ 1-1

1.1 Applications ....................................................................................................... 1-1

1.2 Hardware and software requirements ............................................................... 1-2

2 Commissioning ..................................... ......................................................................... 2-1

2.1 Installing the library on the STEP 7 PG/PC ...................................................... 2-1

2.2 Adding function blocks ...................................................................................... 2-2

2.3 Connection configuration .................................................................................. 2-2

2.4 Communication settings of the PAC ................................................................. 2-3

2.5 Creating the configuration block with the "Modbus/TCP PAC wizard" .............. 2-3

2.6 Calling the function blocks ................................................................................ 2-3

3 Blocks of the Modbus – PAC communication .......... .................................................. 3-1

3.1 Configuration block CNF_PAC ......................................................................... 3-2

3.2 Data blocks for the PAC values ........................................................................ 3-4

3.3 Function blocks MB_PAC16, MB_PAC32 and MB_PAC94 ............................. 3-7

3.3.1 Functionality ...................................................................................................... 3-7

3.3.2 Parameters of the FBs MB_PAC16, MB_PAC32 and MB_PAC94 .................. 3-9

3.4 Loggerblocks UDP_LOGGER and UDP_MSG_BUILDER ............................. 3-11

3.5 Data and standard functions used by the FB .................................................. 3-12

3.6 Renaming/rewiring of standard functions ....................................................... 3-13

4 Licensing ......................................... ............................................................................... 4-1

5 Diagnostics ....................................... .............................................................................. 5-1

5.1 Diagnostics via the display elements of the CPU ............................................. 5-2

5.2 Diagnostics via PAC status bits in the CNF_PAC ............................................ 5-3

5.3 Diagnostics via LAST_ERROR in the data block of the PAC device ................ 5-3

5.4 Diagnostic messages of the FBs MB_PAC16, MB_PAC32 and MB_PAC94 ... 5-4

5.5 Diagnostic messages of the blocks used ......................................................... 5-7

5.6 Diagnostic messages of the SFC24 ................................................................. 5-7

6 Application example ............................... ....................................................................... 6-1

A References ........................................ ................................................................................. 1

Page 8: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Product description

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

1-1

1 Product description

1.1 Applications

Positioning in the system environment

The function blocks are a software product for CPUs with integrated PN interface of the SIMATIC S7-300, S7-400 and IM 151-8 PN/DP CPU.

Function of the FBs

These function blocks enable communication between a SIMATIC CPU with integrated PN interface and several PAC devices.

The maximum number of connectable PAC devices is 20, 100 or 512 PACs, depending on the license. A license cannot be transferred to another CPU.

While communicating, the data of basic type 3 and the energy counters are read out and written to S7 data blocks. Furthermore, predefined counters in the PAC device can be reset. Please refer to section 3.2 for a list of all PAC values accessed.

Product /block differences

The products

• SIMATIC Modbus/TCP 20 SENTRON PAC

• SIMATIC Modbus/TCP 100 SENTRON PAC and

• SIMATIC Modbus/TCP 512 SENTRON PAC

differ in the number of readable PAC devices . The number of PAC devices is governed by licensing.

Each of the products contains the function blocks MB_PAC16, MB_PAC32, and MB_PAC94. The blocks differ only in the number of simultaneously usable connections .

Page 9: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Product description

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

1-2

1.2 Hardware and software requirements

Usable Modules for MB_PAC16/32/94

You can find the current hardware requirements here: http://www.siemens.com/s7modbus.

Software Versions The FBs MB_PAC16, MB_PAC32 and MB_PAC94 may be used with STEP7 Version 5.5 or higher.

Memory Requirements

Block Work memory in kByte

Load memory in kByte

MB_PAC16 31 34

MB_PAC32 33 36

MB_PAC94 36 38

TCP_COMM 7 7

UDP_LOGGER 6 6

UDP_MSG_BUILDER 1 1

Page 10: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Commissioning

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

2-1

2 Commissioning

General Information

The following STEP7 specifications refer to STEP7 Version 5.5. Processes, name and directory specifications may differ in later versions.

Prerequisites STEP7 basic knowledge, STL knowledge, PLC basic knowledge

2.1 Installing the library on the STEP 7 PG/PC

What We Provide You

The attached CD contains two setups. The first one installs the library "Modbus_PAC ", the example project, and the manuals in German and English in the corresponding STEP7 directories. The second setup installs the Modbus/TCP PAC Wizard.

The manuals can also be found on the CD as PDF file.

Requirements To perform the installation, STEP7 must be installed.

Installation Insert the Modbus CD in the CD-ROM drive of your PG/PC. If the setup program does not start automatically, the installation is performed as follows:

1. Select the CD-ROM drive in Windows Explorer, open the directory Setup_Modbus_Lib, and double-click on the file SIMATIC Modbus/TCP SENTRON PAC V1.1.1.exe .

2. Follow the instructions that the installation program displays step by step.

3. Select the CD-ROM drive in Windows Explorer, open the directory Setup_Wizard, and double-click on the file Setup_PAC-Wizard.exe .

You now find

• the library in \Program Files\Siemens\Step7\S7libs,

• the example project in \Program Files\Siemens\Step7\Examples,

• the manual in \Program Files\Siemens\Step7\S7manual\S7Comm,

• the Software Registration Form in \Program Files\Siemens\Step7\S7libs\Modbus_PAC.

• The Modbus/TCP PAC wizard can be opened when clicking START -> SIMATIC -> Modbus/TCP PAC wizard.

To access the Modbus library the first time, use the "Browse" function of the open dialog for library.

The manual can also be opened via the shortcut under \Program Files\Siemens\Documentation.

Page 11: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Commissioning

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

2-2

2.2 Adding function blocks

MODBUS library Blocks

The following FBs are required for Modbus communication:

• MB_PAC16 or MB_PAC32 or MB_PAC94

• TCP_COMM, UDP_LOGGER, UDP_MSG_BUILDER and UDP_DATA

To be able to add these to your project, you must copy the blocks from the library.

Blocks of the Standard Library

Data are sent and received via the function blocks TSEND (FB63) and TRCV (FB64).

These communication blocks are in the Standard Library ���� Communication Blocks and must also be added to your project.

Please note that the following versions of the FBs are required for trouble-free operation of the MB_PAC16, MB_PAC32 and MB_PAC94:

TSEND V2.1 or higher TRCV V2.2 or higher TCON V2.4 or higher TDISCON V2.1 or higher

2.3 Connection configuration

General Information

No connection configuration is required in NetPro for communication via the integrated PN interface of the CPU. Connections are established and disconnected using the function blocks TCON (FB65) and TDISCON (FB66).

Page 12: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Commissioning

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

2-3

2.4 Communication settings of the PAC

Setting via the User Interface

The desired IP address, the subnet mask and "Modbus/TCP" as protocol must be set on the PAC device.

Setting via the user interface is described for the PAC3200/4200 in section 9.2.7 or 9.2.8.

2.5 Creating the configuration block with the "Modb us/TCP PAC Wizard"

General Information

The configuration data for PAC communication are set in the data block CNF_PAC. This configuration DB is created with the "Modbus/TCP PAC Wizard". The Wizard generates the complete structure of the configuration DB CNF_PAC and creates the data blocks for the PAC devices.

The wizard performs an upload of a SPL file of the tool powerconfig as well.

2.6 Calling the function blocks

Calling the FB For a correct program sequence the function blocks MB_PAC16, MB_PAC32 or MB_PAC94 must be called in a cyclical OB.

It is not permitted to simultaneously call a Modbus block in OB1 and in a cyclic interrupt OB (e.g. OB35).

Only 1 Modbus block instance may be added to 1 CPU.

The TCP_COMM block is called subordinately and may not additionally be called in an OB.

The OB121 must be available on the CPU. Further information can be found in the chapter "Licensing" .

Page 13: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Blocks of the Modbus – PAC communication

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3-1

3 Blocks of the Modbus – PAC communication

Overview The MB_PAC16/32/94 blocks process the data transfer between the CPU and the PAC devices. They internally call the block TCP_COMM, which is responsible for connection management.

All PAC devices to be processed are configured in the block CNF_PAC.

The values read out from the PAC devices are stored in the PAC data blocks .

PAC

PN-CPU

PAC 3 2 PAC 1 PAC 4

DB for PAC 3

DB for PAC 1 DB for PAC 2

DB for PAC 4

PAC 1

PAC 2

PAC 3

PAC 4

CNF_PAC: Config-DB of the PACs

Data blocks for PAC values

MB_PAC16

Page 14: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Blocks of the Modbus – PAC communication

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3-2

3.1 Configuration block CNF_PAC

General information

The configuration DB CNF_PAC is created with the "Modbus/TCP PAC Wizard" and contains all information needed for communication with the connected PAC devices. This includes:

• The number of connections used to communicate with the PAC devices

• The IP addresses of the PAC devices • The numbers of the data blocks in which the values from the PAC

devices are saved • The status display of the PAC devices

With one CPU, several connections may be used simultaneously for Modbus-PAC communication. The maximum number of simultaneously established connections depends on the CPU.

Up to 512 PAC devices can be configured in the CNF_PAC. Here, the number of PAC devices can be divided as required among the connections to be used.

The data from the configuration DB is checked on in itialization and may not be changed during runtime. The structure of the CNF_PAC must not be changed.

STATUS_PAC The array STATUS_PAC [1..512] , which shows the current states of the PAC units during runtime, is in the first part of CNF_PAC. Each bit designates 1 PAC device, in ascending order from the first PAC device.

Example: The states of the PAC devices 1 to 14 from ID_1 are stored in STATUS_PAC[1] to STATUS_PAC[14]. The states of the PAC devices from ID_2 are stored in STATUS_PAC[15] to STATUS_PAC[28], etc.

Page 15: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Blocks of the Modbus – PAC communication

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3-3

If the status bit of a PAC device is TRUE, an error in the last data transfer has been detected. If the status bit is FALSE, the last data transfer for this PAC device has been processed successfully.

Connection parameters

The connection parameters are defined in the second part of the CNF_PAC.

• For each connection there is 1 structure, e.g. ID_1, ID_2, etc.

• Each connection has a unique ID number.

• Max. 16, 32 or 94 connections can be used in parallel depending on the Modbus block.

• For each of these connections, the number of PAC devices processed under this connection is specified in an array.

• The IP address and the number of the data block to store the read PAC values are set for each PAC device. The parameters are visible in the data view for the individual PAC devices.

Page 16: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Blocks of the Modbus – PAC communication

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3-4

3.2 Data blocks for the PAC values

General information

There is 1 data block for PAC specific values for each PAC device. These data blocks are automatically created in the right length and with complete parameter names by the "Modbus/TCP PAC Wizard".

CONTROL_BYTE Using CONTROL_BYTE , the operating hours counter, the maximum values, the minimum values and the energy counters can be reset.

If one or more reset bits are set during runtime, the next time this PAC is processed the relevant values in the PAC device are reset and the associated reset bit is then set to FALSE.

Status values DATA_VALID shows whether the values in the data block could be transferred consistently during the last processing. The DATA_VALID bit is reset if the query for the relevant device is running or the query could not be ended correctly.

ERROR_COUNTER shows the number of processing cycles with errors for this device. This value can be reset manually.

LAST_ERROR shows the last error status for this PAC device.

TIMESTAMP shows the time stamp for the last time the data could be read out consistently.

Page 17: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Blocks of the Modbus – PAC communication

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3-5

Data The data of basic type 3 and the energy counters are read out.

Register number Meaning

Read

1, 2 Voltage A-N

3, 4 Voltage B-N

5, 6 Voltage C-N

7, 8 Voltage A-B

9, 10 Voltage B-C

11, 12 Voltage C-A

13, 14 Current A

15, 16 Current B

17, 18 Current C

19, 20 Apparent power A

21, 22 Apparent power B

23, 24 Apparent power C

25, 26 Active power A

27, 28 Active power B

29,30 Active power C

31,32 Reactive power A

33, 34 Reactive power B

35, 36 Reactive power C

37, 38 Power factor A

39, 40 Power factor B

41, 42 Power factor C

43, 44 THD voltage A1)

45, 46 THD voltage B1)

47, 48 THD voltage C1)

49, 50 THD current A1)

51, 52 THD current B1)

53, 54 THD current C1)

55, 56 Power frequency

57, 58 Mean value voltage UL-N

59, 60 Mean value voltage UL-L

61, 62 3-phase average current

63, 64 Total apparent power

65, 66 Total active power

67, 68 Total reactive power (Qn)

69, 70 Total power factor

71, 72 Amplitude unbalance of voltage

73, 74 Amplitude unbalance of current

Page 18: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Blocks of the Modbus – PAC communication

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3-6

Register number Meaning

205, 206 Device diagnostics and device status

207, 208 Status of the digital outputs

209, 210 Status of the digital inputs

211, 212 Active tariff

213, 214 Operating hours counter

517, 518 Length of the last period

2801, 2802 Active energy procurement tariff 1

2803, 2804 Active energy procurement tariff 2

2805, 2806 Active energy supply tariff 1

2807, 2808 Active energy supply tariff 2

2809, 2810 Reactive energy procurement tariff 1

2811, 2812 Reactive energy procurement tariff 2

2813, 2814 Reactive energy supply tariff 1

2815, 2816 Reactive energy supply tariff 2

2817, 2818 Apparent output supply tariff 1

2819, 2820 Apparent output supply tariff 2

Write

213, 214 Operating hours counter

60002 Reset of maximum values

60003 Reset of minimum values

60004 Reset of energy counter (0 = all, 1 = active energy procurement tariff 1, 2 = tariff 2)

Page 19: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Blocks of the Modbus – PAC communication

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3-7

3.3 Function blocks MB_PAC16, MB_PAC32 and MB_PAC94

3.3.1 Functionality

Differentiation of the blocks MB_PAC16, MB_PAC32 and MB_PAC94

The blocks MB_PAC16, MB_PAC32 and MB_PAC94 differ in the number of maximum connections that can be established simultaneously with this block.

Block Maximum number of parallel connections

MB_PAC16 16

MB_PAC32 32

MB_PAC94 94

With one CPU, several connections may be used simultaneously for Modbus-PAC communication. The maximum number of simultaneous connections is CPU dependent and can be found in the technical data for each CPU. By using multiple connections, the data throughput can be increased and the update time reduced.

The size of the instance DB for the blocks is directly proportional to the number of possible connections. To save memory space, we recommend using the smallest possible block for your application.

Tasks The blocks implement the following tasks:

• Cyclical reading of the data of basic type 3 and the energy counters of all configured PAC devices

• Data transfer to the parameterized DB

• Deletion of PAC counters on request

• Time based monitoring of connection establishment and termination as well as the receipt of data

• Connection and data management using the T-blocks from the standard library

• Application of the Modbus/TCP protocol

• License checking

Page 20: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Blocks of the Modbus – PAC communication

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3-8

Triggering of job and completed message

Modbus communication is activated with the parameterization of CYCLICAL > 0 ms. When the given time expires, the connection to the first PAC device is established. If scheduled, the counters in the PAC device are reset. The data of basic type 3 and the energy counters are then read out and written to the relevant data block.

The CPU waits for the parameterized time MONITOR for a response from the PAC device. If a timeout occurs (no response from PAC device), the job ends for the PAC device with an error and the next PAC device is processed.

If the response telegram is received within MONITOR, a plausibility test is performed. If the result is positive, the required actions are performed.

If additional PAC devices are parameterized for the connection ID, these are processed consecutively. Here, the PAC devices within 1 connection ID are always processed sequentially. In contrast, the various connection IDs in the CNF_PAC block are processed in parallel, i.e. the PAC devices in the first connection ID are read out in parallel with the PAC devices in the second connection ID.

The output DONE is set if all parameterized PAC devices in the CNF_PAC can be read out without error. If an error is detected in at least 1 PAC device, the job is ended with an error, the ERROR bit is set, and an error number is shown in STATUS.

Online help Block online help is available in the SIMATIC Manager for the function blocks MB_PAC16/32/94. If the block is marked and the "F1" key is pressed, the online help is opened with the most important information on the block.

Programming error OB121

If the Modbus block is not yet licensed for this CPU, the OB121 is called.

!

____________________________________________________________

Warning

If the OB121 is missing from the control, the CPU i s set to STOP state. ___________________________________________________________

Page 21: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Blocks of the Modbus – PAC communication

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3-9

3.3.2 Parameters of the FBs MB_PAC16, MB_PAC32 and MB_PAC94

Parameters of the function blocks MB_PAC16, MB_PAC3 2 and MB_PAC94

Parameter Decl. Type Description Range of values

Init

INIT IN BOOL TRUE: Block is initialized TRUE/FALSE no

CONFIG_DB IN BLOCK_DB Number of the configuration DB CNF_PAC

CPU dependent

yes

MONITOR IN TIME Monitoring time for connection establishment and termination and for the receipt of data from the link partner The minimum time that may be set is 20 ms Default: 500 ms

T#20ms to

T#+24d20h31m23s647ms

no

REG_KEY IN STRING [17] Registration key (activation code) for licensing

Character no

CYCLICAL IN TIME Polling cycle 0: No processing > 0: Data should be read cyclically every x seconds Default: 5 s

T#0ms to T#+24d20h31 m23s647ms

no

CONN_CNT IN INT 0: All parallel connections are established at the same time > 0: Count of connections, which are established at the same time (= in 1 CPU cycle)

0 to 94 no

CONN_WAIT IN TIME 0: Connection establishment without delay > 0: next connection establishment after x ms

T#0ms to T#+24d20h31 m23s647ms

no

DONE OUT BOOL TRUE: The values of all PAC devices have been read or written without error

TRUE/ FALSE

no

ERROR OUT BOOL TRUE: An error occurred in processing the PAC devices

TRUE/ FALSE

no

STATUS OUT WORD Error number / status display 0 to FFFF no

IDENT_CODE OUT STRING [18] Identification number for licensing With this identifier, you may request the REG_KEY activation key for your license.

Character no

Outputs The output parameters are dynamic displays and thus represent only 1 CPU cycle . They must be copied to different memory areas for any further processing or display in a variable table.

Ranges of values There may be CPU specific restrictions to consider in the ranges of values for the various parameters.

Page 22: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Blocks of the Modbus – PAC communication

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3-10

INIT With INIT = TRUE, the Modbus block initiates a restart. Here, the connection IDs and the parameterized PAC devices are read from the config block CNF_PAC and checked for validity.

The restart, e.g. on a change in CNF_PAC, may only be performed if no PAC devices are presently being read out. If PAC devices are to be added to CNF_PAC, it must be ensured using CYCLICAL = 0 ms that no new polling cycle is started. After the change in CNF_PAC, the block must be reinitialized with INIT = TRUE.

If INIT = TRUE is set, the array STATUS_PAC [1..512] in CNF_PAC-DB is deleted.

Please note that depending on the number of connections and PACs, the cycle time of the OB is increased for 1 CPU cycle due to the validity test on INIT = TRUE. Use of the OB80 in the user program is recommended.

CONFIG_DB The CONFIG_DB parameter designates the number of the data block CNF_PAC. The PAC specific parameters that are needed for communication between the PN-CPU and the PAC devices are stored in this parameter data block.

The parameter CONFIG_DB is an initialization parameter. After the parameter is changed, reinitialization of the block via INIT is required.

The value range for this parameter is CPU dependent. The DB number 0 is not allowed, because it is reserved for the system. The DB number is entered in plain text in the form "DBxy".

MONITOR The monitoring time MONITOR monitors the establishment and termination of connections and the receipt of data from the link partner. The minimum value is 20 ms.

If MONITOR is set to < 20 ms and a polling cycle is to be started, a relevant error message occurs. No data from the PAC devices is read.

If the monitoring time is exceeded, the active job is ended with an error. A monitoring time of 500 ms is recommended.

In selection of MONITOR it should be noted, that the time of the polling cycle and so also the updating time of the other PAC devices is increased by this time, if a connection error to a PAC device occurs.

REG_KEY The block must be licensed on every CPU. The block is licensed with the correct entry of the activation code at this parameter and Modbus communication can be used without restriction. Further information can be found in the chapter "Licensing" .

Page 23: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Blocks of the Modbus – PAC communication

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3-11

CYCLICAL The minimum interval between the start of two polling cycles is defined with CYCLICAL. After the CYCLICAL time elapses, the PAC device polling cycle begins. If CYCLICAL runs out while a polling cycle is still active, a new polling cycle is immediately started after the current polling cycle ends. The user is informed with a message in STATUS.

If CYCLICAL = 0 ms, there is no telegram processing.

Changing the parameter has no influence on a running polling cycle. It’s effective only with the next polling cycle.

CONN_CNT CONN_WAIT

Depend on the used CPU, the network utilization and the requested updating time of the PAC values, it’s possible that the connection establishment to the PAC devices must be executed block by block. The error A100 for a lot of PAC devices indicates that.

If CONN_CNT = 0, all parallel connections from CONFIG_DB are established at the same time. The value CONN_WAIT is not relevant.

If CONN_CNT > 0, in 1 CPU cylce the parameterized count of connections is established at the same time. The establishment of further connections is executed in the following CPU cycles. If CONN_WAIT = 0 ms, further connection establishment is executed in the next CPU cycle. If CONN_WAIT > 0 ms , further connections are established if the parameterized time is elapsed.

DONE TRUE shows that the values of all configured PAC devices have been read out without error or that the counters could be reset.

ERROR If this output is set, an error has been detected. In the activated polling cycle, at least 1 PAC device could not be read out without error or the counters could not be reset. The relevant error number is shown in the output STATUS.

STATUS The output STATUS displays the error number if ERROR is set. Furthermore, the status information of the block is shown; in this case ERROR is not set.

The error number and status information are described in the chapter "Diagnostics".

IDENT_CODE After the CPU starts up, an 18-digit identifier is shown at this parameter with which the licensing code REG_KEY (= activation code) for Modbus communication is requested.

For further information refer to the chapter "Licensing" .

3.4 Loggerblocks UDP_LOGGER and UDP_MSG_BUILDER

General In special cases an extended diagnosis is possible with use of the UDP logger. Please contact the Product Support.

The logger functionality is disabled by default.

Page 24: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Blocks of the Modbus – PAC communication

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3-12

3.5 Data and standard functions used by the FB

Instance DB The MB_PAC16/32/94 function blocks save the data in an instance DB. This instance DB is generated by STEP7 the first time the FB is started up.

The instance data block contains parameters of the types Input, Output and Input/Output as well as static variables, which it needs to start up. These variables are retentive and remain valid between FB calls. The internal execution of the FBs is controlled via the variables.

Memory requirement of the instance DB:

Instance DB Work memory Load memory

MB_PAC16 approx. 7 KB approx. 8 KB

MB_PAC32 approx. 11 KB approx. 13 KB

MB_PAC94 approx. 29 KB approx. 31 KB

Local variables 130 bytes of local data are required for the FB. Added to this are the local data of the subordinate TCP_COMM (50 bytes) and of the TCON, TDISCON, TSEND or TRCV, up to 28 bytes depending on the block. This adds up to a maximum 208 bytes of local data for an FB MB_PAC16/32/94 call. If the logger is used, further 162 bytes local data are needed.

Config DB The PAC specific parameters are stored in the configuration DB CNF_PAC.

Timers/Memory bits

The function block does not use any timers and memory bits.

Standard FBs for connection processing and data transmission

The FB TCP_COMM called in FB MB_PAC16/32/94 uses the following blocks from the standard library:

• TCON

• TDISCON

• TSEND

• TRCV

SFCs for other functions

The FBs MB_PAC16, MB_PAC32 and MB_PAC94 use the following SFCs from the standard library:

• SFB4 "TON"

• SFC1 "READ_CLK"

• SFC20 "BLKMOV"

• SFC24 "TEST_DB"

• SFC51 "RDSYSST"

• SFC52 "WR_USMSG"

Usage in CFC If the Modbus block should be inserted in CFC, the block TUSEND from the Standard Library must be copied into the step7 program.

Page 25: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Blocks of the Modbus – PAC communication

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

3-13

3.6 Renaming/rewiring of standard functions

Reason If in the user project the numbers of the standard functions have already been used or the number range has been reserved for other applications, you can rewire the internally called function blocks FB63, FB64, FB65, FB66, FB99, FC99 and FB103.

The system functions SFC1, SFC20, SFC24, SFC51 and SFC52 as well as the system function block SFB4 cannot be renamed/rewired.

Order In SIMATIC Manager in STEP7 there are several rules regarding block numbers to be followed in rewiring.

If you want to rewire the blocks from the Modbus library, proceed in the following sequence:

1. FB63 TSEND FB64 TRCV FB65 TCON FB66 TDISCON

2. FC99 UDP_MSG_BUILDER FB99 UDP_LOGGER

3. FB103 TCP_COMM

4. FB109 MB_PAC16 FB110 MB_PAC32 or FB111 MB_PAC64

Not all functions or function blocks have to be rewired. Even if you only want to rewire a few of these, the sequence must be maintained.

Reassignment To rewire the FBs, proceed as follows:

1. Select "Options > Reference data > Display" to obtain information about the operands used.

2. In the block folder object properties, set the operand priority to "Absolute value".

3. In SIMATIC Manager, select the function "Options > Rewire" to rewire the operands to free ranges.

4. To continue to use the symbols in diagnostic tools, update the changes in the symbol table.

You can check the changes with "Options > Reference data > Display".

Page 26: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Licensing

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

4-1

4 Licensing

General information

The blocks MB_PAC16, MB_PAC32 or MB_PAC94 must be licensed individually on each CPU. Licensing takes place in 2 steps: Reading out the IDENT_CODE and entering the REG_KEY activation code. The OB121 must be available on the CPU.

Reading out the IDENT_CODE

Proceed as follows to read out the IDENT_CODE:

1. Parameterize the Modbus block in a cyclic OB according to your requirements. Load the program in the CPU and set it to RUN.

2. Open the instance DB of the Modbus block. On the menu, select "Data block" -> "Open online" to open the DB online.

"Monitor block" via the button is not sufficient.

Page 27: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Licensing

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

4-2

3. At the output IDENT_CODE, an 18-digit character string is displayed. Copy this string from the DB and paste it into the form SOFTWARE REGISTRATION FORM. This form is stored in the library path ..\Program Files\Siemens\Step7\S7LIBS\Modbus_PAC during installation and is also found on the installation CD. Enter the license number from the product packaging in the form.

4. Send this form as Service Request to Customer Support. Hereupon you will receive the registration key for your PLC.

Page 28: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Licensing

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

4-3

Entering the REG_KEY activation code

The activation code REG_KEY must be entered at the Modbus block call.

The REG_KEY should be saved to a global DB, through which the Modbus block contains the necessary activation code (see following example).

Proceed as follows to enter the REG_KEY activation code:

1. Copy the preconfigured licensing block DB3 from the "Modbus_PAC" library to your project. If the DB number is already in use in the project, the license DB can also be renamed.

2. Open the license DB and copy the 17-digit activation code provided by copying and pasting to the "Initial value" column.

3. To prevent having to enter the activation code again after the CPU is reloaded, it must be permanently entered in the data block. For this purpose, switch to the DB data view via "View" -> "Data view". Using the menu "Edit" -> "Initialize Data Block", all values in the "Initial value" column will then be imported to the "Actual value" column.

4. In the cyclical OB at parameter REG_KEY of the Modbus block, enter the value "DB3.REG_KEY".

5. Load the modified block to the CPU. The activation code can be added in runtime; a switch from STOP -> RUN is not necessary.

The block has now been licensed for this CPU.

Page 29: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Licensing

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

4-4

Missing or incorrect licensing

If no activation code, or an incorrect activation code, is entered, the CPU's SF-LED (for S7-300 and IM151-8) or INTF-LED (for S7-400) flashes and an entry is made cyclically in the diagnostic buffer regarding the missing license. The error number for a missing license is W#16#A090.

!

____________________________________________________________

Warning

If the OB121 is missing from the control, the CPU i s set to STOP state. ____________________________________________________________

The Modbus communication is processed if the activation code is incorrect or missing, but at the output STATUS, W#16#A090 "No valid license available" is constantly displayed.

Page 30: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Diagnostics

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

5-1

5 Diagnostics

Diagnostic functions

The diagnostic functions of the PN-CPU allow you to quickly localize errors when they occur. The following diagnostic options are available:

• Diagnostics via the display elements of the CPU

• Diagnostics via the STATUS output of the MB_PAC16/32/94 function block

• Diagnostics via PAC status bits in the CNF_PAC

• Diagnostics via LAST_ERROR / ERROR_COUNTER in the data block of the PAC device

• Error logging by means of the UDP logger. Please contact the Product Support for this feature.

Display elements (LED)

The display elements inform you about the operating state and any possible error states of the CPU. The display elements provide you with an initial overview of internal, external, and interface specific errors that may occur.

STATUS output of the Modbus block

The function block MB_PAC16/32/94 has a STATUS output for an error diagnosis.

The output STATUS provides error messages regarding both Modbus specific telegram processing and connection processing. It also issues status messages.

By reading the STATUS output, you receive general information about errors that occurred during communication. You can evaluate the STATUS parameter in the user program.

Page 31: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Diagnostics

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

5-2

5.1 Diagnostics via the display elements of the CPU

Display functions The CPU display elements provide you with information about the module status. There is a distinction between the following display functions:

• Group error displays PN-CPU 300 - SF Group error If this LED flashes, the Modbus block is not yet licensed. For further information, refer to the chapter "Licensing" . PN-CPU 400 - INTF Group error If this LED flashes, the Modbus block is not yet licensed. For further information, refer to the chapter "Licensing" .

• Special displays PN-CPU 300, PN-CPU 400, and IM 151-8 PN/DP CPU: - RX/TX a telegram is being transferred via the interface

You can find a detailed description of the display elements in the relevant CPU manual.

Page 32: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Diagnostics

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

5-3

5.2 Diagnostics via PAC status bits in the CNF_PAC

Array STATUS_PAC

There is an STATUS_PAC [1..512] array in the config DB CNF_PAC. Using this array, it is possible in the user program to quickly detect and check which PAC device has reported an error.

The status TRUE of a bit in this array indicates an error in reading out the values of this PAC device. The number of the PAC device in the status array is equivalent to the number in the following PAC configurations in the CNF_PAC block.

In this example, the values from the PAC devices 5 and 7 could not be read out without error; STATUS_PAC[x] is set to TRUE.

5.3 Diagnostics via LAST_ERROR in the data block of the PAC device

Status in PAC data block

The parameter "LAST_ERROR" is available in each data block of a PAC device.

The parameter "LAST_ERROR" displays the last error number to occur in reading out the values of this PAC device.

Page 33: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Diagnostics

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

5-4

5.4 Diagnostic messages of the FBs MB_PAC16, MB_PAC 32 and MB_PAC94

Messages at the STATUS output of the FB

The STATUS output is available on the Modbus block. The block processing error messages are shown here with ERROR = TRUE. If ERROR = FALSE, status information is shown.

In the following is a list of FB specific error and status messages.

Error messages of the called SFCs and FBs

The Modbus blocks use the standard blocks SFC1, SFC20, SFC24, SFC51, SFC52, SFB4, FB63, FB64, FB65 and FB66. The error messages of these blocks are passed on unchanged to STATUS.

You can find further details about these error messages in the diagnostic buffer or the online help for the SFCs/FBs in SIMATIC Manager.

Error messages at the STATUS output

STATUS (Hex)

Event text Remedy

A001 The config DB CNF_PAC is too short. Correct the length of the CNF_PAC DB.

A003 A data DB in which the PAC values are to be saved is too short. The data block must be at least 230 bytes long.

Lengthen the data block.

A007 An invalid monitoring period has been parameterized in MONITOR. A value >= 20 ms must be entered.

Correct the parameterization.

A009 The received Transaction Identifier TI is different from the one that was sent.

Using a telegram recording, check the data of the link partner and contact Product Support. A00A The received UNIT is different from the one that was

sent.

A00B The received function code is different from the one that was sent.

A00C The received byte count does not match the number of registers.

A00D The register/bit address or register/bit number in the response telegram is different to the one in the request telegram.

A00E The length specification in the Modbus specific telegram header does not match the specifications of the register/bit number or the byte count in the telegram.

A00F A Protocol Identifier other than 0 has been received.

A01A Incorrect length in header: 1 to 253 bytes are permissible.

A019 A DB number in the config DB CNF_PAC has been set to 0. DB 0 may not be used, because this is reserved for the system.

Correct the parameterization of the DB number to be > 0.

A01F The Modbus block is in a forbidden operating state. Contact Product Support.

Page 34: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Diagnostics

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

5-5

Error messages at the STATUS output

STATUS (Hex)

Event text Remedy

A07A An invalid value has been given at the parameter ID in the config DB CNF_PAC (value range of 1 to 4095).

Correct the parameterization at the ID in block CNF_PAC.

A07B The specified ID is included twice in the config DB CNF_PAC.

Correct the parameterization in the DB CNF_PAC.

A07C An invalid IP address was specified in the config DB CNF_PAC (impermissible addresses are 0.x.x.x, 127.x.x.x und 255.x.x.x).

Correct the parameterization in the DB CNF_PAC.

A07E The number of the instance DB of the block MB_PAC16/32/94 is specified at the input parameter CONFIG_DB.

Correct the parameterization.

A07F The DB specified at CONFIG_DB is not a PAC configuration DB. The RESERVED value was changed; the DB has an incorrect length or an incorrect DB was specified.

Correct the parameterization.

A080 The CONFIG_DB was changed or a CPU was restarted during a running polling cycle.

Initialize the block after changing the CONFIG_DB or after restarting a CPU with INIT = TRUE.

A084 No character string for the licensing could be detected. Contact the Product Support.

A085 An error occurred during license detection. Check that there is no impermissible write access to the license DB in the project. Contact the Product Support, if necessary.

A086 The CPU could not be recognized. Contact the Product Support.

A087 In the config DB CNF_PAC, more PAC devices have been configured than are permitted by the license or the maximum number of PACs of 512 has been exceeded.

Reduce the number of PAC devices in the config DB or purchase a higher license.

A088 All enable bits were set to FALSE. At least 1 enable bit must be set to TRUE. Contact the Product Support, if necessary.

A089 The time CYCLICAL has elapsed while a job is running. This is a status information. The ERROR bit is not set.

The next polling cycle is started immediately once the currently running cycle ends.

A090 The Modbus block has not yet been licensed for this CPU. This is a status information. The ERROR bit is not set. Modbus communication is also running without a license.

Read out the identification string IDENT_CODE for this CPU and request the registration key. See the chapter "Licensing" in the manual.

Page 35: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Diagnostics

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

5-6

Error messages at the STATUS output

STATUS (Hex)

Event text Remedy

A091 An exception telegram with exception code 1 was received as response.

The communication partner does not support the requested function. Contact the Product Support.

A092 An exception telegram with exception code 2 was received as response.

A nonexistent/forbidden address has been accessed at the link partner.

A093 An exception telegram with exception code 3 was received as response.

A094 An exception telegram with exception code 4 was received as response.

A095 An exception telegram with unknown exception code was received as response.

A096 INIT = TRUE was set during a polling cycle. The block may only be initialized after a running polling cycle ends. If necessary, set CYCLICAL = 0 ms to prevent further polling cycles from being activated.

A100 The monitoring time MONITOR has elapsed for a job. The connection is terminated.

Check the parameterization of the connection.

A101 The internal monitoring time of the TDISCON function has elapsed.

Contact the Product Support.

Page 36: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Diagnostics

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

5-7

5.5 Diagnostic messages of the blocks used

Error messages of the blocks SFC 6, SFC 20, SFC51, SFC52, FB 63, FB 64, FB 65 and FB 66 at the STATUS output

STATUS (Hex)

Event text Remedy

7xxx For detailed information, please refer to the online help of the SIMATIC Manager.

See online help (SIMATIC Manager -> Select block -> F1 key)

8xxx For detailed information, please refer to the online help of the SIMATIC Manager.

See online help (SIMATIC Manager -> Select block -> F1 key)

5.6 Diagnostic messages of the SFC24

Error messages of the SFC24 at the STATUS output

STATUS (Hex)

Event text Remedy

80A1 DB number = 0 or too large for the CPU Select a valid DB number.

80B1 The DB does not exist on the CPU. All PAC data blocks and the config DB must be created and copied into the CPU.

80B2 DB UNLINKED Do not generate DB as UNLINKED.

Page 37: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

Application example

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

6-1

6 Application example

General The following shows the use of the MB_PAC16 FB in a simple program example.

Please note that the supplied example project only represents an orientation aid for the use of ModbusPAC blocks and is not suitable for use in productive systems.

Example project on the CD

On the CD you can find an example project in which SIMATIC stations are created for all ModbusPAC blocks.

• The SIMATIC station is S7-300, S7-400 or IM 151-8 PN/DP CPU

• The SIMATIC station operates with MB_PAC16, MB_PAC32 or MB_PAC94

Program example The program example consists of two blocks:

• Start-up block OB100

• Cyclical operation OB1 with calls of the FB109, FB110 or FB111

• Programming error OB121

• Configuration block CNF_PAC with various numbers of PAC devices and connections

• Global data block for licensing

• Data blocks for the register values

• Logger blocks

Blocks used The listed blocks are used in the supplied example project for S7 stations with FB MB_PAC16.

Block Symbol Comment

OB 1 CYCL_EXC Cyclic program execution

OB 100 COMPLETE RESTART Start-up OB for restart

OB 121 PROG_ERR Programming error OB

FB 99 UDP_LOGGER Logger block

FB 103 TCP_COMM FB TCP_COMM

FB 109 MB_PAC16 FB MB_PAC16

FC 99 UDP_MSG_BUILDER MessageBuilder for logger block

DB 1 CONTROL_DAT Work DB CONTROL DAT for FB MB_PAC16

DB 2 CNF_PAC Config DB CNF_PAC for FB MB_PAC16

DB 3 LICENSE_DB License DB for FB MB_PAC16

DB 4 UDP_DATA DB for logger block

DB 109 IDB_MODBUS Instance DB for FB MB_PAC16

DB 200 – DB 214

PAC_DATA_x Data blocks for the values of the PAC devices 1 to 15

Page 38: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

1

A References

The MODBUS Organization

MODBUS APPLICATION PROTOCOL SPECIFICATION V1.1b, December 28, 2006

http://www.modbus.org

Page 39: SIMATIC Modbus/TCP Connection of Sentron PAC … · SIMATIC S7 SIMATIC Modbus/TCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU Manual Edition 1.2 Preface, table of contents

ModbusTCP Connection of Sentron PAC 3200/4200 to a SIMATIC PN-CPU 6AV6676-6MA30-0AX0, 6AV6676-6MA30-1AX0, 6AV6676-6MA30-2AX0; Manual Edition 1.2

2

Customer Support Siemens AG Phone: +49 (0)911 895 7 222 Customer Support

http://www.siemens.com/s7modbus

Siemens Aktiengesellschaft Subject to change without notice release: 09/2014