Topology detection methods, devices, systems and equipment for distributed PLC systems

By using a topology detection method for distributed PLC systems, and leveraging the interaction of probe packets between the gateway module and the interface module, combined with master-slave bus communication, topology self-discovery of the PLC system is achieved. This solves the problem of low efficiency in traditional network configuration and improves system stability and reliability.

CN120474924BActive Publication Date: 2026-11-17NINGBO HOLLYSHI INFORMATION SECURITY RES INST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510548268.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-28
Publication Date
2026-11-17
Estimated Expiration
2045-04-28

AI Technical Summary

Technical Problem

Traditional large-scale PLC networking configuration mode is inefficient, prone to errors or omissions, affecting system stability and reliability, and relies on complex manual operation, making it difficult to meet the high efficiency and accuracy requirements of modern industrial production.

Method used

A topology detection method for distributed PLC systems is adopted. By interacting with probe packets between the gateway module and the interface module, the average data processing delay and location information are determined. Combined with the master-slave bus communication mechanism, the topology of the PLC system is self-discovered, reducing manual intervention.

Benefits of technology

This has improved the stability and reliability of the PLC system, reduced labor costs, increased work efficiency, simplified system configuration and maintenance processes, and significantly enhanced product competitiveness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120474924B_ABST
    Figure CN120474924B_ABST
Patent Text Reader

Abstract

This invention discloses a topology detection method, apparatus, system, and device for a distributed PLC system, relating to the technical field of PLC system topology detection. The method includes: a gateway module sending a first probe packet to the interface module of a test node, and determining the average data processing delay by combining the reception time of the first probe packet and the transmission time of the first response packet in the first response packet returned by the interface module, thereby determining the total waiting delay; sending a second probe packet to all target nodes, and acquiring second response packets returned by multiple interface modules of multiple target nodes within the total waiting delay; wherein the second response packet includes the location information and type information of the interface module, thereby determining the first-layer topology data between the gateway module and the interface module; this invention enables self-discovery of the PLC system topology, reduces labor, improves work efficiency, and ensures the stability and reliability of the PLC system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the technical field of PLC system topology detection, and specifically relates to a method, apparatus, system and equipment for topology detection of a distributed PLC system. Background Technology

[0002] Modern industrial production using inverters is a highly integrated, complex, and efficient system with distinct and intertwined characteristics. It typically involves large-scale production lines and manufacturing processes, capable of producing large quantities of products efficiently and continuously. This model requires the deployment of a large number of PLCs (Programmable Logic Controllers) of different models to meet the control needs of different stages and processes. Distributed PLC systems employ a remote mechanism, deploying PLC nodes in remote locations far from the control center. They connect to the control center and transmit data through a communication network. This remote mechanism not only reduces wiring costs and complexity but also improves the system's flexibility and scalability. Distributed PLC systems can easily cope with large-scale production environments, achieving comprehensive control of the entire production line through the collaborative work of multiple PLC nodes.

[0003] Traditional methods for configuring large-scale PLC networks rely heavily on detailed records during installation and module-by-module configuration during the engineering configuration phase. This approach is not only time-consuming but also involves numerous manual steps, each requiring extremely high precision and consistency. Specifically, during installation, engineers must meticulously record key information such as the location, model, and connection relationships of each PLC node for reference during subsequent configuration. In the engineering configuration phase, they must further configure each PLC module individually, including setting communication parameters, defining input / output variables, and writing control logic—each step demanding meticulous attention.

[0004] However, this model is not only time-consuming and labor-intensive, but also prone to alignment problems due to the involvement of multiple different personnel. Each engineer may have a different understanding of the system and different operating habits, which may lead to errors or omissions during the configuration process, thus affecting the stability and reliability of the entire system. Therefore, from recording to configuration, the entire process often takes more than a month, which is not only inefficient but also increases project risks.

[0005] In summary, the traditional large-scale PLC networking configuration mode has many shortcomings, and there is an urgent need for more efficient, accurate and automated solutions to meet the increasingly complex industrial control needs. Summary of the Invention

[0006] To address the aforementioned issues, this invention proposes a topology detection method, apparatus, system, and device for distributed PLC systems, which enables topology self-discovery of PLC systems, reduces labor, improves work efficiency, and ensures the stability and reliability of PLC systems.

[0007] In a first aspect, the present invention provides a topology detection method for a distributed PLC system, applied to a gateway module in a distributed PLC system, wherein the gateway module is connected to multiple interface modules of multiple nodes, and the method includes:

[0008] A first probe packet is sent to multiple interface modules of multiple test nodes, and multiple first response packets returned by the multiple interface modules of the multiple test nodes are obtained. The average data processing latency of the interface modules is determined based on the reception time of the multiple first probe packets and the transmission time of the multiple first response packets. The first response packet includes the reception time of the first probe packet and the transmission time of the first response packet. The average data processing latency characterizes the average data processing time of a single interface module from receiving data to completing data processing and preparing to output the processing result. The first probe packet is used to detect the topology network structure between the gateway module and the multiple interface modules. The test nodes are pre-specified nodes used to test the average data processing latency of a single interface module.

[0009] The total waiting time for the gateway module to receive data from multiple interface modules of multiple target nodes is determined based on the average data processing latency.

[0010] Send a second probe packet to multiple interface modules of multiple target nodes, and obtain a second response packet returned by multiple interface modules of multiple target nodes within the total waiting time; wherein, the second response packet includes the location information and type information of the interface module;

[0011] The first-layer topology data between the gateway module and multiple interface modules of multiple target nodes is determined based on the location information and the type information.

