A gateway system and method supporting multi-protocol PLC communication
By introducing communication protocol middleware into the PLC system, encapsulating variable information of different protocol PLCs, and using the OPC UA protocol for data exchange, the problem of communication between different brands and protocol PLCs is solved, and data interaction with multi-PLC collaborative control is realized, with high flexibility and scalability.
Patent Information
- Application Number
- CN202210798122.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-08
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2042-07-08
AI Technical Summary
The prior art is difficult to achieve simple communication between PLCs of different brands and protocols, resulting in difficulty in data interaction in multiple PLC collaborative control scenarios.
Through communication protocol middleware, variable information in PLCs in different protocols is encapsulated into intermediate protocols to realize communication between PLCs. The specific method is to use a gateway system, including PLC variable reading and writing module, PLC communication module and operation configuration module, and use the OPC UA protocol as the basis to read, write and communicate data through the OPC UA server and OPC UA client.
It realizes convenient data communication between PLCs with different protocols, meets the needs of collaborative control of multiple PLCs, and does not require modification of PLC programs, which has high flexibility and scalability.
Smart Images

Figure CN115174315B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of PLC communication, and in particular to a gateway system and method supporting multi-protocol PLC communication. Background Art
[0002] PLC (Programmable Logic Controller) is an industrial controller. Due to its powerful performance, high reliability, strong anti-interference ability and convenient operation, it is widely used in various fields of modern industrial automation control and serves as the control hub of automation systems such as automation equipment and automated assembly lines.
[0003] In a complete automation control system, a single PLC may not be able to meet the control requirements due to performance or functional limitations. In this case, multiple PLCs are required to work together to achieve collaborative control. In this scenario, data interaction and communication between PLCs becomes a core issue that needs to be solved. Among the existing communication solutions, Ethernet communication has been favored by the industry due to its large communication data volume and high communication rate, and has now become the mainstream communication method. For PLCs of the same brand, manufacturers generally provide communication solutions based on their own Ethernet protocols, but when it comes to PLCs of different brands and protocols, there is currently no simpler communication method due to the inconsistency of communication protocols between PLCs. Summary of the invention
[0004] In view of the problems existing in the above-mentioned technology, the present invention provides a method for supporting multi-protocol PLC communication. The method does not directly implement address exchange between PLCs, but encapsulates variable information in different protocol PLCs into an intermediate protocol through communication protocol middleware, and implements communication indirectly. Based on this method, the present invention develops a gateway system, which is connected to the PLC device through Ethernet. Data communication between different protocol PLCs can be realized through relatively convenient parameter configuration, meeting the needs of collaborative control of multiple PLCs.
[0005] The present invention provides a gateway system supporting multi-protocol PLC communication, comprising: a PLC variable reading and writing module, a PLC communication module and an operation configuration module;
[0006] The PLC variable reading and writing module is based on the TCP protocol and is used to read and write variable information in PLCs with different communication protocols and establish a Socket connection with the PLC;
[0007] PLC communication module, used to realize the master-slave communication between PLCs, and directly coupled with the PLC variable reading and writing module;
[0008] The PLC communication module is a Client / Server architecture;
[0009] The operation configuration module is developed based on Java and JavaScript languages and is a web application built on the SpringBoot framework. The front-end configuration page is built using technologies such as the Vue.js framework based on JavaScript language.
[0010] The system is mainly developed using Java language. It can run well on both Linux and Windows systems and has good cross-platform performance. The system can be deployed on small industrial computers and Linux development boards to transform the hardware system into a gateway device. The PLC communication module is based on the OPC UA protocol. By modifying the node value through the OPC UA server and OPC UA client, the variable information in the PLC is read, written and modified indirectly, realizing the master-slave communication between PLCs. The front-end configuration page in the operation configuration module is constructed using technologies such as the Vue.js framework based on the JavaScript language. Its main function is to facilitate developers to use and configure the entire system, including establishing a connection with the PLC, creating and mapping communication nodes, and starting communication services.
[0011] The present invention also provides a method for supporting multi-protocol PLC communication, comprising the following steps:
[0012] Step 1: Determine the PLC model and IP address, and determine the PLC variable address and variable mapping relationship required for communication based on the on-site process requirements and PLC program;
[0013] Step 2: According to the PLC model, determine the protocol class required for TCP communication with the PLC, instantiate the protocol class, and establish a socket connection;
[0014] Step 3: The communication protocol middleware creates a communication master station and a communication slave station for the PLC in the communication chain, and creates communication nodes for the communication master station and the communication slave station according to the communication variable information determined in step 1;
[0015] Step 4: Add variable mapping relationships for the communication master and communication slave created in step 3, based on the variable mapping relationships determined in step 1, and ensure that the node data types mapped at both ends are the same and the inputs and outputs correspond.
[0016] Preferably, the step 2 further comprises the following sub-steps:
[0017] Sub-step 21: The PLC variable read / write module receives configuration data, including the PLC model and IP address;
[0018] Sub-step 22: According to the ID of the PLC model, query the corresponding communication protocol in the database;
[0019] Sub-step 23: Instantiate according to the queried communication protocol type and the obtained IP address;
[0020] Sub-step 24: Establish socket connection objects for PLCs of different protocols, and read and write data through write() and read() in the connection objects.
[0021] Preferably, the step three further comprises the following sub-steps:
[0022] Sub-step 31: Establish an OPC UA server for a PLC in the communication chain, encapsulate the communication variable information of the PLC into a node form in the OPC UA address space, and then start an OPC UA server using the address space object as a parameter. The PLC in the communication chain is the communication master station;
[0023] Sub-step 32: Establish an OPC UA client for the remaining PLCs in the communication chain, instantiate an OPC UA client object with a subscription function, and use the OPC UA client to call the PLC's data read and write module to read and write variables.
[0024] The essential features of the present invention are: a multi-protocol PLC communication method in the present invention is highly versatile, and PLCs with the same or different protocols can realize communication functions through this system; it is non-invasive, and there is no need to modify the PLC program during the communication process; it is highly flexible, and the two PLCs do not communicate directly, but are decoupled by means of a communication protocol middleware, and the communication node information and node mapping relationship can be changed at any time according to needs.
[0025] The gateway system device supporting multi-protocol PLC communication in the present invention is easy to expand. The PLC variable reading and writing module adopts a plug-in development method. Only the module needs to be expanded and developed to support new PLCs. The core module of this system is based on the C / S architecture of the OPC UA protocol. It can not only realize the communication between PLC hardware, but also read the variable information in the PLC based on the OPC UA protocol, thereby realizing the collection and monitoring of the operating status information of field equipment or assembly lines. With the advantages of the OPC UA protocol, the integration of "OT" and "IT" is realized, providing data support for edge computing and cloud computing. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a system architecture diagram for realizing communication by the gateway system in the present invention;
[0027] Figure 2is a step diagram of the communication method of the present invention;
[0028] Figure 3 It is the PLC variable reading and writing module that establishes the connection flow chart according to the PLC model;
[0029] Figure 4 It is the flow chart of how the PLC communication module realizes communication;
[0030] Figure 5 It is the connection test and communication node configuration diagram of the gateway system;
[0031] Figure 6 It is the communication service settings and communication node mapping diagram. DETAILED DESCRIPTION
[0032] The technical solution of the present invention is further described in detail below through specific embodiments in conjunction with the accompanying drawings.
[0033] Example 1
[0034] like Figure 1 As shown in the figure, it is the overall architecture diagram of using the gateway system for communication, which is divided into system operation medium, operation configuration module, PLC variable reading and writing module, and PLC communication module. Figure 2 As shown, it is a step diagram of the communication method in the present invention. The communication method in the present invention is described in detail below in combination with the above modules.
[0035] 1. In the operation configuration module, enter the model and IP address of the PLC with the same or different protocol that needs to communicate, and perform a connection test on the PLC.
[0036] 2. If Figure 3 The figure shows the connection flow chart of the PLC variable read-write module according to the PLC model. Because the operation configuration module and the PLC variable read-write module are directly coupled, the PLC variable read-write module will receive the configuration data from the front end. This module will search for the corresponding protocol class in the MySQL database according to the ID of the PLC model. For example, Siemens PLC corresponds to SiemensTcp class, Mitsubishi PLC corresponds to MelsecFxTcp class, Xinje PLC corresponds to XinJeTcp class, and so on. After finding the corresponding protocol class, the PLC model and IP address sent by the front end are used as parameters to instantiate the protocol class, so that a socket connection object with different protocol PLCs can be established, and specific data in the PLC can be read and written through methods such as write() and read() in the connection object.
[0037] 3. After the PLC variable read / write module successfully establishes a connection with a PLC of a different protocol, according to the communication method of the present invention, to realize the communication between two PLCs, it is necessary to introduce a communication protocol middleware. The communication protocol middleware here is the PLC communication module implemented based on the OPC UA protocol, which is also the core module of the entire method. This module is mainly implemented based on the Client / Server architecture of the OPC UA protocol, in which the OPC UA client will browse and subscribe to the nodes in the OPC UA server. Figure 4 As shown, first, this module will establish an OPC UA server for a PLC in the communication chain, that is, encapsulate the communication variable information of the PLC into the node form in the OPC UA address space, and then use the address space object as a parameter to start an OPC UA server. The PLC is the communication master in the communication chain; then, this module will establish an OPC UA client for the remaining PLCs, that is, instantiate an OPC UA client object with a subscription function, and use the OPC UA client to call the PLC's data read and write module to read and write specific variables. The communication node of the slave station is the specific variable here, and these PLCs are communication slaves in the communication chain.
[0038] 4. After the PLC communication module has established the communication master station, communication slave station and communication node, the OPC UA server and OPC UA client can be used to modify the node information to indirectly realize the communication between the two PLCs. Figure 4 As shown in the figure, the solid arrow is the process of the master station PLC writing data to the slave station PLC, and the dotted arrow is the process of the slave station PLC writing data to the master station PLC. The more detailed communication process is as follows:
[0039] ① When the variable information in the master PLC changes, the output node information in the OPC UA server will change. At this time, when the UaMonitoredItem (monitor object) of the OPC UA client detects the change in node data, it will activate the callback function. The callback function will extract the variable information stored in the changed node information, call the PLC data read and write module, and write the data to the slave PLC.
[0040] ② Establish a real-time background thread, in which the OPC UA client will cyclically call the slave PLC data read and write module to continuously write data to the input node of the OPC UA server. Therefore, when the variable information in the slave PLC changes, the node information of the OPC UA server will also change, and the changed data will be written to the master PLC.
[0041] In this way, the exchange of variable information between PLCs of different protocols is completed, and communication between PLCs is indirectly realized.
[0042] Taking the automated control system of a manipulator material picking and placing module of a certain automated equipment as an example, the gateway system is deployed on a small industrial computer to implement the communication method in the invention. The following are the specific implementation steps.
[0043] Step 1: Insert the Siemens S7-200Smart PLC and Xinjie XD5E-60T6-E PLC into the Ethernet port of the industrial computer respectively; start the industrial computer and set the static IP addresses of the two network ports to be in the same network segment as the IP address of the PLC; then use a network cable to connect the PC used for configuration to the industrial computer, and still ensure that the static IPs of the two devices are in the same network segment. Here, set the static IP of the network port connecting the industrial computer and PC to "192.168.3.1".
[0044] Step 2: If Figure 5 As shown, open the Chrome browser on the PC and enter http: / / 192.168.3.1:8080 / comm in the URL bar to open the gateway system. In the system, select the PLC model, fill in the PLC IP address, and test the connection between the system and the PLC. At this time, the PLC variable read and write module will search for the SiemensTcp class corresponding to S7-200Smart and the XinJeTcp class corresponding to XD5E-60T6-E, instantiate these two examples, and establish a connection with the PLC socket.
[0045] Step 3: After the connection is successful, Figure 5 As shown in the figure, in the master node list, create the variables M20.0, M20.1, V20.0, V20.1, VD20, and VD32 in S7-200Smart as communication nodes and add them to the node manager Master01; in the slave node list, create the variables M110, M111, M100, M101, D10, and D18 in XD5E-60T6-E as communication nodes and add them to the node manager Slave01. At this time, the PLC communication module uses S7-200Smart as the communication master station and XD5E-60T6-E as the communication slave station, and creates the communication nodes corresponding to the master and slave stations.
[0046] Step 4: If Figure 6As shown in the figure, in the communication service settings, set the OPC UA server parameters of the master station PLC. Then add the mapping relationship between the PLC master station communication node and the PLC slave station communication node in the node mapping list. When adding the mapping relationship, first of all, according to the actual needs, secondly, ensure that the data types of the two mapped nodes are the same, and the input and output correspond correctly. After setting the corresponding parameters, you can start the communication service to realize multi-protocol PLC communication. After starting the communication service, an OPC UA server link will be automatically generated. Through this link, based on the OPC UA protocol, you can collect variable information in the PLC and obtain the device operation status.
Claims
1. A method for supporting multi-protocol PLC communication, characterized in that: The following steps are involved: Step 1: Determine the PLC model and IP address, and determine the PLC variable address and variable mapping relationship required for communication based on the on-site process requirements and PLC program; Step 2: According to the PLC model, determine the protocol class required for TCP communication with the PLC, instantiate the protocol class, and establish a socket connection; Sub-step 21: The PLC variable read / write module receives configuration data, including the PLC model and IP address; Sub-step 22: According to the ID of the PLC model, query the corresponding communication protocol in the database; Sub-step 23: Instantiate according to the queried communication protocol type and the obtained IP address; Sub-step 24: Establish socket connection objects for PLCs with different protocols, and read and write data through write() and read() in the connection objects; Step 3: The communication protocol middleware creates a communication master station and a communication slave station for the PLC in the communication chain, and creates communication nodes for the communication master station and the communication slave station according to the communication variable information determined in step 1; Sub-step 31: Establish an OPC UA server for a PLC in the communication chain, encapsulate the communication variable information of the PLC into a node form in the OPC UA address space, and then start an OPC UA server with the address space object as a parameter. The PLC in the communication chain is the communication master station; Sub-step 32: Establish an OPC UA client for the remaining PLCs in the communication chain, instantiate an OPC UA client object with a subscription function, and use the OPC UA client to call the PLC's data read and write module to read and write variables; Step 4: Add variable mapping relationships for the communication master and communication slave created in step 3, based on the variable mapping relationships determined in step 1, and ensure that the node data types mapped at both ends are the same and the inputs and outputs correspond.
Citation Information
Patent Citations
Industrial field oriented intelligent Internet-of-things gateway
CN108833269A
Method and device for collecting data, storage medium and processor
CN109284294A