Home
Display - Siemens
Contents
1. J 8 1 8 1 How the MB_PNHSV FB wolks a 8 1 8 2 Parameters of the PNHSV function block 8 5 SIMATIC Modbus TCP Redundant Communication of PN H Systems i 6AV6676 6MB10 0AX0 Manual Edition 1 1 Table of contents 8 3 Example of address mapping uu 8 10 8 4 Data and standard functions used by the 8 13 8 5 Renaming rewiring functions and function blocks 8 14 9 Additional DICKS ISI 9 1 9 1 GEG eae gs e M NM NE Lo 9 1 9 2 Job list for cyclic telegr aMi nsus enne 9 2 10 Use in a single PN CPU L u 10 1 11 DIAQNOSUCS ete 11 1 11 1 Diagnostics via the display elements of the CPU 11 1 11 2 MB PNHCL and MB PNHSV FB diagnostics messages 11 2 11 3 Diagnostics messages of integrated blocks 11 8 11 4 SFC24 diagnostics messages 1 T 11 8 11 5 Diagnostic messages with alarm bits seen 11 9 Woe Client Docks era eiiis geriet enr itu eiit nete 11 9 115 2 Server block xtd eue n pg y a pees 11 12 12 Application example
2. 12 1 12 1 Sample project in STL Modbus 12 2 12 2 Sample project in STL Modbus server sse 12 3 12 3 Sample project in CFC Modbus client 12 4 12 4 Sample project in CFC Modbus server see 12 5 A FOTO COS fte ELE A SIMATIC Modbus TCP Redundant Communication of PN H Systems ii 6AV6676 6MB10 0AX0 Manual Edition 1 1 Product description 1 Product description 1 4 Applications Classification in the system environment FB function Using port number 502 This function block is a software product for CPUs with an integrated PN interface in a SIMATIC S7 H system The function blocks enable communication between an S7 H CPU with an integrated PN interface and a device supporting Modbus TCP Function codes 1 2 3 4 5 6 15 and 16 are supported Data transmission is carried out in accordance with the client server principle The SIMATIC S7 can be operated as a client or as a server during data transmission Redundant communication is supported Use in both an S7 400H system and in an S7 Single PN CPU is possible The blocks operate in hot standby mode Hot standby is the term for parallel redundant signal processing in redundant components This enables the System as a whole to switch bumpless to the standby components Modbus TCP usually runs via port 502 This po
3. examples FED p MB TCP_PN_RED_400 H Double sided Client 3 B CPU 414 5 PN DP CYCL_EXC STL Organization Black 57 Program 1 RED FLT STL Organization Block aM Sources COMPLETE RESTART STL Organization Block oi mr amp 08121 PROG ERR STL Organization Block H Double sided Server amp FB63 TSEND STL Function Block E H Single sided Client amp FB64 STL Function Block Bm H Single sided Server amp FB65 TCON STL Function Block g 6 TDISCON STL Function Block 81178913 _ SCL Function Block g 914 MOD CLI SCL Function Block g FB915 MB_PNHCL SCL Function Block ick DB1 CONTROL DAT DB Data Block 063 License DB DB Data Block 084 MODBUS_HPARAM DB Data Block 06811 Holding RegisterArea Data Block 0812 Holding Register Area2 DB Data Block DB13 Input Register Area DB Data Block i DB14 Coils Area DB Data Block i DB15 Inputs Area DB Data Block 0616 Coils Area 2 DB Data Block 08915 IDB_MODBUS DB Instance data block Client_Job Client_Job Variable T able g SFB4 TON STL System function bloc n These block numbers are also used in the example project supplied for S7 H stations with FB PNHCL sex sme Los evoe oyee program processa oB121 PROG Programming enor OB memaly calea FB TOP_COWM Feos mB PNH UserblockFBMB_PNHOL Fm mr
4. TIMEOUT elapsed A101 The internal monitoring time of the TDISCON function Contact the Product Support has expired FFFF The connection has not been configured If this connection is to be used it must be configured in startup at id x SIMATIC Modbus TCP Redundant Communication of PN H Systems 11 7 6AV6676 6MB10 0AX0 Manual Edition 1 1 Diagnostics 11 3 Diagnostics messages of integrated blocks Error messages of integrated FCs SFCs STATUS Remedy Hex 7XXX Please see the SIMATIC Manager online help for See online help SIMATIC detailed information Manager Select block Press F1 8XXX Please see the SIMATIC Manager online help for See online help SIMATIC detailed information Manager gt Select block gt Press F1 80C4 The H system is in the process of connecting and This error message from TCON updating may occur once after a warm restart of the H system and can be ignored 11 4 SFC24 diagnostics messages Error messages of the SFC24 STATUS Remedy Hex 80A1 DB number 0 or too large for the CPU Select a valid DB number to the CPU 8082 DBUNLINKED Do not generate DB as UNLINKED 80B1 The DB does not exist in the CPU All data blocks specified at DB x must be created and transferred SIMATIC Modbus TCP Redundant Communication of PN H Systems 11 8 6AV6676 6MB10 0AX0 Manual Edition 1 1 Diagnostics 11 5 Diagnostic messages with alarm bits The Modbus blocks allo
5. UNIT Blocks used These block numbers are also used in the example project supplied for S7 H stations with FB PNHCL sx umm emm CYL exc oyee program procesna mE MODBUS HPARAM P Parameter DB for FB MB PNHCL Ines O e Deis SIMATIC Modbus TCP Redundant Communication of PN H Systems 12 4 6AV6676 6MB10 0AX0 Manual Edition 1 1 Application example 12 4 Sample project in CFC Modbus server Overview The example project was generated with CFC V8 0 Update 1 OA Counter ERROR OA Counter cru Save STRTUS OR Upwards ERROR GB STATUSO Save STATUS_18 Save STA Blocks used These block numbers are also used in the example project supplied for S7 H stations with FB MB_PNHSV Block Symbol Comment O oa CYL exe oya program procesna MODBUS HPARAM P Parameter DB for FB MB PNHSV SIMATIC Modbus TCP Redundant Communication of PN H Systems 12 5 6AV6676 6MB10 0AX0 Manual Edition 1 1 A References MODBUS MODBUS APPLICATION PROTOCOL SPECIFICATION organization V1 1b3 April 26 2012 http www modbus org SIMATIC Modbus TCP Redundant Communication of PN H Systems 6AV6676 6MB10 0AX0 Manual Edition 1 1 Customer Support Siemens AG Industry Sector Industry Automation Division Industrial Automation Systems Factory Automation
6. AS FA Phone 49 0 911 895 7 222 Customer Support http www siemens com s7modbus Siemens Aktiengesellschaft Subject to change without notice SIMATIC Modbus TCP Redundant Communication of PN H Systems 6AV6676 6MB10 0AX0 Manual Edition 1 1 release 08 2014
7. For additional information see the section Diagnostic messages with alarm bits Output RedErrDev TRUE indicates a redundancy error at the communication partner With single sided redundancy this means that the connection from node A to CPUO or CPU1 has failed With double sided redundancy it means that both connections to node A or both connections to node B of the communication partner have failed For additional information see the section Diagnostic messages with alarm bits The TotComErr output value TRUE indicates a complete loss of communication i e all configured connections have been disrupted For additional information see the section Diagnostic messages with alarm bits If an error has occurred in manual initialization this is indicated with Init Error TRUE The Init Status output displays the error number when Init Error is set The error numbers are described in section Diagnostics SIMATIC Modbus TCP Redundant Communication of PN H Systems 8 9 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHSV function block Modbus server 8 3 Example of address mapping Interpretation of Modbus addresses Example Data area parameter assignment SIMATIC Modbus TCP Redundant Communication of PN H Systems 6AV6676 6MB10 0AX0 Manual Edition 1 1 The MODBUS data model is based on a range of memory areas with varying characteristics Some systems such as MODICON PLCs distinguish between these memory are
8. Request Connection interrupted I O at modbus block RECV_TIMEOUT DONE FALSE ERROR TRUE STATUS 0 Error STATUS_1A Error ENQ TRUE DONE FALSE ERROR TRUE STATUS 0A AOFF STATUS_1A AOFF Connection 1A Teuse conn is recovered time elapses Connection 1A is internally set me available DONE FALSE ERROR FALSE STATUS 0A Error STATUS 1A 0 Connection 1A is used ENQ TRUE Request 5 F 5 Response m DONE TRUE ERROR FALSE STATUS 0A 0 STATUS 1A 0 SIMATIC Modbus TCP Redundant Communication of PN H Systems 6AV6676 6MB10 0AX0 Manual Edition 1 1 7 7 MB_PNHCL function block Modbus client nme m WORD Connection ID for CPUO to communication 1 to 4095 mn partner node A in accordance with W 16 1 to configuration in the parameter DB W 16 FFF configuration in the parameter DB W 16 FFF Connection ID for CPUO to communication 1 to 4095 partner node B in accordance with WiH 61H to 7 2 Parameters of the function block MB PNHCL configuration in the parameter DB W 16 FFF reuse conn IN Yes time use all Yes conn RECV TIME TIME Monitoring time for data receipt at least 20ms T 20ms to No OUT T 24d20h31 m23s CONN_TIME TIME Monitoring time for connection establishment T 100ms to Connection ID for CPU1 to communication 1 to 4095 partner node B in accordance with W 16 1 to configuration in the parameter DB W 16 F
9. Address mapping MB_PNHSV function block Modbus server In this example DB11 is 1002 bytes a total of 500 registers are mapped register 0 register 499 2 reserved bytes DB12 is 364 bytes a total of 181 registers are mapped register 720 register 900 2 reserved bytes DB13 is 564 bytes a total of 281 input registers are mapped register 720 register 1000 2 reserved bytes DB14 is 80 bytes a total of 611 coils bits are mapped coil 640 coil 1250 2 reserved bytes DB15 is 78 bytes a total of 601 inputs bits are mapped input 1700 input 2300 2 reserved bytes DB16 is 78 bytes a total of 601 coils bits are mapped coil 1700 coil 2300 2 reserved bytes The figure below shows the Simatic memory areas and the register and bit based definition of memory in the Modbus devices The figure is based on the parameter assignment above In the Modbus device The Modbus addresses shown in black relate to the data link layer and the addresses shown in gray to the application layer In SIMATIC The SIMATIC addresses in the first column are the offset in the DB The Modbus register numbers are in the square brackets SIMATIC Modbus TCP Redundant Communication of PN H Systems 8 11 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHSV function block Modbus server SIMATIC Modbus device 4 LAD STL FBD DB14 Coils Area F File Edit Insert PLC Debug View Opt Dc
10. Connection e CPU1 connection to partner node A gt Connection 1A e CPUO connection to partner node B gt Connection 0B e CPU1 connection to partner node B gt Connection 1B The figure below illustrates the connection names S7 station Switch Communication partner SIMATIC Modbus TCP Redundant Communication of PN H Systems 6 5 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHCL function block Modbus client 7 PNHCL function block Modbus client 7 1 How the MB PNHCL FB works General information FB tasks The CPU is the client if the S7 initiates reading data from or writing data to the remote partner The FBs MB PNHCL MOD and TCP COMM are required for client operation Multiple instances of the MB PNHCL block can be called in the program There is no limitation of the maximum number of parallel called Modbus blocks on the part of the library However the CPU may have a limit on the number of connections that can be established simultaneously In the CPU manual it is detailed how many connections can be processed simultaneously If there are multiple instances of PNHCL you must make sure that each block instance has allocated its own parameter data block and that the connection IDs are unique across the CPU The MB PNHCL function block performs the following tasks e Coordinating the connection s via which the telegrams are sent e Managing Transaction Identifiers TI e License check
11. connections Standard FBs for data transfer The MB PNHCL function block saves its data in an instance DB This instance DB is generated by STEP 7 the first time the FB is called The instance data block contains parameters of the type input and output type as well as static variables required for its execution These variables are remanent and remain valid between FB calls The variables control the internal process of the FB Memory requirement of the instance DB Instance DB MB PNHCL Work memory Load memory approx 3 KB approx 5 KB A maximum total of 186 bytes of local data is required for an MB PNHCL FB call The connection specific and Modbus specific parameters are saved in the MODBUS HPARAM PN parameter DB The function block does not use any timers The function block does not use any flags TCP COMM FB called in the MB PNHCL MOD CLI FB uses the TCON and TDISCON blocks from the standard library to establish and terminate connections between the CPU and the communication partner TCP COMM FB called in the MB PNHCL MOD FB uses the TSEND and TRCV blocks from the standard library for data transfer between the CPU and the communication partner MB PNHCL The MB PNHCL FB uses the following SFCs from the standard library SFCs for other SFC6 RD SINFO functions e SFC20 BLKMOV e SFC24 TEST DP e SFC51 RDSYSST e SFC52 WR USMSG SIMATIC Modbus TCP Redundant Communica
12. 1 1 Application example 12 Application example General information Simatic stations in the example project Program example During installation two example projects are stored in Program Files Siemens Step7 Examples e Sample project in STL TCP PN RED 400 and e Sample project in CFC MB PN RED The example projects contain Simatic stations for all function variants e The S7 station is the client or server e Single sided or double sided redundancy The S7 program is provided for information only and should not be considered as a recommended solution for customer specific plant configurations The example project contains the following Simatic stations Single Block station name aed H Double sided client H Double sided server H Single sided client H Single sided server The program examples consist of the following blocks e Startup block OB100 with call of FB915 or FB917 e Programming error OB121 e Cyclic operation OB1 or OB35 with call of FB915 or FB917 e Global data blocks for triggering jobs e g with a variable table and for licensing e Data blocks for register and bit values SIMATIC Modbus TCP Redundant Communication of PN H Systems 12 1 6AV6676 6MB10 0AX0 Manual Edition 1 1 Application example 12 4 Sample project in STL Modbus client Overview Blocks used MB TCP PN RED 400 Component view C Program Fes
13. 2 Assigning a CPU IP address 3 2 3 3 Inserting the function blocks into the 3 4 3 4 Multiple connections to port 502 a 3 6 4 Assigning Modbus communication parameters 4 1 4 1 Parameter assignment with the wizard 4 3 4 2 Manual parameter assignment u nnns 4 4 5 u aos a EAE EA a A E iu e eese 5 1 6 Reg ndanoy u iat a aps u aqa 6 1 6 1 Configuration of redundant communication 6 1 6 2 Single sided redundancoy a nnns 6 3 6 3 Double sided redundanoy u uu 6 5 7 MB PNHCL function block Modbus client 7 1 7 1 How the MB PNHCL FB works 7 1 7 2 Parameters of the function block MB PNHLCOL 7 8 7 3 Example of address mapping u uu 7 16 7 4 Data and standard functions used by the 7 19 7 5 Renaming rewiring functions and function blocks 7 21 8 MB_PNHSV function block Modbus server
14. LINGE IIT s MODBUS HPARAM P Parameter DB for FB MB_PNHCL 13 iputregsterarea Vale OB Dis SIMATIC Modbus TCP Redundant Communication of PN H Systems 12 2 6AV6676 6MB10 0AX0 Manual Edition 1 1 Application example 12 2 Sample project in STL Modbus server Overview Blocks used H Double sided Client 2 System data a SDB H Double sided Server iz 081 CYCL EXC STL Organization Block El 4145 0872 RED_FLT STL Organization Block ag 57 ud 08100 COMPLETE RESTART STL Organization Block a gem 08121 PROG_ERR STL Organization Block CPU 414 5 H g FB53 TSEND STL Function Block H Single sided Client g FBB4 TRCV STL Function Block Single sided Server g FB65 TCON STL Function Block g TDISCON STL Function Block 5178913 _ SCL Function Block 5178916 MOD_SERY SCL Function Block g FB917 MB PNHSV SCL Function Block DB1 CONTROL DAT DB Data Block ick 063 License DB DB Data Block i 064 MODBUS_HPARAM DB Data Block D811 Holding Register Area Data Block DB12 Holding Register Area 2 DB Data Block ick 0613 Input Register Area DB Data Block iz DB14 Coils Area DB Data Block i 0615 Inputs Area DB Data Block i DBIE Coils Area 2 DB Data Block ick D8917 IDB_MODBUS DB Instance data block v Server Job Server Job Variable T able g SFB4 TON STL System function bloc 4 ABE 2 These block n
15. REG 18 15 0 6_19 l IODBUS HPARAM db 2 DB2 db 3 V wopsus 7 DB2 db 7 You will find the supplementary blocks and a detailed description here www siemens com s7modbus or from Customer Support SIMATIC Modbus TCP Redundant Communication of PN H Systems 9 1 6AV6676 6MB10 0AX0 Manual Edition 1 1 Additional blocks 9 2 Job list for cyclic telegrams General information Application example The Job_List block allows you to configure a list of jobs to be processed cyclically 2 Job List You will find the additional block and a detailed description here www siemens com s7modbus or from Customer Support SIMATIC Modbus TCP Redundant Communication of PN H Systems 6AV6676 6MB10 0AX0 Manual Edition 1 1 Use in a single PN CPU 10 Usein a single PN CPU General information Modules suitable for MB PNHCL and MB PNHSV Modbus blocks for The Modbus TCP PN CPU Redundant package can also be operated in an S7 PN Single CPU 57 400 57 300 ET200S The description of the functions and parameters in the sections above and below also apply to application in a single PN CPU You must use CPUs that can provide sufficient local data for each priority class gt Section 7 4 and Section 8 4 You also need to check the CPU specific limits such as the maximu
16. Reference data Display Set the address priority to Absolute value in the object properties of the block folder In SIMATIC Manager select the block folder and open the Options Rewire function to rewire the addresses to free areas To continue using the symbols in diagnostic tools apply the changes to the symbol table The modifications can be verified by Options References data Display SIMATIC Modbus TCP Redundant Communication of PN H Systems 8 14 6AV6676 6MB10 0AX0 Manual Edition 1 1 Additional blocks 9 Additional blocks 9 1 Support in CFC General To facilitate configuration in CFC there is the option of configuring the information Modbus values using DataCollector FBs instead of global FBs The send and receive buffers are shifted to the CFC chart using drag amp drop Application The DataCollector FBs are placed in the CFC chart The IDB output is example connected to DB parameters db 1 to db 8 in the parameter data block The Modbus values can then subsequently be connected straight from the channel blocks to the DataCollector FB 2 IN V is o Rze o 15 0 REG 1 MfoDBUS_MPARAM db 1 DB2 db 1 16 0 2 15 0 3 15 0 REG 4 1 6 0 REG 5 15 0 REG 6 l15 0 REG 7 15 0 REG 15 0 9 16 0 6 10 l15 0 REG 11 15 0 RE6 12 15 0 REG 13 15 0 14 15 0 REG 15 l15 0 REG 15 16 0 REG_17 15 0
17. S7 station Switch Communication partner SIMATIC Modbus TCP Redundant Communication of PN H Systems 6 1 6AV6676 6MB10 0AX0 Manual Edition 1 1 Redundancy Double sided redundancy S7 station Switch Communication partner Port number for The Modbus client uses a port number of 2000 or higher client and server The Modbus server is usually addressed with port number 502 Depending on the CPU it may be possible to configure port 502 for multiple connections multiport If local port 502 has been configured for two or more connections the requesting clients are randomly assigned to the available server connections The first client that tries to connect to the MB_PNHSV block is not automatically assigned connection 0A Once the client requests have been assigned to the server connections this assignment remains in place for the duration of telegram traffic until the connection is terminated SIMATIC Modbus TCP Redundant Communication of PN H Systems 6 2 6AV6676 6MB10 0AX0 Manual Edition 1 1 Redundancy 6 2 Single sided redundancy General information Configuration One connection must be configured in the parameter data block for each connection between the communication partners The connection points of the S7 are labeled 0 and 1 and the connection points of the communication partner A and B If the S7 is set up as redundant one connection is created for CPUO to node A of the communication partner an
18. Section 3 1 Assign MODBUS_HPARAM_PN parameter DB parameters in accordance with requirements client server connection establishment upon restart Modbus registers DB areas etc gt Section 4 For Modbus client Call and configure Modbus block MB_PNHCL in the necessary OBs gt Sections 7 1 and 7 2 or For Modbus server Call and configure Modbus block MB_PNHSV in the necessary OBs gt Sections 8 1 and 8 2 Load the user program to the CPU and license the Modbus block for the CPU gt Section 5 SIMATIC Modbus TCP Redundant Communication of PN H Systems 2 1 6AV6676 6MB10 0AX0 Manual Edition 1 1 Commissioning 3 Commissioning General information Requirements The information below on STEP 7 and configuring communication connections relates to STEP 7 Version 5 5 SP2 HF1 Procedures names and directory information can differ in later versions Basic knowledge of STEP 7 knowledge of STL basic knowledge of PLC 3 1 Installing the library in the STEP7 PG PC Product package Requirements The enclosed CD contains a setup program for installing the Modbus PN CPU Red library the example projects and the German and English manuals in the corresponding STEP 7 directories The CD also contains the manuals in PDF format Before installation STEP7 V5 5 configuration software must first have been installed Installation Insert the Modbus CD into the CD ROM drive of your programming device PC If the setup progra
19. blocks These parameters enable the TCON and TDISCON functions to establish and terminate a connection See section 4 2 for details You must comply with the data structure of the connection parameter block or no connection will be established The data required for the mode and address reference such as the Modbus areas mapped in the data blocks and the S7 mode Modbus server or Modbus client is stored in the Modbus parameters You must comply with the data structure of the Modbus parameters or error free processing will not be possible There are two possible ways to configure the connection and Modbus options parameters You can enter the information using a wizard for quick and easy configuration Alternatively you can set the parameters by editing the structure in the parameter data block These two options are detailed in sections 4 1 and 4 2 below No further parameters must be saved in the parameter datablock SIMATIC Modbus TCP Redundant Communication of PN H Systems 4 2 6AV6676 6MB10 0AX0 Manual Edition 1 1 Assigning MODBUS communication parameters 4 1 Parameter assignment with the wizard General The Modbus TCP PN Red Wizard offers a simple and easy way to information configure the connections and the Modbus parameters in the MODBUS HPARAM PN parameter data block This method creates the complete data block connection parameters and Modbus parameters We recommend using the wizard for MODBUS HPARAM PN parameter a
20. c P initia _ 1 1 soon rares UM it LAD STL FBD DB16 Coils Area 2 Eile Edit Insert PLC Debug View Optic Dz oc address Name Coils from 00001 ii LAD STL FBD DB15 Inputs Area MO File Edit Insert PLC Debug View Options Da amp S Selo 6 name 0o 0 1nputsti7001 4peer 4555 11701 Input register ae from 30001 i LAD STL FBD DB13 Input Register G File Edit Insert PLC Debug View Opt D s5m occ 0 0 imput Registeri720 lt Input Register 721 560 0 Input Register l1000 WORD 562 0 reserved WORD Holding register H8SLAD STL FBD DB11 Holding Registd from 40001 F File Edit Insert PLC Debug View Opt Du E lt ns a Holding_Register 0 WORD Holding_Register 1 WORD BX gamma 998 0 Holding Register 499 WORD ick File Edit Insert PLC Debug View Opti Dig as cm oc ee ee ces 0 0 Helding Register 72014MORD z 0 Helding Register 7211 woRD o oo 360 0 Helding Register 90014 SIMATIC Modbus TCP Redundant Communication of PN Systems 8 12 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHSV function block Modbus server 8 4 Data and standard functions used by the FB Instance DB Local variables Parameter DB Timers Flags Standa
21. length error when reading 3 07 55 08 438 AM 09 16 2013 Event ID 168 A090 4 07 55 08 438 09 16 2013 Area length error when reading 5 07 54 08 411 AM 09 16 2013 Event ID 16 090 6 07 54 08 411 09 16 2013 Area length error when reading ti 07 53 08 383 AM 09 16 2013 Event ID 16 4090 8 07 53 08 383 09 16 2013 Area length error when reading Details Event 1 of 79 EventID 158 A080 No entry in text database Hexadecimal values will be displayed Event ID 16 4090 OB 16 01 PK 16 01 DatlD 1 2 168 50 CO Additional infol 2 3 158 4D4F 4442 5553 Save As Settings Close Update Print Open Block Warning The CPU will turn to STOP mode if the OB121 is not available If no or the wrong activation code is entered Modbus communication will be processed but W 16 A090 No valid license will always be displayed at the STATUS x outputs SIMATIC Modbus TCP Redundant Communication of PN H Systems 5 4 6AV6676 6MB10 0AX0 Manual Edition 1 1 Redundancy 6 Redundancy 6 1 Configuration of redundant communication General The following pages provide an overview of the various options for configuring information redundancy The communication stations can be standalone or redundant If one of the two stations is standalone the term single sided redundancy is used If both partners are redundant this is known as double sided redundancy Single sided redundancy
22. run simultaneously However the CPU may have a limit on the number of connections that can be established simultaneously The CPU manuals set out how many connections can be established simultaneously If there are multiple instances of MB PNHSV you must make sure that each block instance has allocated its own parameter data block and that the connection IDs are unique across the CPU The MB PNHSY block calls the MOD SERV block internally multiple times and implements licensing and coordinates MOD SERV calls of the various connections The MOD SERV block performs the following tasks e Generating MODBUS specific telegram headers during sending e Checking the MODBUS specific telegram headers upon receipt e Checking whether the data areas addressed by the client exist e Data transfer from to the DB configured e Generating exception telegrams when errors occur Exception Meaning code 1 The function code sent is not supported 2 Access to a non existent or invalid address 3 Invalid length entered for this function code SIMATIC Modbus TCP Redundant Communication of PN H Systems 8 1 6AV6676 6MB10 0AX0 Manual Edition 1 1 Online help FB call FB startup Cyclic operation of the FB MB PNHSV function block Modbus server The MOD CLI block calls the TCP COMM block internally multiple times TCP COMM performs the following tasks e Handling connections and data using the T blocks in the stand
23. 121 must be available in the CPU Please note In S7 H stations only the CPU in rack 0 is licensed The CPU in rack 0 therefore cannot be changed after licensing Reading out the IDENT CODE Proceed as follows to read out the IDENT CODE 1 Assign the parameters for block PNHCL PNHSV in accordance with your requirements in a cyclic OB OB1 or cyclic interrupt OB and in OB100 Load the program to the CPU and switch the CPU to RUN 2 Open the project in online mode in SIMATIC Manager In this online project open the instance DB of the Modbus block e SIMATIC Manager MB_TCP_PN_RED_400 File Edit Insert PLC View Options Wi D eh a X Ell H Double sided tier Ed 414 15 i 57 EZ Datablock Edit PLC Debug Window Help E ceu 414 H Double sid Declar Initial valu Actual value H Single side 16 W 16 0 16 0 Single side 17 n WRITE READ BOOL FALSE FALSE 18 0 UNIT BYTE B 16 0 16 0 19 D out LICENSED BOOL FALSE FALSE 20 1 out BUSY BOOL FALSE FALSE 2 2 out DONE BOOL FALSE FALSE 22 3 out ERROR BOOL FALSE FALSE 23 4 out ESTAB D BOOL FALSE FALSE 24 D out STATUS DA WORD 16 0 W 16 A0FF 25 D out ESTAB_1A BOOL FALSE FALSE 26 out STATUS_1A WORD 16 0 W 16 FFFF 27 0 out ESTAB_OB BOOL FALSE FALS
24. 6 0 Not used db 8 0 0 start 8 0 0 end 8 0 0 7 16 Address mapping MB_PNHCL function block Modbus client In this example DB11 is 1002 bytes a total of 500 registers are mapped register 0 register 499 2 reserved bytes DB12 is 364 bytes a total of 181 registers are mapped register 720 register 900 2 reserved bytes DB13 is 564 bytes a total of 281 input registers are mapped register 720 register 1000 2 reserved bytes DB14 is 80 bytes a total of 611 coils bits are mapped coil 640 coil 1250 2 reserved bytes DB15 is 78 bytes a total of 601 inputs bits are mapped input 1700 input 2300 2 reserved bytes DB16 is 78 bytes a total of 601 coils bits are mapped coil 1700 coil 2300 2 reserved bytes The figure below shows the Simatic memory areas and the register and bit based definition of memory in the Modbus devices The figure is based on the parameter assignment above In the Modbus device The Modbus addresses shown in black relate to the data link layer and the addresses shown in gray to the application layer In SIMATIC The SIMATIC addresses in the first column are the offset in the DB The Modbus register numbers are in the square brackets SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 17 6AV6676 6MB10 0AX0 Manual Edition 1 1 SIMATIC 4 LAD STL FBD DB14 Coils Area i File Edit Insert PLC Debug View Opt Dg
25. DB I DB must be re initialized with a CPU STOP RUN Initialization can also be carried out using the Init parameter Runtime parameters can be changed during cyclic operation You should not change the input parameters while a job is in progress You should wait until one job has completed with DONE or ERROR before preparing for the next job and making the necessary parameter changes The output parameters are dynamic displays and are therefore only pending for 1 CPU cycle They must be copied to other memory areas for additional processing or for display in the variable table There may also be CPU specific restrictions on the value ranges for the various parameters SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 10 6AV6676 6MB10 0AX0 Manual Edition 1 1 id 0 a id id O b id 1 b db param reuse conn time use all conn MB PNHCL function block Modbus client A connection ID is required for each PN CPU connection to a communication partner A different connection ID must be used for each logical connection This connection ID is configured in the connection parameter block in the MODBUS HPARAM PN parameter data block The connection ID is a unique number for the connection from the CPU to the communication partner and can have a value between 1 and 4095 The connection ID from the connection parameter block is entered here and must be unique across the CPU a Connection from CPUO to communication partner n
26. E 28 D out STATUS 0B WORD 16 0 W 16 FFFF 29 0 out ESTAB_1B BOOL FALSE FALSE 30 D out STATUS 1B WORD W 1640 W 16 FFFF E D out IDENT CODE STRL CACAIMBDBHFEEDMAM J 32 D out Rederrs BOOL FALSE TRUE 33 1 RedErrDev BOOL FALSE TRUE 34 2 TotComErr BOOL FALSE TRUE 35 Bout Init Error BOOL FALSE FALSE 36 0 out Init Status WORD W 16 0 16 0 37 76 0 stat CONNECTION WORD W 16 0 W 16 1 SIMATIC Modbus TCP Redundant Communication of PN H Systems 6AV6676 6MB10 0AX0 Manual Edition 1 1 5 1 Licensing 3 18 character string is displayed at the IDENT CODE output Copy this string from the DB to the SOFTWARE REGISTRATION FORM using copy and paste This form is saved during installation at the library path Program Files Siemens Step7 S7LIBS Modbus PN CPU Red and is also available on the installation CD Enter the license no of the product packaging on the form is 17 Data block Edit PLC Debug Window Help o c 4 lt gt a dh or A Address Declar Name Type Initial valu Actual value 20 36 1 out BUSY BOOL FALSE FALSE 21 36 2 out DONE BOOL FALSE FALSE 22 36 3 out ERROR BOOL FALSE FALSE 23 36 4 out ESTAB DA BOOL FALSE FALSE 24 38 0 out STATUS D WORD W 16 0 W 16 ADFF 25 40 0 out ESTAB 14 BOOL FALSE FALSE 26 42 0 out STATUS 1A WORD W 16 0 W 16 FFFF 27 44 0
27. E enables manual initialization of the Modbus block Initialization can only be performed if there is no job in progress The client may not send a request during this time Please note with manual initialization that the initialization parameters need to be configured in the cyclic OB Warning Manual initialization terminates the configured connections If the ID parameters are changed the connections must be terminated manually with DISCONNECT TRUE and ENR FALSE before manual initialization The FB is activated by a positive level at the input Telegrams from the client can be received If the connection is not established and ENR is set ESTAB_x FALSE connection establishment is activated If ENR switches from TRUE to FALSE during normal operation the connection may be terminated This depends on the setting at the DISCONNECT parameter If the ENR input is not set and there is a connection in place the data received are rejected All configured connections are always monitored and incoming requests answered If this output is set to TRUE the Modbus block is licensed on this CPU If the output is FALSE no license string or the wrong license string has been entered For additional information see the section Licensing If this output is set a Modbus telegram is currently being processed ESTAB_x TRUE indicates that a connection to the communication partner is in place and that data can be transferred ES
28. FF Parameter DB contains all connection and Depends on Connection ID for CPU1 to communication 1 to 4095 Yes partner node A in accordance with W 16 1 to Modbus parameters for this Modbus block CPU instance Time after which it will attempt to re establish T 1s to the connection at least 1s T 24d20h31 BOOL g ss IN IN IN IN IN IN IN N OUT and termination at least 100ms T 24d20h31 m23s DISCON IN BOOL TRUE Connection termination after receipt of TRUE FALSE No NECT response telegram REG_KEY_ IN BLOCK_ Data block with registration key for licensing Depends on No DB DB CPU BOOL Manual initialization on rising edge TRUE FALSE BOOL Job trigger on rising edge TRUE FALSE DATA TYPE IN BYTE Data type to be processed No Coils 1 Inputs 2 Holding register 3 Input register 4 START IN WORD MODBUS start address 0 to 65535 ADDRESS W 16 0000 to W 1 6 FFFF SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 8 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHCL function block Modbus client incl el ro RR LENGTH IN WORD _ Number of values to be processed Coils Read function Write function Inputs Read function Holding register Read function Write function Input register Read function 1 to 2000 11 to 1968 1 to 2000 1 to 125 1 to 123 1 to 125 WRITE BOOL Write access TRUE READ Read access FALSE UNIT BYTE unit Identifier LICENSED OUT BOOL Licensing status o
29. For connection OB CONNECTION S the information block starts at address DBX 128 0 For connection 1B CONNECTION 4 the information block starts at address DBX 160 0 SIMATIC Modbus TCP Redundant Communication of PN H Systems 8 3 6AV6676 6MB10 0AXO0 Manual Edition 1 1 Connection processing Activate the FB Handling fora faulty connection MB_PNHSV function block Modbus server Passive connection establishment is done by the Modbus server The required data is read out of the connection parameters in the MODBUS HPARAM_PN DB A parameter in the connection parameter block active_est is used to define whether the PN CPU is to act as active or passive communication partner With both connection types active and passive the TCON function opens a communication channel to the communication partner during runtime The time of connection establishment is defined with a parameter in the DB MODBUS_HPARAM_PN connect_at_startup Connection termination is controlled with the DISCONNECT parameter at the MB_PNHSV FB A positive level at the ENR trigger input prepares the FB to receive a request telegram from the client The server is passive When ENR TRUE all configured connections are active and ready to receive The system does not switch between connections The client can send either via one connection only or via all connections The telegrams received are checked If the result is positive the response telegram is gene
30. IC STEP 7 Manager To rewire blocks from the Modbus library proceed in this order 1 2 FB915 MB_PNHCL FB914 MOD_CLI FB913 TCP_COMM FB63 TSEND FB64 TRCV FB65 TCON FB66 TDISCON You do not need to rewire all functions or all function blocks However you must work in this order even if you are only rewiring some of them Rewiring Proceed as follows to rewire FBs 1 Information on the addresses used is found under Options Reference data Display Set the address priority to Absolute value in the object properties of the block folder In SIMATIC Manager select the block folder and open the Options gt Rewire function to rewire the addresses to free areas To continue using the symbols in diagnostic tools apply the changes to the symbol table The modifications can be verified by clicking Options References data Display SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 21 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHSV function block Modbus server 8 MB _PNHSV function block Modbus server 8 1 How the MB_PNHSV FB works General information FB tasks The S7 is the server if the remote partner initiates reading data from or writing data to the S7 The FBs MB PNHSV MOD SERV TCP COMM are required for server functionality Multiple instances of the MB PNHSV block can be called in the program The library has no limit to the number of Modbus blocks that can
31. IN Connection ID for CPU1 to communication 1 to 4095 partner node B in accordance with W 16 1 to configuration in the parameter DB W 16 FFF N N N Parameter _ Parameter DB contains all connection and Depends on Yes DB Modbus parameters for this Modbus block CPU instance RECV_TIME Monitoring time for data receipt at least 20ms T 20ms to OUT T 24d20h31 m23s CONN TIME I TIME Monitoring time for connection establishment T 100ms to OUT and termination at least 100ms T 24d20h31 m23s DISCON IN BOOL TRUE Connection termination when ENR TRUE FALSE N NECT FALSE REG_KEY_ BLOCK_ Data block with registration key for licensing N DB CPU Init BOOL Manual initialization on rising edge TRUE FALSE ENR BOOL Ready to receive with positive level TRUE FALSE LICENSED OUT BOOL Licensing status of the Modbus block Block is licensed TRUE Block is not licensed FALSE BUSY OUT BOOL Processing status of a Modbus telegram In progress Not in progress TRUE FALSE NDR 0A OUT BOOL TRUE Client request has been executed and TRUE FALSE answered on connection 0A i E z HE E o ERROR 0A BOOL TRUE An error has occurred on connection TRUE FALS OA STATUS 0A WORD Status of connection 0A 0 to FFFF NDR 1A OUT BOOL TRUE Client request has been executed and TRUE FALSE answered on connection 1A ERROR 1A BOOL TRUE An error has occurred on connection TRUE FALSE N 1A SIMATIC Modbu
32. ISCON Value range W 16 1 to W 16 FFF SIMATIC Modbus TCP Redundant Communication of PN H Systems 6AV6676 6MB10 0AX0 Manual Edition 1 1 connection_type active_est local_device_id local_tsap_id_len rem_subnet_id_ len rem_staddr_len rem_tsap_id_len next_staddr_len Assigning MODBUS communication parameters This is where you specify the connection type for connection establishment by the TCON function The value to set depends on the CPU TCP compatibility mode B 16 01 for CPU 315 or 317 lt FW V2 3 TCP B 16 11 for CPU 315 or 317 gt FW V2 4 IM 151 8 PN DP CPU CPU314C CPU319 CPU412 H CPU414 H CPU416 H CPU417 H These specifications data may vary depending on the firmware used For additional information refer to http support automation siemens com WW view en 24294554 This parameter specifies the type of connection establishment active or passive Active connection establishment is done by the Modbus client and passive connection establishment by the Modbus server Active connection establishment TRUE Passive connection establishment FALSE The local_device_id defines the IE interface of the PN CPU used Different settings are required depending on the PN CPU type IM 151 8 PN DP CPU 16 1 CPU 314C 315 or 317 BHI 6 2 CPU 319 16 3 CPU 412 414 H 416 417 H 16 5 CPU in rack 1 of the station 16 15 In H stations The S7400 PN CPU in rack 0 communi
33. ROR bit is not set and request the registration key Modbus communication will also run without a license A091 With PNHCL only An exception telegram with The communication partner does exception code 1 was received in response not support the requested function A092 With MB PNHCL only An exception telegram with Correct the LENGTH or exception code 2 was received in response START ADDRESS for the FB Access to a non existent invalid address at the call communication partner 093 With MB PNHCL only An exception telegram with The communication partner exception code 3 was received in response cannot process the telegram received for example it does not support the requested length A094 With MB PNHCL only An exception telegram with The communication partner exception code 4 was received in response cannot process the telegram received in its current status A095 With MB PNHCL only An exception telegram with Check the communication partner unknown exception code was received in response error messages and if necessary verify the data of the communication partner with the help of a telegram trace AOFF The connection is not currently established This is Check the connections Correct status information the value at reuse conn time if necessary A100 The CONN TIMEOUT or RECV TIMEOUT monitoring Check the parameter assignment time for a job has expired of the connection The connection is terminated when
34. RV FB uses the following SFCs from the standard library SFCs for other SFC20 BLKMOV functions e SFC24 TEST DP TCP COMM The TCP COMM FB uses the following SFB from the standard library as well SFCs for other as the T blocks functions e SFB4 TON SIMATIC Modbus TCP Redundant Communication of PN H Systems 8 13 6AV6676 6MB10 0AXO0 Manual Edition 1 1 MB_PNHSV function block Modbus server 8 5 Renaming rewiring functions and function blocks Motive If the numbers of the standard functions are already being used in your project or the number range is reserved for other applications e g in CFC you can rewire the internally called FB63 FB64 FB65 and FB66 function blocks of the TCP_COMM FB or the MB_PNHSV MOD_SERV and TCP_COMM blocks The system functions SFC6 SFC20 SFC24 SFC51 and SFC52 and the system function block SFB4 cannot be renamed rewired Reaction A set of rules concerning the function block numbering have to be considered when rewiring function blocks in SIMATIC STEP 7 Manager To rewire blocks from the Modbus library proceed in this order 1 2 FB917 MB_PNHSV FB916 MOD_SERV FB913 TCP_COMM FB63 TSEND FB64 TRCV FB65 TCON FB66 TDISCON You do not need to rewire all functions or all function blocks However you must work in this order even if you are only rewiring some of them Rewiring Proceed as follows to rewire FBs 1 Information on the addresses used is found under Options
35. SIEMENS SIMATIC SIMATIC Modbus TCP redundant communication via the integrated PN interface of H CPUs SIEMENS SIMATIC S7 SIMATIC Modbus TCP redundant communication via the integrated PN interface of H CPUs Manual Edition 1 1 Preface Table of Contents Product description Getting started Commissioning Parameter assignment Licensing Redundancy FB MB PNHCL FB MB PNHSV Additional blocks Use in a single PN CPU Diagnostics Application example Appendices References Glossary Cc O Q FF WO N ZI N OQ Safety instructions Qualified personnel Intended use This manual contains information which you must observe in order to ensure your own personal safety and avoid material damage This information is highlighted in the manual by a warning triangle and marked as follows according to the level of danger Danger indicates that death serious personal injury or substantial property damage will result if proper precautions are not taken Warning indicates that death serious personal injury or substantial property damage may result if proper precautions are not taken Caution indicates that minor personal injury or property damage may result if proper precautions are not taken Note draws your attention to particularly important information on the product or on handling the product or to a particular part of the documentation A device may only b
36. TAB_x FALSE indicates that there is no connection to the communication partner SIMATIC Modbus TCP Redundant Communication of PN H Systems 8 8 6AV6676 6MB10 0AX0 Manual Edition 1 1 NDR 0A NDR_1A 0B NDR 1B ERROR ERROR 1 ERROR 0B ERROR 1B STATUS STATUS 1A STATUS STATUS 1B IDENT CODE RedErrS7 RedErrDev TotComErr Init Error Init Status MB PNHSV function block Modbus server The output indicates that telegram traffic has completed without errors on this connection If this output is set errors have been detected on this connection during a request telegram from the client or during the sending of the response telegram The corresponding error number is displayed at the STATUS x output The STATUS x outputs show the error number when ERROR x is set and the status information for the corresponding connection when ERROR x is not set The error numbers and status information are described in section Diagnostics Following CPU startup this parameter displays an 18 digit identifier that is used to request the REG KEY activation code for Modbus communication For additional information see the section Licensing Output RedErrS7 TRUE indicates a redundancy error at the SIMATIC With single sided redundancy this means that the CPUO or CPU1 connection has failed With double sided redundancy it means that both CPUO connections or both CPU1 connections have failed
37. The MB_PNHCL block calls the MOD_CLI block internally multiple times The MOD CLI block performs the following tasks e Generating MODBUS specific telegram headers during sending e Checking the MODBUS specific telegram headers upon receipt e Checking whether the data areas addressed exist e Data transfer from to the DB configured The MOD block calls the TCP COMM block internally multiple times TCP COMM performs the following tasks e Handling connections and data using the T blocks of the standard library e Time monitoring of connection establishment and termination and data receipt SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 1 6AV6676 6MB10 0AX0 Manual Edition 1 1 Online help FB call FB startup Cyclic operation of the FB Programming error OB121 MB_PNHCL function block Modbus client Block online help is available for the MB_PNHCL function block in SIMATIC Manager Selecting the block and pressing the key F1 opens the online help with the most important information about the block The MB_PNHCL function block must be integrated into two OBs to ensure the program runs correctly e inthe startup OB100 and e in a cyclic OB OB1 or in a cyclic interrupt OB e g OB35 The same instance data block must be used The other FBs in the library MOD CLI and TCP COMM are called subordinately and must not also be called in an OB The MB PNHCL FB must not be called simultaneously in OB1 and in a c
38. a type 3 Correct the parameter overlap assignment The data areas must A024 The configured areas data type 2 and data type 4 not share registers overlap A025 The configured areas data type 2 and data type 5 overlap A026 The configured areas data type 2 and data type 6 overlap A027 The configured areas data type 2 and data type overlap A028 The configured areas data type 2 and data type8 overlap A034 The configured areas data type 3 and data type 4 overlap A035 The configured areas data type 3 and data type 5 overlap A036 The configured areas data type 3 and data type 6 overlap A037 configured areas data type and data type 7 overlap A045 The configured areas data type 4 and data type 5 overlap A046 The configured areas data type 4 and data type 6 overlap A047 The configured areas data type 4 and data type 7 overlap A048 The configured areas data type 4 and data type 8 overlap A056 The configured areas data type 5 and data type 6 overlap A057 The configured areas data type 5 data type 7 overlap A058 The configured areas data type 5 and data type 8 overlap SIMATIC Modbus TCP Redundant Communication of PN H Systems 11 5 6AV6676 6MB10 0AX0 Manual Edition 1 1 A038 configured areas data type and data type 8 overlap Diagnostics Error messages for the MB_PNHCL and MB_PNHSV FBs STATUS Remedy Hex A067 The configured areas data type 6 and data ty
39. ace PN IO RO S3 5 General Parameters Gateway IP address 192 168 0 1 Ip Do not use router Subnet mask 255 255 255 0 C Use router Address Subnet not networked New Properties Delete Cancel Help 3 Enter the IP address and the subnet mask If you are establishing a connection via a router you must also enter the address of the router SIMATIC Modbus TCP Redundant Communication of PN H Systems 3 2 6AV6676 6MB10 0AX0 Manual Edition 1 1 Commissioning 4 Click the New button and assign a name for a new Industrial Ethernet subnet Confirm with OK Result You have now created a new Industrial Ethernet subnet 5 Click the OK button Result The properties dialog box of the CPU 414 5H PN DP PN IO interface closes 6 Insert a CPU 414 5H PN DP into the second rack as well This CPU will automatically be assigned the next consecutive IP address SIMATIC Modbus TCP Redundant Communication of PN H Systems 3 3 6AV6676 6MB10 0AX0 Manual Edition 1 1 Commissioning 3 3 Inserting the function blocks into the program Modbus library The Modbus library contains the S7 Client and S7 Server folders with the content FBs for redundant communication S7 client The S7 Client folder includes the blocks e FB915 MB PNHCL e FB914 MOD and e FB913 TCP COMM All 3 blocks are always needed for redundant communication The MB PNHCL bloc
40. and 4095 The connection ID from the connection parameter block is entered here and must be unique across the CPU a Connection from CPUO to communication partner node A a Connection from CPU1 to communication partner node A b Connection from CPUO to communication partner node B b Connection from CPU1 to communication partner node B Connection 0A is the default connection and must be configured If the communication partner is set up as standalone you only need parameters id O a and id 1 a If the S7 is set up as standalone you only need parameters id O a id O b If both communication partners are set up as redundant all 4 connections are configured The parameter db param is the number of data block MODBUS HPARAM PN This parameter data block contains the connection specific and Modbus specific parameters required for communication between the PN CPU and the communication partner The value range for this parameter depends on the CPU 0 cannot be used as a DB number because it is reserved for the system The DB number is input in plain text in the following format Each Modbus block instance requires its own parameter data block The monitoring time TIMEOUT monitors the receipt of the response from the communication partner The minimum value is 20ms We recommend a monitoring time of approx 1 5 seconds If TIMEOUT is set to lt 20ms a default value of 1 2 s is used An error is reported
41. ard library e Time monitoring of connection establishment and termination and data receipt Block online help is available for the MB PNHSV function block in SIMATIC Manager Selecting the block and pressing F1 opens the online help with the most important information about the block The MB PNHSY function block must be integrated into two OBs to ensure the program runs correctly e inthe startup OB100 and e inacyclic OB OB1 or in a cyclic interrupt OB e g OB35 The same instance data block must be used The other FBs in the library MOD SERV and TCP COMM are called subordinately and must not also be called in an OB The MB PNHSV FB must not be called simultaneously in OB1 and in a cyclic interrupt OB e g OB35 There must be an OB121 in the CPU Additional information on this can be found in the section Licensing The MB PNHSY function block is called unconditionally once in OB100 e The initialization parameters must be assigned in line according to the station configuration e initialization parameters are applied to the instance DB e The runtime parameters are not evaluated during startup e The data from MODBUS HPARAM PN is checked for plausibility In cyclic operation the MB PNHSV FB is called in OB35 for example e block functions are activated on the basis of the runtime parameters e fajobis running changes to the runtime parameters not evaluated e initialization param
42. as using the register or bit address For example the holding register is defined as register 40001 with offset 0 memory type 4xxxx reference 0001 This issue is often a source of confusion as some manuals describe and refer to the register address of the application layer and others use the register or bit address actually transferred in the protocol For its start_x end_x and START_ADDRESS parameters the MODBUS FB uses the Modbus address actually transferred Each function code can therefore transfer register bit addresses of 0000 to data_type_1 16 3 Holding register db 1 W 16 B DB 11 start_1 W 16 0 Start address 0 end_1 W 16 1F3 End address 499 data_type_2 16 3 Holding register db_2 W 16 C DB 12 start _2 W 16 2D0 Start address 720 end 2 W 16 384 End address 900 data_type_3 16 4 Input register db 3 W 16 D DB 13 start _3 W 16 2D0 Start address 720 end 3 W 16 3E8 End address 1000 data_type_4 B 16 0 Not used db 4 0 0 start 4 0 0 end 4 0 0 data_type_5 BHI 6 1 Coils db 5 W 16 E DB 14 start_5 W 16 280 Start address 640 end_5 W 16 4E2 End address 1250 data_type_6 16 2 Inputs db_6 W 16 F DB 15 start_6 W 16 6A4 Start address 1700 end 6 W 16 8FC End address 2300 data_type_7 16 1 Coils db 7 W 16 10 DB 16 start 7 W 16 6A4 Start address 1700 end 7 W 16 8FC End address 2300 data type 8 16 0 Not used db 8 0 0 start 8 0 0 end 8 0 0 8 10
43. byte of port no in hex display local tsap id 2 low byte of the port no in hex display local tsap id 3 16 B 16 00 rem_subnet_id This parameter is not used currently and must be assigned 0 rem_staddr This byte array is where the IP address of the remote communication partner is entered No IP address is entered for unspecified connections The representation depends on the parameter connection_type Example IP address 192 168 0 1 For connection type 16 01 rem staddr 1 B 16 01 1 1 rem staddr 2 B 16 00 0 rem staddr 3 B 16 A8 168 rem staddr 4 16 0 192 rem staddr 5 6 B 16 00 reserved Forconnection type 16 11 rem_staddr 1 16 0 192 rem_staddr 2 B 16 A8 168 rem_staddr 3 B 16 00 0 rem staddr 4 B 16 01 1 rem staddr 5 6 B 16 00 reserved rem_tsap_id This parameter is used to set the remote port number The type of representation depends on the parameter connection_type The value range depends on the CPU For connection type 16 01 local_tsap_id 1 low byte of port no in hex display local_tsap_id 2 high byte of port no in hex display local tsap id 3 16 B 16 00 For connection type 16 11 local tsap id 1 high byte of port no in hex display local tsap id 2 low byte of port no in hex display local tsap id 3 16 B 16 00 next_staddr This parameter defines the rack and slot number of the CP used If the CPU s integrated PN interface is being used
44. cates via local device id 5 and the CPU in rack 1 communicates via local device id 15pex The length of the local tsap id parameter local port number is specified here Active connection establishment 0 Passive connection establishment 2 This parameter is not used currently and must be assigned B 16 0 The length of the rem staddr parameter i e the IP address of the communication partner is specified here No IP address for the partner is specified if communication is to take place with an unspecified connection Unspecified connection 16 0 Specified connection 16 4 This parameter defines the length of the rem_tsap_id parameter the port number of the remote communication partner Active connection establishment 2 Passive connection establishment 0 The length of the next_staddr parameter is specified here For PN interfaces B 16 0 SIMATIC Modbus TCP Redundant Communication of PN H Systems 4 5 6AV6676 6MB10 0AX0 Manual Edition 1 1 Assigning MODBUS communication parameters local_tsap_id This parameter is used to set the local port number The representation depends on the parameter connection_type The value range depends on the CPU The port number must be unique within the CPU For connection type 16 01 local tsap id 1 low byte of port no in hex display local id 2 high byte of port no in hex display local tsap id 3 16 B 16 00 For connection type 16 11 local tsap id 1 high
45. cording With MB PNHSV Change the With MB PNHSV Invalid function code received The client request The Modbus FB S7 responds with an exception telegram processes function codes 1 2 3 4 5 6 15 and 16 AO0C The byte count received does not match the number of Verify the data of the registers communication partner with the The connection is terminated help of a telegram trace AO00D With MB PNHCL Register bit address or number of registers bits in the response telegram does not correspond to that in the request telegram AOOE Length in the Modbus specific telegram header does not correspond to the specified number of registers bits or specified byte count in the telegram The FB rejects the data The connection is terminated AOOF Protocol Identifier not equal to 0 received Verify the data ofthe M communication partner with the The connection is terminated help of a telegram trace A010 DB number assigned twice in parameters db 1 to Correct the parameter db 8 assignment in the MODBUS HPARAM PN DB A011 Invalid value given at the DATA TYPE input parameter Correct the call parameters valid values 1 4 A012 The configured areas data type 1 and data type 2 Correct the parameter overlap assignment The data areas must A013 The configured areas data type 1 and data type not share registers overlap A014 The configured areas data type 1 and data type 4 overlap A017 The configur
46. d at regular intervals and necessary corrections included in subsequent editions Suggestions Siemens AG for improvement are welcome Industry Sector This document is subject to technical changes without prior notice Industry Automation Division Industrial Automation Systems Factory Automation I lA AS FA DH FTH 6 P O Box 23 55 D 90713 F rth Germany Preface Purpose of this manual Contents of this manual Preface The information in this manual will enable you to set up and put in operation the connection between an H CPU with an integrated PN interface and a device supporting Modbus TCP protocol This manual details the function of the Modbus function block and its parameter assignment The manual covers the following e Product description e Getting started e Commissioning e Assigning Modbus communication parameters e Licensing e Function blocks e Additional blocks e Diagnostics e Application example Scope of the This manual applies to the following software manual Product Identification number From version Modbus TCP PN CPU redundant 6AV6676 6MB10 0AX0 Note This manual describes the FB version valid at the time the manual was issued SIMATIC Modbus TCP Redundant Communication of PN H Systems 1 6AV6676 6MB10 0AX0 Manual Edition 1 1 Additional information Questions Conventions Area of application Preface For all other information on PN H CPUS installation commissioni
47. d one connection for CPU1 to node B of the communication partner e CPUO connection to partner node A gt Connection e CPU1 connection to partner node A gt Connection 1A The figure below illustrates the connection names S7 station Switch Communication partner SIMATIC Modbus TCP Redundant Communication of PN H Systems 6 3 6AV6676 6MB10 0AX0 Manual Edition 1 1 Redundancy If the S7 is set up as standalone and the communication partner as redundant one connection is created from CPUO to node A of the communication partner and one connection from CPUO to node B of the communication partner e CPUO connection to partner node A gt Connection CPUO connection to partner node B gt Connection The figure below illustrates the connection names S7 station Switch Communication partner SIMATIC Modbus TCP Redundant Communication of PN H Systems 6 4 6AV6676 6MB10 0AX0 Manual Edition 1 1 Redundancy 6 3 Double sided redundancy General One connection must be configured in the parameter data block for each information connection between the communication partners The connection points of the S7 are labeled 0 and 1 and the connection points of the communication partner A and B Configuration With double sided redundancy two connections are created for CPUO to the communication partner and two connections for CPU1 to the communication partner e CPUO connection to partner node gt
48. ded Switch to the DB data view by selecting View gt Data view The menu command Edit gt Initialize data block applies all values from the Initial value column to the Actual value column 4 Inthe cyclic OB enter the data block number of the license DB at the REG KEY parameter of the Modbus block 5 Load the modified blocks to the CPU The activation code can be entered during runtime a STOP gt RUN transition is not necessary The block is now licensed for this CPU SIMATIC Modbus TCP Redundant Communication of PN H Systems 5 3 6AV6676 6MB10 0AX0 Manual Edition 1 1 Licensing No or incorrect If no activation code is entered or the activation code is wrong the INTF LED licensing of the H CPU flash once a minute and an entry is written cyclically to the diagnostics buffer indicating the lack of a license The error number for no license is W 16 A090 If you are using a single PN CPU the LED will flash every 4 seconds and an entry will be made in the diagnostics buffer 2515 Path PN RED 400 H Double sided Cli Operating mode of the CPU gt RUN Status OK Performance Data Communication Stacks H State Identification General Diagnostic Buffer Memory Scan Cycle Time Time System Events iler settings active Time including CPU time difference Time of d 1 07 56 08 467 09 3 EventID 16 4090 2 07 56 08 467 09 16 2013 Area
49. e commissioned and operated by qualified personnel Qualified personnel for the purposes of the safety instructions contained in this manual are persons who are authorized to commission ground and label devices systems and circuits in accordance with established safety practices and standards Please note the following Warning The device may only be used for the applications specified in the catalog and technical description and only in conjunction with non Siemens equipment and components if these have been specifically recommended or approved by Siemens Trouble free and safe operation requires proper transport storage installation and assembly as well as careful use and maintenance SIMATIC is a registered trademark of SIEMENS AG Trademarks Any other names appearing in this document may be trademarks the use of which by third parties for their own purposes may breach owners rights Copyright Siemens AG 2013 All Rights Reserved Disclaimer The reproduction transmission or use of this document or its We have checked that the contents of this document correspond to contents is not permitted without express written authorization the hardware and software described Nevertheless we cannot Parties breaching this provision shall be liable for damages All rights assume responsibility for any deviations that may arise The reserved in particular for patent and utility model registration information in this publication is checke
50. e systems such as MODICON PLCs distinguish between these memory areas using the register or bit address For example the holding register is defined as register 40001 with offset 0 memory type 4xxxx reference 0001 This issue is often a source of confusion as some manuals describe and refer to the register address of the application layer and others use the register or bit address actually transferred in the protocol For its start x end x and START ADDRESS parameters the MODBUS FB uses the Modbus address actually transferred Each function code can therefore transfer register bit addresses of 0000 to data_type_1 16 3 Holding register db 1 W 16 B DB 11 start_1 W 16 0 Start address 0 end_1 W 16 1F3 End address 499 data_type_2 16 3 Holding register db_2 W 16 C DB 12 start _2 W 16 2D0 Start address 720 end 2 W 16 384 End address 900 data_type_3 16 4 Input register db 3 W 16 D DB 13 start _3 W 16 2D0 Start address 720 end 3 W 16 3E8 End address 1000 data_type_4 B 16 0 Not used db 4 0 0 start 4 0 0 end 4 0 0 data_type_5 BHI 6 1 Coils db 5 W 16 E DB 14 start_5 W 16 280 Start address 640 end_5 W 16 4E2 End address 1250 data_type_6 16 2 Inputs db_6 W 16 F DB 15 start_6 W 16 6A4 Start address 1700 end 6 W 16 8FC End address 2300 data_type_7 16 1 Coils db 7 W 16 10 DB 16 start 7 W 16 6A4 Start address 1700 end 7 W 16 8FC End address 2300 data type 8 1
51. ection blocks are created for single sided redundancy and four connection blocks for double sided redundancy Once the connection blocks are defined the Modbus parameters are specified One predefined parameter data block each for single sided and double sided redundancy can be found as an example in the Modbus_PN_CPU_Red library Setup of DB MODBUS HPARAM PN with single sided connection Address Name 0 0 FALSE Single sided connection 2 0 STRUCT Connection 0A Connection parameters END STRUCT 66 0 STRUCT Connection 1A Connection parameters END STRUCT 130 0 Modbus parameters SIMATIC Modbus TCP Redundant Communication of PN H Systems 4 1 6AV6676 6MB10 0AX0 Manual Edition 1 1 Connection parameters Modbus parameters Configuration Assigning MODBUS communication parameters Setup of DB MODBUS HPARAM PN with double sided connection Address Name 0 0 TRUE Double sided connection 2 0 STRUCT Connection 0A Connection parameters END_STRUCT 66 0 STRUCT Connection 1A Connection parameters END_STRUCT 130 0 STRUCT Connection 0B Connection parameters END_STRUCT 194 0 STRUCT Connection 1B Connection parameters END_STRUCT 258 0 Modbus parameters The connection specific parameters such as the hardware interface used locally and the IP address of the communication partner are defined in the connection
52. ection of the activated job DISCONNECT TRUE specifies that the connection is to be terminated after data transfer If this parameter is TRUE the time reuse conn time for the re establishment of the connections is not started This parameter is a runtime parameter and can be set and reset as required The block must be licensed on each H system The block is licensed and Modbus communication can be used without restrictions once the activation code has been entered correctly The data block number containing the activation code is entered here Multiple activation codes can be entered one after another in the DB The Modbus block browses the DB for the right activation code For additional information see the section Licensing The parameter Init TRUE enables manual initialization of the Modbus block Initialization can only be performed if there is no job in progress This must be ensured in the program with ENQ FALSE and BUSY FALSE Please note with manual initialization that the initialization parameters need to be configured in the cyclic OB Warning Manual initialization terminates the configured connections If the ID parameters are changed the connections must be terminated manually with DISCONNECT TRUE before manual initialization Data transfer is initiated with a rising edge The request telegram is generated with the values of the UNIT WRITE_READ DATA_TYPE START_ADDRESS and LENGTH input parameters A
53. ed areas data type 1 and data type 7 overlap A018 The configured areas data type 1 and data type 8 overlap A019 of the db x parameters was set to 0 although the Correct the parameter corresponding data type xis configured as gt 0 DBO assignment at db xto gt 0 may not be used because it is reserved for the system A01A Incorrect length in header Values to 253 bytes are Verify the data ofthe possible communication partner with the A015 The configured areas data type 1 and data type 5 overlap A016 The configured areas data type 1 and data type 6 overlap The connection is terminated help of a telegram trace SIMATIC Modbus TCP Redundant Communication of PN H Systems 11 4 6AV6676 6MB10 0AX0 Manual Edition 1 1 Diagnostics Error messages for the MB_PNHCL MB PNHSV FBs STATUS Remedy Hex A01B With MB PNHSV and function code 5 Verify the data ofthe Invalid status received for coil communication partner with the help of a telegram trace The S7 responds with an exception telegram An invalid value is configured at reuse conn cycle Correct the parameter assignment A monitoring time of gt 1s must be configured A parameter data block for clients has been configured Correct the parameter at the MB_PNHSV or a parameter data block for assignment of the parameter data servers has been configured at the MB_PNHCL block 023 The configured areas data type 2 and dat
54. end x 1 Modbus address 1 register or 1 bit value is assigned Sections 7 3 and 8 3 give an example of mapping MODBUS addresses to S7 memory areas start x end x MODBUS address 0 to 65535 W 16 0000 to W 16 FFFF This array is used internally for message data within the FB Accessing or changing the array is inadmissible This array is used internally for message data within the FB Accessing or changing the array is inadmissible This array is used internally for message data within the FB Accessing or changing the array is inadmissible This array is used internally for message data within the FB Accessing or changing the array is inadmissible This array is used internally for message data within the FB Accessing or changing the array is inadmissible This array is used internally for message data within the FB Accessing or changing the array is inadmissible This array is used internally for message data within the FB Accessing or changing the array is inadmissible This array is used internally for message data within the FB Accessing or changing the array is inadmissible SIMATIC Modbus TCP Redundant Communication of PN H Systems 4 9 6AV6676 6MB10 0AX0 Manual Edition 1 1 5 Licensing General information individually Licensing The MB PNHCL MB_PNHSV blocks must be licensed on each CPU Licensing is performed in two steps the IDENT CODE is read out and the REG KEY activation code entered The OB
55. er of registers bits in With MB PNHSV Change the the request telegram The S7 responds with an number in the client request exception telegram telegram Ranges Read coils inputs 1 to 2000 Write coils 1 to 1968 Read registers 1 to 125 Write holding registers 1 to 123 A006 The range specified with DATA TYPE With MB PNHCL Correct the START ADDRESS and LENGTH does not exist in DATA TYPE START data type 1to data type 8 ADDRESS and LENGTH With MB PNHSV CODI Bon The S7 responds with an exception telegram With MB_PNHSV Change the client request or correct the parameter assignment at data type x A007 With MB PNHCL Invalid monitoring time configured at Correct the parameter RECV TIMEOUT or CONN TIMEOUT A value assignment 20ms must be entered for RECV TIMEOUT and a value gt 100ms for CONN TIMEOUT A009 With MB PNHCL Transaction Identifier TI received Verify the data ofthe does not correspond to TI sent communication partner with the The connection is terminated help of a telegram trace AOOA With MB PNHCL UNIT received does not correspond to UNIT sent SIMATIC Modbus TCP Redundant Communication of PN H Systems 11 3 6AV6676 6MB10 0AX0 Manual Edition 1 1 Diagnostics Error messages for the MB_PNHCL and MB_PNHSV FBs STATUS Remedy Hex AOO0B With MB PNHCL Function code received does not With MB PNHCL Check the correspond to function code sent communication partner using telegram re
56. establishment again If the connection was not established since the initialization connection errors are shown with ERROR TRUE otherwise with ERROR FALSE The minimum time that can be set is one second This parameter defines the number of connections via which the Modbus telegrams are to be sent If set to FALSE the Modbus telegrams are only sent via one connection If the parameter is TRUE the Modbus telegrams are sent via all configured connections SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 11 6AV6676 6MB10 0AX0 Manual Edition 1 1 RECV_TIMEOUT CONN_TIMEOUT DISCONNECT REG_KEY_DB Init ENQ MB_PNHCL function block Modbus client The monitoring time RECV_TIMEOUT monitors the receipt of the response telegram from the communication partner The minimum value is 20ms If RECV_TIMEOUT is set to lt 20ms an error message appears and the activated job is rejected When the monitoring time elapses without receiving a telegram the activated job finishes with an error The CONN_TIMEOUT time monitors connection establishment and termination The minimum value is 100ms If the connection is not successfully established or terminated within the configured monitoring time a corresponding error message appears at the STATUS x output When connect at startup TRUE a too low configured CONN TIMEOUT is set to 5s In cyclic operation a too short CONN TIMEOUT results in an error message and the rej
57. eters are not evaluated unless manual initialization is executed SIMATIC Modbus TCP Redundant Communication of PN H Systems 8 2 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHSV function block Modbus server Programming error If the Modbus block has not been licensed for this CPU yet OB121 is called OB121 Warning The CPU will turn to STOP mode if the OB121 is not available Instance DB At each client request the values for the job executed are saved in the I DB of Information on the the server in an information block If necessary they can be read in the user client request program The following values are buffered in the I DB for each connection and are valid when NDR TRUE Address in the IDB Variable name Description for connection 0A DBX 66 5 CONNECTION 1 TRUE Writes to S7 WRITE READ FALSE Reads from S7 DBB 67 CONNECTION 1 Unit number UNIT DBB 68 CONNECTION 1 Addressed data type DATA TYPE 1 Coils 2 Inputs 3 Holding register 4 Input register DBW 70 CONNECTION 1 Start address START ADDRESS DBW 72 CONNECTION 1 Number of registers bits LENGTH processed DBW 74 CONNECTION 1 Transaction Identifier TI sequential number DBD 88 CONNECTION 1 Counter for jobs processed Cnt NDR without errors DBD 92 CONNECTION 1 Counter for errors detected Cnt ERROR For connection 1A CONNECTION 2 the information block starts at address DBX 96 0
58. f the Modbus block Block is licensed Block is not licensed BUSY OUT BOOL Processing status of a Modbus telegram In progress Not in progress 0 to 255 B 16 0 to BiH 6 FF DONE OUT BOOL TRUE Activated job completed without errors TRUE FALSE No on at least one connection ERROR OUT BOOL TRUE Errors have occurred on all TRUE FALSE No connections IDENT OUT STRING Identification for licensing Use this string to Character No EM MEE cM Crewe RedErrDev OUT BOOL TRUE communication partner lost TRUE FALSE No redundancy TotComErr BOOL TRUE Complete failure of communication TRUE FALSE Init Error OUT BOOL TRUE Error occurred during manual TRUE FALSE No initialization Init Status WORD Status of manual initialization 0 to FFFF SIMATIC Modbus TCP Redundant Communication of PN H Systems 6AV6676 6MB10 0AX0 Manual Edition 1 1 7 9 General information Value ranges MB_PNHCL function block Modbus client The parameters of the MB_PNHCL FB are divided into two groups e Initialization parameters lower case e Runtime parameters upper case The initialization parameters are only evaluated and applied to the instance DB when called in OB100 The initialization parameters are marked Yes in the INIT column of the table above Changes to the initialization parameters during normal operation have no effect Following a change to these parameters for example in test operation the instance
59. if this monitoring time elapses RECV_TIMEOUT monitors the runtime of the request telegram The time gap between individual requests from the client is not included CONN TIMEOUT specifies the time for monitoring connection establishment termination The minimum value is 100ms If the connection is not successfully established or terminated within the configured monitoring time a corresponding error message appears at the STATUS x output If CONN TIMEOUT has been set to 100ms a default value of 5s is used SIMATIC Modbus TCP Redundant Communication of PN H Systems 8 7 6AV6676 6MB10 0AX0 Manual Edition 1 1 DISCONNECT REG_KEY_DB Init ENR LICENSED BUSY ESTAB 0A ESTAB 1 ESTAB ESTAB 1B MB PNHSV function block Modbus server DISCONNECT TRUE terminates the connection if the ENR parameter is set to FALSE If the parameter is TRUE the connections are not re established This parameter is a runtime parameter and can be set and reset as required The block must be licensed on each H system The block is licensed and Modbus communication can be used without restrictions once the activation code has been entered correctly The data block number containing the activation code is entered here Multiple activation codes can be entered one after another in the DB The Modbus block browses the DB for the right activation code For additional information see the section Licensing The parameter Init TRU
60. k calls the MOD CLI block internally multiple times and this calls COMM The library also contains a MODBUS HPARAM PN 2 parameter data block for single sided redundancy a MODBUS HPARAM PN 4 parameter data block for double sided redundancy and the license DB as a template You can also copy this to your project to facilitate processing Modbus PN CPU Red 5 9 57 Client B FB913 TCP COMM SCL Function Block TCP COMM gj READ IMPORTANT 53 MOD_CLI SCL Function Block MOD CLI g FB315 MB PNHCL SCL Function Block MB PNHCL i 082 MODBUS_HPARAM_PN_2 DB Data Block MBHPARAM i 083 License DB DB Data Block 084 MODBUS_HPARAM_PN_4 DB Data Block MBHPARAM gt S7 server The S7 Server folder includes the blocks e FB917 MB_PNHSV e FB916 MOD SERV and e FB913 TCP COMM All 3 blocks are always needed for redundant communication The MB PNHSY block calls the SERV block internally multiple times and it calls COMM The library also contains a MODBUS HPARAM PN 2 parameter data block for single sided redundancy a MODBUS HPARAM PN 4 parameter data block for double sided redundancy and the license DB as a template You can also copy this to your project to facilitate processing Modbus PN CPU Red Component view C Program Files SIEMENS STEP7 S7LIBS Modbus PN CPU Red X 4 iol xl E Q Modbus PN CPU Ried 89 57 Client a FB913 TCP_COMM SCL Function Block TCP_COMM 9 4 57 Server 5178916 SERV SCL Function Bl
61. ks SFB4 FB63 FB64 FB65 and FB66 The error messages of these blocks are also forwarded unchanged to STATUS x You will find more information on these error messages in the diagnostics buffer or in the online help for the SFCs FCs in SIMATIC Manager SIMATIC Modbus TCP Redundant Communication of PN H Systems 11 2 6AV6676 6MB10 0AX0 Manual Edition 1 1 Diagnostics Error messages for the MB_PNHCL and MB_PNHSV FBs STATUS Remedy Hex A001 The parameter DB MODBUS HPARAM PN is too Correct the short or too long MODBUS HPARAM PN DB A002 The end x parameter is less than start x Correct the information in the MODBUS HPARAM PN DB A003 A DB to which the MODBUS addresses are to be Extend the DB mapped is too short With MB PNHCL Correct the Minimum length START ADDRESS or LENGTH register values x start x 1 2 2 job parameters bit values end x start 8 1 2 ces With MB PNHSV Change the Other possible causes client request e With MB PNHCL Incorrect call parameters e With MB PNHSV Incorrect address area in the client s request telegram The S7 responds with exception telegram A004 With MB PNHCL only Correct the call parameters Only An invalid combination of DATA TYPE and data types 1 and 3 can be written WRITE READ has been specified A005 With MB PNHCL Invalid value entered at the With MB PNHCL Correct the LENGTH parameter LENGTH parameter With PNHSV Invalid numb
62. l write jobs This specifies the time when the connection is established If connect at startup is set to TRUE the connection will be independent of ENR established as soon as the CPU is restarted In this case a job may not be triggered until the connections have been correctly established ESTAB x TRUE or an error has been displayed at ERROR and STATUS x At the latest when CONN TIMEOUT has elapsed the status outputs are updated FALSE Connection established when ENQ or ENR set TRUE Connection established immediately after restart 8 data areas are available for mapping MODBUS addresses in the S7 memory At least the first data area must be defined the other 7 data areas are optional The system either reads from or writes to the data areas depending on the triggered job With one request only one DB can be accessed Even if consecutive register numbers or coils are located in two different DBs two requests are necessary to access them both This must be taken into account during the parameterization It is possible to map more Modbus areas registers or bit values to a data block than can be processed with one telegram The data type x parameter specifies which MODBUS data types are mapped in this data block If a value of 0 is entered in data type x the data area will not be used Identifier Data type Size 0 Area not used 1 Coils Bit Inputs Bit Holding register Word O nm Inp
63. m FB number The same FBs are used with a single PN CPU as with high availability PN single PN CPUs CPUs Make sure that you use the correct local_device_id for configuration All other CPU specific parameters must also be checked and modified manually if necessary SIMATIC Modbus TCP Redundant Communication of PN H Systems 10 1 6AV6676 6MB10 0AX0 Manual Edition 1 1 Diagnostics 11 Diagnostics Diagnostics functions Display elements LED MB PNHCL and MB PNHSV STATUS outputs MB PNHCL and MB PNHSV alarm bits The diagnostics functions of the PN CPU enable you to quickly locate any errors that occur The following diagnostic functions are available e Diagnostics via the display elements of the CPUs Diagnostics via the STATUS outputs of the Modbus function blocks Diagnostics via the alarm bits of the Modbus function blocks The display elements provide information on the operating status and or any errors of the CPUs The display elements give a broad overview of internal external and interface specific errors The MB PNHCL and MB PNHSV function blocks have STATUS outputs for error diagnostics Reading the STATUS outputs gives you general information on errors that occurred during communication You can evaluate the STATUS parameters in the user program The Modbus function blocks also have outputs to display the loss of redundancy and complete loss of communication The alarm bits are set in accordance with
64. m does not start automatically install as follows 1 In Windows Explorer select the CD ROM drive open the Setup directory and launch the setup program 2 Follow the on screen step by step instructions of the installation program You can now find e The libraries under Program Files Siemens Step7 S libs e The example projects under Program Files Siemens Step7 Examples e manual under Files Siemens Step7 S7manual S7Comm e The software registration form under Program Files Siemens Step7 S 7libs Modbus PN CPU Red The first time you call the Modbus library use the Browse function in the Open dialog to access the library in S7libs The manual can also be opened using the shortcut under Program Files Siemens Documentation SIMATIC Modbus TCP Redundant Communication of PN H Systems 3 1 6AV6676 6MB10 0AXO0 Manual Edition 1 1 Commissioning 3 2 Assigning a CPU IP address Introduction This example of IP address assignment uses a CPU 414 5H PN DP Procedure Before configuration you must first generate an S7 project with STEP7 1 Open HW Config and insert the racks and power supplies Add a CPU 414 5H PN DP after the power supply i 0 UR2 H 1 PS 407 104 n 3 IR CPU 414 5 PN DP x2 9 5 x rEZ IF1 9 H Sync Modul IF2 9 H Sync Modul X5 d 2v0 X5P18 Pot X5P28 Por 2 xj 2 The properties dialog box of the PN IO interface X5 is displayed Properties Ethernet interf
65. mmediately in the event of a protocol error In the event of a connection error all configured connections are checked and ERROR is only set if all connections are faulty use all conn TRUE If this output is set errors have been detected on all configured connections The error numbers are displayed at the STATUS outputs ESTAB x TRUE indicates that a connection to the communication partner is established and that data can be transferred ESTAB x FALSE indicates that there is no connection to the communication partner If at least 1 projected connection fails these outputs are updated after reuse conn time is elapsed The STATUS x outputs show the error number when ERROR is set and the status information for the corresponding connection when ERROR is not set The error numbers and status information are described in Diagnostics Following CPUO startup this parameter displays an 18 digit identifier that is used to request the REG KEY activation code for Modbus communication For additional information see the section Licensing SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 14 6AV6676 6MB10 0AX0 Manual Edition 1 1 RedErrS7 RedErrDev TotComErr Init_Error Init_Status MB_PNHCL function block Modbus client Output RedErrS7 TRUE indicates a redundancy error at the SIMATIC With single sided redundancy this means that the CPUO or CPU1 connection has failed With double sided redunda
66. ms are sent and received via 2 configured connections Once the configured reuse conn time has elapsed the system attempts to establish the faulty connections again Number of faulty STATUS STATUS OB STATUS 1A STATUS 1 RedErrS7 RedErrDev TotComErr connections wa FEF Free FALSE FALSE FALSE FFFF TRUE TRUE FALSE NM FFFF FFFF TRUE TRUE FALSE SIMATIC Modbus TCP Redundant Communication of PN H Systems 11 10 6AV6676 6MB10 0AX0 Manual Edition 1 1 Diagnostics 4 use all conn TRUE 4 connections are configured The telegrams are sent and received via 4 configured connections Once the configured reuse conn time has elapsed the system attempts to establish the faulty connections again Number of faulty STATUS STATUS OB STATUS 1A STATUS 1 RedErrS7 RedErrDev TotComErr connections o o FALSE FALSE FALSE e FALSE FALSE FALSE NEN FALSE FALSE FALSE FALSE FALSE SIMATIC Modbus TCP Redundant Communication of PN H Systems 11 11 6AV6676 6MB10 0AX0 Manual Edition 1 1 Diagnostics 11 5 2 Server block The server block tries to establish faulty connections again on a cyclic basis Number of faulty STATUS STATUS 0B STATUS_1A STATUS_1B RedErrS7 RedErrDev TotComErr connections Loo o FALSE FALSE FALSE SIMATIC Modbus TCP Redundant Communication of PN H Systems 11 12 6AV6676 6MB10 0AX0 Manual Edition
67. ncy it means that both CPUO connections or both CPU1 connections have failed For additional information see the section Diagnostic messages with alarm bits Output RedErrDev TRUE indicates a redundancy error at the communication partner With single sided redundancy this means that the connection from node A to CPUO or CPU1 has failed With double sided redundancy it means that both connections to node A or both connections to node B of the communication partner have failed For additional information see the section Diagnostic messages with alarm bits The TotComErr output value TRUE indicates a complete loss of communication i e all configured connections have been disrupted For additional information see the section Diagnostic messages with alarm bits If an error has occurred in manual initialization this is indicated with Init Error TRUE The Init Status output displays the error number when Init Error is set The error numbers are described in Diagnostics SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 15 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHCL function block Modbus client 7 3 Example of address mapping Interpretation of Modbus addresses Example Data area parameter assignment SIMATIC Modbus TCP Redundant Communication of PN H Systems 6AV6676 6MB10 0AX0 Manual Edition 1 1 The MODBUS data model is based on a range of memory areas with varying characteristics Som
68. new job cannot be sent until the previous job has completed with DONE or ERROR If the connection has not been established ESTAB_x FALSE this is done before data transfer is carried out SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 12 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHCL function block Modbus client DATA_TYPE The DATA_TYPE parameter indicates which Modbus data type is being processed with the current telegram The following values are permitted Coils 16 1 Inputs 16 2 Holding register 16 3 Input register 16 4 The various different data types are directly related to the function codes used TYPE write code memos 3 true s START ADDRESS The START ADDRESS parameter specifies the first MODBUS address to be written or read LENGTH The LENGTH parameter specifies the number of MODBUS values to be written or read For read functions a maximum of 125 holding and input registers are possible per telegram A maximum of 2000 bits are possible for coils and inputs For write functions the maximum number of registers for the holding register is 123 and the maximum number of bits for coils 1968 The registers or bit values processed with a request telegram must be located in one DB WRITE READ This parameter defines whether a read or a write function is to be executed If the input is FALSE the function is a read function TRUE indicates a write function Write acce
69. ng etc refer to the following manual SIEMENS SIMATIC High availability Systems S7 400H System manual A5E00267693 1 1 SIEMENS SIMATIC S7 400 Automation System S7 400 CPU Data Manual A5E00850745 10 For additional information on STEP7 refer to the following manuals SIEMENS SIMATIC Software Basic Software for S7 and M7 STEP7 User Manual C79000 G7000 C502 SIEMENS SIMATIC Software System Software for S7 300 400 System and Standard Functions Reference Manual C79000 G7000 C503 02 If you have any questions on the use of the FBs described in this manual and do not find the answers in this document contact the local Siemens representative who provided you with this function block This documentation uses the generic term CPU The information applies to H CPUS with an integrated PN interface The function blocks detailed in this manual connect PN H CPUs to non Siemens Modbus devices SIMATIC Modbus TCP Redundant Communication of PN H Systems 2 6AV6676 6MB10 0AX0 Manual Edition 1 1 Table of contents Table of contents 1 Product description 2 22 ieee 1 1 1 1 Applications iiu 1 1 1 2 Hardware and software 1 2 2 Getting started oue eerie 2 1 3 ennt 3 1 3 1 Installing the library in the STEP7 PQG PC sse 3 1 3
70. o the instance DB when called in OB100 The initialization parameters are marked Yes in the INIT column of the table above Changes to the initialization parameters during normal operation have no effect Following a change to these parameters for example in test operation the instance DB I DB must be re initialized with a CPU STOP RUN Initialization can also be carried out using the Init parameter Runtime parameters can be changed during cyclic operation You should not change the input parameters while a job is in progress The output parameters are dynamic displays and are therefore only pending for 1 CPU cycle They must be copied to other memory areas for additional processing or for display in the variable table SIMATIC Modbus TCP Redundant Communication of PN H Systems 8 6 6AV6676 6MB10 0AX0 Manual Edition 1 1 Value ranges d 0 1 a id O b id 1 b db param RECV TIMEOUT CONN TIMEOUT MB PNHSV function block Modbus server There may also be CPU specific restrictions on the value ranges for the various parameters A connection ID is required for each PN CPU connection to a communication partner A different connection ID must be used for each logical connection This connection ID is configured in the connection parameter block in the MODBUS HPARAM PN parameter data block The connection ID is a unique number for the connection from the CPU to the communication partner and can have a value between 1
71. ock MOD_SERV gj READ IMPORTANT MB_PNHSV SCL Function Block MB PNHSV i DB2 MODBUS HPARAM PN 2 DB Data Block MBHPARAM iz DB3 License DB DB Data Block i D84 MODBUS_HPARAM_PN_4 DB Data Block MBHPARAM 4 n SIMATIC Modbus TCP Redundant Communication of PN H Systems 3 4 6AV6676 6MB10 0AXO0 Manual Edition 1 1 Commissioning Blocks in the The following FBs are required for Modbus communication standard library TSEND FB63 e TRCV FB64 e FB65 e TDISCON FB66 These communication blocks can be found in the Standard Library gt Communication Blocks library and must also be inserted into your project Please note that the following versions of the FBs are required for the smooth operation of the MB PNHCL and MB PNHSV FBs TSEND V2 1 V2 2 TCON V2 4 TDISCON V2 1 SIMATIC Modbus TCP Redundant Communication of PN H Systems 3 5 6AV6676 6MB10 0AX0 Manual Edition 1 1 Commissioning 3 4 Multiple connections to port 502 General information Requirements Number of connections enabled Configuration Some CPUs can multiplex TCP connections In these cases multiple MODBUS clients can connect to port 502 of the CPU multiport The CPU acts as the MODBUS server Information on which CPUs with which firmware versions allow multiple port 502 use is available here www siemens com s7modbus For this function to be available the following settings must be made in block selec
72. ode A a Connection from CPU1 to communication partner node A b Connection from CPUO to communication partner node B b Connection from CPU1 to communication partner node B Connection 0A is the default connection and must be configured If the communication partner is set up as standalone you only need parameters id O a and 1 a If the S7 is set up as standalone you only need parameters id O a id 0 b If both communication partners are set up as redundant all 4 connections are configured The parameter db param is the number of data block MODBUS HPARAM PN This parameter data block contains the connection specific and Modbus specific parameters required for communication between the PN CPU and the communication partner The value range for this parameter depends on the CPU 0 cannot be used as a DB number because it is reserved for the system The DB number is input in plain text in the following format Each Modbus block instance requires its own parameter data block This parameter defines the intervals at which a connection recognized as faulty is to be included in communication again In the event of a connection error on OA 1A OB or 1B a timer is started with the time specified at this parameter As long as this timer is running the system does not attempt to establish the connection or to send Modbus telegrams via the connection When the timer stops the Modbus block automatically activates connection
73. onnection Scenario a All response telegrams are received without errors Connection 0A gt Connection Server at modbus block Request m z gt Response o z ea DONE TRUE ERROR FALSE STATUS 0A 0 STATUS 1A 0 SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 5 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHCL function block Modbus client Scenario b At least one response telegram is not received Connection Connection Server I O at modbus block ENQ TRUE Request Connection 5 interrupted m 2 F E gj 7 ERROR FALSE STATUS 0A 0 STATUS 1A Error ENQ TRUE Request m 2 gt Response x 7 ERROR FALSE TUN STATUS 0A 0 Connection STATUS A0FF is recovered Es Ieuse conn time elapses Connection 1A is internally set to available DONE FALSE ERROR FALSE STATUS_0A 0 STATUS_1A 0 Both connections are used again ENQ TRUE Request Response RECV_TIME DONE TRUE ERROR FALSE STATUS_0A 0 STATUS_1A 0 SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 6 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHCL function block Modbus client Scenario c No response telegrams are received Connection Connection 1A
74. out ESTAB_OB BOOL FALSE FALSE 28 46 0 out STATUS 0B WORD W 16 0 W 16 FFFF 29 48 0 out ESTAB_1B BOOL FALSE FALSE 30 50 0 out STATUS_1B WORD W 16 0 W 16 FFFF 31 52 0 out IDENT CODE STRI 2 32 72 0 out RedErrS7 BOOL FAL TRUE 33 72 1 out RedErrDev BOOL F TRUE 34 72 2 out TotComErr BOOL TRUE 35 72 3 out Init Error BOOL FALSE FALSE Please insert the IDENT CODE here The manual contains information how to find g t the IDENT CODE Bitte tragen Sie den IDENT CODE hier eif Das Handbuch enth lt Informationen wj Sie den IDENT CODE ermitteln gt gt gt IDENT_CODE lt Modbus TCP ype of Software f Softwaretyp Runtime Software Please insert the License No here _ Type ot License Lizenztyp Single License You find the License No on the package of the pe pectus Vus ee ORIGINAL INDUSTRIAL 50 Software Class Software dari A Bitte tragen Sie die Lizenz Nr hier ein Reference hardware Ziclharcware Sie finden die Lizenz Nr auf der Verpackung de A 1 Systems Cond tions Systemanforcevwng gt gt gt License No Lizenz Nr lt lt lt Revrark Aneetkung Software onc electronic documentation or CD orto Joon se No 20996 6201 0000841 T mImERUER SIMATIC Modbus TCP Redundant Communication of PN H Systems 5 2 6AV6676 6MB10 0AX0 Manual Edition 1 1 Licensing 1 Send this form as Service Reque
75. p of a telegram trace Register value received does not correspond to register value sent Or the intance DB was transferred to the CPU without restart With MB_PNHCL A new job was triggered before the Do not trigger a new job until the current one was completed The job is not executed previous job has completed with This is a status information The ERROR bit is not set DONE TRUE or ERROR Manual block initialization was started while a job was TRUE in progress Do not initialize until all running jobs have completed A084 No IDENT_CODE identifier could be calculated for Please contact the Product licensing Support A085 error occurred during license detection Check for unauthorized write The error is displayed the first time it occurs with access to the license DB The ERROR TRUE Thereafter it appears as a status REG KEY structure must not be message with ERROR FALSE changed Contact the Product Support in case of problems SIMATIC Modbus TCP Redundant Communication of PN H Systems 11 6 6AV6676 6MB10 0AX0 Manual Edition 1 1 Diagnostics Error messages for the MB_PNHCL and MB_PNHSV FBs STATUS Event text Remedy Hex A086 attempt was made to write to a write protected data Remove the data block write block protection or use another DB A090 The Modbus block has not yet been licensed for this Read the IDENT CODE CPU identification string for this CPU This is status information The ER
76. pe 7 overlap A068 The configured areas data type 6 and data type 8 overlap A078 The configured areas data type 7and data type 8 overlap A079 The connection ID specified at the parameter id x does Correct the parameter not exist in the MODBUS HPARAM PN parameter assignment at input id x DB A07A Invalid value assigned value range of 1 to 4095 or value assigned twice at parameter id x of the block 7 The id x specified exists twice in the parameter DB Correct the parameter A07C Invalid value specified at parameter data type assignment in the parameter DB valid values are 0 to 4 MODBUS_HPARAM_PN DB No entry in the data type 1 parameter in the parameter DB Parameter area 1 is the initial area and must be configured AO07E The number of the instance DB of block PNHCL or MB PNHSV was specified at db x AO07F The DB specified at db param is not a Modbus Correct the parameter parameter DB assignment at input db param A080 Different instance DBs are used to call the Modbus The Modbus block must be called block in cyclic OB and in OB100 with the same instance DB in the startup OB and the cyclic OB After the transfer of the IDB to the CPU an initialization of the Modbus block is needed A081 Only with MB_PNHCL and function code 5 Verify the data ofthe Response telegram data does not echo request communication partner with the A082 Only with MB_PNHCL and function code 6 hel
77. rated and sent The NDR x bit for the relevant connection is set to inform the user of the completed telegram traffic A request telegram with errors results in an error message The ERROR bit for the relevant connection is set and the error number is displayed in the STATUS x parameter Depending on the type of error either the client request is answered with an exception telegram or no response telegram is sent to the client The MB PNHSV block detects a connection error if the TSEND TRCV communication functions report an error during data telegram transfer Once the error code has been displayed the status AOFF is then indicated This means that the connection has been configured but is not currently established If an error is detected in a connection and ENR is set the system tries to establish the connection again SIMATIC Modbus TCP Redundant Communication of PN H Systems 8 4 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHSV function block Modbus server 8 2 Parameters of the MB_PNHSV function block IN W Connection ID for CPUO to communication 1 to 4095 partner node A in accordance with WiH 61H to configuration in the parameter DB W 16 FFF IN Connection ID for CPU1 to communication 1 to 4095 partner node A in accordance with W 16 1 to configuration in the parameter DB W 16 FFF IN Connection ID for CPUO to communication 1 to 4095 partner node B in accordance with WiH 61H to configuration in the parameter DB W 16 FFF
78. rd FBs for processing connections Standard FBs for data transfer The MB PNHSV function block saves the data in an instance DB This instance DB is generated by STEP 7 the first time the FB is called The instance data block contains parameters of the type input and output as well as static variables required for its execution These variables are remanent and remain valid between FB calls The variables control the internal process of the FB Memory requirement of the instance DB Instance Work memory Load memory MB PNHSV approx 3 KB approx 5 KB A maximum total of 186 bytes of local data is required for an MB PNHSV FB call The connection specific and Modbus specific parameters are saved in the MODBUS HPARAM PN parameter DB The function block does not use any timers The function block does not use any flags TCP COMM FB called in the MB PNHSV MOD SERV FB uses the TCON and TDISCON blocks from the standard library to establish and terminate connections between the CPU and the communication partner The TCP COMM FB called in the MB PNHSV MOD SERV FB uses the TSEND and TROV blocks from the standard library for data transfer between the CPU and the communication partner MB PNHSV The MB PNHSV FB uses the following SFCs from the standard library SFCs for other SFC6 RD SINFO functions e SFC20 BLKMOV e SFC24 TEST DP e SFC51 RDSYSST e SFC52 WR USMSG MOD SERV The MOD SE
79. rt number is only an option for PN CPUS with the corresponding firmware version Information on port number release can be found here http support automation siemens com W W view en 3401 0717 Certain types of CPU can maintain and operate connections to multiple clients via local port 502 The technical details are set out in section Multiple connections to Port 502 SIMATIC Modbus TCP Redundant Communication of PN H Systems 1 1 6AV6676 6MB10 0AX0 Manual Edition 1 1 Product description 1 2 Hardware and software requirements Modules suitable for MB PNHCL and MB PNHSV Software versions Memory space required The current hardware requirements can be found here WWW siemens com s7modbus The MB PNHCL or MB PNHSV FB can be used as of STEP 7 Version 5 5 SP2 HF1 The MB PNHCL FB requires 17 KB of working memory and 20 KB of load memory The MOD CLI FB requires 10 KB of working and load memory The MB PNHSV FB requires 14 KB of working memory and 17 KB of load memory The MOD SERV FB requires 10 KB of working and load memory The MOD COMM FB requires 2 KB of working and load memory You can calculate the exact block lengths using the block properties in SIMATIC Manager SIMATIC Modbus TCP Redundant Communication of PN H Systems 1 2 6AV6676 6MB10 0AX0 Manual Edition 1 1 Getting started 2 Getting started Procedure Install SIMATIC Modbus TCP PN CPU redundant and add Modbus blocks to the user project gt
80. s amp _ HALAD STL FBD DB16 Coils Area 2 G File Edit Insert PLC Debug View Optic Dig SWS 5 oc Bum ss o eeiietesooT iKMLAD STL FBD DB15 Inputs Area MO F File Edit Insert PLC Debug View Options 515 1700 eoor Bc LAD STL FBD DB13 Input Register File Edit Insert PLC Debug View Opt Da H amp X rr 0 o Input_Register 720 Input Register 721 560 0 Input_Register 1000 ses VSILAD STL FBD DB11 Holding Regist F File Edit Insert PLC Debug View Opt Du E _ Register toi 6 Register tit tooo ose VSILAD STL FBD DB12 Holding Registe Eile Edit Insert PLC Debug View Opti Da SS gt ss o rra r 0 0 Holding Register 720 ORD z 0 Helding Register 7211 woRD 360 0 Holding Register 900 mU ED ss ojreservea MB PNHCL function block Modbus client Modbus device Coils from 00001 Input register from 30001 Holding register from 40001 SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 18 6AV6676 6MB10 0AXO0 Manual Edition 1 1 MB_PNHCL function block Modbus client 7 4 Data and standard functions used by the FB Instance DB Local variables Parameter DB Timers Flags Standard FBs for processing
81. s active and passive the TCON function opens a communication channel to the communication partner during runtime The time when the connection establishment starts is defined with a parameter in the DB MODBUS HPARAM PN connect at startup Connection termination is controlled with the DISCONNECT parameter at the MB PNHCL FB Job trigger A rising edge at the trigger input ENQ initiates a job In accordance with the UNIT DATA TYPE START ADDRESS LENGTH and WRITE READ input parameters a MODBUS request telegram is generated and sent to the partner station via the TCP IP connection The block waits for the configured delay RECV_TIMEOUT for a response from the server Handling for a The MB PNHCL block detects a connection error if the TSEND TRCV faulty connection communication functions report an error during data telegram transfer Once the error code has been displayed the status AOFF is then indicated This means that the connection has been configured but is not currently established If a connection error is detected the time reuse conn time is started As long as the reuse conn time timer is still running the system does not try to send Modbus telegrams via the faulty connection Once the time has elapsed the system attempts to re establish the connection SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 3 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHCL function block Modbus client Send telegrams With
82. s TCP Redundant Communication of PN H Systems 8 5 6AV6676 6MB10 0AX0 Manual Edition 1 1 N N N N MB_PNHSV function block Modbus server STATUS 1A WORD Status of connection 1A 0 to FFFF No NDR OB OUT BOOL TRUE Client request has been executed and TRUE FALSE No answered on connection 0B ERROR BOOL TRUE An error has occurred on connection TRUE FALSE No OB STATUS WORD Status of connection OtoFFFF NDR_1B OUT BOOL TRUE Client request has been executed and TRUE FALSE No answered on connection 1B ERROR_1B BOOL TRUE An error has occurred on connection TRUE FALSE No 1B STATUS 1B WORD Status of connection 1B 0 to FFFF No IDENT OUT STRING Identification for licensing Use this Character No CODE 18 identification string to request the license RedErS7 OUT BOOL _ TRUE 7 lost redundancy TRUE FALSE No RedErrDev OUT BOOL TRUE Communication partner lost TRUE FALSE No redundandy TotComErr BOOL TRUE Complete failure of communication TRUE FALSE No Init Error OUT BOOL TRUE An error occurred during manual TRUE FALSE No initialization Init Status WORD Status of manual initialization 0 to FFFF No General The parameters of the MB PNHSV FB are divided into two groups information e Initialization parameters lower case e Runtime parameters upper case The initialization parameters are only evaluated and applied t
83. ss is only possible to holding registers and coils Input register and inputs can only be written SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 13 6AV6676 6MB10 0AX0 Manual Edition 1 1 UNIT LICENSED BUSY DONE ERROR ESTAB 0A ESTAB 1A ESTAB ESTAB 1B STATUS 0A STATUS 1A STATUS 0B STATUS 1B IDENT CODE MB PNHCL function block Modbus client The UNIT parameter Unit Identifier uniquely identifies the communication partner It is most important when one converter has multiple serial nodes to be addressed with different UNIT numbers The input is to be set in accordance with requirements The FB applies this value to the request telegram and checks it when the response is received Please note that some communication partners expect a specific UNIT number If this output is set to TRUE the Modbus block is licensed on this CPU If the output is FALSE no license string or the wrong license string has been entered For additional information see the section Licensing If this output is set a Modbus telegram is currently being processed The activated job has completed without errors on at least one connection Read function the response data from the server has already been entered in the DB Write function the server response to the request telegram has been received If this output is set errors have been detected on all active connections use all conn FALSE ERROR is set i
84. ssignment You will find the wizard at http support automation siemens com WW view en 2077896767 SIMATIC Modbus TCP Redundant Communication of PN H Systems 4 3 6AV6676 6MB10 0AX0 Manual Edition 1 1 Assigning MODBUS communication parameters 4 2 Manual parameter assignment Procedure Connection parameter setup and modifications block_length id Copy DB2 for single sided redundancy or DB5 for double sided redundancy for the client or server from the Modbus PN CPU Red library and add it to your project If the number is already in use elsewhere the DB can be renamed In this example DB2 for single sided redundancy is used The parameters in the MODBUS HPARAM PN block must not be changed during runtime If the parameters are changed the CPU must be restarted with STOP gt RUN One block is required for each connection Address Name Initial value sns NNNNNNNNNEEEEEEEEEEEEN bie engen wm fusero hs om nen __ Lien ems Ls Lien epe LL nune puce nme spare um EN mmm This parameter defines the length of the connection parameters and must not be changed Fixed value W 16 40 A connection ID is issued for each logical connection This ID must be unique across the CPU when T communication is used The ID is specified when the FB MB PNHCL MB PNHSV is called and is used for internal calls of the T blocks TCON TSEND TRCV and TD
85. st http support automation siemens com WW view en 38718979 to Customer Support Hereupon you will receive the registration key for your PLC 2 Information on use in CFC The CFC editor can only display a set number of characters online The complete IDENT CODE is displayed in the tooltip of the output parameter or in the IDB Entering the The REG KEY activation code must be declared for each call of the Modbus REG KEY block activation code The REG KEY should be saved in a global DB Via this global DB all Modbus blocks can receive the activation code see also example below Process as follows to enter the REG KEY activation code 1 the predefined licensing block DB3 from the Modbus PN CPU Red library to your project If the DB number is already in use in the project the license DB can be renamed 2 Openthe license DB and copy the 17 digit activation code provided to the Initial value column using copy and paste Multiple keys can be entered as a list VSLAD STL FBD DB3 License DB MB TCP PN RED 400 Double sided Client CPU 414 5 H PN DP G File Edit Insert PLC Debug View Options Window Help Dee HS Selo Gu 2 67 lt address Nam 8 h struct word aaa eae REG KEY 1 STRING 17 insert REG KEY Registration Key 3 The activation code must be permanently saved in the data block so that is does not need to be entered each time the CPU is re loa
86. the setting use_all_conn FALSE the MODBUS telegram is sent via one via one connection the currently active connection In case of a timeout no response from the server or a connection error the system attempts to send the configured telegram via the other a maximum of 4 configured connections The sequence in doing so is 0A 1A OB and 1B When a telegram is successfully transferred via a connection this connection is marked active and is used for subsequent telegram transfer In case of a connection error of the active connection a transmission retry is carried out via the other configured connections If all send attempts fail ERROR and STATUS x are set accordingly When a response telegram is received a validity check is carried out If the result is positive the required actions will be taken and the job will be completed without error The DONE output is set If an error is recognized during verification the job is finished with an error the ERROR bit is set and an error number is displayed at STATUS x In this case the system does not launch another send attempt for the telegram via the next configured connection The system only switches to the other configured connections if a connection error is detected or no response was received Connection Connection at modbus block ENQ TRUE Request RECV TIME Response DONE TRUE ERROR FALSE STATUS 0A 0 STATUS 1A 0 Connec
87. the status of the ESTAB x outputs of the configured connections 11 1 Diagnostics via the display elements of the CPU Display functions The CPU display elements provide information on the module status The following display functions are used Group error displays PN CPU 300 and IM 151 8 PN DP CPU SF Group error If this LED flashes the Modbus block has not yet been licensed For additional information see the section Licensing PN H CPU 400 INTF Group error If this LED flashes the Modbus block has not yet been licensed For additional information see the section Licensing Special displays PN CPU 300 PN H CPU 400 and IM 151 8 PN DP CPU RX TX A telegram is being transferred via the interface A detailed description of the display elements can be found in the corresponding CPU manuals SIMATIC Modbus TCP Redundant Communication of PN H Systems 11 1 6AV6676 6MB10 0AX0 Manual Edition 1 1 Diagnostics 11 2 MB PNHCL and MB_PNHSV FB diagnostics messages Messages at the The error messages are displayed at the status outputs of the PNHCL STATUS output of and MB PNHSVY Below you can find a list of the FB specific error messages the FBs Error messages of The Modbus FBs use the standard blocks SFC6 SFC20 SFC24 SFC51 and the SFCs and FCs SFC52 The error messages of these blocks are forwarded unchanged to called STATUS x The COMM FB called in MOD CLI or MOD SERV uses the standard bloc
88. this parameter must be set to 0 next staddr 1 6 B 16 00 spare This parameter is not used and must be preset to 0 SIMATIC Modbus TCP Redundant Communication of PN H Systems 4 6 6AV6676 6MB10 0AX0 Manual Edition 1 1 Assigning MODBUS communication parameters Adapting Modbus The Modbus parameters in the MODBUS HPARAM PN block are used to parameters define the mode of Modbus communication and how Modbus addresses are mapped to SIMATIC addresses ne server_client BOOL TRUE E END_STRUCT ele ojo o o Ble o na RI in o N o Ble co co oio o in v m o EIS E m J o o o N o SIMATIC Modbus TCP Redundant Communication of PN Systems 4 7 6AV6676 6MB10 0AX0 Manual Edition 1 1 server_client single_write connect_at_ startup 8 data areas data_type_x db_x Assigning MODBUS communication parameters TRUE S7 is the server to set when using MB PNHSV FALSE S7 is the client to set when using MB PNHCL Function codes 5 and 6 are used for write jobs with a length of 1 in the MB PNHCL block when the parameter single write TRUE If single write FALSE function codes 15 and 16 are used for al
89. tion interrupted ENQ TRUE Request Internal Error Request DONE TRUE ERROR FALSE STATUS_0A Error Connection 0A STATUS 1A 0 is recovered reuse_conn_ time elapses Connection 0A is internally set to DONE FALSE available ERROR FALSE STATUS 0A 0 STATUS 1A 0 Connection 1A is still used ENQ TRUE Request OUT Response RECV TIME DONE TRUE ERROR FALSE STATUS 0A 0 STATUS 1A 0 SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 4 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHCL function block Modbus client Send telegrams With the setting use_all_conn TRUE the MODBUS telegram is sent via all via all connections configured and established connections A plausibility check is carried out once a response telegram is received via one of the connections If the plausibility check is positive the required actions are executed The DONE ERROR and STATUS x outputs are only updated once the activated job has been completed on all configured connections either a response telegram has been received or the monitoring time elapsed If a valid response telegram has been received on at least one connection the DONE output is set If errors have been detected on all connections the ERROR bit is set and the error numbers are displayed at STATUS x If one of the configured connections has failed subsequent MODBUS telegrams are not sent via the faulty c
90. tion and parameter assignment e CPU is the server e Port 502 is the local port e Unspecified TCP connection e Passive connection establishment The number of connections that a CPU can accept at port 502 depends on the module Please see the technical data of the CPU for details One unique connection in the parameter DB is required for each client that is to connect to port 502 of the server SIMATIC Modbus TCP Redundant Communication of PN H Systems 3 6 6AV6676 6MB10 0AX0 Manual Edition 1 1 Assigning MODBUS communication parameters 4 Assigning Modbus communication parameters General information The MODBUS _ HPARAM connection data block Communication via the integrated PN interface of the CPU does not require connection configuration in NetPro The connections are established and terminated using the TCON FB65 and TDISCON FB66 function blocks Multiple connections to different communication partners can be configured and established at the same time The number of connections established simultaneously depends on the CPU The data required for establishing connections and processing Modbus telegrams is defined in a data block the parameter data block MODBUS_HPARAM_PN At first the connection parameters are defined subsequently the Modbus parameters are defined Each connection 0A 1A OB and 1B requires 1 connection block in which the connection parameters between the communication partners are defined Two conn
91. tion of PN H Systems 7 19 6AV6676 6MB10 0AXO0 Manual Edition 1 1 MB_PNHCL function block Modbus client MOD CLI The MOD CLI FB uses the following SFCs from the standard library SFCs for other i functions e SFC20 BLKMOV e SFC24 TEST DP TCP COMM TCP COMM FB uses the following SFB from the standard library as well SFCs for other as the T blocks functions e SFB4 TON Additional The TI parameter is updated internally by the MB_PNHCL block and information incremented by one with each new job The time within which connection termination can be detected can be adjusted with the Keep Alive Time parameter You will find this parameter in the CPU properties in HW Config SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 20 6AV6676 6MB10 0AXO0 Manual Edition 1 1 MB_PNHCL function block Modbus client 7 5 Renaming rewiring functions and function blocks Motive If the numbers of the standard functions are already being used in your project or the number range is reserved for other applications e g in CFC you can rewire the internally called FB63 FB64 FB65 and FB66 function blocks of the _ FB or the MB_PNHCL MOD CLI MOD SERV and TCP COMM blocks The system functions SFC6 SFC20 SFC24 SFC51 and SFC52 and the system function block SFB4 cannot be renamed rewired Reaction A set of rules concerning the function block numbering have to be considered when rewiring function blocks in SIMAT
92. umbers are also used in the example project supplied for S7 H stations with FB MB_PNHSV smo Comment __ _ DAT Work DB CONTROL DAT for FB MB_PNHSV LICENSE_DB License DB for FB MB PNHSV MODBUS HPARAM P Parameter DB for FB MB PNHCL mss lis sasa Vawe DB torarsas SIMATIC Modbus TCP Redundant Communication of PN H Systems 12 3 6AV6676 6MB10 0AX0 Manual Edition 1 1 Application example 12 3 Sample project in CFC Modbus client Overview The example project was generated with CFC V8 0 Update 1 1681 W id 0 a LICENSED E0 ioo0 I PV 1s 2W id La Busy Bo 15 3 id 0b DONE B0 1584 ia 15 ERROR B0 4 DB db param 0 B0 Save STATUS 5 reuse con STATUS 0A W Bal 1 60 ure all ESTaB BO BO ERROR 1s 200m TI TIME STATUS l W W STATUS 0 5 CONN TIME BO W STATUS 1 obo DIscommec STATUS OB U W STATUS DE REG KEY D 15 BO W STATUS 15 License DB W o Ema STATUS 15 W 15 3 DATA TYPE IDENT COD SN l6 s W START ADD RedErrS BO l6 4 W LENGTH RedErrDev BO 0 BO WRITE REA TotComErr BO 16 1
93. ut register Word The db x parameter defines the data block in which the MODBUS registers or bit values subsequently defined are to be mapped 0 cannot be used as a DB number because it is reserved for system functions db x DB number 1 to 65535 W 16 0001 to W 16 FFFF The data block must be 2 bytes longer than required for the configured data The last two bytes are required for internal purposes SIMATIC Modbus TCP Redundant Communication of PN H Systems 4 8 6AV6676 6MB10 0AX0 Manual Edition 1 1 start_x end x conn 0A send buffer conn recv buffer conn 1A send buffer conn 1A recv buffer conn OB send buffer conn OB recv buffer conn 1B send buffer conn 1B recv buffer Assigning MODBUS communication parameters start x specifies the first Modbus address mapped in data word 0 of the DB The end x parameter defines the address of the last MODBUS address For register access the data word number in the S7 DB in which the last Modbus address is entered is calculated according to the following formula DBW number end x start x 2 For bit access the data byte number in the S7 DB in which the last Modbus address is entered is calculated according to the following formula DBB number end x start x 7 8 The defined data areas must not overlap The end x parameter must not be smaller than start x In the event of an error FB startup will finished with an error When start xis equal to
94. w you to detect a loss of redundancy This is displayed at RedErrS7 RedErrDev and TotComErr outputs These status bits can be connected to an alarm block or to other blocks where they can be evaluated The alarm bits are set in accordance with the status of the configured connections at ESTAB_x 11 5 1 Client block The alarm bits are set as follows in line with the parameter assignment 1 use all conn FALSE The telegrams are only sent and received via one connection the other configured connections are on standby Once the configured reuse conn time has elapsed the system attempts to establish the faulty connections again Number of faulty STATUS STATUS OB STATUS 1A STATUS 1B RedErrS7 RedErrDev TotComErr connections Fase raise SIMATIC Modbus TCP Redundant Communication of PN H Systems 11 9 6AV6676 6MB10 0AX0 Manual Edition 1 1 Diagnostics 2 use all conn TRUE S7 is redundant the communication partner is set up as standalone The telegrams are sent and received via 2 configured connections Once the configured reuse conn time has elapsed the system attempts to establish the faulty connections again Number of faulty STATUS STATUS OB STATUS 1A STATUS 1B RedErrS7 RedErrDev TotComErr connections FF 20 TRUE TRUE FALSE FFFF FFFF TRUE TRUE FALSE 3 use all conn TRUE S7 is standalone the communication partner is set up as redundant The telegra
95. yclic interrupt OB e g OB35 There must be an OB121 in the CPU Additional information on this can be found in the section Licensing The MB PNHCL function block is called unconditionally once in OB100 e The initialization parameters must be set according to the station configuration e The initialization parameters are applied to the instance DB e The runtime parameters are not evaluated during startup e The data from MODBUS HPARAM PN is checked for plausibility In cyclic operation the PNHCL FB is called in OB35 for example e block functions are activated according to the runtime parameters e When a job is running changes to the runtime parameters are ignored e initialization parameters are not evaluated unless manual initialization is executed If the Modbus block has not been licensed for this CPU yet OB121 is called Warning The CPU will turn to STOP mode if the OB121 is not available SIMATIC Modbus TCP Redundant Communication of PN H Systems 7 2 6AV6676 6MB10 0AX0 Manual Edition 1 1 MB_PNHCL function block Modbus client Connection Active connection establishment is done by the Modbus client The required processing information is read out of the connection parameters in the MODBUS HPARAM PN DB A parameter in the connection parameter block active est is used to define whether the PN CPU is to act as active or passive communication partner With both connection type
Download Pdf Manuals
Related Search
Related Contents
Manuale Utente IONIC NRG 三菱HEMS冷蔵庫無線LANアダプター 取扱説明書 The DS2G Program User's Guide Käyttöohje 取扱説明書 Mi。ーetフオーユ一キャスタ一セッ ト MANUAL DE INSTALACIÓN DEL PROGRAMA PWXP JP マニュアル - SurgiQuest User Manual - CoaguChek USA Copyright © All rights reserved.
Failed to retrieve file