[0012] In an optional embodiment, the step of sending first probe packets to multiple interface modules of multiple test nodes and obtaining multiple first response packets returned by multiple interface modules of multiple test nodes, and determining the average data processing latency of the interface modules based on the reception time of the multiple first probe packets and the sending time of the multiple first response packets, includes:

[0013] The first probe packet is sent in unicast to multiple interface modules of multiple test nodes;

[0014] Retrieve multiple first response packets returned by multiple test nodes;

[0015] The average latency of multiple interface modules of multiple test nodes is determined based on the reception time of the first probe packet and the transmission time of the multiple first response packets.

[0016] The average data processing latency of a single node is determined based on the average latency of the multiple interface modules and a preset empirical value.

[0017] In an optional embodiment, the method further includes:

[0018] During the operation of the distributed PLC system, the system acquires interactive data sent from multiple interface modules of multiple target nodes to the gateway module. The interactive data includes periodic data and non-periodic data. Based on the interactive data, the system determines the connection status of the multiple interface modules of the multiple target nodes. The connection status includes offline status and online status.

[0019] Determine whether the connection status of the multiple interface modules of the multiple target nodes is offline. If so, update the first layer topology data.

[0020] Secondly, the present invention provides a topology detection method for a distributed PLC system, applied to the main control module of the PLC system, wherein the main control module and multiple communication modules are respectively connected to a base plate; wherein multiple first pins of the main control module are connected to a first power supply and are electrically connected one-to-one with the second pins of the communication modules in different slots through the base plate; wherein the first pins are general purpose input / output pins, and the second pins are grounded; the method includes:

[0021] Obtain voltage information from multiple first pins, and determine the online communication module based on the voltage information;

[0022] Based on the bus protocol, a third probe packet is sent to multiple communication modules in multiple designated slots, so that the multiple communication modules in multiple designated slots match the slot number in the third probe packet with their own slot number, and then send a third response packet to the main control module when the match is successful; wherein, the third response packet includes the slot number and board type of the communication module;

[0023] Obtain the third response packets sent by multiple communication modules in multiple specified slots;

[0024] The third probe packet is sent to multiple communication modules in multiple target slots based on the bus protocol;

[0025] Obtain the third response packet sent by multiple communication modules for multiple target slots;

[0026] The third response packet determines the third-layer topology data between the main control module and multiple communication modules.

[0027] In an optional embodiment, the plurality of communication modules determine their own slot numbers using the following method:

[0028] Obtain the level values ​​of multiple third pins electrically connected to the base plate; wherein, the third pin is grounded or connected to a second power supply according to the binary value of its own slot number;

[0029] The slot number is determined based on the level values ​​of the plurality of third pins.

[0030] In an optional embodiment, after determining the third-layer topology data between the main control module and the multiple communication modules based on the third response packet, the method further includes:

[0031] The overall topology of the PLC system is determined based on the first-layer topology data determined by any one of the topology data methods of the distributed PLC in the first aspect, the second-layer topology data between the communication module and the gateway module, and the third-layer topology data; wherein, the second-layer topology data is obtained by the communication module and the gateway module through self-discovery based on the bus protocol;

[0032] In response to a broadcast probe packet sent by the host computer, a fourth response packet is sent to the host computer, the fourth response packet including the overall topology, so that the host computer determines the site topology based on the overall topology relationship of all PLC systems and displays the site topology.

[0033] Thirdly, the present invention provides a topology detection device for a distributed PLC system, applied to a gateway module in a distributed PLC system, wherein the gateway module is connected to multiple interface modules of multiple nodes, and the device includes:

[0034] A test node detection module is used to send first probe packets to multiple interface modules of multiple test nodes and obtain multiple first response packets returned by the multiple interface modules of multiple test nodes. The average data processing latency of the interface modules is determined based on the reception time of the multiple first probe packets and the transmission time of the multiple first response packets. The first response packet includes the reception time of the first probe packet and the transmission time of the first response packet. The average data processing latency characterizes the average data processing time of a single interface module from receiving data to completing data processing and preparing to output the processing result. The first probe packets are used to detect the topology network structure between the gateway module and the multiple interface modules. The test nodes are pre-specified nodes used to test the average data processing latency of a single interface module.

[0035] The total waiting time module is used to determine the total waiting time for the gateway module to receive data from multiple interface modules of multiple target nodes based on the average data processing time.

[0036] The target node detection module is used to send second detection packets to multiple interface modules of multiple target nodes, and to obtain second response packets returned by multiple interface modules of multiple target nodes within the total waiting time; wherein, the second response packet includes the location information and type information of the interface module;

[0037] The first determining module is used to determine the first-layer topology data between the gateway module and multiple interface modules of multiple target nodes based on the location information and the type information.

[0038] Fourthly, the present invention provides a topology detection device for a distributed PLC system, applied to the main control module of the PLC system. The main control module and multiple communication modules are respectively connected to a base plate. The main control module has multiple first pins connected to a first power supply, and simultaneously electrically connected to the second pins of the communication modules in different slots via the base plate. The first pins are general-purpose input / output pins, and the second pins are grounded. The device includes:

[0039] An online detection module is used to acquire voltage information from multiple first pins and determine the online communication module based on the voltage information.

[0040] A designated slot detection module is used to send a third detection packet to multiple communication modules in multiple designated slots based on a bus protocol, so that the multiple communication modules in multiple designated slots match the slot number in the third detection packet with their own slot number, and send a third response packet to the main control module when the match is successful; wherein, the third response packet includes the slot number and board type of the communication module;

