How to realize the communication between Siemens S7-300 PLC and DCS control system

How to Realize the Communication between Siemens S7-300 PLC and DCS Control System——Application of Shanghai Zibo Automation Modbus to Profibus-DP Gateway Abstract: This article is about the Siemens S7-300 PLC and Yokogawa CS3000 DCS distributed control system. Communication, how to realize mutual communication between Modbus and Profibus-DP protocol devices, the application of Shanghai Zibo Automation's Modbus to Profibus-DP gateway PM-160, and the communication modes of these two different communication protocols.
Keywords: Modbus Protocol Profibus-DP Protocol Modbus to Profibus-DP Serial to Profibus-DP Distributed Control System Communication Network I. INTRODUCTION The rapid development of modern industry has continuously promoted the development of automation control technology and equipment communication technology innovation. Currently, PLCs, DCSs, smart meters, etc. have been widely used in field production control systems and have evolved into a distributed industrial control system in which the above devices cooperate with each other and face the entire production process. In this system, fieldbus communication technology is crucial. This paper describes the application of Shanghai Zibo Automation's Modbus to Profibus-DP protocol gateway device for a water conservancy station distributed control system project.
Second, the system composition
1. System Structure The system is composed as shown in Fig. 1, in which the field-level control devices other than Siemens S7-300 PLC are omitted. The system upper computer uses Yokogawa CS3000 DCS distributed control system to achieve centralized monitoring of the entire water conservancy project. One of the lower computers adopts the Siemens S7-300 series PLC to realize various on-site intelligent instruments, including on-site motors, intelligent switches, frequency converters, sensors, start-stop control and information acquisition of detection equipment.

Fig. 1 System Structure In the system structure shown in the figure above, various on-site smart meters (using the Modbus protocol or various non-standard protocols, and the interfaces are RS485, RS422, or RS232) can all pass through Shanghai Zibo Automation's universal serial port ( The Modbus/RS485/RS422/RS232) to Profibus-DP gateway PM-160 is connected to the Siemens S7-300 PLC. At this time, the protocol type of the gateway PM-160 on the serial port side is Modbus master or universal mode. Yokogawa DCS also uses Siemens Automation's universal serial port (Modbus/RS485/RS422/RS232) to Profibus-DP gateway PM-160 for data acquisition and monitoring of Siemens S7-300 PLC. At this time, the gateway PM-160 is on the serial port. The protocol type on the side is a Modbus slave.
2, communication network composition
2.1 Introduction to Profibus Protocol
PROFIBUS is one of the most popular field bus standards in the world. With its unique technical features, strict certification standards, open standards, support from numerous manufacturers, and continuously developing application profiles, PROFIBUS has become the most important and widely used. Fieldbus standard.
The PROFIBUS fieldbus communication protocol consists of three main parts:
• PROFIBUS DP: Round-robin communication between the master station and the slave station. It is mainly used for cell-level and field-level communication in automation systems.
• PROFIBUS PA: Power and communication data are transmitted in parallel via the bus and are mainly used for cell-level and field-level communication in process-oriented automation systems.
• PROFIBUS FMS: Defines the communication model between the master station and the master station. It is mainly used for the system-level and plant-level process data exchange in the automation system. PROFIBUS-DP is a high-speed network and the communication speed reaches 12M. PROFIBUS-DP can connect remote I/O, actuator, intelligent motor controller, human-machine interface HMI, valve positioner, inverter and other intelligent devices. A PROFIBUS-DP bus can connect up to 123 slave devices. The topology of PROFIBUS-DP can be bus type, star type and tree type. The communication medium can be shielded twisted pair, optical fiber and infrared transmission. When using twisted pair, the repeater can reach the maximum communication distance. 1.2 kilometers, up to 9 repeaters can be used, and the maximum communication distance can reach 9 kilometers. When optical fiber is used, the farthest communication distance can reach more than 100 kilometers. Multi-film optical fiber is used. The longest distance between two points can reach 3 kilometers. When single-fiber optical fiber is used, the longest distance between two points can reach 3 kilometers.
2.2 Introduction to Modbus Protocol
The Modbus protocol is a master-slave serial communication protocol suitable for industrial control applications. It uses query communication to transfer information between master and slave devices, and can address 1-247 device address ranges. The protocol includes broadcast inquiry and separate device inquiry. The difference between the two is that the broadcast query does not need to respond to information from the device. The communication process of the master and slave devices is shown in Figure 2:


Figure 2 Modbus master and slave device query response
Modbus protocol commonly used function code shown in Figure 3:

Figure 3 Modbus protocol commonly used function code
The Modbus protocol has two transmission modes: ASCII mode and RTU mode. With the baud rate, RTU mode can transmit more data than ASCII mode, so most industrial networks use RTU mode. The information transmission packet format in RTU mode is shown in Figure 4:

