A fast ring network redundancy system for medium and large PLCs based on optimized RSTP and its implementation method
By optimizing the RSTP protocol stack and hardware coupling, a collaborative control system between the PLC master station and the embedded network switching chip is constructed. This solves the problems of slow convergence speed of network redundancy technology and insufficient control logic coordination in medium and large-sized PLC systems, and achieves rapid fault recovery and high reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUXI XINJIE ELECTRICAL
- Filing Date
- 2026-03-06
- Publication Date
- 2026-06-02
AI Technical Summary
Existing network redundancy technologies for medium and large-scale PLC systems suffer from slow convergence speed, lack of coordination between the network and control logic, and insufficient system-level redundancy capabilities, failing to meet the real-time and reliability requirements of industrial control.
By optimizing the RSTP protocol stack and tightly coupling it with dedicated hardware, a collaborative control system is built that tightly couples the PLC master station, embedded network switching chip, and network management module. This enables network status monitoring and control logic linkage, and optimizes the protocol stack to achieve rapid convergence and intelligent response.
It achieves millisecond-level fault recovery in medium and large-scale PLC ring network redundancy systems, reduces system construction and maintenance costs, improves the coordination capability between the network and control, and meets the high reliability and real-time requirements of industrial control.
Smart Images

Figure CN122137699A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial automation control technology, and in particular to a fast ring network redundancy system for medium and large PLCs based on optimized RSTP and its implementation method. Background Technology
[0002] Medium and large-scale PLCs are mainly used in critical fields with extremely high requirements for reliability and control performance, including military, major equipment, and critical infrastructure. Typical application industries cover metallurgy, automotive, oil and gas, municipal, rail transit, power, and petrochemical. A typical medium and large-scale PLC system usually needs to connect and manage a large number of heterogeneous devices to form a dense control network. These devices include distributed I / O modules, human-machine interfaces (HMIs), drive units and other intelligent devices, and upper-level information systems.
[0003] Due to the core role of medium and large-sized PLCs in industrial control systems, they place almost stringent requirements on the networks carrying communication, mainly focusing on three dimensions: determinism and real-time performance, high reliability and high availability, and seamless connectivity. Any network interruption, congestion, or uncertain delays are not only communication technology issues but can also directly translate into production line shutdowns, equipment damage, and even safety accidents. Therefore, providing high-performance, highly reliable redundant communication guarantees for the networks of medium and large-sized PLCs is a rigid requirement and a key foundation for ensuring the stable and efficient operation of modern intelligent manufacturing systems.
[0004] Currently, the major network redundancy technologies in the industry all have significant limitations, specifically in the following aspects: 1. Disadvantages of traditional general-purpose ring network protocols Spanning Tree Protocol (STP) and its rapid version (RSTP) are standard Layer 2 network loop prevention and redundancy protocols. Although RSTP reduces network convergence time from 30-50 seconds in STP to 1-10 seconds, the convergence speed is still too slow for industrial control scenarios requiring fault recovery times in the hundreds of milliseconds or even milliseconds, and cannot prevent production interruptions. In addition, the fast convergence mechanism of standard RSTP relies on the lossless and low-latency transmission of Bridge Protocol Data Units (BPDUs). In complex industrial network environments with burst traffic and multicast background traffic, BPDU messages are prone to queuing delays or even being dropped due to instantaneous network congestion. This causes the protocol convergence process to revert to a slow mode that relies on traditional timers, resulting in uncertainty in the convergence time and making it difficult to meet the millisecond-level deterministic latency guarantee required for industrial control.
[0005] 2. Disadvantages of industrial-specific private ring network protocols To address the shortcomings of standard protocols, proprietary ring network protocols from industrial switch manufacturers such as HiPER-Ring (Hiesmann) and TurboRing (Mosaic) can achieve fast fault switching in less than 50 milliseconds. However, they suffer from core technical closure issues: First, poor compatibility, with different manufacturers' proprietary protocols being incompatible with each other, requiring users to use network equipment from the same brand, resulting in "vendor lock-in"; second, high cost, with proprietary industrial switches being expensive, significantly increasing the cost of system construction, maintenance, and expansion; and third, weak coordination with control systems, as the protocols only operate at the network device level, preventing the PLC main control system from sensing changes in the underlying network topology in real time, leading to a disconnect where "the network has been restored, but the control logic has not been adjusted in time," resulting in insufficient overall intelligent recovery capability of the system.
[0006] 3. Challenges of other standard industrial Ethernet redundancy protocols Ethernet loop protection switching protocol (ERPS / G.8032), as an ITU-T standard, provides carrier-grade convergence performance of less than 50ms, but its configuration and management are complex, requiring manual planning of roles such as ring network master nodes and neighbor nodes, increasing the difficulty of engineering implementation and the risk of errors, and placing excessive demands on the network expertise of automation engineers; Device-level ring network (DLR) is mainly used at the field device layer, supporting microsecond-level fault recovery, but it has specific hardware requirements for network switching chips, requiring the use of dedicated chips or modules, resulting in high hardware costs and a narrow range of choices; Parallel redundancy protocol (HSR / PRP) provides "zero-latency" seamless redundancy and is a standard feature of critical facilities such as substations, but its implementation heavily relies on foreign application-specific integrated circuits (ASICs), resulting in extremely high hardware costs and risks to supply chain security and technological self-control, making it difficult to widely adopt in cost-sensitive and self-controllable general industrial applications.
[0007] 4. Insufficient redundancy and coordination capabilities at the PLC system level. Existing redundancy technologies mostly focus on link redundancy at the network device or chip level. However, as the core of the control system, the PLC master station generally lacks a deep and intelligent collaborative mechanism with the redundant network. When the network topology changes, the PLC cannot detect the event in a timely and accurate manner, nor can it make corresponding logical adjustments, route switching, or early warning notifications at the application level. This results in a disconnect between network redundancy and control logic, and the overall intelligent recovery capability and reliability of the system fail to reach their optimal levels.
[0008] In summary, existing technologies suffer from a contradiction between convergence speed and real-time performance, as well as the core problem of insufficient system-level redundancy. There is an urgent need in this field for a medium-to-large-sized PLC ring network redundancy solution that can guarantee industrial-grade performance, have openness and cost advantages, and achieve deep collaboration between network and control. Summary of the Invention
[0009] The purpose of this invention is to overcome the problems of the prior art and provide a fast ring network redundancy system and implementation method for medium and large PLCs based on optimized RSTP. This addresses the technical problems of slow convergence speed of the standard RSTP protocol, which fails to meet industrial real-time requirements; lack of coordination between network redundancy and PLC control logic; and insufficient system-level redundancy capabilities. Specifically, it achieves the following objectives: 1. Break through the performance bottleneck of standard RSTP: By performing industrial-grade deep optimization of the RSTP protocol stack and tightly coupling it with dedicated hardware, its convergence time is stably reduced from the second level to less than the hundred millisecond level, making it capable of handling high real-time scenarios of medium and large PLCs. 2. Achieve intelligent integration of network and control: Break down the information barriers between network devices and control systems, enabling the PLC master station to perceive network topology changes in real time and trigger corresponding control logic linkages, thus achieving a leap from "network redundancy" to "system-level intelligent redundancy"; 3. Finding a superior balance in the impossible triangle of "openness", "high performance" and "low cost / ease of use": Optimized based on the standard RSTP protocol, avoiding dependence on proprietary protocols, giving users greater freedom of device selection and lower system construction and maintenance costs, and providing a network redundancy solution that integrates openness, efficiency, low cost and intelligence.
[0010] The above objectives are achieved through the following technical solutions: A medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP includes a PLC master station and multiple remote I / O stations connected to the ring network; the PLC master station integrates a central processing unit, an embedded network switching chip, and a network management module running in the master station system, which together form a tightly coupled collaborative control system. The central processing unit (CPU) is used to execute user control logic programs; the embedded network switching chip is interconnected with the CPU's data plane via a high-speed internal bus, receives control from the CPU through a management interface, and provides at least two dedicated high-speed Ethernet ports for building a redundant ring network; the network management module serves as the core of interaction between the PLC master station and the embedded network switching chip, enabling RSTP protocol parameter configuration, network status monitoring, topology change event processing, and control logic linkage triggering.
[0011] As a further optimization of this system, the high-speed internal bus is the RGMII bus, and the management interface is the MDIO interface; the embedded network switching chip is the JL6107S, and the central processing unit is an ARM Cortex-A series or equivalent industrial-grade processor; the link or topology change events of the embedded network switching chip are reported to the central processing unit through interrupt lines or polling.
[0012] As a further optimization of this system, the network management module includes a parameter management and optimization protocol stack, a status monitoring and event triggering unit; The parameter management and optimization protocol stack stores the default RSTP parameter set for industrial ring network optimization, which can be automatically configured to the embedded network switching chip and supports differentiated overlay of upper computer configuration parameters. When the configuration is default / abnormal, it will automatically fall back to the default parameters. The status monitoring and event triggering unit listens to the RSTP status and port link status of the embedded network switching chip in real time through the MDIO interface, and sends a system interrupt or event signal to the central processing unit after capturing topology change events.
[0013] As a further optimization of this system, the parameter management and optimization protocol stack has the functions of topology change message suppression and merging, and backup port MAC table pre-synchronization. The topology change message suppression and merging specifically involves: normalizing port Up / Down, BPDU timeout, and root port switching into TopoEvent; merging multiple events within a preset merging window; performing only one or a few TC processing actions after the window expires; and triggering a preset duration of suppression for ports that experience jitter exceeding the threshold number within a preset jitter window, during which the ports are blocked and TC is not repeatedly triggered. The pre-synchronization of the backup port MAC table specifically involves: when the protocol converges, after determining that the backup port is about to switch to the forwarding state, the primary MAC table entry of the root port is pre-synchronized to the backup port to achieve real-time data forwarding after the port switch.
[0014] As a further optimization of this system, the PLC master station runs a Linux operating system, and the network management module runs as a user-mode process and has a built-in user-mode threaded RSTP protocol engine. The RSTP protocol engine is derived from the open-source mstpd source code. It removes the dependency on the Linux kernel bridge STP / MSTP state and retains only the port state machine, timer management, BPDU encoding / decoding and port role selection logic, thus completing the RSTP control plane closed loop in user space.
[0015] As a further optimization of this system, the user-space threaded RSTP protocol engine maps BPDU packets to the high-priority or independent queue of the embedded network switching chip and adopts a real-time scheduling / time-limited processing strategy for BPDU transmission and reception. The protocol engine's inputs include port events, timers, and BPDU inputs, while its outputs include port forwarding status control, topology change processing, and operational status and event reporting information. It also features BPDU protection and anomaly isolation functions, enabling BPDU Guard / Filter mechanisms for edge ports and BPDU validity verification and rate limiting for ring network ports.
[0016] As a further optimization of this system, it also includes a host computer / engineering station, which provides a graphical configuration interface, supports ring network redundancy enable selection, ring network port selection, bridge priority and port priority configuration, and the configuration parameters can be saved as files and sent to the non-volatile storage of the PLC master station; and the host computer / engineering station has configuration and diagnostic functions for the PLC master station.
[0017] A method for implementing a medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP, applicable to any of the systems described above, includes the following steps: S1. Networking: The PLC master station is connected end to end through two dedicated high-speed Ethernet ring network ports of the embedded network switching chip to form a physical ring network with multiple remote I / O stations. The host computer / engineering station completes the configuration of ring network redundancy related parameters and sends them to the PLC master station. S2. Optimized Convergence and Intelligent Response: When a link failure, node power failure, or link jitter occurs in the ring network, rapid self-healing and intelligent linkage operations are executed sequentially to achieve millisecond-level recovery of network communication and synchronous adjustment of control logic.
[0018] As a further optimization of this method, the startup configuration process of the PLC master station is as follows: After the PLC master station starts, the network management module first loads the fixed industrial ring network RSTP default parameter set, and forms the final operating parameters by overriding the differences in the configuration file issued by the host computer; the network management module writes the final parameters into the RSTP-related registers / entries of the embedded network switching chip through the MDIO interface, adds the ring network port to the RSTP instance, and starts BPDU transmission and reception, timers, and port state machines; when parameters change during operation, the network management module verifies and updates the configuration and records the version and change log.
[0019] As a further optimization of this method, the specific process of rapid self-healing and intelligent linkage in step S2 is as follows: S21. After the embedded network switching chip detects a fault, it reports the event to the central processing unit via an interrupt line or a polling method. S22. The driver / HAL layer reads the port and RSTP status through the MDIO interface and transmits it to the network management module; S23. The network management module triggers the user-space threaded RSTP protocol engine to converge quickly, performs MAC table pre-synchronization and TC message suppression / merging, and adopts a delayed refresh and selective refresh strategy for the MAC table to complete network recovery and data forwarding within 100 milliseconds. S24. The network management module publishes a topology change event to the PLC running state and triggers the network event function block in the user program through system interrupt or message queue. S25. The central processing unit executes preset control linkage actions, including path switching, alarm reporting, key processes entering a safe state, or switching to a backup communication path.
[0020] The present invention provides a fast ring network redundancy system and implementation method for medium and large PLCs based on optimized RSTP. By constructing a tightly coupled collaborative control architecture of the central processing unit unit of the PLC master station, the embedded network switching chip and the network management module, and achieving efficient interconnection by relying on the high-speed internal bus and management interface, the system achieves highly reliable operation and fast response of the medium and large PLC ring network redundancy through RSTP protocol parameter configuration, network status monitoring and topology event linkage processing, thus solving the problems of insufficient collaboration and poor reliability of traditional solutions. Attached Figure Description
[0021] Figure 1 This is a block diagram of the overall functional modules in a medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP as described in this invention. Figure 2 This is a block diagram of the internal hardware and software functional modules of the PLC master station in a medium-to-large PLC fast ring network redundancy system based on optimized RSTP, as described in this invention. Figure 3 This is a flowchart illustrating the collaborative process from topology change to control linkage in the implementation method of a medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP as described in this invention. Detailed Implementation
[0022] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. The described embodiments are merely some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0023] like Figure 1 As shown, this solution provides a fast ring network redundancy system for medium and large PLCs based on optimized RSTP. The system includes a PLC master station, multiple remote I / O stations, and a host computer / engineering station. The multiple remote I / O stations are connected to the PLC master station on the same ring network, and the host computer / engineering station communicates with the PLC master station to realize configuration and diagnostic functions.
[0024] The PLC master station is the core of the entire system, integrating a central processing unit, an embedded network switching chip, and a network management module running within the master station system. These three components form a tightly coupled, collaborative control system. The PLC master station's internal hardware and software functional modules include... Figure 2 As shown, the functions and connections of each component are as follows: The PLC master station is the core of the entire system, integrating a central processing unit, an embedded network switching chip, and a network management module running within the master station system. These three components form a tightly coupled, collaborative control system. The PLC master station's internal hardware and software functional modules include... Figure 2 As shown, the functions and connections of each component are as follows: The central processing unit of this system uses an ARM Cortex-A series or equivalent general-purpose industrial-grade processor. Its core function is to run the PLC runtime system, execute user control logic programs, and receive network topology change event signals from the network management module to trigger preset control linkage actions.
[0025] The embedded network switch chip used in this system is the JL6107S, which provides at least two dedicated high-speed Ethernet ports as ring network ports A / B for constructing a redundant ring network. This chip achieves high-speed data plane interconnection with the central processing unit (CPU) via the RGMII high-speed internal bus and receives control from the CPU through the MDIO management interface. The network management module can use this interface to collect port status data, read / write registers, and configure and distribute RSTP-related parameters of the switch chip. Furthermore, changes in link status or topology of the switch chip can be notified to the CPU via interrupt lines or polling, enabling network events to trigger the network event function block on the PLC side with higher priority.
[0026] The network management module of this system is a software entity running in the application layer of the PLC master station operating system. As the "brain" for interaction between the PLC master station and the embedded network switching chip, it has a built-in parameter management and optimization protocol stack, status monitoring and event triggering unit, and also integrates a user-mode threaded RSTP protocol engine. Its core functions include RSTP parameter configuration and optimization, real-time network status monitoring, topology change event handling, BPDU protection and anomaly isolation, MAC table optimization, and control logic linkage triggering.
[0027] The parameter management and optimization protocol stack stores a default RSTP parameter set optimized for industrial ring networks, including bridge priority, port path cost, Hello time, forwardDelay, and forwarding table aging time. When the PLC master station starts up, it can automatically configure this parameter set into the embedded network switching chip. It also supports differentiated coverage of configuration parameters for host computer / engineering station, and can automatically fall back to the default parameters when the configuration is default or abnormal to ensure system availability. It can also adaptively correct parameters such as path cost according to port speed / topology scale.
[0028] This protocol stack features topology change message suppression and merging capabilities: it normalizes all topology-related events, such as port up / down, BPDU timeout, and root port switching, into a topology event, TopoEvent. Upon the arrival of the first event, a merging window of preset duration is initiated. Within the window, only the event count, the set of affected ports, and the latest event timestamp are recorded. After the window expires, a TC processing action is performed all at once, including generating one or a few TCBPDUs, updating the tcWhile timer, and issuing a MAC table processing command. For the same port experiencing more than a threshold number of jitter events within a preset jitter window, a preset duration of hold suppression is triggered. During this period, the port remains blocked and TC is not triggered repeatedly, significantly reducing broadcast storms and service interruptions caused by link jitter.
[0029] The protocol stack also has a backup port MAC table pre-synchronization function: during the protocol convergence process, when it is determined that the backup port is about to switch to the forwarding state, the primary MAC table entries learned by the root port are proactively synchronized to the backup port in advance. After the port switch is completed, there is no need to relearn the MAC address, and data can be forwarded immediately based on the pre-synchronized MAC table, eliminating the convergence delay caused by MAC address relearning, and further reducing the end-to-end communication recovery time to the millisecond level.
[0030] Status monitoring and event triggering unit: It monitors the RSTP status information and port link status of the embedded network switching chip in real time through the MDIO interface. When it detects events such as topology change, port protection trigger, or convergence completion, it immediately sends a system interrupt or event signal to the central processing unit. This signal can trigger the predefined network event function block in the PLC user program to execute preset control actions.
[0031] User-space threaded RSTP protocol engine: The PLC master station runs a Linux operating system, and the network management module runs as a single user-space process. This protocol engine is an independent thread created within the process, which is a deep modification of the open-source mstpd source code. The original daemon process / command line tool runtime framework is split into a reentrant protocol library. Daemonization, command line parsing, and dependence on STP / MSTP states in the Linux kernel bridge are removed. Only the port state machine, timer management, BPDU encoding / decoding, and port role selection logic required by RSTP are retained and trimmed, forming a "user-space controllable RSTP engine" suitable for industrial equipment. The RSTP control plane closure is completed in user space, avoiding the maintenance of protocol state in kernel space, and realizing complete controllability and portability of protocol behavior.
[0032] The protocol engine's input consists of three parts: ① Port event input: Port Up / Down and rate changes are obtained through PHY / MDIO polling or netlink link notification, and the events are written to the protocol thread's event queue; ② Timer input: The protocol thread maintains a unified timer round-robin / min-heap, advancing timers such as Hello, forwardDelay, and tcWhile when a tick arrives; ③ BPDU input: The protocol thread binds to the specified ring network port based on AF_PACKET / RAWSocket to receive BPDU packets and performs validity checks.
[0033] The protocol engine output consists of three parts: ① Port forwarding status control: outputs control commands such as port blocking / learning / forwarding, and sets the port status and filtering rules of the switching chip through the abstract driver interface; ② Topology change processing: outputs TC trigger and MAC table processing instructions; ③ Running status and event reporting: publishes events such as "topology change / port protection trigger / convergence completion" to the PLC runtime for the user program function blocks to link together.
[0034] Meanwhile, the protocol engine has BPDU protection and anomaly isolation functions: it enables BPDU Guard / Filter mechanism for non-ring network ports configured as edge ports, and immediately switches the port to blocked or disabled state and records alarms once a BPDU is received; it enables BPDU legality verification for ring network ports, and the verification content includes protocol identifier, version, length, field range, etc. At the same time, it limits the rate of BPDU messages to prevent abnormal BPDU storms from occupying the CPU and causing convergence degradation, and performs blacklist filtering on the MAC / port of the abnormal source when necessary.
[0035] The host computer / engineering station of this system provides a graphical configuration interface, through which engineers can complete simple configuration operations, including checking "Enable ring network redundancy", selecting ring network ports A / B, configuring bridge priority, port priority and other parameters; the configuration parameters can be saved as a configuration file and sent to the non-volatile storage of the PLC master station. At the same time, the host computer / engineering station also has configuration diagnostic functions for the PLC master station, realizing remote configuration and status monitoring of the ring network redundancy system.
[0036] This embodiment also provides a method for implementing a medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP. Applying the above system, the implementation method of this invention includes a networking step, a PLC master station startup and configuration step, and an optimized convergence and intelligent response step for fault handling. The collaborative process from topology change to control linkage in fault handling is as follows: Figure 3 As shown, the specific steps are as follows: S1, Networking The PLC master station connects to multiple remote I / O stations via two dedicated high-speed Ethernet ring network ports A / B on its embedded network switching chip, forming a physical ring network. Engineers configure parameters such as ring network redundancy, ring network port selection, bridge priority, and port priority through the graphical configuration interface of the host computer / engineering station, and then send the configuration file to the non-volatile storage of the PLC master station.
[0037] PLC Master Station Startup Configuration: After the PLC master station starts, the network management module first loads the fixed industrial ring network RSTP default parameter set, and overwrites the differences according to the configuration file issued by the host computer / engineering station to form the final set of operating parameters. The network management module writes the final parameters into the RSTP related registers or entries of the embedded network switching chip through the MDIO interface, adds the ring network port to the RSTP instance, starts BPDU transceiver, timer and port state machine, and the system enters normal operation.
[0038] During operation, if parameters need to be changed, the host computer / engineering station can issue the change again. The network management module will verify the changes and update the configuration of the embedded network switching chip as needed, and record the configuration version and change log for subsequent traceability and diagnosis.
[0039] S2, Optimized Convergence and Intelligent Response When a link failure, node power outage, or link jitter / repeated plugging and unplugging occurs in the ring network, the system sequentially executes rapid self-healing and intelligent linkage operations to achieve millisecond-level network communication recovery and synchronous adjustment of control logic. The specific execution process is as follows: S21. Fault Detection and Reporting: The embedded network switching chip monitors the ring network status in real time through PHY or port detection functions. When it detects port link failure / break, port down caused by node power failure, or instantaneous link jitter, it reports the event to the central processing unit through interrupt line or polling. S22. Status Reading and Transmission: The driver / HAL layer reads the port status and RSTP status of the embedded network switching chip through the MDIO interface and transmits the read status information to the network management module in real time. S23. Rapid Protocol Convergence and Network Self-Healing: The network management module triggers the user-space threaded RSTP protocol engine for rapid convergence. The protocol engine performs rapid state machine switching based on fixed optimization parameters, TC packet suppression and merging mechanisms. At the same time, the network management module performs pre-synchronization of the MAC table on the backup port to reduce the traffic impact of MAC address relearning and MAC table refresh on the network. During this process, a delayed refresh and selective refresh strategy is adopted for the MAC table. A MAC table refresh is performed after the topology change event merging window ends, and dynamic entries of affected ports / VLANs are refreshed first. Static MAC entries are configured for critical devices or the MAC table aging time is temporarily shortened to shorten the MAC address relearning convergence time and reduce instantaneous flooding. Finally, protocol convergence is completed within hundreds of milliseconds, realizing network recovery and normal data forwarding. During this process, BPDU packets are mapped to the high-priority queue or independent queue of the embedded network switching chip. The user-space threaded RSTP protocol engine adopts a real-time scheduling / time-limited processing strategy for BPDU transmission and reception to avoid BPDU packets being delayed or dropped due to sudden traffic surges, thus preventing degradation of the convergence process. At the same time, the protocol engine performs BPDU protection and anomaly isolation operations to ensure the stability of the ring network operation. S24. Network event publishing and triggering: After the status monitoring and event triggering unit of the network management module captures a network topology change event, it immediately publishes the network event to the PLC running state and triggers the network event function block in the user program with high priority through system interrupt or message queue. S25. Intelligent linkage of control logic: After receiving a network event trigger signal, the central processing unit immediately executes the predefined control linkage actions in the user program, including communication path switching, remote alarm reporting, key processes entering a safe state or switching to a backup communication path, etc., to achieve the synchronous completion of rapid network self-healing and intelligent adjustment of control logic.
[0040] Example 1 This embodiment provides a fast ring network redundancy system for medium and large PLCs based on optimized RSTP, including a PLC master station, multiple remote I / O stations, and a host computer / engineering station. The remote I / O stations and the PLC master station are connected via industrial Ethernet to form a physical ring network. The host computer / engineering station communicates with the PLC master station via Ethernet to achieve configuration and diagnosis.
[0041] The central processing unit of the PLC master station uses an ARM Cortex-A series industrial-grade processor, and the embedded network switching chip is JL6107S. It provides two dedicated high-speed Ethernet ports as ring network ports A / B. The switching chip achieves data interconnection with the CPU through the RGMII bus and control interconnection with the CPU through the MDIO interface. The PLC master station runs a Linux operating system, and the network management module runs as a user-mode process. The process creates a user-mode threaded RSTP protocol engine, which is modified from the open-source mstpd source code. The dependency on the Linux kernel bridge has been removed, and only the port state machine, timer management, BPDU encoding and decoding, and port role selection logic are retained.
[0042] The network management module's parameter management and optimization protocol stack has a fixed set of RSTP optimization parameters for industrial ring networks. It also enables BPDU rate limiting for ring network ports and BPDU Guard mechanism for edge ports.
[0043] The host computer / engineering station is equipped with dedicated configuration and diagnostic software, which provides a graphical operation interface and supports ring network redundancy activation, ring network port selection, bridge priority, and port priority configuration. Configuration parameters can be saved as configuration files and sent to the PLC master station for non-volatile storage.
[0044] Example 2 This embodiment provides an implementation method based on the system described in Embodiment 1, and the specific steps are as follows: 1. Network Setup: Connect the ring network ports A / B of the JL6107S switching chip of the PLC master station to the Ethernet ports of the remote I / O station to form an industrial Ethernet ring network. Through the graphical interface of the host computer / engineering station, check "Enable Ring Network Redundancy", select ring network ports A / B, configure parameters such as bridge priority and port priority, and send the configuration file to the non-volatile memory of the PLC master station.
[0045] 2. PLC Master Station Startup Configuration: After the PLC master station is powered on, the network management module first loads the fixed RSTP optimized parameter set, and overwrites the differences according to the configuration file issued by the host computer to form the final operating parameters. The network management module writes the final parameters into the RSTP related registers of JL6107S through the MDIO interface, adds ring network ports A / B to the RSTP instance, starts BPDU transceiver, timer and port state machine, and the system enters normal operation. At this time, the RSTP protocol sets one of the ports as a backup port and blocks it, and the primary port forwards data.
[0046] 3. Fault Handling - Single Point of Disconnection in Ring Network: When a physical disconnection occurs in a link of the ring network, the JL6107S switching chip detects the port down and reports the event to the CPU via the interrupt line; the driver layer reads the port and RSTP status through the MDIO interface and transmits it to the network management module; the network management module triggers the user-mode RSTP protocol engine to converge, and simultaneously performs pre-synchronization of the MAC table of the backup port, synchronizing the MAC table entries of the root port to the backup port, and performing TC packet suppression and merging operations; after the protocol engine completes the fast state machine switch, it switches the backup port to the forwarding state, and the network recovers within hundreds of milliseconds, realizing normal data forwarding; at the same time, the network management module publishes a topology change event to the PLC running state, triggers the network event function block through the system interrupt, the CPU executes the preset alarm reporting action, uploads the fault information to the host computer / engineering station, and records the fault log.
[0047] 4. Fault Handling - Instantaneous Link Jitter: When a port in the ring network experiences instantaneous link jitter / repeated plugging and unplugging, the TC message suppression and merging mechanism of the network management module is triggered to de-jitter the jitter event. If the preset jitter threshold is reached, a sustained suppression state is triggered. During this period, the port remains blocked and TC messages are not repeatedly triggered, avoiding frequent MAC table refreshes and broadcast storms, and reducing the risk of instantaneous interruption of upper-layer services. After the sustained suppression state ends, if the port status is stable at Up, the protocol engine restores the port to a backup port. If the port status is Down, it is handled according to the single-point disconnection procedure.
[0048] 5. Fault Handling - Node Power Loss: When a PLC or remote I / O station on the ring network loses power, causing a topology change, the switching chip detects the port status change and reports it. The network management module triggers the optimized RSTP protocol engine to complete rapid convergence and restore network communication. At the same time, the network management module publishes network events to the PLC running state, and the CPU executes preset control linkage actions, such as putting the critical processes associated with the power-down node into a safe state or switching to a backup communication path, so as to realize the synchronous completion of network recovery and control response.
[0049] In practical applications, the system in this embodiment maintains a stable recovery time of hundreds of milliseconds for ring network faults, effectively avoids service interruptions during link jitter, and ensures timely response of control logic linkage when nodes lose power, fully meeting the industrial real-time and high reliability requirements of medium and large-sized PLCs. At the same time, the system adopts the standard RSTP protocol, which is compatible with standard Ethernet switches of various brands. Compared with systems using proprietary ring network protocols, this significantly reduces system construction costs and simplifies the engineering implementation process.
[0050] The above description is merely illustrative of the embodiments of the present invention and is not intended to limit the present invention. For those skilled in the art, any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP, characterized in that, It includes a PLC master station and multiple remote I / O stations connected to a ring network; the PLC master station integrates a central processing unit, an embedded network switching chip, and a network management module running within the master station system; The central processing unit (CPU) is used to execute user control logic programs; the embedded network switching chip is interconnected with the CPU's data plane via a high-speed internal bus, receives control from the CPU through a management interface, and provides at least two dedicated high-speed Ethernet ports for building a redundant ring network; the network management module serves as the core of interaction between the PLC master station and the embedded network switching chip, enabling RSTP protocol parameter configuration, network status monitoring, topology change event processing, and control logic linkage triggering.
2. The medium-to-large-scale PLC fast ring network redundancy system and implementation method based on optimized RSTP according to claim 1, characterized in that, The high-speed internal bus is the RGMII bus, and the management interface is the MDIO interface; the embedded network switching chip is the JL6107S, and the central processing unit is an ARM Cortex-A series or equivalent industrial-grade processor; the link or topology change events of the embedded network switching chip are reported to the central processing unit through interrupt lines or polling.
3. A medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP according to claim 1, characterized in that, The network management module includes a parameter management and optimization protocol stack, a status monitoring and event triggering unit; The parameter management and optimization protocol stack stores the default RSTP parameter set for industrial ring network optimization, which can be automatically configured to the embedded network switching chip and supports differentiated overlay of upper computer configuration parameters. When the configuration is default / abnormal, it will automatically fall back to the default parameters. The status monitoring and event triggering unit listens to the RSTP status and port link status of the embedded network switching chip in real time through the MDIO interface, and sends a system interrupt or event signal to the central processing unit after capturing topology change events.
4. A medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP according to claim 3, characterized in that, The parameter management and optimization protocol stack has functions such as topology change message suppression and merging, and backup port MAC table pre-synchronization. The topology change message suppression and merging specifically involves: normalizing port Up / Down, BPDU timeout, and root port switching into TopoEvent; merging multiple events within a preset merging window; performing only one or a few TC processing actions after the window expires; and triggering a preset duration of suppression for ports that experience jitter exceeding the threshold number within a preset jitter window, during which the ports are blocked and TC is not repeatedly triggered. The pre-synchronization of the backup port MAC table specifically involves: when the protocol converges, after determining that the backup port is about to switch to the forwarding state, the primary MAC table entry of the root port is pre-synchronized to the backup port to achieve real-time data forwarding after the port switch.
5. A medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP according to claim 3, characterized in that, The PLC master station runs a Linux operating system, and the network management module runs as a user-mode process and has a built-in user-mode threaded RSTP protocol engine. The RSTP protocol engine is derived from the open-source mstpd source code. It removes the dependency on the Linux kernel bridge STP / MSTP state and retains only the port state machine, timer management, BPDU encoding / decoding and port role selection logic, thus completing the RSTP control plane closed loop in user space.
6. A medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP according to claim 5, characterized in that, The user-space threaded RSTP protocol engine maps BPDU packets to the high-priority or independent queues of the embedded network switching chip, and adopts a real-time scheduling / time-limited processing strategy for BPDU transmission and reception. The protocol engine's inputs include port events, timers, and BPDU inputs, while its outputs include port forwarding status control, topology change processing, and operational status and event reporting information. It also features BPDU protection and anomaly isolation functions, enabling BPDU Guard / Filter mechanisms for edge ports and BPDU validity verification and rate limiting for ring network ports.
7. A medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP according to claim 1, characterized in that, It also includes a host computer / engineering station, which provides a graphical configuration interface, supports ring network redundancy enable selection, ring network port selection, bridge priority and port priority configuration, and the configuration parameters can be saved as files and sent to the non-volatile storage of the PLC master station; and the host computer / engineering station has configuration and diagnostic functions for the PLC master station.
8. A method for implementing a medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP, applied to the system described in any one of claims 1-7, characterized in that, Includes the following steps: S1. Networking: The PLC master station is connected end to end through two dedicated high-speed Ethernet ring network ports of the embedded network switching chip to form a physical ring network with multiple remote I / O stations. The host computer / engineering station completes the configuration of ring network redundancy related parameters and sends them to the PLC master station. S2. Optimized Convergence and Intelligent Response: When a link failure, node power failure, or link jitter occurs in the ring network, rapid self-healing and intelligent linkage operations are executed sequentially to achieve millisecond-level recovery of network communication and synchronous adjustment of control logic.
9. The method for implementing a medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP according to claim 8, characterized in that, The startup configuration process of the PLC master station is as follows: After the PLC master station starts, the network management module first loads the fixed industrial ring network RSTP default parameter set, and forms the final operating parameters by overriding the differences in the configuration file issued by the host computer; the network management module writes the final parameters into the RSTP related registers / entries of the embedded network switching chip through the MDIO interface, adds the ring network port to the RSTP instance, and starts BPDU transmission and reception, timers and port state machines; when the parameters change during operation, the network management module verifies and updates the configuration and records the version and change log.
10. The method for implementing a medium-to-large-scale PLC fast ring network redundancy system based on optimized RSTP according to claim 8, characterized in that, The specific process of rapid self-healing and intelligent linkage described in step S2 is as follows: S21. After the embedded network switching chip detects a fault, it reports the event to the central processing unit via an interrupt line or a polling method. S22. The driver / HAL layer reads the port and RSTP status through the MDIO interface and transmits it to the network management module; S23. The network management module triggers the user-space threaded RSTP protocol engine to converge quickly, performs MAC table pre-synchronization and TC message suppression / merging, and adopts a delayed refresh and selective refresh strategy for the MAC table to complete network recovery and data forwarding within 100 milliseconds. S24. The network management module publishes a topology change event to the PLC running state and triggers the network event function block in the user program through system interrupt or message queue. S25. The central processing unit executes preset control linkage actions, including path switching, alarm reporting, key processes entering a safe state, or switching to a backup communication path.