[0041] The first acquisition module is used to acquire the third response packet sent by multiple communication modules in multiple specified slots;

[0042] The target slot acquisition module is used to send the third probe packet to multiple communication modules of multiple target slots based on a bus protocol;

[0043] The second acquisition module is used to acquire the third response packet sent by multiple communication modules of multiple target slots;

[0044] The second determining module is used to determine the third-layer topology data between the main control module and multiple communication modules based on the third response packet.

[0045] Fifthly, the present invention provides a topology detection system for a distributed PLC system, comprising a host computer and multiple PLC systems. Each PLC system includes a main control module, one or more communication modules, one or more gateway modules, and one or more interface modules. The main control module is connected to one or more communication modules, each communication module is connected to one or more gateway modules, each gateway module is connected to one or more interface modules, and each interface module is connected to one or more monitoring devices. The gateway modules execute the topology detection method for a distributed PLC as described in any one of the first aspects, and the main control module executes the topology detection method for a distributed PLC as described in any one of the second aspects.

[0046] In a sixth aspect, the present invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described in any one of the first and second aspects described above.

[0047] In a seventh aspect, the present invention provides a computer-readable medium having processor-executable non-volatile program code, the program code causing the processor to perform the method described in either the first or second aspect.

[0048] The beneficial effects of the technical solution provided by this invention are:

[0049] First, the topology detection method, apparatus, system, and device for a distributed PLC system provided by this invention involve a gateway module sending a first probe packet to the interface module of a test node, and determining the average data processing delay by combining the reception time of the first probe packet and the transmission time of the first response packet fed back by the interface module, thereby determining the total waiting delay. A second probe packet is then sent to all target nodes, and within the total waiting delay, second response packets returned by multiple interface modules of multiple target nodes are obtained, wherein the second response packets include the location information and type information of the interface modules. Based on the location and type information, the first-layer topology data between the gateway module and the interface modules is determined. This invention proposes a training and detection mechanism between the gateway module and the interface module based on master-slave bus communication, and proposes a bus conflict and topology detection data model, which has guiding significance for other similar master-slave bus mechanisms.

[0050] Secondly, in the topology detection of the main control module and the communication module of this invention, the first pin of the main control module and the second pin of the corresponding communication module are connected through the base plate, wherein the second pin is grounded and the first pin is connected to the first power supply; thus, when the corresponding communication module is inserted into the base plate, the level of the first pin of the main control module decreases, thereby enabling the main control module to detect the online communication module; simultaneously, based on the bus protocol, a third detection packet is sent to multiple communication modules in multiple specified slots, and the multiple communication modules in the specified slots match the slot number in the third detection packet with their own slot number, thereby sending a third response packet to the main control module when the match is successful; wherein, the third response packet includes the slot number and board type of the communication module; similarly, the main control module sends a third response packet to the communication modules in all target slots to obtain the slot number and board type of the target slot; the main control module determines the third-layer topology data between itself and multiple communication modules based on the slot number and board type information; the base plate where the main control module and the communication module are located in this invention has a specific circuit design, and the topology self-discovery between the main control module and the communication module is realized based on the bus protocol and the circuit design, which is stable and reliable;

[0051] This invention enables the detection of topology relationships among all PLC systems within a network, reducing labor costs, improving work efficiency, and ensuring the stability and reliability of the PLC system. It also greatly facilitates system configuration and maintenance, making it easier to use and more observable, thus significantly enhancing the product's competitiveness. Attached Figure Description

[0052] Figure 1 This is a flowchart illustrating the topology detection method for a distributed PLC system with a gateway module as the execution subject, as provided in an embodiment of the present invention.

[0053] Figure 2 This is a schematic diagram of the gateway module and interface module provided in an embodiment of the present invention;

[0054] Figure 3 This is a flowchart illustrating the topology detection method for a distributed PLC system with the main control module as the execution subject, as provided in an embodiment of the present invention.

[0055] Figure 4 A circuit diagram showing the main control module and communication module connected via a baseboard, provided in an embodiment of the present invention.

[0056] Figure 5 A circuit schematic diagram of some pins of the communication module provided in an embodiment of the present invention;

[0057] Figure 6 This is a topology diagram of the host computer and PLC system of the site provided in an embodiment of the present invention;

[0058] Figure 7This is a schematic diagram illustrating the communication principle between the PLC system and the host computer provided in an embodiment of the present invention.

[0059] Figure 8 A topology diagram of a PLC system provided in an embodiment of the present invention;

[0060] Figure 9 This is a schematic diagram illustrating the principle of the topology detection process provided in an embodiment of the present invention;

[0061] Figure 10 A schematic diagram of the system principle of the topology detection device for a distributed PLC system provided in an embodiment of the present invention;

[0062] Figure 11 A schematic diagram of the system principle of the topology detection device for a distributed PLC system provided in an embodiment of the present invention;

[0063] Figure 12 This is a schematic diagram of the topology detection system of the distributed PLC system provided in an embodiment of the present invention;

[0064] Figure 13 A system schematic diagram of an electronic device provided in an embodiment of the present invention.

[0065] In the diagram: 1-PLC system; 11-Gateway module; 12-Main control module; 13-Communication module; 14-Interface module; 2-Host computer; 110-Test node detection module; 120-Total waiting time delay module; 130-Module; 140-Module; 210-Module; 220-Module; 230-Module; 240-Module; 250-Module; 1000-Electronic equipment; 1001-Communication interface; 1002-Processor; 1003-Memory; 1004-Bus. Detailed Implementation