Figure 4 Modbus RTU message format It does not have a start bit and a stop bit, but it is the start and end of the message with an interval of at least 3.5 characters. All character bits of information frame are composed of hexadecimal characters 0-9, AF.
Modbus RTU communication protocol frame structure:

Figure 5 RTU communication protocol frame format
Example of Modbus RTU master reading slave register data: query by master device.

Figure 6 Main device query format
Example of Modbus RTU mode master reading slave register data: Slave response.

Figure 7 Slave device response format
2.3 Network Composition and Hardware Introduction As shown in Figure 1, two networks in this system design use Shanghai Zibo Automation's Modbus to Profibus-DP gateway PM-160. The role of the gateway in these two networks is different, including:
In the upper network (establishing the Siemens S7-300 PLC and Yokogawa DCS connection communication), the Modbus to Profibus-DP gateway PM-160 acts as a Modbus slave on the Modbus side, a slave on the Profibus-DP side, and a Profibus-DP master station. (Siemens S7-300 PLC) Communication with Modbus Master (Yokogawa CS3000). The DCS communication part adopts the communication module of Yokogawa model ALR121, and supports the Modbus communication software package provided by Yokogawa. The maximum communication data capacity of the communication module is 4000 words. Through the gateway configuration software of Shanghai Zibo Automation, the PM-160 is configured, and the read and write commands and data of the DCS are converted and stored accordingly, and mapped to the input and output image area of ​​the Siemens PLC to realize the upper and lower machines. Real-time transmission of control information.
In the lower network (establishing Siemens S7-300 PLC and field smart meter connection communication), the Modbus to Profibus-DP gateway PM-160 acts as a Modbus master on the Modbus side, a slave on the Profibus-DP side, and a Modbus slave ( On-site various smart meters (field motors, smart switches, frequency converters, sensors, etc.) communicate with Profibus-DP masters (Siemens S7-300 PLC). The serial network (field smart meter) device interface is RS485 or RS232. They can all communicate with Siemens S7-300 PLC through Shanghai Zibo Automation's Modbus to Profibus-DP gateway PM-160. Among them, through the use of gateway matching configuration software to PM-160 related configuration, the need to collect the slave station equipment information through the gateway read and write commands and data conversion, storage, mapping to Siemens PLC input and output mapping area to achieve PLC collects and monitors data from on-site smart meters.
Third, Modbus to Profibus-DP gateway PM-160 configuration PM-160 is a general-purpose Modbus/RS485/RS422/RS232 to Profibus-DP protocol conversion gateway, established in the gateway RAM Modbus/RS485/RS422/RS232 to Profibus - DP mapping data area, software implementation Modbus/RS485/RS422/RS232 to Profibus-DP protocol conversion and data exchange. Any device (Modbus protocol or non-standard protocol) with RS485/422/232 interface can be interconnected with the fieldbus Profibus-DP through the PM-160. Among them, PM-160 communicates with Profibus-DP as Profibus-DP slave station, PM-160 can be used as Modbus master station, Modbus slave station when communicating with serial device, also can support the transparent transmission of data with non-standard serial device . By registering the GSD file of the gateway PM-160 in Siemens STEP7, the relevant hardware and software configuration of the gateway can be performed in the programming software to complete the corresponding communication function. See detailed hardware and software configuration methods below:
1. Hardware configuration of Modbus to Profibus-DP gateway PM-160
The PM-160's Profibus-DP slave address can be set via the gateway's hardware rotary encoder or configuration button. The rotary switch has two bits, the left bit is set to the address high (ten bits), and the right bit is set to the address low bit (units). The DIP switch can be used to set the gateway PM-160 to normal operation or configuration. When the PM-160 is in the configuration state, the user can set related read/write commands and parameters through the configuration software.
The PM-160 comes with a standard Profibus-DP interface that users can connect to Profibus-DP fieldbus using standard Profibus-DP connectors and standard Profibus-DP cables.
PM-160 provides three kinds of serial ports: RS485/422/232. Modbus slaves, master devices and user non-standard serial devices can communicate with gateway PM-160 through these three interfaces. The PM-160 does not have a built-in terminating resistor. When performing RS485 communication, please note that a termination resistor (120 ohms) is added to each terminal of the RS485 bus.
2. Software configuration of Modbus to Profibus-DP gateway PM-160
1) Set the PM-160 field total new and subnet-related parameters and commands using the matching software to set the PM-160 to the configuration state through the dial switch, open the installed configuration software (product CD or visit http://DownLoad01.asp) :
When implementing PLC and DCS communication, the subnet protocol type is set to Modbus slave, and set the serial communication baud rate, data bit, parity bit, stop bit, PM-160 as Modbus slave address, communication interface. Among them, the serial communication baud rate, data bit, parity bit, stop bit setting should be consistent with the connected Modbus master station equipment (DCS);

Figure 8 PM-160 as a Modbus slave on the Modbus side (connection to PLC and DCS)
When the communication between the PLC and the Modbus device is realized, the subnet protocol type is set to the Modbus master station, and the serial port communication parameters, the communication transmission mode, and the communication interface are set. Among them, the setting of serial communication parameters should be consistent with the connected Modbus slave device:

Figure 9 PM-160 as a Modbus master on the Modbus side (connecting PLCs and Modbus slaves)
Among them, “node-1” in FIG. 9 indicates that the connected slave station device address is 1, and two commands “read holding register” and “preset multiple registers” are configured, indicating that the gateway reads the corresponding address of the slave station. Data, and can output data to the Modbus slave device, the command configuration method is as follows:

Figure 10 PM-160 as a Modbus master on the Modbus side (command configuration)
Modbus register start address: The Modbus register start address of the user input target acquisition data;
Number of data: the number of registers or coils of the target data;
Memory map start address: Corresponding memory buffer address for Modbus slave device data.

When the communication between the PLC and the non-standard protocol device is realized, the subnet protocol type is set to the universal mode, and serial port communication parameters, control modes, and communication interfaces are set. Among them, the setting of serial port communication parameters should be consistent with the connected non-standard serial device (field smart meter): The common mode supported by PM-160 is the transparent transmission mode. Users can judge the data by the data length and transaction serial number in the data. Integrity and whether it is a frame of new data.

Figure 11 Common mode

2) Configuration of Gateway M-160 in STEP 7 On the hardware configuration screen of STEP 7, import the GSD file corresponding to the PM-160 and add the PM-160 configuration file to the STEP7 device configuration library. The user can find the registered device in the hardware configuration interface: Catalog->PROFIBUS DP->Additional Field Devices->General->CONVERTER->PM-160.

