Modbus RTU device routing module based on host asynchronous agent
By introducing a Modbus RTU device routing module with host asynchronous agent into the Modbus network, the problem of insufficient communication rate in pipelined deployment environments is solved, achieving efficient Modbus device communication and maintaining network stability in fault conditions. It can be adapted to existing systems without changing the protocol.
Patent Information
- Application Number
- CN202411825210.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2044-12-12
AI Technical Summary
In a production environment with a streamlined layout, the Modbus device connection method based on RS485 bus makes it difficult to guarantee the communication rate, especially when the production line is too long or the equipment is unevenly distributed.
The Modbus RTU device routing module, based on asynchronous proxy, divides the Modbus network into backbone information links and sub-information links. It utilizes the proxy host function to conduct master-slave communication in the sub-information links and adopts asynchronous rate and full-duplex communication mode in the backbone information links to achieve efficient data transmission.
In a production environment with a streamlined layout, it achieves high-efficiency Modbus device communication rates, avoids the impact of long-distance communication, and does not affect the overall network communication when a sub-information link fails, without requiring changes to the existing Modbus communication protocol and host computer software.
Smart Images

Figure CN119728333B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of industrial control technology, and more specifically, relates to a Modbus RTU device routing module based on host asynchronous agent. Background Technology
[0002] Currently, Modbus devices based on the RS485 bus are mainly connected in two topologies: bus topology and star topology. In a bus topology, one master Modbus device and multiple slave Modbus devices share a single RS485 bus for communication. In a star topology, several Modbus devices are grouped together using multiple independent RS485 buses and connected to a Modbus gateway device acting as a central node. The central node manages the communication of all devices. Both topologies are simple in structure.
[0003] However, in a production environment with an assembly line layout: if a bus topology is used to connect all production equipment, see Appendix. Figure 1 The shared RS485 bus must be matched to the length of the production line. If the production line is too long, the data communication rate cannot be guaranteed due to the excessive length of the RS485 bus. For a star topology connecting all production equipment, see Appendix. Figure 2 Regardless of where the Modbus gateway, which serves as the central node, is placed, there will be several RS485 buses that must be connected to the Modbus gateway from a remote location, and the communication speed of the Modbus devices on these buses is difficult to guarantee. Summary of the Invention
[0004] In view of the above-mentioned defects or improvement needs of the existing technology, this application provides a Modbus RTU device routing module based on host asynchronous agent, which aims to solve the technical problem that the existing Modbus device connection method based on RS485 bus is difficult to guarantee the communication rate of Modbus devices in the face of production environment with pipeline layout.
[0005] To achieve the above objectives, in a first aspect, this application provides a Modbus RTU device routing module based on a host asynchronous agent, the Modbus RTU device routing module comprising:
[0006] The Modbus slave port is used to connect to the upstream device.
[0007] The first Modbus master port is used to connect to downstream devices;
[0008] The second Modbus master port is used to connect to slave devices;
[0009] The data control unit is configured to obtain Modbus data from a Modbus slave port, a first Modbus master port and a second Modbus master port, if a device address in the Modbus data is a slave device address of the Modbus RTU device routing module, the data control unit is configured to perform master-slave interaction of the Modbus data through the second Modbus master port and the slave device as a proxy master; if the device address is a host address, the Modbus data is output through the Modbus slave port at an asynchronous rate; otherwise, the Modbus data is output through the first Modbus master port at the asynchronous rate.
[0010] Preferably, full-duplex communication mode is adopted for data interaction between the data control unit and the upper device and between the data control unit and the lower device.
[0011] Preferably, the data control unit comprises a storage subunit configured to cache the obtained Modbus data.
[0012] Preferably, if the device address is equal to the local address, the Modbus RTU device routing module is operated based on the Modbus data.
[0013] Preferably, the upper device comprises a host and a Modbus RTU device routing module.
[0014] Preferably, the lower device comprises a Modbus RTU device routing module.
[0015] Preferably, the slave device comprises the Modbus RTU device.
[0016] In a second aspect, the application provides a Modbus RTU device routing method based on host asynchronous proxy, the Modbus RTU device routing method comprising:
[0017] The host and each Modbus routing are connected in series to form a backbone information link; each Modbus routing and its mounted slave device form a sub-information link;
[0018] The Modbus routing is configured to obtain Modbus data from the backbone information link and the sub-information link, if a device address in the Modbus data is a slave device address, the Modbus routing is configured to perform master-slave interaction of the Modbus data through the sub-information link as a proxy master and the slave device; if the device address is a host address, the Modbus data is transmitted to an upstream Modbus routing or the host through the backbone information link at an asynchronous rate; otherwise, the Modbus data is transmitted to a downstream Modbus routing through the backbone information link at the asynchronous rate.
[0019] Preferably, the backbone information link adopts a full-duplex communication mode.
[0020] Preferably, if the device address is equal to the local address, the Modbus data is operated based on the Modbus route.
[0021] Overall, compared with the prior art, the above technical solutions conceived by the present application have the following beneficial effects:
[0022] (1) The present application is suitable for a production environment arranged in a pipeline manner. A long-distance pipeline path can be arranged to cover the backbone information link, and a concentrated area of communication devices can be covered by arranging a sub-information link. Since the Modbus route in each sub-information link has the function of master-slave communication by a proxy host, master-slave communication is not required in the backbone information link, and asynchronous rate communication with a faster speed can be adopted, and a full-duplex communication mode can be adopted. Thus, the long backbone information link is difficult to affect the communication rate of the entire network, and the excessive number of slaves in the entire network does not affect the communication rate of the Modbus device, since independent communication is adopted in different sub-information links.
[0023] (2) The present application divides the Modbus network into a combination of a backbone information link and a sub-information link by a Modbus route, and separates the backbone information link and the sub-information link by different ports on the Modbus route. Even if a fault occurs in the sub-information link, it will not affect the communication of the entire network.
[0024] (3) The present application can better adapt to the existing system, without changing the original Modbus communication protocol, the host computer software and the application layer. Only the routing table of the Modbus route in the original network needs to be configured accordingly. BRIEF DESCRIPTION OF DRAWINGS
[0025] Figure 1 is a Modbus network structure diagram in a bus topology structure in a pipeline production environment in the background art of the present application.
[0026] Figure 2 is a Modbus network structure diagram in a star topology structure in a pipeline production environment in the background art of the present application.
[0027] Figure 3 is a structure diagram of a Modbus RTU device routing module based on a host asynchronous proxy provided by an embodiment of the present application.
[0028] Figure 4is a schematic diagram of a route search method provided by an embodiment of the present application.
[0029] Figure 5 is a Modbus network structure schematic diagram of the route method of the device in a pipeline production environment provided by an embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application is further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.
[0031] The terms "first" and "second" and the like in the specification and claims herein are used to distinguish different objects, and are not used to describe a specific order of the objects. For example, the first Modbus master port and the second Modbus master port are used to distinguish different Modbus master ports, and are not used to describe a specific order of the Modbus master ports.
[0032] In the embodiments of the present application, the words "exemplary" or "for example" are used to mean serving as an example, instance, or illustration. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or advantageous than other embodiments or design schemes. Rather, the use of the words "exemplary" or "for example" is intended to present relevant concepts in a concrete manner.
[0033] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "a plurality of" is two or more, for example, a plurality of slave devices means two or more slave devices, and the like; a plurality of route modules means two or more route modules, and the like.
[0034] First, the technical terms involved in the embodiments of the present application are introduced.
[0035] Modbus, Modbus is a communication protocol used for communication between devices in the field of industrial automation.
[0036] Next, the technical scheme provided in the embodiments of the present application is introduced.
[0037] Embodiment 1
[0038] As shown in Figure 3 Embodiment 1 of the present application is a Modbus RTU device routing module based on host asynchronous proxy, which includes:
[0039] Modbus slave port, used for connecting with the superior device; in the embodiment, the Modbus slave port is connected with the superior device in series; the superior device includes the host computer and the Modbus RTU device routing module.
[0040] First Modbus master port, used for connecting with the subordinate device; in the embodiment, the first Modbus master port is connected with the subordinate device in series; the subordinate device includes the Modbus RTU device routing module.
[0041] Second Modbus master port, used for connecting with the slave device; in the embodiment, the second Modbus master port is connected with the slave device; the slave device includes the Modbus RTU device.
[0042] Based on the above three interfaces, the Modbus RTU device routing module can realize the topology structure of the binary tree in the network, and the binary tree structure can be matched with the networking requirements and the routing search algorithm of various production environments by pruning branches and leaves, as shown in the specific embodiment. Figure 4
[0043] The Modbus RTU device routing module further includes:
[0044] The data control unit is used for obtaining Modbus data from the Modbus slave port, the first Modbus master port and the second Modbus master port; the Modbus data is cached in the storage subunit, and the device address of the Modbus data is obtained by protocol analysis on the Modbus data cache.
[0045] If the device address in the Modbus data is the slave device address of the Modbus RTU device routing module, the data control unit is used as a proxy host to perform master-slave interaction of the Modbus data with the slave device through the second Modbus master port; if the device address is the host computer address, the Modbus data is output through the Modbus slave port at an asynchronous rate; if the device address is equal to the local address, the Modbus RTU device routing module is operated based on the Modbus data, and the operation includes routing configuration and remote control; otherwise, the Modbus data is output through the first Modbus master port at an asynchronous rate.
[0046] The asynchronous rate is set to 10 times the master-slave interaction rate.
[0047] The data control unit and the superior device, and the data control unit and the subordinate device adopt full-duplex communication mode for data interaction.
[0048] In the sub-information link composed of the data control unit and slave devices thereof, the data control unit has the function of proxy host for master-slave communication. In the backbone information link composed of the host computer and the Modbus RTU device routing module, master-slave communication is not required, asynchronous rate communication with faster speed can be adopted, and full-duplex communication mode can be adopted. Therefore, the communication rate of the entire network will not be affected even if the backbone information link is too long. Meanwhile, all the slaves are distributed in different sub-information links, and independent communication is adopted in different sub-information links. Therefore, the communication rate of the Modbus device will not be affected even if there are too many slaves in the entire network.
[0049] The Modbus RTU device routing module of the present application further comprises:
[0050] The routing table stores the device addresses of various devices in the Modbus network, such as the device addresses of the slave devices of the Modbus RTU device routing module, the device address of the host computer, the device address of the self device, the device addresses of other Modbus RTU device routing modules, the device addresses of other slave devices, and the like.
[0051] After the data control unit analyzes the device address of the Modbus data, the device position is searched in the routing table, so as to select the port to send the Modbus data.
[0052] The Modbus RTU device routing module of the present application can be well adapted to the existing system without changing the original Modbus communication protocol. The host computer software and the application layer do not need to be changed. Only the routing table of the original Modbus routing in the network needs to be configured accordingly, and the Modbus RTU device routing module of the present application can be obtained.
[0053] Embodiment 2:
[0054] The embodiment 2 of the present application is the application of the Modbus RTU device routing method based on host asynchronous proxy in the pipeline production environment.
[0055] As shown in Figure 5 , it is a schematic diagram of the Modbus network structure composed thereof.
[0056] Among them, the host computer and the three Modbus routings adopt the form of series connection to constitute the backbone information link; each Modbus routing and the slave devices mounted thereby constitute a sub-information link; as shown in the figure, in the embodiment, the long-distance pipeline path can be covered by the backbone information link, and the area where the communication devices are concentrated can be covered by the sub-information link.
[0057] The Modbus router obtains Modbus data from the backbone information link and the sub-information link. If the device address in the Modbus data is the slave device address of the Modbus router, the Modbus router is used as a proxy master to perform master-slave interaction of the Modbus data with the slave device via the sub-information link. If the device address is the host address, the Modbus data is transmitted to the upstream Modbus router or host via the backbone information link at an asynchronous rate. If the device address is equal to the local address, the Modbus router is operated based on the Modbus data. Otherwise, the Modbus data is transmitted to the downstream Modbus router via the backbone information link at the asynchronous rate. The backbone information link uses a full-duplex communication mode. The asynchronous rate is set to be 10 times the master-slave interaction rate.
[0058] Since the Modbus router in each sub-information link has the function of proxy master for master-slave communication, the backbone information link does not need to perform master-slave communication, can use a faster asynchronous rate communication, and can use a full-duplex communication mode. Thus, the communication rate of the entire network is not affected by the length of the backbone information link. In addition, all slaves are distributed in different sub-information links, and independent communication is used in different sub-information links. Thus, the communication rate of the Modbus device is not affected by the number of slaves in the entire network.
[0059] In addition, in the embodiments of the present application, the Modbus network is divided into a combination of the backbone information link and the sub-information link by the Modbus router, and the backbone information link and the sub-information link are hardware isolated by different ports of the Modbus router. Even if a fault occurs in the sub-information link, the communication of the entire network is not affected.
[0060] It can be understood that the various numerical numbers involved in the embodiments of the present application are only used for differentiation for convenience of description, and do not limit the scope of the embodiments of the present application.
[0061] It can be understood by those skilled in the art that the above only describes the preferred embodiments of the present application, and is not used to limit the present application. Any modification, equivalent replacement and improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A Modbus RTU device routing module based on host asynchronous agent, characterized in that, The Modbus RTU device routing module includes: The Modbus slave port is used to connect to the upstream device. The first Modbus master port is used to connect to downstream devices; The second Modbus master port is used to connect to slave devices; The data control unit is used to obtain Modbus data from the Modbus slave port, the first Modbus master port, and the second Modbus master port. If the device address in the Modbus data is the slave device address of the local Modbus RTU device routing module, the data control unit acts as a proxy host to perform master-slave interaction of Modbus data with its slave device through the second Modbus master port. If the device address is the host computer address, the Modbus data is output through the Modbus slave port at an asynchronous rate. Otherwise, the Modbus data is output through the first Modbus master port at an asynchronous rate.
2. The Modbus RTU device routing module according to claim 1, characterized in that, The data control unit and the upper-level device, as well as the data control unit and the lower-level device, use full-duplex communication mode for data interaction.
3. The Modbus RTU device routing module according to claim 1, characterized in that, The data control unit includes a storage subunit for caching acquired Modbus data.
4. The Modbus RTU device routing module according to claim 1, characterized in that, If the device address is equal to the local address, then the Modbus RTU device routing module is operated based on the Modbus data.
5. The Modbus RTU device routing module according to claim 1 or 2, characterized in that, The upper-level equipment includes a host computer and a Modbus RTU device routing module.
6. The Modbus RTU device routing module according to claim 1 or 2, characterized in that, The lower-level device includes a Modbus RTU device routing module.
7. The Modbus RTU device routing module according to claim 1 or 2, characterized in that, The slave device includes the Modbus RTU device.
8. A Modbus RTU device routing method based on host asynchronous agent, characterized in that, The Modbus RTU device routing method includes: The host computer and each Modbus router are connected in series to form the backbone information link; each Modbus router and its connected slave device form a sub-information link. Modbus routing obtains Modbus data from the backbone information link and sub-information links. If the device address in the Modbus data is its slave device address, then the Modbus routing acts as a proxy host and interacts with its slave device via the sub-information link to exchange Modbus data. If the device address is a host computer address, then the Modbus data is transmitted to the upstream Modbus routing or host computer via the backbone information link at an asynchronous rate. Otherwise, the Modbus data is transmitted to the downstream Modbus routing via the backbone information link at an asynchronous rate.
9. The Modbus RTU device routing method according to claim 8, characterized in that, The backbone information link adopts full-duplex communication mode.
10. The Modbus RTU device routing method according to claim 8, characterized in that, If the device address is equal to the local address, then this Modbus route is operated based on the Modbus data.
Citation Information
Patent Citations
Method for transmitting Modbus RTU protocol in wide area network
CN113162931A
Industrial control network data acquisition system based on mobile agent
CN113965623A