[0066] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0067] like Figure 12 As shown, the topology detection system of the distributed PLC system proposed in this embodiment includes a host computer and multiple PLC systems 1. Each PLC system 1 includes a main control module 12, one or more communication modules 13, one or more gateway modules 11, and one or more interface modules 14. The main control module 12 is connected to one or more communication modules 13. Each communication module 13 is connected to one or more gateway modules 11. Each gateway module 11 is connected to one or more interface modules 14. Each interface module 14 is connected to one or more monitoring devices.

[0068] Specifically, the main control module is the central processing unit of the PLC system, and the interface module, also known as the I / O module, is used to connect monitoring equipment. In this embodiment, the monitoring equipment refers to field data acquisition and control devices such as sensors installed at the production end.

[0069] In one possible embodiment, such as Figure 7 As shown, the PLC system is connected to the host computer via a redundant Ethernet ring network. A main control module 12 and multiple communication modules 13 are plugged into the same baseboard, as are a gateway module 11 and multiple interface modules 14. The interface modules 14 are connected to third-party DP devices (PROFIBUS / USDP protocol industrial peripherals). The baseboard here is a pluggable system with a base that powers each module and connects them together.

[0070] In this embodiment, multiple sets of main control modules and communication modules are installed in the host rack, and multiple sets of gateway modules and interface modules are installed in the slave rack.

[0071] In one possible embodiment, such as Figure 8 The diagram shows the system topology. The top layer consists of two main racks, followed by two slave racks. The main and slave racks are connected via communication modules and gateway modules (IMX). Each main rack includes a main control module (as shown in the diagram, main control unit module-A and main control unit module-B) and a communication module. Each slave rack includes gateway modules (IM1-IMn) and subsequent I / O modules (interface modules). Main control unit module-A and communication modules 1-n are mounted on the same baseboard, as are main control unit module-B and communication modules 1-n. The main control unit modules-A and-B are connected to each other via wires. Gateway module IM1 and multiple interface modules IO1-IOn are mounted on the same baseboard, as are gateway module IM2 and multiple interface modules IO1-IOn. Each set of gateway modules is connected to its respective main control module, and the gateway modules IM1 and IM2 are connected to each other via wires.

[0072] This embodiment of topology detection is divided into three levels. The first level is the self-discovery of topology between the gateway module and the interface module. The second level is the connection structure between the communication module of the master rack and the gateway module of the slave rack. The third level is the self-discovery of topology between the communication module and the interface module. In the second level, the gateway module sends information about the topology connectivity between itself and the interface module to the communication module. In the first level of topology detection, the number of interface modules is unknown. This embodiment proposes a mathematical model and implementation mechanism based on master-slave bus topology detection. In the third level, a method is proposed to identify the topology and type of modules on the same baseboard based on specific circuit design and probe packet interaction mechanism. Furthermore, the topology detection method in this embodiment is based on the Ethernet broadcast packet mechanism.

[0073] The first-layer topology detection method and the third-layer topology detection method are introduced below through examples. First, the self-discovery of topology between the gateway module and the interface module is introduced through examples.

[0074] Reference Figure 1 The topology detection method for a distributed PLC system proposed in this embodiment is applied to the gateway module in the distributed PLC system. The gateway module is connected to multiple interface modules of multiple nodes, and includes the following steps S110 to S140.

[0075] Step S110: Send first probe packets to multiple interface modules of multiple test nodes and obtain multiple first response packets returned by multiple interface modules of multiple test nodes. Determine the average data processing latency of the interface modules based on the reception time of the multiple first probe packets and the transmission time of the multiple first response packets. The first response packet includes the reception time of the first probe packet and the transmission time of the first response packet. The average data processing latency characterizes the average data processing time of a single interface module from receiving data to completing data processing and preparing to output the processing result. The first probe packets are used to detect the topology network structure between the gateway module and the multiple interface modules. The test nodes are pre-specified nodes used to test the average data processing latency of a single interface module.

[0076] Here, the distributed PLC system interface module is deployed remotely, close to the monitoring equipment. It uses a master-slave industrial bus protocol to communicate with the communication module and the main control module, completing the acquisition, processing, and output functions of the equipment inputs. Because the I / O modules are located remotely and are numerous, the number and model of the modules cannot be identified. Figure 2 The diagram shows a typical industrial bus topology, with the gateway module connected to 10 nodes.

[0077] During the system production and testing phase, upon system startup, the gateway module automatically executes the method described in this embodiment to perform topology probing. For example, nodes 1, 5, and 10 are selected as test nodes (1, 5, and 10 are the slot numbers of the node modules; these values ​​are obtained based on circuit design by acquiring combinations of high and low voltage levels, and only interface modules inserted into a specific slot can obtain this value). Interface modules are then inserted into positions 1, 5, and 10 respectively. After system startup, the gateway module first sends a first probe packet to the interface modules of each test node to determine the average data processing latency.

[0078] Although the speed of electrical signals in conductors is less than the speed of light, the transmission path delay is negligible in short-distance communication based on master-slave protocols. For example, over a bus distance of 1000 meters, the path delay in master-slave communication using copper wire as the conductor is approximately 5µs. This delay primarily occurs at each node during the process of receiving, processing, and transmitting data from the master station. This embodiment calculates the data processing delay of several test nodes to determine their average data processing delay. This average data processing delay is then used to represent the data processing delay of all nodes for subsequent probing.

[0079] In a possible embodiment, this step specifically includes the following steps (1)-(4).

[0080] (1) Send the first probe packet to multiple interface modules of multiple test nodes in unicast form.