Figure 12 Configuration Interface

After adding the PM-160 to the configuration page of STEP7, you can insert the corresponding data block for address mapping of the image area. PM-160 provides the following data blocks:

Figure 13 Data block provided by PM-160 Push the required input and output data blocks to the corresponding slot in the gateway. As shown in the figure below, drag the data block “24Words Input, 24Words Output” to the slot of PM-160 with Profibus-DP slave address 3. At this time, the corresponding address of the mapping area is 256, and the PLC program needs to The corresponding data is addressed via PIW256 (PIB256) or PQW256 (PQB256).

Figure 14 Start address of PLC image area (command configuration)
Fourth, data read and write
1, DCS read and write PLC data
DCS reads and writes PLC data through the PM-160 as a Modus master station, and reads data using the 04H function code. The corresponding register start address is 0H (30001H), and the data is written using the 10H (03H) function code. The corresponding register start address is 0H (40001H).
2, PLC read and write field instrumentation data
1) PLC reads and writes Modbus slave device data
The PLC sends and receives the Modbus master command to read and write the field serial device data through the PM-160. The relationship between the start address of the image area and the start address of the gateway memory map is as follows: Take the configuration in Figure 14 as an example.

Figure 15 PLC reading and writing Modbus slave device data address correspondence through PM-160
2) PLC reads and writes non-standard serial device data
The first two bytes of the input mapping area of ​​the PLC indicate the serial data length and transaction serial number of the received data respectively, and the others are the received data. The serial number of the transaction changes, indicating that a new serial port data has been received. Among them, you can configure the software to set whether to enable the serial data length function. The first two bytes of the PLC's output mapping area indicate the serial port data length and transaction serial number that are sent respectively, and the others are the serial port data to be sent. The serial number of the transaction changes, and the PLC sends serial data of the corresponding length.
V. CONCLUSION In this system, the Modbus to Profibus-DP gateway PM-160 plays three roles: establishing a connection between the Modbus master and the Profibus-DP master (Modbus master mode); establishing a Modbus slave and Communication between Profibus-DP masters (Modbus Slave mode); connection communication between non-standard serial devices and Profibus-DP masters is recommended (universal mode). Since the operation of this communication system, the entire system has communicated normally, which has effectively ensured the normal operation of the entire water conservancy project control system. The use of Shanghai Zibo Automation's Modbus to Profibus-DP gateway can greatly facilitate automation of industrial field control and operation.

With Cummins Engine Generator

With Cummins Engine Generator,Cummins Diesel Generator,Cummins Diesel Generator Set,Cummins Diesel Generator Get

Shanghai Kosta Electric Co., Ltd. , https://www.shkostagenerator.com

Posted on