Modbus RTU equipment routing module based on host asynchronous proxy
By using the Modbus RTU device routing module based on host asynchronous agent in a production environment with pipeline layout, the problem of difficult to guarantee the communication rate of Modbus devices is solved, efficient Modbus device communication is achieved, and adapted to existing systems.
Patent Information
- Application Number
- CN202411825210.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-12
AI Technical Summary
In a production environment with pipeline layout, the connection method of Modbus equipment based on the RS485 bus is difficult to ensure the communication rate of Modbus equipment, especially in bus-type topology and star topology.
The Modbus RTU device routing module based on a host asynchronous proxy is adopted, which includes a Modbus slave port, a first Modbus master port, a second Modbus master port and a data control unit. The master-slave interaction is performed through the data control unit as a proxy host, and hardware isolation is performed between the backbone information link and the sub-information link.
It is realized that in a production environment with pipeline layout, the long-distance RS485 bus no longer affects the communication rate of the Modbus device, and failures in the sub-information link will not affect the entire network communication. At the same time, it is adapted to the existing system without changing the Modbus communication protocol.
Smart Images

Figure CN119728333A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of industrial control technology, and more specifically, relates to a ModbusRTU device routing module based on a host asynchronous agent. Background Art
[0002] At present, the connection methods of Modbus devices based on RS485 bus mainly include bus topology and star topology. Among them, the bus topology is that a master Modbus device and multiple slave Modbus devices share an RS485 bus for communication; the star topology is that several Modbus devices are grouped and connected to the Modbus gateway device as the central node through multiple independent RS485 buses. The central node is responsible for managing the communication of all devices. The advantages of these two topologies are simple structure.
[0003] However, in a production environment with assembly line layout: If a bus topology is used to connect all production equipment, see Appendix Figure 1 , the only common RS485 bus must match the length of the assembly line. When the assembly line is too long, the data communication rate cannot be guaranteed due to the length of the RS485 bus. If a star topology is used to connect all production equipment, see the attached Figure 2 No matter where the Modbus gateway as the central node is placed, there will be several RS485 buses that must be connected to the Modbus gateway from the remote end, and the communication rate of the Modbus devices on these buses is difficult to guarantee. Summary of the invention
[0004] In view of the above defects or improvement needs of the prior art, the present application provides a Modbus RTU device routing module based on a host asynchronous agent, which aims to solve the technical problem that the communication rate of the Modbus device is difficult to guarantee when facing a production environment with a pipeline layout using the existing Modbus device connection method based on RS485 bus.
[0005] To achieve the above objectives, in a first aspect, the present application provides a Modbus RTU device routing module based on a host asynchronous agent, the Modbus RTU device routing module comprising:
[0006] Modbus slave port, used to connect to the upper-level device;
[0007] The first Modbus master port is used to connect to the lower-level device;
[0008] The second Modbus master port is used to connect to the slave device;
[0009] A 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 Modbus RTU device routing module, the data control unit is used 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.
[0010] Preferably, a full-duplex communication mode is used for data exchange between the data control unit and the upper-level device, and between the data control unit and the lower-level device.
[0011] Preferably, the data control unit includes a storage subunit for caching the acquired Modbus data.
[0012] Preferably, if the device address is equal to the local address, the ModbusRTU device routing module is operated based on the Modbus data.
[0013] Preferably, the upper-level device includes a host computer and a Modbus RTU device routing module.
[0014] Preferably, the lower-level device includes a Modbus RTU device routing module.
[0015] Preferably, the slave device includes the Modbus RTU device.
[0016] In a second aspect, the present application provides a Modbus RTU device routing method based on a host asynchronous agent, the Modbus RTU device routing method comprising:
[0017] The host computer and each Modbus router are connected in series to form a trunk information link; each Modbus router and its mounted slave device form a sub-information link;
[0018] The Modbus router obtains Modbus data from the trunk information link and the sub-information link. If the device address in the Modbus data is the slave device address, the Modbus router is used as a proxy host and its slave device performs master-slave interaction of Modbus data via the sub-information link; if the device address is the host computer address, the Modbus data is transmitted to the upstream Modbus router or host computer via the trunk information link at an asynchronous rate; otherwise, the Modbus data is transmitted to the downstream Modbus router via the trunk information link at an 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 route is operated based on the Modbus data.
[0021] In general, the above technical solutions conceived by this application have the following beneficial effects compared with the prior art:
[0022] (1) The present application scheme is suitable for production environments with assembly line layout. Long-distance assembly line paths can be covered by laying out trunk information links, and areas where communication equipment is concentrated can be covered by laying out sub-information links. Since the Modbus routing in each sub-information link has the function of acting as a proxy host for master-slave communication, there is no need for master-slave communication in the trunk information link, and a faster asynchronous rate communication can be used, and a full-duplex communication mode can be used. In this way, even if the trunk information link is too long, it is difficult to affect the communication rate of the entire network. At the same time, all slaves are distributed in different sub-information links, and independent communication is used in different sub-information links. Therefore, too many slaves in the entire network will not affect the communication rate of the Modbus device.
[0023] (2) The present application divides the Modbus network into a combination of a trunk information link and a sub-information link through Modbus routing, and performs hardware isolation between the trunk information link and the sub-information link through different ports on the Modbus routing; 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 solution can be well adapted to the existing system without changing the original Modbus communication protocol, and the host computer software and application layer do not need to be changed. It can be completed by simply configuring the routing table of the Modbus routing in the original network accordingly. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a schematic diagram of a Modbus network structure using a bus topology in an assembly line production environment in the background technology of this application.
[0026] Figure 2 It is a schematic diagram of a Modbus network structure using a star topology in an assembly line production environment in the background technology of this application.
[0027] Figure 3 It is a structural diagram of a Modbus RTU device routing module based on host asynchronous agent provided in an embodiment of the present application.
[0028] Figure 4It is a schematic diagram of the routing search method provided in an embodiment of the present application.
[0029] Figure 5 It is a schematic diagram of the Modbus network structure using the device routing method of the present application in the assembly line production environment provided by the embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying 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" in the specification and claims herein are used to distinguish different objects rather than to describe a specific order of the objects. For example, a first Modbus master port and a second Modbus master port are used to distinguish different Modbus master ports rather than to describe a specific order of the Modbus master ports.
[0032] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0033] In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more than two. For example, multiple slave devices refer to two or more slave devices, etc.; multiple routing modules refer to two or more routing modules, etc.
[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 solutions provided in the embodiments of the present application are introduced.
[0037] Embodiment 1:
[0038] like Figure 3 As shown, it is embodiment 1 of the present application, a Modbus RTU device routing module based on host asynchronous agent, which includes:
[0039] The Modbus slave port is used to connect to the upper-level device. In this embodiment, the Modbus slave port is connected in series with the upper-level device. The upper-level device includes a host computer and a Modbus RTU device routing module.
[0040] The first Modbus master port is used to connect to the lower-level device. In this embodiment, the first Modbus master port is connected in series with the lower-level device. The lower-level device includes a Modbus RTU device routing module.
[0041] The second Modbus master port is used to connect to the slave device. In this embodiment, the slave device is mounted through the second Modbus master port. The slave device includes the Modbus RTU device.
[0042] Based on the above three interfaces, the Modbus RTU device routing module of this application can realize the binary tree topology in the network, and the binary tree structure can match the networking requirements and routing search algorithms of various production environments by pruning branches and leaves, as shown in the following example: Figure 4 shown.
[0043] The Modbus RTU device routing module of this application also includes:
[0044] 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; the Modbus data is cached in the storage subunit, and the Modbus data cache is parsed by protocol to obtain the device address of the Modbus data.
[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 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; 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 operations here include routing configuration and remote control operations; 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] Wherein, the data control unit and the upper-level device, and the data control unit and the lower-level device use a full-duplex communication mode for data exchange.
[0048] In the sub-information link composed of the data control unit and its slave devices, the data control unit has the function of acting as an agent for the host to perform master-slave communication. In the trunk information link composed of the host computer and the Modbus RTU device routing module, there is no need for master-slave communication. A faster asynchronous rate communication can be used, and a full-duplex communication mode can be used. In this way, the communication rate of the entire network will not be affected if the trunk information link is too long. At the same time, all slaves are distributed in different sub-information links, and independent communication is used in different sub-information links. Therefore, too many slaves in the entire network will not affect the communication rate of the Modbus device.
[0049] The Modbus RTU device routing module of this application also includes:
[0050] The routing table stores the device addresses of each device in the Modbus network, for example: the device address of the slave device under the Modbus RTU device routing module; the device address of the host computer; its own device address; the device address of other Modbus RTU device routing modules; the device address of other slave devices; and so on.
[0051] After parsing the device address of the Modbus data, the data control unit will search for the device location in the routing table to select a port to send the Modbus data.
[0052] The Modbus RTU device routing module in the present application can be well adapted to the existing system without changing the original Modbus communication protocol, and the host computer software and application layer do not need to be changed. The Modbus RTU device routing module of the present application can be obtained by simply configuring the routing table of the Modbus routing in the original network accordingly.
[0053] Embodiment 2:
[0054] Embodiment 2 of the present application is an application of a Modbus RTU device routing method based on host asynchronous agent in an assembly line production environment.
[0055] like Figure 5 As shown, this is a schematic diagram of the Modbus network structure it consists of.
[0056] Among them, the host computer and three Modbus routers are connected in series to form a trunk information link; each Modbus router and its mounted slave device constitute a sub-information link; as shown in the figure, in this embodiment, the long-distance pipeline path can be covered by the trunk information link, and the area where the communication equipment is concentrated is covered by the sub-information link.
[0057] The Modbus router obtains Modbus data from the trunk information link and the sub-information link. If the device address in the Modbus data is the slave device address, the Modbus router is used as a proxy host and its slave device to perform master-slave interaction of Modbus data via the sub-information link; if the device address is the host computer address, the Modbus data is transmitted to the upstream Modbus router or host computer via the trunk 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 trunk information link at an asynchronous rate. The trunk information link adopts full-duplex communication mode. The asynchronous rate is set to 10 times the master-slave interaction rate.
[0058] Since the Modbus routers in each sub-information link have the function of acting as a proxy host for master-slave communication, there is no need for master-slave communication in the main information link. A faster asynchronous rate communication can be used, and a full-duplex communication mode can be used. In this way, a long main information link will not affect the communication rate of the entire network. At the same time, all slaves are distributed in different sub-information links, and independent communication is used in different sub-information links. Therefore, too many slaves in the entire network will not affect the communication rate of the Modbus device.
[0059] In the embodiment of the present application, the Modbus network is divided into a combination of a trunk information link and a sub-information link through Modbus routing, and the trunk information link and the sub-information link are hardware isolated through different ports on the Modbus routing; even if a fault occurs in the sub-information link, it will not affect the communication of the entire network.
[0060] It should be understood that the various numerical numbers involved in the embodiments of the present application are only used for the convenience of description and are not used to limit the scope of the embodiments of the present application.
[0061] The above content is easily understood by those skilled in the art. The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions and improvements made within the spirit and principles 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: Modbus slave port, used to connect to the upper-level device; The first Modbus master port is used to connect to the lower-level device; The second Modbus master port is used to connect to the slave device; A 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 Modbus RTU device routing module, the data control unit is used 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, and the data control unit and the lower-level device use a full-duplex communication mode for data exchange.
3. The Modbus RTU device routing module according to claim 1, characterized in that: The data control unit includes a storage subunit for caching the 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, 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 device 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 comprises: The host computer and each Modbus router are connected in series to form a trunk information link; each Modbus router and its mounted slave device form a sub-information link; The Modbus router obtains Modbus data from the trunk information link and the sub-information link. If the device address in the Modbus data is the slave device address, the Modbus router is used as a proxy host and its slave device performs master-slave interaction of Modbus data via the sub-information link; if the device address is the host computer address, the Modbus data is transmitted to the upstream Modbus router or host computer via the trunk information link at an asynchronous rate; otherwise, the Modbus data is transmitted to the downstream Modbus router via the trunk 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 a 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, the 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
TCP and RTU protocol conversion method of PLC
CN117857652A
Master-slave integrated Modbus RTU gateway and communication system
CN119011339A
Multiple communication apparatus and method between TCP and modbus communication devices
KR102712526B1