[0081] (2) Obtain multiple first response packets returned by multiple test nodes.

[0082] (3) Determine the average latency of multiple interface modules of multiple test nodes based on the reception time of the first probe packet and the transmission time of multiple first response packets.

[0083] (4) Determine the average data processing latency of a single node based on the average latency of multiple interface modules and the preset experience value.

[0084] Here, after sending the first probe packet to multiple designated test nodes, the bus will not conflict due to the specified receiving address. Each node receives the packet and begins to mark (the process of marking, recording, and updating the status of devices and paths in the network), processes the received packet, fills in the response packet, and sends the first response packet. When sending the first response packet, the time difference (time to send the first response packet - time to receive the first probe packet) is filled in. The interface module obtains the transmit and receive time of a node after receiving a response packet. In this embodiment, the average latency of the node transceiver in processing data can be obtained based on the times of three nodes. Adding an empirical value, the average data processing latency Tproc of the node can be obtained.

[0085] Step S120: Determine the total waiting time for the gateway module to receive data from multiple interface modules of multiple target nodes based on the average data processing latency.

[0086] Specifically, the interface modules of each node receive and process packets serially. The waiting delay of the nth (n>1) node is (1+2+3+·····+(n-1))×Tproc. If a gateway module can support a maximum of 127 interface modules and the estimated TProc is 1ms, then the total waiting delay is (1+2+3+4+·····+127)×Tproc=8128(ms).

[0087] Step S130: Send a second probe packet to multiple interface modules of multiple target nodes, and obtain the second response packet returned by multiple interface modules of multiple target nodes within the total waiting time; wherein, the second response packet includes the location information and type information of the interface module.

[0088] Specifically, in step S110, the first probe packet is sent by the gateway module and is a unicast address (indicating a specific node). The receiving node recognizes it as a test packet and includes processing time information in its first response packet. Step S130 is then sent by the gateway module to all target nodes using a broadcast address (0xff or other indication of broadcast meaning). In this embodiment, the "target node" refers to the node to be probed. Generally, the target node is all nodes, meaning the gateway module sends the second probe packet to the interface modules of all nodes. In the probe packet with the broadcast address, the interface module only needs to return its own slot (location information) and type data (type information).

[0089] Step S140: Determine the first-layer topology data between the gateway module and multiple interface modules of multiple target nodes based on location information and type information.

[0090] In this way, the gateway module collects the slot and type data of all nodes, thus obtaining all nodes and data connected to the current gateway module. The first layer of topology data includes slot information and board type (i.e., interface module type), forming a topology diagram of the rack's board types and slots. That is, it shows which slots on a specific backplane of the current slave rack contain which types of boards, ultimately forming the topology diagram of the slave rack's board types and slots.

[0091] The above describes the topology self-discovery between the gateway module and the interface module during the system testing phase. During system operation, topology detection is performed through the following steps (1) to (2).

[0092] (1) When the distributed PLC system is running, acquire the interaction data sent from multiple interface modules of multiple target nodes to the gateway module. The interaction data includes periodic data and non-periodic data. Determine the connection status of multiple interface modules of multiple target nodes based on the interaction data. The connection status includes offline status and online status.

[0093] (2) Determine whether the connection status of multiple interface modules of multiple target nodes is offline. If so, update the first layer topology data.

[0094] Specifically, during system operation, the gateway module and its downstream interface modules exchange periodic data (such as physical quantities collected by sensors being periodically sent to the gateway module) and aperiodic data (such as keep-alive messages, which the gateway sends, the interface modules respond to, and if an interface module fails to respond multiple times, it is considered offline). The gateway module obtains the channel values ​​and diagnostic values ​​of the interface modules and relies on the periodic and aperiodic data to determine whether an interface module is offline or online. In some embodiments, the gateway module can update the first-layer topology data based on whether a certain interface module is offline.

[0095] The following example illustrates the topology self-discovery between the main control module and the communication module.

[0096] Reference Figure 3 The topology detection method for a distributed PLC system provided in this embodiment is applied to the main control module of the PLC system. The main control module and multiple communication modules are respectively connected to the base plate. The main control module has multiple first pins connected to a first power supply, and each pin is electrically connected to a corresponding second pin of a communication module in a different slot through the base plate. The first pins are general purpose input / output pins (i.e., GOIO pins), and the second pins are grounded. The method includes the following steps S210 to S260.

[0097] Step S210: Obtain voltage information of multiple first pins, and determine the online communication module based on the voltage information.

[0098] Here, the main control module and communication module are installed on the main rack of the distributed PLC system. The main control module and communication module are plugged into the same baseboard. Through special circuit design of the baseboard and modules, a mechanism can be realized for the main control module to detect whether the module in a specific slot is online. As shown below, the four GPIO pins of the main control module are pulled up to the power supply, and the communication module signal is pulled down to ground. These two signals are turned on by the baseboard. When the module is inserted, the power signal of the corresponding GPIO pin of the main control module is pulled low. When the communication module is removed, the power signal of the corresponding main control module is pulled high. Based on this, it is determined whether the communication module is in place. At the same time, it depends on the correspondence between different slots and GPIO pins on the baseboard to determine which slots the modules are online.

[0099] like Figure 4As shown, the main control module's four GPIO pins J1, J2, J3, and J4 are connected to power supply E1. After a communication module is inserted into its corresponding slot, its ground pin J5 is grounded to GND1. Pin J5 is connected to pin J1 of the main control module via the base plate, causing pin J1 to change from high to low. The main control module determines that the communication module is online based on the voltage change at pin J1.

