Professional Documents
Culture Documents
Modbus/TCP Client Standardized and redundant Communication of PCS 7 with Third-Party Systems
SIMATIC PCS 7 V8.0 Application Description September 2013
Siemens Industry Online Support This entry is taken from Siemens Industry Online Support. The following link takes you directly to the download page of this document: http://support.automation.siemens.com/WW/view/en/75867147
Caution The functions and solutions described in this entry predominantly confine themselves to the realization of the automation task. Please also take into account that corresponding protective measures have to be taken in the context of Industrial Security when connecting your equipment to other parts of the plant, the enterprise network or the Internet. For more information, please refer to Entry ID 50203404. http://support.automation.siemens.com/WW/view/en/50203404
Copyright
Task Description and Solution General Information on the Library PCS 7 Modbus/TCP Client Diagnostics Hardware changes during operation Renaming and Rewiring Function Blocks Performance Supplementary Information History
1 2 3 4 5 6 7 8 9
SIMATIC PCS 7 V8.0 Modbus/TCP Client Standardized and redundant Communication of PCS 7 with Third-Party Systems
Siemens AG 2013 All rights reserved
Application Example
Copyright
Copyright
Table of Contents
Table of Contents
Warranty and Liability .............................................................................................. 4 Table of Contents ..................................................................................................... 5 1 Task Description and Solution ...................................................................... 6 1.1 1.2 2 2.1 2.2 2.3 2.4 2.5 2.5.1 2.5.2 2.5.3 3
Siemens AG 2013 All rights reserved
Task .................................................................................................. 6 Solution ............................................................................................. 6 Modbus/TCP versions ....................................................................... 9 Purchase order and scope of delivery .............................................. 12 Installing the library.......................................................................... 12 Licensing ......................................................................................... 13 Hardware and software requirements............................................... 15 Hardware requirements ................................................................... 15 Software requirements..................................................................... 16 Updating the SIMATIC NET library................................................... 16 Setting up the network in NetPro...................................................... 20 Parameterizing the CP..................................................................... 20 Parameterizing the peer................................................................... 21 Configuring the communication connection ...................................... 22 Inserting the blocks into the master data library................................ 26 CFC engineering ............................................................................. 27 Variant A: Allocation blocks for global data blocks ............................ 29 Variant B: DataCollector blocks with instance data blocks ................ 35 Modbus telegram management........................................................ 37
PCS 7 Modbus/TCP Client............................................................................ 17 3.1 3.1.1 3.1.2 3.1.3 3.2 3.3 3.3.1 3.3.2 3.3.3
Copyright
4 5 6
Diagnostics ................................................................................................... 47 Hardware changes during operation ........................................................... 55 Renaming and Rewiring Function Blocks ................................................... 56 6.1 6.2 Renaming ........................................................................................ 57 Rewiring .......................................................................................... 57
7 8 9
1
1.1
1.2
Solution
We introduce you to a Modbus/TCP library available in different versions that allows you to connect third-party systems to PCS 7 via Modbus/TCP. A general description is followed by a configuration example that completely describes the Modbus/TCP client solutions for redundant connection of third-party systems to PCS 7 via Industrial Ethernet. The example uses the OpenModbus/TCP Redundant V2.1 Modbus/TCP library.
Copyright
Customer benefits This configuration example enables you to significantly reduce your engineering overhead using PCS 7 standard means and increase performance. You can use this solution for both new configurations and integration into existing projects. All the necessary hardware and software products are from Siemens and ensure the usual compatibility, up-to-dateness and upgrade options. The solution considers both the PCS 7 standard and the Modbus standard without exception. In addition, using the Modbus library provides you with the following advantages: Easy connection of systems from different manufacturers to PCS 7 via Industrial Ethernet Step-by-step, cost-effective expansion or modernization of legacy systems over their entire life cycle Reliable support from Siemens No specific Modbus know-how needed Engineering in the familiar PCS 7 environment Block library with online help (F1) in German and English Setup in German and English
Siemens AG 2013 All rights reserved
Main contents of the application description Advantages Required hardware and software Installation and setup Configuration Performance data
Copyright
Validity All Modbus blocks described and used in this application description are released for PCS 7 V7 and PCS 7 V8. PCS 7 V8.0 was used for the descriptions and screen shots of the configuration examples described in this document.
Principle of operation
Copyright
2.1
Modbus/TCP versions
There are several versions of the Modbus/TCP library that have been modified for use with different CPUs and communication interfaces. Furthermore, appropriate library versions are available for both server and client operation and the redundant connection. In addition to the paid Modbus/TCP library, allocation blocks and Job_List blocks for out-of-the-box solutions are available for free download. These blocks can be customized to specific project requirements (open source). For the Modbus/TCP library version that suits your application, please refer to the following table.
Table 2-1
Product OpenModbus/TCP
Siemens AG 2013 All rights reserved
Description Contains the Modbus block for Modbus communication via CPs. This Modbus version is suitable for SIMATIC S7-300 and S7-400 CPUs. A CP343-1 or CP443-1 is required for Modbus communication.
Order number (MLFB) 2XV9 450-1MB00 Single license Valid for one CPU
Copyright
Contains the Modbus block for redundant Modbus communication via CPs (for the S7-400H system). This Modbus version is suitable for SIMATIC S7-400H systems. One CP443-1 per subsystem is required for Modbus communication.
Supports function codes 3, 4 and 16. NOTICE Function codes 1, 2, 5, 6 and 15 are not supported.
2XV9 450-1MB01 Single license Valid for one redundant pair of CPUs
Description Contains the Modbus block for redundant Modbus communication via CPs for S7-300, S7400 and S7-400H. This Modbus version is suitable for SIMATIC S7-300, S7-400 and S7-400H systems. One CP443-1 or CP343-1 per subsystem is required for Modbus communication.
Order number (MLFB) 2XV9 450-1MB11 Single license Valid for one redundant pair of CPUs or one CPU with two CPs
OpenModbus/TCP PN
Contains the Modbus block for Modbus communication via the integrated PN interface. This Modbus version is suitable for SIMATIC S7-PN CPUs and ET200S PN-CPUs. Modbus communication takes place via the integrated PN interface.
Copyright
10
Description Contains the Modbus block for Modbus communication via the integrated PN interface for reading out predefined values from numerous Sentron PAC 3200 devices. This Modbus version is suitable for SIMATIC S7 PNCPUs and ET200S PN-CPUs. Modbus communication takes place via the integrated PN interface.
Supported function codes Reads out the values of basic type 3 and the values of the energy counters.
Order number (MLFB) 6AV6676-6MA300AX0 For max. 20 connectable PAC 3200 devices. 6AV6676-6MA301AX0 For max. 100 connectable PAC 3200 devices. 6AV6676-6MA302AX0 For max. 512 connectable PAC 3200 devices. Each with single license and valid for one CPU
Copyright
11
2.2
Note
2.3
Scope of delivery
Copyright
12
Make sure that you use the blocks from the correct folder depending on your CPU type (300 or 400) and the architecture used (server or client). The blocks in the S7 folders for the S7-300 or S7-400 CPU have the same FB numbers. Make sure that the correct blocks are inserted into the correct CPU.
NOTICE
2.4
General
Licensing
The Modbus driver block, MB_REDCL, requires licensing. This licensing must be performed individually for each CPU. For additional information, please refer to the OpenModbus/TCP manual available at the following link: https://www.industry.siemens.com/services/global/en/IT4Industry/products/simatic_ add_ons/s7_open_modbus_tcp/Pages/default_tab.aspx
Licensing is performed in the folowing steps: Reading out the IDENT_CODE Inserting it into the SOFTWARE REGISTRATION FORM Emailing the form to it4.industry@siemens.com Receiving the registration key Entering the REG_KEY registration key OB121 must exist in order to enter the registration key. For an H system, only the CPU in rack 0 is licensed. Therefore, it is not possible to exchange the CPU from rack 0 after licensing.
Copyright
Note
Reading out the IDENT_CODE 1. To read out the IDENT_CODE, proceed as follows: 2. Parameterize the MB_REDCL block according to your requirements. 3. Download the program to the CPU and set the CPU to Run. 4. Open the instance data block of the Modbus driver block. 5. In the menu bar, select Data block > Open Online. When the code is read out directly on the Modbus data block, not all characters will be displayed.
NOTICE
13
6. Search for the IDENT_CODE output and read out the ident code in the Actual value column. 7. Copy this ident code. 8. Open the SOFTWARE REGISTRATION FORM This form can be found on the installation CD and, after installing the Modbus/TCP library, is available in the following path: \Program Files\Siemens\Step7\S7LIBS\Modbus_TCP_CP_Red300_400 9. Enter the ident code. 10. Enter the license no. of your Modbus/TCP library printed on the cover of the product packaging. 11. Email the form to it4.industry@siemens.com. 12. After that, you receive the registration key for the CPU.
Entering the registration key The REG_KEY registration key must be entered on each Modbus driver block used in the CPU. To simplify matters, you can store the REG_KEY in a global data block that supplies all Modbus driver blocks with the registration key.
Siemens AG 2013 All rights reserved
To do so, proceed as follows: 1. Copy the prefabricated licensing block DB3 from the Modbus_TCP_CP_Red300_400 library to your project. If the DB number has already been assigned in your project, rename the licensing block before copying. Make sure that you select DB3 from the appropriate directory, e.g. S7 400 Client.
NOTICE
Copyright
2. Open the license DB and use copy and paste to copy the 17-digit registration key sent to you to the Initial value column. 3. To ensure that you do not need to enter the registration key again after reloading the CPU, permanently enter it in the data block. Use the View > Data view menu option to go to the data view of the DB. 4. Execute the Edit > Initialize Data Block menu command. By doing so, all values of the Initial value column are applied to the Actual value column. 5. Change to the CFC and connect the REG_KEY input of the block MB_REDCL to the data block DB3. 6. Download the modified blocks to the CPU. The registration key can be entered during runtime, a STOP -> RUN transition is not necessary. The block is now licensed for this CPU.
Missing or wrong licensing If the registration key is missing or wrong, the INTF LED of the CPU flashes once per minute and an entry regarding the missing license is written to the diagnostic buffer.
14
NOTICE
The error number for a missing license is W#16#A090. If the registration key is missing or wrong, Modbus communication is processed. However, W#16#A090 no valid license is then displayed at the STATUS_x outputs. If this error code is displayed although a registration key has been entered, you should check if FC10 EQ_STRING was inserted into the project.
2.5
2.5.1
Type CP343-1 Lean CP343-1 CP343-1 CP343-1 Advanced CP443-1 Advanced CP443-1 Advanced CP343-1 Lean CP343-1 CP343-1 Advanced CP343-1 Advanced CP443-1 CP443-1 CP443-1 Advanced CP443-1 Advanced
Order number 6GK7343-1CX10-0XE0 6GK7343-1EX21-0XE0 6GK7343-1EX30-0XE0 6GK7343-1GX21-0XE0 6GK7443-1EX40-0XE0 6GK7443-1EX41-0XE0 6GK7343-1CX10-0XE0 6GK7343-1EX30-0XE0 6GK7343-1GX30-0XE0 6GK7343-1GX31-0XE0 6GK7443-1EX20-0XE0 6GK7443-1EX30-0XE0 6GK7443-1GX20-0XE0 6GK7443-1GX30-0XE0
Firmware version 2.1 1.0.17 2.0.16 1.0.24 2.2.35 1.0.24 2.2 2.2 1.0.23 3.0 1.0.26 3.0 2.0 3.0
Copyright
15
2.5.2
Software requirements
The redundant master Modbus connection presented in this chapter requires the following software components: OpenModbus/TCP Redundant V2.1 library SIMATIC PCS 7 version 7.0 and higher SIMATIC NET library When using PCS 7 V7.0 to PCS 7 V7.1 SP1, the SIMATIC Net library must be updated. Otherwise, malfunctions may occur. This update is no longer necessary for PCS 7 V7.1 SP2 and higher.
NOTICE
2.5.3
To use these driver blocks, the AG_LSEND and AG_LRECV blocks from the SIMATIC NET library must have version V3.1. Therefore, SIMACTIC NET must be updated for the following PCS 7 versions to update the blocks from version V3.0 to version V3.1: PCS 7 V7.0 PCS 7 V7.0 SP1 PCS 7 V7.0 SP2 PCS 7 V7.0 SP 3 PCS 7 V7.1 PCS 7 V7.1 SP1 The following links provide all the necessary information and descriptions and the update package: Information and descriptions http://support.automation.siemens.com/WW/view/en/22172239 Download http://support.automation.siemens.com/WW/view/en/8797900 For PCS 7 V7.1 SP2 and higher, the SIMATIC NET update is not necessary as it includes STEP 7 V5.5 and the required blocks of version 3.1 are part of STEP 7 V5.5.
Copyright
Note
16
SEND_I
RECV_I
Copyright
SEND_R
Job_List
RECV_R
Job_List
SEND_W
RECV_W
Modbus/TCP Master-Treiber
Modbus-Hilfsbaustein
17
A PCS 7 process tag for a redundant Modbus/TCP client connection consists of 4 block types: Interface blocks (SEND and RECEIVE) Modbus driver Job_List block Message block
Interface blocks (add-on Modbus blocks) The send blocks prepare the data provided by the CFCs or data blocks for the communication data block. The send blocks exist for the Boolean, Real, Integer and Word data types. The Modbus driver (MB_REDCL) coordinates the receiving and saving of the data in the data block. The interface blocks allow you to conveniently display the data stored in the data block in the CFCs. The receive blocks exist for the Boolean, Real, Integer and Word data types. The Additional Modbus Blocks description provides detailed block and functional descriptions and is available at the following link: https://www.industry.siemens.com/services/global/en/IT4Industry/products/simatic_ add_ons/s7_open_modbus_tcp/Pages/default_tab.aspx
Modbus driver for redundant communication (MB_REDCL) The MB_REDCL function block performs the following tasks: Coordinates via which connection(s) the telegrams are sent Monitors all configured connections via AG_CNTRL Controls transaction identifiers (TI) The MB_REDCL function block allows you to establish communication between a CP443-1 or CP343-1 and a partner supporting the Open Modbus/TCP protocol in a redundant system. Function codes 1, 2, 3, 4, 5, 6, 15 and 16 are supported. The block then operates as a Modbus client, i.e. as an active partner, and can process max. 4 telegram jobs. Detailed block and functional descriptions can be found on the installation DVD and, when the installation is complete, in the following path: \Program Files\Siemens\Step7\S7manual\S7Comm The MB_REDCL block can only be used for the client application.
Copyright
Note
18
Job_List (add-on Modbus blocks) The Job_List block offers a high degree of flexibility when parameterizing the individual jobs. For example: Status message when timeouts occur. The entire job list can be processed on a time-controlled basis. The job list can be canceled at any time. Jobs can be temporarily skipped. The Additional Modbus Blocks description provides detailed block and functional descriptions and is available at the following link: https://www.industry.siemens.com/services/global/en/IT4Industry/products/simatic_ add_ons/s7_open_modbus_tcp/pages/default_tab.aspx
Message block
Siemens AG 2013 All rights reserved
The message block includes an Alarm_8P via which the statuses are combined with the message texts of the message list and displayed. Therefore, the message list displays not only the error numbers, but also additional plain text.
Copyright
19
3.1
Requirement
Sample projects The supplied sample project is a multiproject, MB_TCP_CP_RED_CFC, with four user projects for the respective fields of application:
Siemens AG 2013 All rights reserved
H Double-sided (Client) H Double-sided (Server) H Single-sided (Client) H Single-sided (Server) The individual user projects include preconfigured Modbus typicals (CFCs).
Copyright
3.1.1
Parameterizing the CP
To parameterize the CP, go to HW Config and perform the following steps: 1. In HW Config, open the properties of the first CP. 2. Select the Properties button. 3. Switch to the Parameters tab. 4. Select the following subnet and IP address: IP no.: Subnet: IP no.: Subnet: 192.168.0.11 255.255.255.0 192.168.0.12 255.255.255.0
5. Repeat the Step 1 to 4 and select the following subnet and IP address:
20
Figure 3-2
3.1.2
Copyright
4. Assign an IP address, in this example 192.168.0.21, for the primary interface in the same subnet as the peer station. The subnet mask must be the same as for the partner station.
21
5. Assign an IP address, in this example 192.168.0.21, for the primary interface in the same subnet as the peer station. The subnet mask must be the same as for the partner station. 6. Select the associated subnet that establishes the connection between the CP interface and the peer interface. 7. For a redundant connection, once again select the New button (see step 3) and in the next window, select Industrial Ethernet and then the OK button. 8. For a redundant connection, repeat steps 3 through 5 and assign an IP address for the redundant interface, in this example: 192.168.0.22, which is in the same subnet as the partner station. The subnet mask must be the same as for the partner station. See Figure 3-5.
Figure 3-4
3.1.3
Copyright
Client Ports:
2000
2001
2000
2001
0A
0B
1A
1B
Server Ports:
502
503
502
503
192.168.0.21
192.168.0.22
22
In this example, the H system has the following IP addresses: 192.168.0.11 and 192.168.0.12. For access to node A of the peer, port number 2000 can be used for both CP0 and CP1 as the two CPs have different IP addresses (connection 0A and 1A). Also for access to node B of the peer, the same port number can be used for both CPs: 2001 (connection 0B and 1B). In this example, the IP addresses of the partner station are 192.168.0.21 and 192.168.22. For access to CP0 of the H system, the same port number can be used for node A and node B: 502 (connection 0A and 0B). You can also use the same port number for access to CP1 of the H system: 503 (connection 1A and 1B). 1. In NetPro, select the first CPU of the H system. 2. Insert a new connection into the NetPro configuration table. 3. As the connection partner, select Other Station. 4. As the connection type, select TCP connection. 5. Select the OK button. The Properties window of the connection opens.
Siemens AG 2013 All rights reserved
Figure 3-6
Copyright
6. The "General Information" tab includes a predefined ID you can freely assign. 7. In Name:, enter a meaningful name in order to identify your TCP connection in the network.
23
Figure 3-7
Note
The Connection ID (local ID) and Load address block parameters will be needed later to parameterize the Modbus driver.
8. In "Name:", enter a meaningful name in order to identify your TCP connection in the network. 9. The Active connection establishment check box must be checked. 10. Select the Route button and in Remote, select the first port of the other station (server). 11. Switch to the Addresses tab. Assign the following port numbers and make sure that you select the correct IP numbers.
Table 3-1
Copyright
Remote 192.168.0.21
Note
The IP addresses in this window cannot be changed. If an incorrect IP address is displayed, use the OK button to exit the window and once again select the port of the other station (steps 7 through 9).
12. Use the "OK" button to exit the window. 13. Insert a second connection into the same CPU (steps 1 through 8). 14. In the General Information tab, select the Route button. 15. Select the second port of the other station.
24
16. Switch to the Addresses tab Assign the following port numbers and make sure that you select the correct IP numbers.
Table 3-2
Remote 192.168.0.22
17. Use the "OK" button to exit the window. 18. Select the second CPU and insert a new connection (steps 2 through 8). 19. In the General Information tab, select the Route button. 20. Select the first port of the other station. 21. Switch to the Addresses tab. Assign the following port numbers and make sure that you select the correct IP numbers.
Table 3-3
Siemens AG 2013 All rights reserved
Remote 192.168.0.21
22. Use the "OK" button to exit the window. 23. Once again, select the second CPU and insert a second new connection (steps 2 through 8). 24. In the General Information tab, select the Route button. 25. Select the second port of the other station. 26. Switch to the Addresses tab Assign the following port numbers and make sure that you select the correct IP numbers.
Table 3-4
Copyright
Remote 192.168.0.22
27. Use the "OK" button to exit the window. In the Addresses tab, you can customize the port numbers as desired.
Note
25
3.2
Inserting the Modbus blocks Check if the following function block numbers (FB no.) and data block numbers (FC no.) have been assigned in your user project and master data library: FB909 FB908 DB3 If the block and DB numbers already exist, perform a rewiring in the S7 master data library (see chapter 6 Renaming and Rewiring Function Blocks). If these numbers are not yet used, continue. 1. Open the Modbus_TCP_CP_Red300_400 library and from the S7 400 Client folder, copy the following blocks to your master data library:
Siemens AG 2013 All rights reserved
NOTICE
Inserting the SIMATIC_NET_CP blocks The Modbus blocks use the AG_LSEND and AG_LRECV functions. Check if the following function numbers (FC no.) have been assigned in your user project: FC50 FC60 If the function numbers already exist, perform a rewiring in the S7 master data library (see chapter 6 Renaming and Rewiring Function Blocks). If these numbers are not yet used, continue with the engineering.
NOTICE
NOTICE
Copyright
The use of OpenModbus/TCP Redundant V2.1 requires the AG_LSEND and AG_LRECV blocks from the SIMATIC NET library version V3.1 and higher. For the relevant PCS 7 versions and information on how to update these SIMATIC NET blocks, please refer to chapter 0 Updating the SIMATIC NET library.
26
3.3
CFC engineering
This application describes an off-the-shelf Modbus/TCP solution that is subdivided into three subcharts in one CFC:
Figure 3-8
Copyright
Table 3-5
Description
Modbus telegram management Modbus driver Job list Diagnostics This chapter uses step-by-step instructions to provide a detailed description of the Modbus/TCP solution. Depending on the project requirements, two options are available to access the send and receive buffers (CFC subchart 1 and 2). Variant A accesses the buffers via global DBs, Variant B accesses them via instance DBs. In terms of the function, Modbus telegram management (CFC subchart 3) is the same for both variants and differs only in the way the user data is prepared.
27
Variant A: Allocation blocks for global data blocks In Variant A, the data to be sent and the data to be received is transferred via global DBs. Only Modbus data type 3 (Holding Register; Word) is supported. It is also possible to send Boolean, Integer and Real data types, but they will be converted to words before sending. This variant is recommended in particular for mixed data formats in a DB and large data volumes. Receive allocation blocks include the PCS 7 quality codes and substitute values can be applied in the event of an error or connection incident. The global data blocks are created manually depending on the project requirements.
Variant B: DataCollector blocks with instance data blocks In Variant B, the data to be sent and the data to be received is transferred via the instance DBs. Sending and receiving data is supported in the following formats: Boolean, Integer, Real and Word (Modbus data types 1 (Coils; Bool), 2 (Inputs; Bool), 3 (Holding Register; Word) and 4 (Input Register)). It is not possible to mix the data in an instance DB. Per instance DB, only Word or only Real or only Integer or only Boolean data types can be sent and received. Send and receive engineering is performed only in the CFC environment.
Table 3-6
Variant A Data blocks Data volume Modbus data types Global DBs Large data volume 3 (Holding Register)
Variant B Instance DBs Small data volume 1 (Coils; Bool) 2 (Inputs; Bool) 3 (Holding Register; Word) 4 (Input Register) Boolean, Real, Integer, Word Remain in the original format when sending. Send / receive: 80 BOOL each Send / receive: 125 INT each Send / receive: 63 REAL each Send / receive: Receive 124 WORDs, send 123 WORDs Mixed operation is not possible. Only Boolean or only Real or only Integer or only Word per DB. Unavailable Unavailable CFC only
Copyright
Formats
Boolean, Real, Integer, Word Converted to words before sending. Send / receive: 16 BOOL each Send / receive: 10 INT each Send / receive: 10 REAL each
Mixed operation
Mixed data formats are possible in a DB. For receive blocks only PCS 7 standard CFC + manual creation of data blocks.
28
Note
The execution order in the CFCs must be adjusted manually. 1. Send blocks 2. Job_List 3. MB_REDCL 4. Receive blocks
3.3.1
Allocation blocks The allocation blocks are the interfaces for the user program. They enable access to the data to be sent or received of the send or receive buffers of global data blocks.
Send allocation blocks Blocks are available to allocate 10 Real, 10 Integer and 16 Boolean values to the send mailbox.
Siemens AG 2013 All rights reserved
Figure 3-9
Copyright
29
Receive allocation blocks The receive allocation data blocks operate on a controlled basis, i.e. they do not output data before the receive function block sets the new data received output to 1. The user has the additional option to apply substitute values if an error occurs (e.g., connection abort). The receive allocation data blocks include PCS 7 quality codes. Blocks are available to output 10 Real, 10 Integer and 16 Boolean values from the receive mailbox.
Figure 3-10
Copyright
Creating the global data block In Variant A, the data (Boolean, Real, Integer) is converted to Word format. In this example, this means: 16 Boolean 10 Integer 10 Real in Coils array (1 word) in Int array (10 words) in Real array (10 words)
NOTICE
In addition to the user data, the global DB requires two bytes (1 word) for internal processing. This word must not be changed. Maximum user data per job (in this example): Receive: 248 bytes DB length = 250 bytes Send: 246 bytes DB length = 248 bytes
30
1. Configure the global send data block as shown in the figure below. The Comment column shows the assignment between bus addresses and Modbus application addresses (Holding Register).
Figure 3-11: Send assignment between bus addresses and Modbus application addresses
Table 3-7: Receive assignment between bus addresses and Modbus application addresses
Copyright
2. Configure the global receive data block as shown in the figure below. The Comment column shows the assignment between bus addresses and Modbus application addresses (Holding Register).
31
Inserting the send blocks and interconnection 1. After you have created the global data blocks, open a CFC. 2. Drag the following blocks to CFC subchart 1:
Table 3-8
Qty. 4
Rename to P01_SND10B P02_SND10B P03_SND10B P04_SND10B P05_SND10I P06_SND10I P07_SND10I P08_SND10I P09_SND10R P10_SND10R P11_SND10R P12_SND10R
SND_INT
SND_REAL
3. Interconnect the SOURCE inputs of the blocks with the appropriate arrays of the global send data block. 4. Set the ACTIVE inputs to 1. 5. At the DB_LEN inputs, set the length of the global data block. As, in this example, all blocks access the same global data block, the value is identical for each block: 246 bytes of user data + 2 bytes for internal processing = 248. It is not possible to apply substitute values on the send block.
Copyright
Note
32
Figure 3-12
Inserting the receive blocks and interconnection 1. Drag the following blocks to CFC subchart 2:
Table 3-9
Copyright
Qty. 4
Rename to P01_RCV10B P02_RCV10B P03_RCV10B P04_RCV10B P05_RCV10I P06_RCV10I P07_RCV10I P08_RCV10I P09_RCV10R P10_RCV10R P11_RCV10R P12_RCV10R
RCV_INT
RCV_REAL
2. Interconnect the SOURCE inputs of the blocks with the appropriate arrays of the global receive data block. 3. Set the ACTIVE inputs to 1. 4. At the DB_LEN inputs, set the length of the global data block. As, in this example, all blocks access the same global data block, the value is identical for each block: 248 bytes of user data + 2 bytes for internal processing = 250. 5. Inputs SUBS_ON0 to SUBSONx allow you to activate substitute value feedforward in case of an error for each individual value.
33
Figure 3-13
Copyright
34
3.3.2
Inserting the receive blocks and interconnection 1. Open a CFC. 2. Drag the following blocks to your CFC:
Table 3-10
Qty. 0 0 0 1
Siemens AG 2013 All rights reserved
Description Receive blocks for Boolean values Receive blocks for Integer values Receive blocks for Real values Receive blocks for Word values
Note
The OUT blocks read the data out of the data block and are therefore the receive data blocks.
3. Interconnect the "IDB" outputs of the blocks with the "db_x" input of the "MB_REDCL" block.
Copyright
35
Figure 3-14
Inserting the send blocks and interconnection 1. Drag the following blocks to your CFC:
Table 3-11
Copyright
Qty. 1 0 0 1
Description Send blocks for Boolean values Send blocks for Integer values Send blocks for Real values Send blocks for Word values
Note
The IN blocks pass on the data to the data block and are therefore the send blocks.
2. Interconnect the "IDB" outputs of the blocks with the "db_x" input of the "MB_REDCL" block.
36
Figure 3-15
3.3.3
Copyright
Figure 3-16
37
MB_REDCL The following table provides a detailed description of the inputs and outputs of the Modbus driver. The table is part of the SIMATIC Modbus/TCP Redundant Communication via CP443-1 in H-Systems manual.
Table 3-12: Inputs/outputs id_0_a id_1_a id_0_b id_1_b Description For each configured connection in NetPro, a connection ID is assigned. The connection ID clearly describes the connection between the CPU and peer via the CP. The number from the connection configuration has to be entered here. The range of values for this parameter depends on the CPU. id_0_a represents id_1_a represents id_0_b represents id_1_b represents
Siemens AG 2013 All rights reserved
the connection from CP0 to peer/node A the connection from CP1 to peer/node A the connection from CP0 to peer/node B the connection from CP1 to peer/node B
Connection 0A is the default connection, its configuration is mandatory. If the peer has a stand-alone design, only the id_0_a and id_1_a parameters are required. laddr_cp0 laddr_cp1 The laddr_cp0 and laddr_cp1 parameters represent the input addresses of CP0 and CP1 from HW Config (I address). The configured value has to be entered here. The range of values for this parameter depends on the CPU. check_conn_cycle This parameter defines at which time interval the configured connections are checked with AG_CNTRL. The time can be set in second intervals; the default value is 30 seconds. The results of the connection check are displayed at the STATUS outputs. If use_all_conn = FALSE, the 0 seconds setting allows you to disable monitoring. If check_conn_cycle = 0 is parameterized, it is not possible to detect a connection error without telegram traffic via this connection. We recommend to assign > 0 ms to this parameter. use_all_conn This parameter defines via how many connections the Modbus telegrams are to be sent. If FALSE, the Modbus telegrams are only sent via 1 connection. If the parameter is TRUE, the Modbus telegrams are sent via all configured connections. If the single_write parameter= TRUE, function codes 5 and 6 are used for write jobs with length 1. If single_write = FALSE, function codes 15 and 16 are used for all write jobs.
Copyright
single_write
38
Inputs/outputs Init
Description The Init = TRUE parameter allows manual initialization of the Modbus block. Initialization can be performed only if currently no job is running. In the program, this must be ensured with ENQ = FALSE and BUSY = FALSE. For manual initialization, please note that the initialization parameters must be parameterized in the cyclic OB. Note Manual initialization terminates and reestablishes the configured connections.
data_type_x
The data_type_x parameter specifies which Modbus data types are mapped to this DB. If the value 0 is entered in data_type_x, the appropriate data area is not used.
db_x
The db_x parameter specifies the data block to which the MODBUS registers or bit values defined below are mapped. DB number 0 is not allowed as it is reserved for the system. The data blocks must be 2 bytes longer than necessary for the Modbus values. The last word is used for internal purposes and must not be changed.
Copyright
start_x
start_x specifies the first Modbus address mapped to data word 0 of the DB. The maximum number of Modbus addresses that can be mapped to the DB is calculated during startup from the size of the DB. For register access, the calculation of the last Modbus address in the DB is based on the following formula: Last Modbus address in the DB = (DB length (in bytes) - 2) / 2 + start_x - 1 For bit access, the calculation of the last Modbus address in the DB is based on the following formula: Last Modbus address in the DB = (DB length (in bytes) - 2) * 8 + start_x - 1 Note The defined data areas must not overlap.
MONITOR
The MONITOR monitoring time monitors reception of the data from the peer on the currently active connections. The minimum time that can be set is 20 ms. A monitoring time of approx. 1.5 seconds is recommended. The MONITOR time monitors receipt of the complete response telegram from the server. If the monitoring time is exceeded, the activated job is terminated with an error. The time is started after sending the request telegram is complete and stopped after the complete data has been received.
39
Inputs/outputs REG_KEY
Description The block must be licensed on each CPU. When the registration key is entered correctly on this parameter, the block is licensed and Modbus communication can be used without any restrictions. A positive edge initiates the data transfer. The request telegram is generated with the values of the UNIT, WRITE_READ, DATA_TYPE, START_ADDRESS and LENGTH input parameters. A new job can only be sent if the previous one was completed with DONE or ERROR. The DATA_TYPE parameter indicates which Modbus data type is processed with the current telegram. The following values are permitted: Coils B#16#1 Inputs B#16#2 Holding Register B#16#3 Input Register B#16#4 The different data types are directly related to the function codes used.
ENQ
DATA_TYPE
START_ADDRESS LENGTH
Copyright
The START_ADDRESS parameter defines the first MODBUS address that is written or read. The LENGTH parameter defines the number of MODBUS values that are written or read. For read functions, max. 125 registers are possible per telegram for the Holding and Input register. Max. 2000 bits are possible for Coils and Inputs. For write functions, max. 123 registers are possible for the Holding register and max. 1968 bits are possible for Coils. The registers or bit values processed with a request telegram must be in the same DB.
WRITE_READ
This parameter defines whether a read or write function is to be executed. If the input has the value FALSE, it is a read function. The value TRUE defines a write function. If this output is set to TRUE, the Modbus block is licensed on this CPU. If the output is FALSE, the license string is missing or wrong. For more information, please refer to the Licensing chapter.
LICENSED
BUSY DONE
If this output is set, AG_LSEND or AG_LRECV is active. On at least 1 connection, the activated job was completed without errors. For a read function, the response data from the server has already been entered in the DB; for a write function, the response to the request telegram has already been received from the server.
40
Inputs/outputs ERROR
Description If this output is set, an error was detected on all active connections. use_all_conn = FALSE: If a protocol error occurs, ERROR is set immediately. If a connection error occurs, all configured connections are checked and ERROR is set only if all connections are faulty. use_all_conn = TRUE: If this output is set, an error was detected on all configured connections. The error numbers are displayed at the STATUS outputs.
If ERROR is set, the STATUS_x outputs display the error number; if ERROR is not set, they display the status information for the respective connection. For a description of the error numbers and status information, please refer to the Diagnostics chapter. After CPU startup, this parameter displays an 18-digit ID that is used to request the licensing code (registration key) for Modbus communication. For more information, please refer to the Licensing chapter.
RedErrS7
The RedErrS7 = TRUE output indicates a redundancy error on the SIMATIC side. For single-sided redundancy, this means that the connection of CP0 or CP1 has failed. For double-sided redundancy, both connections of CP0 or both connections of CP1 have failed. The RedErrDev = TRUE output indicates a redundancy error on the peer side. For single-sided redundancy, this means that the connection from node A to CP0 or CP1 has failed. For double-sided redundancy, both connections to node A or both connections to node B of the peer have failed. If TRUE, the TotComErr output indicates a total loss of communication, i.e. all configured connections are faulty. If an error occurred during manual initialization, this is indicated with Init_Error = TRUE. If Init_Error is set, the Init_Status displays the error number.
RedErrDev
Copyright
Job_List The tables below provide a detailed description of the inputs and outputs and status and error displays.
Table 3-13: Input parameters Parameter CYCLICAL DONE ERROR Job1_DATA_TYPE Job1_START_ADDRESS Data type TIME BOOL BOOL BYTE WORD Description > 0 ms: Cyclic job list processing Feedback of the Modbus/TCP block that the last job could be completed without errors Feedback of the Modbus/TCP block that the last job was terminated with an error 1st job: data type, 0 = no processing 1st job: Start address
41
Parameter Job1_LENGTH Job1_WRITE_READ Job2_DATA_TYPE Job2_START_ADDRESS Job2_LENGTH Job2_WRITE_READ Job3_DATA_TYPE Job3_START_ADDRESS Job3_LENGTH Job3_WRITE_READ Job4_DATA_TYPE Job4_START_ADDRESS Job4_LENGTH Job4_WRITE_READ Job5_DATA_TYPE Job5_START_ADDRESS
Siemens AG 2013 All rights reserved
Data type WORD BOOL BYTE WORD WORD BOOL BYTE WORD WORD BOOL BYTE WORD WORD BOOL BYTE WORD WORD BOOL BOOL 1 job: Length 1st job: Write/read
st
Description
2nd job: Data type, 0 = no processing 2nd job: Start address 2nd job: Length 2nd job: Write/read 3rd job: data type, 0 = no processing 3rd job: Start address 3rd job: Length 3rd job: Write/read 4th job: Data type, 0 = no processing 4th job: Start address 4th job: Length 4th job: Write/read 5th job: Data type, 0 = no processing 5th job: Start address 5th job: Length 5th job: Write/read TRUE: Abort of the running job list processing
Job5_LENGTH Job5_WRITE_READ ABORT Table 3-14: Output parameters Parameter QENQ QDATA_TYPE QSTART_ADDRESS QLENGTH QWRITE_READ BUSY STATUS
Description Job start for the Modbus/TCP block DATA_TYPE of the current job START_ADDRESS of the current job LENGTH of the current job WRITE_READ of the current job Running job list Status information of the block
Copyright
Table 3-15: Status and error display Status 16#A089 Meaning The set cycle time has elapsed while the processing list is still active. Notes After the last job has been completed, the job list is immediately reprocessed.
42
In standard mode, the MB_REDCL Modbus driver can process up to 4 telegrams. The data type is defined and both the start address of the communication registers and the data buffers used (DB) are specified. The Job_List is used to parameterize access to the Modbus offsets of the registers. In addition, the length or number of the written or read registers is defined. WRITE_READ is used to define the read or write command. Interconnecting the blocks 1. Drag the following blocks to your CFC subchart 3:
Table 3-16 Qty. 1 1 1 Block name Job_List MB_REDCL MB_DIAG Rename to Order List MODREDCL Description Job management Modbus/TCP driver block Status and error messages
Copyright
Note
The MB_DIAG block is available on the same page as this document. http://support.automation.siemens.com/WW/view/en/75867147
43
Table 3-17 Job_List Outputs QENQ QDATA_TYPE QSTART_ADRESS QLENGTH Inputs DONE ERROR Table 3-18 MB_REDCL Outputs STATUS_0A STATUS_1A STATUS_0B STATUS_1B ERROR RedErrS7 RedErrDev TotComErr Table 3-19 MB_REDCL Ausgnge ERROR RCV_BIT, RCV_INT, RCV_REAL Eingnge INVALID Inputs STATUS_0A STATUS_1A STATUS_0B STATUS_1B ERROR RedErrS7 RedErrDev TotComErr MB_DIAG MB_REDCL Inputs ENQ DATA_TYPE START_ADRESS LENGTH Outputs DONE ERROR
Copyright
Note
Please make sure that the Job_List and MB_REDCL blocks are integrated in OB100 (restart/warm restart). In addition, make sure that the block sequence is correct.
Note
A text library is supplied with the MB_DIAG block. This text library assigns the associated event descriptions to the hexadecimal statuses and error messages. Therefore, WinCC displays the errors, including status [hex], and the associated error descriptions in plain text.
44
Parameterizing MB_REDCL 1. At the id_0_a input of the MB_REDCL block, enter 1 for the 1st connection.
Figure 3-18
2. At the "laddr_cp" input of the "MB_REDCL" block, enter the "loader address". This address can be found in NetPro in the properties of the connections. 3. At the use_all_conn input, enter 1 to send the telegram via all configured connections. 4. At the data_type input, enter 3 for data type 3 (words). 5. At the db_1 input, assign 21 (hex 15) for the DB number. 6. At the start_1 input, enter 0 for the first Modbus register of the data block (DB). 7. This example does not consider jobs 2 to 4.
Copyright
45
8. Set the "EN" input of the "Job_List" block to 1 to activate the block. 9. At the CYCLICAL input, enter the time [in ms] in how many milliseconds the job list is to be processed. 10. At the Job1_DATA_TYPE input, enter 3 for data type 3 (word). 11. At the Job1_START_ADDRESS input, enter the job start address on the predefined data area in the data block. 12. At the Job1_LENGTH input, enter the job length of the area. 13. At the Job1_WRITE_READ input, select whether you want to write or read. 14. This example does not use jobs 2 to 5.
Copyright
46
4 Diagnostics
Diagnostics
The MB_REDCL Modbus driver monitors the four possible communication connections. The four status outputs, STATUS_0A to STATUS_1B, display the error messages in hexadecimal format. After interconnection with the free open source block MB_DIAG, the configured message texts are automatically displayed in Runtime in the event of an error. You can download this open source block and the associated text table from the HTML page from which you downloaded this document (http://support.automation.siemens.com/WW/view/en/75867147). 1. Download the MB_DIAG block and the associated text table. The text table is an example and can be customized to the project requirements. A list of all messages the MB_REDCL Modbus driver block contains can be found at the end of this chapter.
Figure 4-1
NOTE
Copyright
2. Store the text table in your project in the text libraries. 3. Integrate the MB_DIAG block into your master data library and insert the MB_DIAG block into your CFC. 4. Make at least the following connections:
47
4 Diagnostics
Table 4-1 MB_REDCL STATUS_0A STATUS_1A STATUS_0B STATUS_1B MB_DIAG STATUS_0A STATUS_1A STATUS_0B STATUS_1B Description Monitoring of the four possible communication connections.
192.168.0.11
192.168.0.12
Client Ports:
2000
2001
2000
2001
0A
0B
1A
1B
Server Ports:
502
503
502
503
192.168.0.21
ERROR RedErrS7 RedErrDev TotComErr ERROR RedErrS7 RedErrDev TotComErr
192.168.0.22
An error has occurred on all active connections. Redundancy error on the SIMATIC side. Redundancy error on the peer side. Total loss of communication; all configured connections are faulty.
Copyright
48
4 Diagnostics
Figure 4-2
Copyright
5. The "Ctime" input parameter allows you to prevent multiple messages for an error that is still active. The error message is not displayed again until the error has not been active at least for the time "Ctime". This allows you to prevent a flood of messages. Enter 0 to disable this function. 6. Select the MB_DIAG block and open its properties. 7. Click on the "Messages " button. 8. In "Event", you can directly enter the message texts or call the message texts from the text table.
Figure 4-3
49
4 Diagnostics
The error numbers and message texts are determined and displayed based on the text table as shown in the figure below:
Figure 4-4
Error Messages The table below contains the assignment of the hexadecimal messages to the plain text messages as included in the downloadable text table.
Table 4-2 Error messages of the MB_REDCL and MB_REDSV FBs
Siemens AG 2013 All rights reserved
Event text An error was detected when checking start_x. The DB, to which Modbus addresses shall be mapped, is too short. Minimum length in bytes: Registers: (START_ADDRESS start_x + LENGTH) * 2 + 2 Bits: (START_ADDRESS start_x + LENGTH) / 8 + 2 CP is client: Wrong initialization parameter. CP is server: Wrong address area in the request telegram of the client. Contact Product Support. Extend the DB.
Remedy
CP is client: Correct the START_ ADDRESS or LENGTH job parameters. CP is server: Modify the request of the client.
Copyright
A004
Applies only with CP is client: An invalid combination of DATA_TYPE and WRITE_READ is given.
Correct the call parameters. Only data types 1 and 3 can be written.
50
4 Diagnostics
Error messages of the MB_REDCL and MB_REDSV FBs Status [Hex] A005 Event text CP is client: An invalid value for the parameter LENGTH is given. CP is server: The number of registers or bits in the request telegram is invalid. The CP sends an exception telegram. Range of values: Read coils/inputs: 1 to 2000 Write coils: 1 to 1968 Read registers: 1 to 125 Write holding registers: 1 to 123 A006 The given range of data defined with DATA_TYPE, START_ADDRESS and LENGTH does not exist in data_type_1 to data_type_4. CP is server: The CP sends an exception telegram. A007 CP is client: An invalid monitoring time MONITOR is parameterized. A value > 20 ms is required. Monitoring time MONITOR elapsed when AG_RECV waits for receipt. E.g. connection is not established. Partner is not ready. The connection is terminated and reestablished. A009 CP is client: The received transaction identifier TI is not equal to the sent one. The connection is terminated and reestablished. A00A CP is client: The received UNIT is not equal to the sent one. The connection is terminated and reestablished. Check the data of the peer with the aid of a telegram trace. Check the data of the peer with the aid of a telegram trace. CP is client: Correct the DATA_TYPE, START_ADDRESS and LENGTH parameter combination. CP is server: Modify the request of the client or correct the parameterization of data_type_x. Correct the parameterization. Remedy CP is client: Correct the LENGTH parameter. CP is server: Modify the number in the request telegram.
A008
Copyright
Check the settings and, if necessary, error messages of the peer. Check if the peer needs a specific UNIT identifier.
51
4 Diagnostics
Error messages of the MB_REDCL and MB_REDSV FBs Status [Hex] A00B Event text CP is client: Received function code is not equal to the sent one. CP is server: An invalid function code was received. The CP sends an exception telegram. The connection is terminated and reestablished. A00C The received byte count does not match the number of registers/bits. The CP sends an exception telegram. The connection is terminated and reestablished. A00D Only when CP is client: The register/bit address or the number of registers/bits in the response telegram is not equal to the one in the request telegram. The length indicated in the MODBUS specific telegram header does not match the number of registers/bits or the byte count in the telegram. The FB receives all data ignores them. The connection is terminated and reestablished. A00F A protocol identifier <> 0 was received. The connection is terminated and reestablished. A010 A011 A012 A013 A014 A019 In the parameterized area db_1 to db_4 a DB number is used twice. An invalid value for DATA_TYPE is given (value range: 1 to 4). The parameterized areas data_type_1 and data_type_2 overlap. The parameterized areas data_type_1 and data_type_3 overlap. The parameterized areas data_type_1 and data_type_4 overlap. 0 is assigned to one of the parameters db_x while the according data_type_x is <> 0. DB0 cant be used; it is reserved for system functions. Wrong length in header: Range of values: 3 to 253 bytes. The connection is terminated and reestablished. CP is server and function code 5: An invalid value for coils was received. Correct the parameterization on db_x to > 0. Correct the parameterization on db_x. Correct the call parameters. Correct the parameterization. The data areas must not have common registers. Check the data of the peer with the aid of a telegram trace. Check the data of the peer with the aid of a telegram trace. Check the data of the peer with the aid of a telegram trace. Remedy CP is client: Check the data of the peer with the aid of a telegram trace. CP is server: Change the request of the client. The Modbus FB only supports function codes 1, 2, 3, 4, 5, 6, 15 and 16.
A00E
Check the data of the peer with the aid of a telegram trace.
Copyright
A01A
Check the data of the peer with the aid of a telegram trace.
A01B
Check the data of the peer with the aid of a telegram trace.
52
4 Diagnostics
Error messages of the MB_REDCL and MB_REDSV FBs Status [Hex] A01E Event text The CP has received invalid data which could not be assigned. The connection is terminated and reestablished. A01F The FB MB_REDCL and MB_REDSV respectively have turned to an invalid state. Check_conn_cycle is set to < 1s, so no or a too small cycle time is parameterized for AG_CNTRL. Contact Product Support. Remedy Check the error message of the peer. If necessary, check the data using a telegram trace.
A020
Correct the parameterization. Client: If use_all_conn = TRUE, a monitoring time > 1 s must be parameterized. Server: A monitoring time > 1 s must be parameterized.
A023
Siemens AG 2013 All rights reserved
The parameterized areas data_type_2 and data_type_3 overlap. The parameterized areas data_type_2 and data_type_4 overlap. The parameterized areas data_type_3 and data_type_4 overlap. An invalid value id is parameterized. Range of values is 1 to 64. An invalid value data_type_x was given. The value range is 0 to 4. Parameter data_type_1 is not defined. The parameter area 1 is the default area and must be defined. The DB number of db_x is identical to the number of the instance DB. Different instance DBs were used for the call of the Modbus block in OB100 and the cyclic OB. Only if CP is client and function code 5: The received coil status is not equal to the sent one. Only if CP is client and function code 6: The received register value is not equal to the sent one. Only if CP is client: A request was initiated prior to the completion of the previous one. The request is not executed. The manual initialization was started during processing a telegram.
Correct the parameterization. The data areas must not have common registers.
Correct the parameterization at the id_x input. Correct the parameterization on data_type_x. Correct the parameterization on data_type_1. Correct the parameterization on db_x. In the startup OB and the cyclic OB, the Modbus block must be called with the same instance DB. Check the data of the peer with the aid of a telegram trace. Check the data of the peer with the aid of a telegram trace. Do not trigger a new job before the previous job was completed with DONE = TRUE or ERROR = TRUE. Before you initialize the block, make sure that no job is active.
Copyright
A07E A080
A081
A082
A083
53
4 Diagnostics
Error messages of the MB_REDCL and MB_REDSV FBs Status [Hex] A085 Event text An error occurred during the license handling due to an invalid write access. Remedy Check if there has been unauthorized write access to the license DB. The structure of the REG_KEY must not be changed. If necessary, contact Product Support. Read out the IDENT_CODE identification string for this CPU and request the registration key.
A090
The Modbus block is not licensed for this CPU. This is status information. The bit ERROR is not set. The Modbus communication runs without a license as well. An exception telegram with exception code 1 was received (only if CP is client). The connection is terminated and reestablished.
A091
A092
An exception telegram with exception code 2 was received (only if CP is client). An attempt to an invalid or non-existing address at the communication partner was made. An exception telegram with exception code 3 was received (only if CP is client). An exception telegram with exception code 4 was received (only if CP is client). An exception telegram with an unknown exception code was received (only if CP is client). The connection is not ready for communication.
A093
The peer cannot process the received telegram (e.g., it does not support the requested length). The peer is in a state in which it cannot process the received telegram. Check the error messages of the peer and, if necessary, check the data using a telegram trace. Check the connections. If necessary, correct the value on check_conn_cycle. The error can also occur when a CP is used that does not support AG_CNTRL. If you want to use this connection, it must be configured on id_x and laddr_x during startup.
A094 A095
Copyright
A0FF
FFFF
54
Communication delays
Siemens AG 2013 All rights reserved
Loading hardware changes in run mode within an H system may cause delay in communication. The communication delay for H-CiR depends on the current process state, the communication traffic and system parameters. The maximum permissible communication delay can be set in properties of CPU under the H parameter tab. It is possible to calculate the delay times by using system parameters. Run H-CiR at during non-time-critical process states only. The necessity for H-CiR can be reduced by configuring reserve I/O modules and installing I/O resistances to avoid diagnostic messages. For further information on hardware changes in run mode please refer to the system manual "Fault-tolerant systems S7-400H": http://support.automation.siemens.com/WW/view/en/60458386
Copyright
NOTE
55
MB_REDCL / MB_RESV Internally, the MB_REDCL (FB909) / MB_REDSV (FB907) function blocks of the Modbus library call the MB_CPCLI (FB908) / MB_CPSRV (FB906) function blocks that are also part of the Modbus library. MB_CPCLI / MB_CPSRV additionally call the AG_LSEND (FC50) and AG_LRECV (FC60) blocks that are part of the SIMATIC NET library. Frequently, the function code names, FC50 and FC60, have already been assigned to other functions such as I/O modules so that thoughtless copying of the Modbus library blocks overwrites these functions, which may result in malfunctions.
Figure 6-1
Siemens AG 2013 All rights reserved
FB Call
FC Call
FB 909
FB 908
FC 50
Copyright
FC 60
Table 6-1 Scenario 1. The FB and FC numbers are not used in your project. The FB numbers are already used in your project, but the called FC numbers have not yet been assigned. The FB numbers are not used in your project, but other functions already use the called FC numbers. Action There is no need for action. Function blocks and function codes can be copied to the project. Rename either the function blocks in the project or the function blocks to be added: See chapter 6.1 Renaming The FC blocks can be renamed in the project. See chapter 6.1 Renaming The FC blocks cannot be renamed in the project as they are called by other FBs or FCs: See chapter 6.2 Rewiring Both the function blocks and the function codes cannot be renamed in the project: See chapter 6.2 Rewiring
2.
3.
4.
Both the FB numbers and the FC numbers are already used in your project.
56
6.1
Renaming
If you know that no additional function blocks (FBs)/functions (FCs) with the same numbers that have already been assigned to other FBs/FCs in your project are supplied with your add-on blocks, you can rename them. 1. Rename your blocks in the add-on library. 2. Adjust these changes in the symbol table. 3. Copy the blocks to your project.
6.2
Rewiring
Rewiring ensures that the internally hard-coded calls of specific FBs or FCs are adjusted as well.
Order The blocks from the Modbus library must be rewired in the following order:
Siemens AG 2013 All rights reserved
1. FC50 AG_LSEND FC60 AG_LRECV 2. FB908 MB_CPCLI FB906 MB_CPSRV 3. FB909 MB_REDCL FB907 MB_REDSV It is not necessary to rewire all the functions or function blocks. Even if only some of these blocks are to be rewired, this must be done in the above order.
NOTICE
Copyright
Step-by-step instructions In this example, new numbers are assigned to the following FBs and FCs.
Table 6-2 Block name MB_REDCL MB_REDSV MB_CPCLI MB_CPSRV AG_LSEND AG_LRECV From library Modbus/TCP Modbus/TCP Modbus/TCP Modbus/TCP SIMATIC NET SIMATIC NET From FB909 FB907 FB908 FB906 FC50 FC60 To FB1000 FB999 FB1001 FB998 FC550 FC560
To rewire the blocks, proceed as follows: 1. Create a new PCS 7 program. 2. Copy the following Modbus/TCP and SIMATIC NET blocks to your new PCS 7 program:
57
3. Select the "Blocks" folder and then right-click and select "Rewire" to rewire the blocks.
Figure 6-2
4. A blank table appears. In the first column, enter the FB and FC numbers you want to rewire. In the second column, enter the new FB and FC numbers. Select OK to confirm both entries.
Figure 6-3
Copyright
5. Check the result. To do so, select the changed block and open its object properties. Switch to the Calls tab. The window lists the called blocks.
58
FB Call
FC Call
FB 909 FB 1009
FB 908 FB 1008
FC 50 FC 550
FC 60 FC 660
Copyright
Note
This method also allows you to implement all other add-on libraries in the PCS 7 project, regardless of their FB/FC numbers.
59
7 Performance
Performance
The following section lists the hardware and software used for the performance measurements: S7 412-5H PN/DP CPU 412-5HK06-0AB0 (firmware V6.0.1) CP 443-1EX20-0EX0 PCS 7 V8.0 Upd1 (firmware V2.0.57)
Scenario 1 In the first scenario, the first test case uses two MB_REDCL blocks; one block for sending and one block for receiving data. One job is processed per send and receive block (up to 4 jobs would be possible). Each job uses a separate data block (DB). The jobs are processed using 2 Job_List blocks. For the first measurement, 124 words are received and 123 words are sent. For the second measurement, the two MB_REDCL blocks and the two Job_List blocks are copied and inserted. This doubles the number of words that are received and sent (248 / 246).
Siemens AG 2013 All rights reserved
Two more MB_REDCL blocks and two Job_List blocks are copied for each additional measurement. 1st measurement 2 * MB_REDCL + 2 * Job_List 2 * data blocks (1 * for sending; 1 * for receiving) receive 124 words and send 123 words 2nd measurement 4 * MB_REDCL + 4 * Job_List 4 * data blocks (2 * for sending; 2 * for receiving) receive 248 words and send 246 words 3 measurement 6 * MB_REDCL + 6 * Job_List 6 * data blocks (3 * for sending; 3 * for receiving) receive 372 words and send 369 words 4 measurement 8 * MB_REDCL + 8 * Job_List 8 * data blocks (4 * for sending; 4 * for receiving) receive 496 words and send 492 words
th rd
Copyright
60
7 Performance
Figure 7-1
Table 7-2
Copyright
61
7 Performance
Scenario 2A Scenario 2A uses two MB_REDCL blocks; one block for sending and one block for receiving. Each block can process up to 4 jobs. Each job requires a data block (DB). The jobs are processed using two Job_List blocks. For the first measurement, 124 words are read and 123 words are sent via one job. For the second measurement, a second job is parameterized within the MB_REDCL block and 124 words are read and 123 words are sent via this job so that, in total, the number of words read and sent doubles. The number of MB_REDCL and Job_List blocks remains unchanged, but the number of data blocks is increased to 2. For the third measurement, an additional job is parameterized that also reads 124 words and sends 123 words. For the fourth measurement, another additional job is parameterized that reads 124 words and sends 123 words. 1st measurement: 2 * MB_REDCL + 2 * Job_List 2 * data blocks (1 * for sending; 1 * for receiving) receive 124 words and send 123 words
Siemens AG 2013 All rights reserved
2nd measurement: 2 * MB_REDCL + 2 * Job_List 4 * data blocks (2 * for sending; 2 * for receiving) receive 248 words and send 246 words 3rd measurement: 2 * MB_REDCL + 2 * Job_List 6 * data blocks (3 * for sending; 3 * for receiving) receive 372 words and send 369 words 4th measurement: 2 * MB_REDCL + 2 * Job_List 8 * data blocks (4 * for sending; 4 * for receiving) receive 469 words and send 492 words
Figure 7-3
Copyright
62
7 Performance
Table 7-4
Scenario 2B Scenario 2B is identical to the 1st measurement from Scenario 2A; however, the data size received and sent via a job (1 DB) is increased to 496 / 492 words. Measurement
Siemens AG 2013 All rights reserved
2 * MB_REDCL + 2 * Job_List 2 * data blocks (1 * for sending; 1 * for receiving) receive 496 words and send 492 words
Figure 7-5
Copyright
Figure 7-6
63
8 Supplementary Information
Supplementary Information
Table 8-1 Topic 1 2 Reference to the entry Siemens Industry Online Support Title
http://support.automation.siemens.com/WW/view/en/75867147 http://support.automation.siemens.com
9
Siemens AG 2013 All rights reserved
History
Table 9-1 Version V1.0 Date 09/2013 First version Modifications
Copyright
64