[0100] Step S220: Based on the bus protocol, a third probe packet is sent to multiple communication modules in multiple specified slots, so that the multiple communication modules in multiple specified slots match the slot number in the third probe packet with their own slot number, and then send a third response packet to the main control module when the match is successful; wherein, the third response packet includes the slot number and board type of the communication module.

[0101] Step S230: Obtain the third response packet sent by multiple communication modules in multiple specified slots.

[0102] The main control module obtains the online communication modules on the host rack and maps them to slots via GPIO channels. Similarly, in this embodiment, a designated slot is used as the test slot, and a bottom-three probe packet is sent to the designated slot based on the bus protocol.

[0103] In an optional embodiment, multiple communication modules determine their own slot number through the following steps (1)-(2).

[0104] (1) Obtain the level values ​​of multiple third pins that are electrically connected to the base plate; wherein, the third pin is grounded or connected to the second power supply according to the binary value of its own slot number;

[0105] (2) Determine its own slot number based on the level values ​​of multiple third pins.

[0106] Specifically, pull-up / pull-down relationships for slot addresses are pre-designed in different slots on the base plate, allowing the third pin of the communication module to be connected to power or ground according to its slot number. For example, Figure 5 The communication module shown has pins J6 and J7 connected to power supplies E2 and E3 respectively, and pin J8 connected to ground GND2. In this configuration, pins J6 and J7 correspond to 1, and pin J8 corresponds to 0, forming a combined code 011. Binary 011 corresponds to decimal 3, indicating that the communication module is located in slot 3. Based on this mechanism, the communication module can determine its own slot number. Only when its own slot number matches the slot number in the third detection packet will the communication module reply with a third response packet. This third response packet includes the board type (communication module type) of the slot and the corresponding slot number.

[0107] Step S240: Send a third probe packet to multiple communication modules of multiple target slots based on the bus protocol.

[0108] Step S250: Obtain the third response packets sent by multiple communication modules of multiple target slots.

[0109] Step S260: Determine the third-layer topology data between the main control module and multiple communication modules based on the third response packet.

[0110] In steps S240 to S260, after requesting probe packets for all slots and receiving probe packet responses, the slots and types of each communication module of the mainframe rack can be obtained.

[0111] In an optional embodiment, step S260 is followed by steps S270 to S280.

[0112] Step S270: Determine the overall topology of the PLC system based on the first-layer topology data determined by the aforementioned distributed PLC topology data method, the second-layer topology data between the communication module and the gateway module, and the third-layer topology data; wherein, the second-layer topology data is obtained by the communication module and the gateway module through self-discovery based on the bus protocol.

[0113] In step S280, in response to the broadcast probe packet sent by the host computer, a fourth response packet is sent to the host computer. The fourth response packet includes the overall topology structure so that the host computer can determine the site topology structure based on the overall topology relationship of all PLC systems and display the site topology structure.

[0114] In this embodiment, based on the aforementioned detection steps of the first topology data, the second topology data, and the third topology data, the main rack communication module detects the slave module address and the address and type of the downstream interface module, and the PLC system main control module has detected all communication modules of the main rack; the main rack communication module reports the topology data and type of its own communication slave module and interface module to the main control module, and the main rack obtains the entire topology layout and type correspondence of the system.

[0115] like Figure 6 As shown, the host computer at a certain station broadcasts a probe packet based on a specific port UPD broadcast packet. The main control module of each PLC system receives the broadcast packet on its specific UPD port. Based on authentication and packet type judgment, it identifies the packet as a probe packet from the host computer and organizes topology and type data, along with a SN (single identifier for each station), to send a response packet back to the host computer. To avoid excessive broadcast packets, a single response is broadcast. The host computer continuously collects response packets from each PLC system at regular intervals. Once collection is complete, it identifies a station by its SN and presents the topology and type relationships of that station, such as... Figure 6 As shown. Figure 6 The host computer 2 is connected to multiple PLC systems 1.

[0116] The method in this embodiment is as follows: Figure 9As shown, after the PLC slave devices 1 to 3 discover the three-layer topology using the aforementioned method, the host computer sends a probe message based on UPD broadcast to each PLC slave device, and the slave devices 1 to 3 return the topology relationship of their own PLC slave devices respectively.

[0117] For example, the final topo relationship is displayed on the host computer as follows:

[0118] XXX PLC:

[0119] CPU (192.168.0.1);

[0120] Communication module 1 (slot 1);

[0121] Communication module 2 (slot 2);

[0122] Communication module 3 (slot 3);

[0123] Gateway module 1 (MAC address *-*-*-*-*-*);

[0124] IO1(ID1);

[0125] IO2 (ID2);

[0126] Gateway module 2 (MAC address *-*-*-*-*-*);

[0127] IO1(ID1);

[0128] IO2 (ID2);

[0129] IO3 (ID3).

[0130] XXX PLC:

[0131] CPU (192.168.0.2);

[0132] Communication module 1 (slot 1);

[0133] Communication module 2 (slot 2);

[0134] Communication module 3 (slot 3);

[0135] Gateway module 1 (MAC address *-*-*-*-*-*);

[0136] IO1(ID1);

[0137] IO2 (ID2);

[0138] Gateway module 2 (MAC address *-*-*-*-*-*);

[0139] IO1(ID1);

[0140] IO2 (ID2);

[0141] IO3 (ID3).

[0142] XXX PLC:

[0143] CPU (192.168.0.n);

[0144] Communication module 1 (slot 1);

[0145] Communication module 2 (slot 2);

[0146] Communication module 3 (slot 3);

[0147] Gateway module 1 (MAC address *-*-*-*-*-*);

[0148] IO1(ID1);

[0149] IO2 (ID2);

[0150] Gateway module 2 (MAC address *-*-*-*-*-*);

[0151] IO1(ID1);

[0152] IO2 (ID2);

[0153] IO3 (ID3).

[0154] This embodiment proposes a three-level topology discovery mechanism for distributed PLCs, systematically solving the discovery problems of interface modules, communication modules, and the PLC system as a whole. Based on master-slave bus communication, this embodiment innovatively proposes training (testing) and detection discovery mechanisms, resolving bus conflicts and topology detection data models, providing guidance for other similar master-slave bus mechanisms. This embodiment also implements specific circuit design and detection mechanisms, reliably and stably solving the problems of first-level topology data and second-level topology discovery. The method based on this embodiment can comprehensively and completely solve the deployment and topology relationships of all PLC systems within the network. On this basis, interface and simulation design and implementation are carried out, greatly facilitating system configuration, maintenance, ease of use, and observability, significantly enhancing product competitiveness.

[0155] See Figure 10 This invention provides a topology detection device for a distributed PLC system, applied to a gateway module in a distributed PLC system. The gateway module is connected to multiple interface modules of multiple nodes. The device includes a module 110, a total waiting delay module 120, a target node detection module 130, and a first determination module 140.

[0156] The test node detection module 110 is used to send first probe packets to multiple interface modules of multiple test nodes and obtain multiple first response packets returned by multiple interface modules of multiple test nodes. The average data processing latency of the interface modules is determined based on the reception time of the multiple first probe packets and the transmission time of the multiple first response packets. The average data processing latency represents the average data processing time of a single interface module from receiving data to completing data processing and preparing to output the processing result. The first probe packets are used to detect the topology network structure between the gateway module and the multiple interface modules. The test nodes are pre-specified nodes used to test the average data processing latency of a single interface module.

[0157] The total latency waiting module 120 is used to determine the total latency waiting for the gateway module to receive data from multiple interface modules of multiple target nodes based on the average data processing latency. The target node detection module 130 is used to send second probe packets to multiple interface modules of multiple target nodes and, within the total latency waiting period, obtain second response packets returned by the multiple interface modules of multiple target nodes; wherein the second response packets include the location information and type information of the interface modules. The first determination module 140 is used to determine the first-layer topology data between the gateway module and the multiple interface modules of multiple target nodes based on the location information and type information.

[0158] In an optional embodiment, the test node probing module 110 includes a first probe packet sending module, a first response packet acquisition module, an average latency determination module, and a calculation module. The first probe packet sending module sends first probe packets in unicast format to multiple interface modules of multiple test nodes. The first response packet acquisition module acquires multiple first response packets returned by the multiple test nodes. The average latency determination module determines the average latency of the multiple interface modules of the multiple test nodes based on the reception time of the first probe packets and the transmission time of the multiple first response packets. The calculation module determines the average data processing latency of a single node based on the average latency of the multiple interface modules and a preset empirical value.

[0159] In an optional embodiment, the device further includes a status confirmation module and an update module. The status confirmation module is used to acquire, during the operation of the distributed PLC system, interactive data sent from multiple interface modules of multiple target nodes to the gateway module, including periodic and non-periodic data; and to determine the connection status of the multiple interface modules of the multiple target nodes based on the interactive data, including offline and online status. The update module is used to determine whether any of the multiple interface modules of the multiple target nodes are offline; if so, it updates the first-layer topology data.

[0160] See Figure 11This invention provides a topology detection device for a distributed PLC system, applied to the main control module of the distributed PLC system. The main control module and multiple communication modules are respectively connected to a base plate. Multiple first pins of the main control module are connected to a first power supply and are electrically connected to the second pins of communication modules in different slots via the base plate. The first pins are general-purpose input / output pins, and the second pins are grounded. The device includes an online detection module 210, a designated slot detection module 220, a first acquisition module 230, a target slot acquisition module 240, a second acquisition module 250, and a second determination module.

[0161] The online detection module 210 is used to acquire voltage information of multiple first pins and determine the online communication module based on the voltage information. The designated slot detection module 220 is used to send a third detection packet to multiple communication modules in multiple designated slots based on a bus protocol, so that the multiple communication modules in the multiple designated slots match the slot number in the third detection packet with their own slot number, and then send a third response packet to the main control module when a match is successful; wherein, the third response packet includes the slot number and board type of the communication module. The first acquisition module 230 is used to acquire the third response packets sent by the multiple communication modules in multiple designated slots. The target slot acquisition module 240 is used to send a third detection packet to multiple communication modules in multiple target slots based on a bus protocol. The second acquisition module 250 is used to acquire the third response packets sent by the multiple communication modules in multiple target slots. The second determination module 260 is used to determine the third-layer topology data between the main control module and the multiple communication modules based on the third response packet.

[0162] In an optional embodiment, the slot location detection module 220 includes a level acquisition module and a slot number determination module. The level acquisition module is used to acquire the level values ​​of multiple third pins electrically connected to the base plate; wherein, the third pins are grounded or connected to a second power supply according to the binary value of their own slot number. The slot number determination module is used to determine its own slot number based on the level values ​​of the multiple third pins.

[0163] In an optional embodiment, the device further includes: a general topology module and a display module. The general topology module is used to determine the overall topology of the PLC system based on pre-determined first-layer topology data, second-layer topology data between the communication module and the gateway module, and third-layer topology data; wherein the second-layer topology data is obtained by the communication module and the gateway module through self-discovery based on a bus protocol. The display module is used to send a fourth response packet to the host computer in response to a broadcast probe packet sent by the host computer. The fourth response packet includes the general topology, enabling the host computer to determine and display the site topology based on the overall topology relationship of all PLC systems.

[0164] Reference Figure 13The present invention also provides an electronic device 1000, including a communication interface 1001, a processor 1002, a memory 1003, and a bus 1004. The processor 1002, the communication interface 1001, and the memory 1003 are connected via the bus 1004. The memory 1003 is used to store a computer program that supports the processor 1002 in executing the topology detection method of the distributed PLC system. The processor 1002 is configured to execute the program stored in the memory 1003.

[0165] Optionally, embodiments of the present invention also provide a computer-readable medium having non-volatile program code executable by a processor 1002, the program code causing the processor 1002 to perform the topology detection method for a distributed PLC system as described in the above embodiments.

[0166] As is known from common technical knowledge, this invention can be implemented through other embodiments that do not depart from its spirit or essential characteristics. Therefore, the disclosed embodiments described above are merely illustrative in all respects and are not the only ones. All modifications within the scope of this invention or its equivalents are included in this invention.

Claims

1. A topology detection method for a distributed PLC system, characterized in that, A gateway module applied in a distributed PLC system, wherein the gateway module is connected to multiple interface modules of multiple nodes, the method comprising: A first probe packet is sent to multiple interface modules of multiple test nodes, and multiple first response packets returned by the multiple interface modules of the multiple test nodes are obtained. The average data processing latency of the interface modules is determined based on the reception time of the multiple first probe packets and the transmission time of the multiple first response packets. The first response packet includes the reception time of the first probe packet and the transmission time of the first response packet. The average data processing latency characterizes the average data processing time of a single interface module from receiving data to completing data processing and preparing to output the processing result. The first probe packet is used to detect the topology network structure between the gateway module and the multiple interface modules. The test nodes are pre-specified nodes used to test the average data processing latency of a single interface module. The total waiting time for the gateway module to receive data from multiple interface modules of multiple target nodes is determined based on the average data processing latency. Send a second probe packet to multiple interface modules of multiple target nodes, and obtain a second response packet returned by multiple interface modules of multiple target nodes within the total waiting time; wherein, the second response packet includes the location information and type information of the interface module; The first-layer topology data between the gateway module and multiple interface modules of multiple target nodes is determined based on the location information and the type information.

2. The topology detection method for a distributed PLC system according to claim 1, characterized in that, The step of sending first probe packets to multiple interface modules of multiple test nodes and obtaining multiple first response packets returned by multiple interface modules of multiple test nodes, and determining the average data processing latency of the interface modules based on the reception time of the multiple first probe packets and the transmission time of the multiple first response packets, includes: The first probe packet is sent in unicast to multiple interface modules of multiple test nodes; Retrieve multiple first response packets returned by multiple test nodes; The average latency of multiple interface modules of multiple test nodes is determined based on the reception time of the first probe packet and the transmission time of the multiple first response packets. The average data processing latency of a single node is determined based on the average latency of the multiple interface modules and a preset empirical value.

3. The topology detection method for a distributed PLC system according to claim 1, characterized in that, The method further includes: During the operation of the distributed PLC system, the system acquires interactive data sent from multiple interface modules of multiple target nodes to the gateway module. The interactive data includes periodic data and non-periodic data. Based on the interactive data, the system determines the connection status of the multiple interface modules of the multiple target nodes. The connection status includes offline status and online status. Determine whether the connection status of the multiple interface modules of the multiple target nodes is offline. If so, update the first layer topology data.

4. A topology detection device for a distributed PLC system, characterized in that, A gateway module used in a distributed PLC system, the gateway module being connected to multiple interface modules of multiple nodes, the device comprising: A test node detection module is used to send first probe packets to multiple interface modules of multiple test nodes and obtain multiple first response packets returned by the multiple interface modules of multiple test nodes. The average data processing latency of the interface modules is determined based on the reception time of the multiple first probe packets and the transmission time of the multiple first response packets. The first response packet includes the reception time of the first probe packet and the transmission time of the first response packet. The average data processing latency characterizes the average data processing time of a single interface module from receiving data to completing data processing and preparing to output the processing result. The first probe packets are used to detect the topology network structure between the gateway module and the multiple interface modules. The test nodes are pre-specified nodes used to test the average data processing latency of a single interface module. The total waiting time module is used to determine the total waiting time for the gateway module to receive data from multiple interface modules of multiple target nodes based on the average data processing time. The target node detection module is used to send second detection packets to multiple interface modules of multiple target nodes, and to obtain second response packets returned by multiple interface modules of multiple target nodes within the total waiting time; wherein, the second response packet includes the location information and type information of the interface module; The first determining module is used to determine the first-layer topology data between the gateway module and multiple interface modules of multiple target nodes based on the location information and the type information.

5. A topology detection system for a distributed PLC, characterized in that, The system includes a host computer and multiple PLC systems. Each PLC system includes a main control module, one or more communication modules, one or more gateway modules, and one or more interface modules. The main control module is connected to one or more communication modules, each communication module is connected to one or more gateway modules, each gateway module is connected to one or more interface modules, and each interface module is connected to one or more monitoring devices. The gateway module executes the topology detection method of the distributed PLC according to any one of claims 1-3.

6. An electronic device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method according to any one of claims 1-3.

Citation Information

Patent Citations

  • Distributed PLC fault monitoring method, device and equipment and storage medium

    CN116449766A

  • Fast low-overhead in-band time delay measurement method

    CN118631706A