PLC networking data acquisition system and method based on edge gateway
By deploying SDN controllers and virtualization technology in PLC networks, virtual IPs are automatically allocated and IP address isolation is realized. Combined with AI intelligent scheduling and improved Raft consensus algorithm, the problems of IP address conflicts and configuration complexity in PLC network data acquisition are solved, and efficient data collection and network management are achieved.
Patent Information
- Application Number
- CN202510400840.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2045-04-01
AI Technical Summary
When realizing centralized collection of PLC network data, the existing technology faces the problems of IP address conflicts and network configuration complexity. Especially in large industrial networks, traditional methods require manual setting of IP addresses and configuring routing and firewall rules, which is cumbersome and prone to errors.
By deploying SDN controllers, deep packet detection technology is used to identify and classify PLC devices, and virtual IP is automatically allocated and IP address isolation is achieved through virtual subnets and virtual routers. Combining AI intelligent scheduling and improved Raft consensus algorithm, dynamically adjust the acquisition cycle and optimize the acquisition strategy, and detect the edge gateway status through the heartbeat mechanism to automatically update the network topology view.
It effectively solves the problem of IP address conflict between PLC equipment, reduces the complexity of industrial network configuration and manual operation errors, and realizes efficient centralized collection of PLC network data and dynamic network management.
Smart Images

Figure CN119906736A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication transmission technology, and more specifically, to a PLC networking data acquisition system based on an edge gateway and a method thereof. Background Art
[0002] The patent with patent publication number CN116055525A discloses a data acquisition system based on edge computing. The system includes a PLC that connects and controls industrial equipment, an edge gateway that connects industrial equipment or PLC, a cloud platform that connects the edge gateway, and a client that interacts with the cloud platform, wherein the cloud platform is used to generate data acquisition tasks and send the generated data acquisition tasks to the edge gateway; the edge gateway is used to perform data acquisition through the industrial equipment or PLC connected to it according to the received data acquisition tasks, and pre-process the collected data and forward it to the cloud platform. In the data acquisition system based on edge computing provided by the present application, the cloud platform centrally manages the edge gateway, realizes the dynamic issuance of data acquisition tasks, reduces the workload of setting up data acquisition for the equipment, and improves the efficiency of equipment data acquisition.
[0003] The existing PLC networking data acquisition system and method based on edge gateway mainly have the following problems: In order to reduce costs and unify equipment standards, industrial enterprises may purchase PLC devices of the same model in batches. These PLC devices are generally configured with the same IP address by default when leaving the factory, so that they can be quickly identified and used during factory testing or preliminary configuration. At the same time, in order to simplify the installation and debugging process, equipment suppliers may also set the IP address of the PLC device to a common default value so that users can customize the configuration before use. However, many enterprise users did not have the need to build an industrial Internet network in the early days, and did not modify the IP address of the PLC device in time after the equipment was installed, which would cause multiple PLC devices to use the same IP address. In addition, many companies lack foresight when establishing industrial Internet networks. Initially, they only realized the communication between the PLC devices and host computers in the workshop, and did not carry out unified IP address planning for the entire factory workshop. With the rapid expansion of the company's business, there may be conflicts in the IP address segments of multiple workshops.
[0004] Traditional industrial network configuration requires manual setting of parameters such as IP address, subnet mask, gateway, etc. for each device, and configuration of corresponding routing and firewall rules. This process is cumbersome and error-prone, especially in large industrial networks. In addition, under the traditional network architecture, network expansion usually requires adding physical devices and re-planning IP address allocation. The expansion process is complicated and prone to configuration errors. Therefore, how to realize the centralized collection of PLC networking data without changing the existing network architecture and PLC device IP addresses is an urgent problem to be solved.
[0005] In view of this, the present invention proposes a PLC networking data acquisition system based on an edge gateway to solve the above problems. Summary of the invention
[0006] In order to overcome the above-mentioned defects of the prior art and to achieve the above-mentioned purpose, the present invention provides the following technical solution: a PLC networking data acquisition system based on an edge gateway, comprising: The dynamic virtual isolation module deploys an SDN controller and uses deep packet inspection technology to identify and classify different PLC devices, automatically assign them to virtual subnets, and obtain virtual IPs. Each virtual subnet isolates PLC devices with the same IP address through virtual switches and virtual routers. The virtual IP and actual physical network port information of the PLC device are recorded in a mapping table to establish a network topology view. The multi-protocol parsing module connects the edge gateway to the PLC device based on the network topology view, integrates the PLC communication protocol library and uses FPGA hardware acceleration to perform protocol parsing, and reads the PLC networking data from the PLC device in real time; AI intelligent scheduling module reads the real-time status of PLC based on PLC networking data, dynamically adjusts the collection cycle, and optimizes the collection strategy according to the edge gateway CPU load and network congestion conditions; The gateway collaborative perception module, based on the improved Raft consensus algorithm, synchronizes the optimized collection strategy between edge gateways, uses the heartbeat mechanism to detect the edge gateway status, isolates the faulty edge gateway, and automatically updates the network topology view; uses the updated network topology view to re-read the PLC networking data from the PLC device in real time; The data transmission module transmits the read PLC networking data to the acquisition server through a standardized data access interface.
[0007] Preferably, the method for obtaining a virtual IP comprises: Deploy an SDN controller on the edge gateway to centrally manage virtual switches and virtual routers, and configure the connection between the SDN controller and the physical network port of the edge gateway; define virtual switches and virtual routers in the SDN controller as the boundaries of logically isolated virtual subnets; The SDN controller captures data packets in the network through the mirror port, uses DPI technology to parse the data packet payload, and extracts key features; the key features include protocol header fields, function codes, and device identifiers; a preset device fingerprint library, the elements of which include protocol features, manufacturer identifiers, and device models; based on the preset device fingerprint library, PLC devices of different brands and protocol types are identified and classified to obtain classification results; Define virtual subnet division strategies based on the classification results. Virtual subnet division strategies include brand isolation, protocol isolation, and functional group isolation. The SDN controller automatically creates virtual subnets based on the classification results, binds them to the corresponding virtual switches, configures the access control list of the virtual router, and restricts cross-subnet communication. Deploy a lightweight DHCP server in the virtual subnet, assign a unique virtual IP to each PLC, and manually bind the virtual IP to the physical network port for each PLC device through the SDN controller; configure NAT rules in the virtual router to map the PLC's physical IP to a globally unique virtual IP.
[0008] Preferably, the method for isolating PLC devices with the same IP address comprises: In the SDN controller, an independent virtual switch and virtual router are allocated to each virtual subnet; each virtual switch acts as the entrance or exit of the PLC device in the virtual subnet, controlling the traffic forwarding of the PLC device in the virtual subnet; preset configuration flow table rules, the virtual switch controls the traffic by configuring flow table rules, and only allows communication between PLC devices in the same virtual subnet; the preset configuration flow table rules include inlet traffic matching rules, default discard rules, VLAN isolation rules, NAT conversion rules, access control list rules and AI adaptive flow table rules; for different virtual subnets, the virtual switch isolates the traffic in different subnets based on VLAN tags; Each virtual subnet routes and forwards data packets through a virtual router; the virtual router only allows legal cross-subnet data transmission based on network policies and configurations. For devices with the same IP address but belonging to different virtual subnets, illegal cross-subnet communication is prevented by configuring access control policies.
[0009] Preferably, the method for acquiring the network topology view includes: Scan all connected PLC devices through the SDN controller, manually bind the virtual IP of the PLC device to the corresponding physical network port, and generate a PLC device mapping table; record the virtual IP, physical IP, MAC address and connected physical network port information of each PLC device through the PLC device mapping table; take the edge gateway as the central node, build a network topology view based on the PLC device mapping table, and use the topology drawing tool Graphviz to visualize the network topology view.
[0010] Preferably, the method for connecting the edge gateway to the PLC device based on the network topology view includes: The edge gateway reads the virtual IP of each PLC device and its corresponding actual physical network port information based on the obtained network topology view, and establishes a virtual communication link with the PLC device; The frame format, field definition, verification algorithm and state machine logic of various PLC communication protocols are abstracted and encapsulated into a unified PLC communication protocol library; data request commands are generated based on the PLC communication protocol library, and data requests are sent to PLC devices through virtual communication links; PLC devices respond to the received data request commands and transmit original data packets to the edge gateway through virtual communication links; the edge gateway captures the original data packets transmitted by the virtual communication link, and performs protocol decoding and data extraction through FPGA hardware to obtain PLC networking data.
[0011] Preferably, the PLC networking data includes device ID, communication protocol, timestamp, device status data, sensor data and device alarm data.
[0012] Preferably, the method for dynamically adjusting the acquisition period includes: Based on the PLC networking data, the real-time status of the PLC is read, and the fuzzy logic is used to perform multi-dimensional analysis on the real-time status of the PLC to obtain the equipment status classification; based on the equipment status classification, the data collection cycle is dynamically allocated; based on the sliding time window, the collection cycle is adjusted in real time, and when the data change rate exceeds the preset data change rate threshold, the collection cycle is automatically shortened to improve the collection density.
[0013] Preferably, the method for optimizing the acquisition strategy comprises: The CPU usage rate of the edge gateway is collected in real time through the API to obtain the CPU load of the edge gateway; when the CPU load of the edge gateway exceeds the preset CPU load threshold of the edge gateway, the PLC network data polling interval is extended, the number of PLC devices collected concurrently is reduced, and the PLC network data collection tasks of non-critical PLC devices are suspended; Monitor the bandwidth utilization of the network interface in real time, obtain network congestion status, and use a lightweight compression algorithm to compress the collected PLC networking data.
[0014] Preferably, the method for synchronizing the optimized collection strategy between edge gateways based on the improved Raft consensus algorithm includes: The improved Raft consensus algorithm is run on the edge gateway node. The improved Raft consensus algorithm includes a dynamic timeout mechanism. The dynamic timeout mechanism is used to monitor network quality parameters in real time, establish an edge gateway cluster, and complete the initial Leader election. Network quality parameters include round-trip delay, packet loss rate, and network jitter indicators. The network quality comprehensive index is calculated by weighted average network quality parameters. Based on the network quality comprehensive index, the election timeout and log replication timeout of the improved Raft algorithm are dynamically adjusted through an exponential decay model. The collection strategy after synchronization optimization by improving the Raft consensus algorithm is sent to each edge gateway node; the collection strategy after synchronization optimization by improving the Raft consensus algorithm includes maintaining an independent log replication success probability model for each gateway node, Dynamically adjust the retry interval to the optimal value based on the current round-trip delay and packet loss rate; each edge gateway node performs network topology data collection according to the optimized collection strategy; synchronize the collected topology data to the Leader node through the improved Raft consensus mechanism; the Leader node merges the topology data of each gateway node; automatically updates the network topology view, and synchronizes the updated network topology view to each edge gateway node.
[0015] A PLC networking data acquisition method based on an edge gateway, comprising: S1. By deploying SDN controllers and using deep packet inspection technology, different PLC devices are identified and classified, and automatically assigned to virtual subnets to obtain virtual IPs. Each virtual subnet isolates PLC devices with the same IP address through virtual switches and virtual routers. The virtual IP and actual physical network port information of the PLC device are recorded in a mapping table to establish a network topology view. S2, connect the edge gateway to the PLC device based on the network topology view, integrate the PLC communication protocol library and use FPGA hardware acceleration to perform protocol parsing, and read the PLC networking data from the PLC device in real time; S3, read the real-time status of PLC based on PLC networking data, dynamically adjust the collection cycle, and optimize the collection strategy according to the edge gateway CPU load and network congestion; S4. Based on the improved Raft consensus algorithm, the optimized collection strategy is synchronized between edge gateways, and the heartbeat mechanism is used to detect the status of edge gateways, isolate the faulty edge gateways, and automatically update the network topology view; use the updated network topology view to re-read the PLC networking data from the PLC device in real time; S5. Transmit the read PLC networking data to the acquisition server through the standardized data access interface.
[0016] Compared with the prior art, the present invention has the following beneficial effects: The present invention effectively solves the IP address conflict problem that may exist in industrial field PLC devices through virtual IP allocation and NAT mapping mechanism, so that heterogeneous PLC devices with duplicate private addresses can coexist and communicate normally in the same physical network; the virtual subnet isolation technology based on SDN realizes the logical isolation between PLC devices of different brands, different protocols or different functional groups; through automatic device identification and virtual subnet division, the complexity of industrial network configuration is greatly reduced, and manual operation errors are reduced; virtualization technology makes network topology and policy adjustment no longer dependent on physical connection changes, and virtual subnet division and access control policy can be dynamically adjusted through the SDN controller to adapt to the ever-changing industrial network needs.
[0017] Through the combined architecture of virtual switches and virtual routers, complete logical isolation between different virtual subnets is achieved, allowing PLC devices with the same IP address to operate independently in their respective virtual subnets without modifying the original IP configuration of the device, solving the core problem in industrial network integration; the multi-level access control mechanism based on preset configuration flow table rules realizes all-round security protection from the data link layer to the application layer, and can accurately control communication permissions according to protocol characteristics, device types and business needs; standardized virtual switch and virtual router configuration templates greatly reduce the complexity of network deployment. Network administrators only need to focus on policy definitions rather than underlying implementation details, reducing the risk of configuration errors and improving deployment efficiency.
[0018] Through the dynamic timeout mechanism, the system can adaptively adjust the parameters of the Raft algorithm, effectively deal with delay fluctuations, packet loss and network jitter in the edge network environment, and significantly improve the stability of the consensus algorithm under harsh network conditions. The improved Raft algorithm intelligently extends the timeout time when the network quality decreases, effectively reducing the number of unnecessary Leader elections caused by network fluctuations, reducing the computing burden of the edge gateway, and reducing system resource consumption; the optimal retry interval calculation based on network quality makes the timing of sending log replication requests more reasonable, accelerates consensus when the network is good, avoids invalid retries when the network is congested, and improves the overall efficiency of collection strategy synchronization. Through the adaptive detection frequency adjustment mechanism, the system actively reduces the frequency of topology data collection when the network quality is poor, reduces the transmission burden of the edge network, and prevents the deterioration of network congestion; through the optimized consensus mechanism and topology synchronization strategy, the system can maximize the real-time performance of data while ensuring data consistency, and meet the strict requirements of edge computing scenarios for data timeliness. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a structural schematic diagram of a PLC networking data acquisition system based on an edge gateway of the present invention; Figure 2A schematic diagram of a PLC networking data collection method based on an edge gateway according to the present invention; Figure 3 This is a flowchart of the gateway collaborative perception provided by the present invention. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0021] Example 1 See also Figure 1 and Figure 3 As shown, this embodiment 1 further describes a PLC networking data acquisition system based on an edge gateway proposed by the present invention, including: The dynamic virtual isolation module deploys an SDN controller and uses deep packet inspection technology to identify and classify different PLC devices, automatically assign them to virtual subnets, and obtain virtual IPs. Each virtual subnet isolates PLC devices with the same IP address through virtual switches and virtual routers. The virtual IP and actual physical network port information of the PLC device are recorded in a mapping table to establish a network topology view. The multi-protocol parsing module connects the edge gateway to the PLC device based on the network topology view, integrates the PLC communication protocol library and uses FPGA hardware acceleration to perform protocol parsing, and reads the PLC networking data from the PLC device in real time; AI intelligent scheduling module reads the real-time status of PLC based on PLC networking data, dynamically adjusts the collection cycle, and optimizes the collection strategy according to the edge gateway CPU load and network congestion conditions; The gateway collaborative perception module, based on the improved Raft consensus algorithm, synchronizes the optimized collection strategy between edge gateways, uses the heartbeat mechanism to detect the edge gateway status, isolates the faulty edge gateway, and automatically updates the network topology view; uses the updated network topology view to re-read the PLC networking data from the PLC device in real time; The data transmission module transmits the read PLC networking data to the acquisition server through a standardized data access interface.
[0022] Methods for obtaining a virtual IP include: Deploy an SDN controller (such as OpenDaylight, ONOS, or Ryu) on the edge gateway to centrally manage virtual switches and virtual routers, configure the connection between the SDN controller and the physical network port of the edge gateway, and ensure that the controller can perceive the underlying network topology; define virtual switches and virtual routers in the SDN controller as the boundaries of logically isolated virtual subnets; The SDN controller captures data packets in the network through the mirror port, uses DPI technology to parse the data packet payload, and extracts key features; the key features include protocol header fields, function codes, and device identifiers; a preset device fingerprint library, the elements of which include protocol features, manufacturer identifiers, and device models; based on the preset device fingerprint library, PLC devices of different brands and protocol types are identified and classified to obtain classification results; Define virtual subnet division strategies based on the classification results. Virtual subnet division strategies include brand isolation, protocol isolation, and functional group isolation. Brand isolation means that PLCs of the same brand (such as Siemens and Rockwell) are assigned to independent subnets. Protocol isolation means that PLCs of the same protocol (such as ModbusTCP and Profinet) are assigned to the same subnet. Functional group isolation means that control PLCs (such as master stations) and data acquisition PLCs (slave stations) are divided into different subnets. The SDN controller automatically creates virtual subnets based on the classification results, binds them to the corresponding virtual switches, configures the access control list of the virtual router, and limits cross-subnet communication. Deploy a lightweight DHCP server in the virtual subnet, assign a unique virtual IP to each PLC, and manually bind the virtual IP to the physical network port for each PLC device through the SDN controller; configure NAT rules in the virtual router to map the PLC's physical IP (a private address that may conflict) to a globally unique virtual IP.
[0023] A lightweight DHCP server is a Dynamic Host Configuration Protocol (DHCP) server that takes up little resources and is easy to configure and manage. It is suitable for small networks, embedded systems, or resource-constrained environments. Deploying a lightweight DHCP server within a virtual subnet can assign a unique virtual IP address to each PLC device. This helps simplify network management, avoid IP address conflicts, and ensure that each device can communicate correctly. Common lightweight DHCP servers include: Dnsmasq: It integrates DNS cache, DHCP, TFTP and other functions. It is often used in routers and embedded systems. It has simple configuration and high flexibility, and is suitable for small networks. udhcpd: This is a lightweight DHCP server in the BusyBox project, specifically designed for resource-limited environments, suitable for embedded Linux systems such as OpenWRT and other small routing devices; Using these lightweight DHCP servers within a virtual subnet can effectively assign a unique virtual IP address to each PLC device, ensuring network stability and reliability.
[0024] Methods for isolating PLC devices with the same IP address include: In the SDN controller, an independent virtual switch and virtual router are allocated to each virtual subnet; each virtual switch acts as the entrance or exit of the PLC device in the virtual subnet, controls the traffic forwarding of the PLC device in the virtual subnet, ensures the interconnection of the devices in the subnet, and prevents cross-subnet communication; preset configuration flow table rules, the virtual switch controls the traffic by configuring the flow table rules, and only allows communication between PLC devices in the same virtual subnet; the preset configuration flow table rules include inlet traffic matching rules, default discard rules, VLAN isolation rules, NAT conversion rules, access control list rules and AI adaptive flow table rules; for different virtual subnets, the virtual switch isolates the traffic in different subnets based on VLAN tags to prevent direct communication between PLC devices with IP conflicts; It should be noted that the ingress traffic matching rule includes matching fields: source MAC address, source IP address, VLANID, protocol type (such as ModbusTCP, Profinet). The application scenario of this ingress traffic matching rule is when the PLC device is first connected, the SDN controller matches and classifies according to the DPI analysis results. For example, OpenFlow rules; the default discard rule is used to prevent unauthorized traffic from entering the network and improve security. The role of the VLAN isolation rule is to logically isolate PLC devices in different subnets through VLAN to prevent direct communication between PLCs with the same IP address.
[0025] For example, VLAN Tagging can match the field VLAN ID; for example, add VLAN 10 to Modbus TCP devices and VLAN 20 to Profinet devices; VLAN access control: The function of VLAN access control is to prohibit PLC devices in different VLANs from communicating directly, and they must go through the virtual router.
[0026] The role of NAT conversion rules is to resolve conflicts when PLC devices with the same IP address communicate across subnets. For example, source NAT (SNAT) is used to convert the source IP of a PLC device to a unique virtual IP when it accesses an external subnet. Destination NAT (DNAT) is used to map the virtual IP accessed externally back to the actual physical IP of the PLC.
[0027] The role of access control list rules is to limit cross-subnet communication and prevent unauthorized access. For example, prohibit cross-subnet PLC direct communication, such as prohibiting ModbusTCPVLAN10 from accessing ProfinetVLAN20; allow specific traffic (master-slave communication), for example, allow the master PLC to access the slave PLC, the protocol is ModbusTCP; The role of AI adaptive flow table rules is to dynamically adjust flow table rules to optimize network load balancing and security. For example, dynamic NAT based on traffic load, for example, when a certain traffic exceeds 100Mbps, the NAT rule is switched; AI detects abnormal traffic and blocks it, such as automatically blocking it when it finds that a PLC device scans a large number of IP addresses in a short period of time.
[0028] Each virtual subnet routes and forwards data packets through a virtual router. The virtual router has an access control list (ACL) function to control the communication between different virtual subnets. The virtual router only allows legal cross-subnet data transmission according to network policies and configurations. For devices with the same IP address but belonging to different virtual subnets, illegal cross-subnet communication is prevented by configuring access control policies. It should be noted that the access control strategy here is different from the virtual subnet division strategy. The virtual subnet division strategy is a rule determined at the SDN controller level, which is used to preliminarily divide the virtual subnets of PLC devices. It is mainly divided according to different brands, protocol types or functional groups to ensure that similar devices are assigned to the corresponding virtual subnets. This belongs to the stage of network architecture design and determines which devices belong to which subnet. The access control strategy is a specific traffic control at the virtual router level, which determines which traffic can cross subnets and which traffic needs to be blocked; it mainly relies on ACL (access control list) to determine the flow direction of data packets. This is the stage of actual traffic management, which is executed after the subnet division is completed to ensure that the communication between different virtual subnets is constrained.
[0029] Methods for obtaining the network topology view include: Scan all connected PLC devices through the SDN controller, manually bind the virtual IP of the PLC device to the corresponding physical network port, and generate a PLC device mapping table; record the virtual IP, physical IP, MAC address and connected physical network port information of each PLC device through the PLC device mapping table; take the edge gateway as the central node, build a network topology view based on the PLC device mapping table, and use the topology drawing tool Graphviz to visualize the network topology view. For example: Table 1 Mapping table
[0030] The mapping table is used to bind the physical network port (ethX) of the PLC with the virtual IP (10.0.XX) to ensure network isolation; dynamically maintain the device through the SDN controller to support device status changes such as online, offline, and migration; and avoid IP conflicts. Even if different PLC devices use the same private IP, they can be distinguished by the virtual IP.
[0031] The method of connecting the edge gateway to the PLC device based on the network topology view includes: Based on the acquired network topology view, the edge gateway reads the virtual IP of each PLC device and its corresponding actual physical network port information, establishes a virtual communication link with the PLC device, and ensures that the data transmission path is correct and conflict-free; the virtual IP of each PLC device and its corresponding actual physical network port information represent the location and connection relationship of the PLC device in the industrial control network; The network topology view can clearly describe the virtual IP of the PLC device and its corresponding actual physical network port information, so that the edge gateway can quickly establish a virtual communication link and realize the unified management of PLC devices in different plant areas and with different protocols, which improves the visualization, management efficiency and flexibility of the industrial control network. At the same time, it also avoids communication failures caused by address conflicts or link errors in traditional industrial control networks, ensuring the correct data transmission path. The frame format, field definition, verification algorithm and state machine logic of various PLC communication protocols are abstracted and encapsulated into a unified PLC communication protocol library; data request commands are generated based on the PLC communication protocol library, and data requests are sent to PLC devices through virtual communication links; PLC devices respond to the received data request commands and transmit original data packets to the edge gateway through virtual communication links; the edge gateway captures the original data packets transmitted by the virtual communication link, and performs protocol decoding and data extraction through FPGA hardware to obtain PLC networking data.
[0032] The edge gateway generates data request commands through a unified PLC communication protocol library, and collects data from PLC devices efficiently through virtual communication links, ensuring the high real-time and high reliability of the data transmission link, and meeting the needs of industrial control systems for low-latency, quasi-real-time data interaction; protocol decoding and data extraction are implemented through FPGA hardware, significantly improving decoding efficiency and data processing capabilities. Compared with traditional software decoding solutions, hardware-level processing has lower latency and higher data throughput, ensuring the performance requirements of large-scale concurrent data collection and processing. Common PLC communication protocols include ModbusRTU, Profinet, S7, etc. If we need to support ModbusRTU, Profinet and S7 protocols at the same time, we can abstract and encapsulate them in the following ways: Unified protocol frame abstraction: We can define a general "PLC protocol frame" data structure, which contains the following fields: Frame start identifier: used to identify the start of a frame, such as the low-level start bit of ModbusRTU, the Ethernet frame header of Profinet, and the dedicated start code of S7.
[0033] Device address: unique address that identifies the PLC device.
[0034] Function code / command code: indicates the specific operation or command type.
[0035] Data field: contains the actual data content and has a variable length.
[0036] Checksum: such as CRC of ModbusRTU, FCS of Profinet or error checking in S7.
[0037] Frame end marker: marks the end of the data frame.
[0038] Take ModbusRTU as an example: Frame format: [start bit]+[device address]+[function code]+[register data]+[CRC check]+[stop bit]; Parsing steps: Use the start bit to detect the start; extract the device address, function code and data field; calculate the CRC of the data field and compare it with the CRC in the frame to verify the correctness of the data; confirm the end of the frame through the stop bit.
[0039] Device address: 0x01 (device number 1) Function code: 0x04 (read input register) Number of data bytes: 0x02 (indicates 2 bytes of data) Register data: 0x000x64 (decimal 100, corresponding to the temperature sensor reading) 0x000xC8 (decimal 200, corresponding to the pressure sensor reading) Extract data through standardized data format mapping to obtain PLC networking data:
[0040] "Device ID":"PLC_001", "Communication protocol":"ModbusRTU", "Timestamp":"2025-xx-xx10:15:30", "Device Status":"Normal", "Sensor data":{"temperature":100,"pressure":200} "Alarm Information":null.
[0041] PLC networking data includes device ID, communication protocol, timestamp, device status data, sensor data and device alarm data.
[0042] PLC networking data is a comprehensive data set that contains the following specific information: Device ID: The device ID is a unique identifier for each PLC device and is used to distinguish different PLC devices in the network; Communication protocol: Indicates the specific communication standard used by the PLC device. Understanding the communication protocol is essential to correctly interpret the data received from the PLC device; Timestamp: records the exact time when the data was collected, in the format of date and time, which is very useful for analyzing equipment operation trends, diagnosing problems, and performing time series analysis; Equipment status data: including the operating status of PLC equipment, such as running, stopping, fault, etc. This type of data helps operators understand the real-time status of the equipment to facilitate maintenance and troubleshooting; Sensor data: collected by sensors on PLC equipment, including parameters such as temperature, pressure, humidity, flow, etc., which are essential for monitoring production processes and environmental conditions; Equipment alarm data: Contains any abnormal or warning information that occurs during the operation of the PLC equipment, which can help operators quickly identify potential problems and take appropriate measures.
[0043] Methods for dynamically adjusting the collection period include: Based on the PLC networking data, the real-time status of the PLC is read, and the fuzzy logic is used to perform multi-dimensional analysis on the real-time status of the PLC to obtain the equipment status classification; based on the equipment status classification, the data collection cycle is dynamically allocated; based on the sliding time window, the collection cycle is adjusted in real time, and when the data change rate exceeds the preset data change rate threshold, the collection cycle is automatically shortened to improve the collection density.
[0044] Fuzzy logic example: Input parameters are divided into fuzzy sets (high, medium, low) Example of rule: IF (device alarm status = abnormal) AND (device importance = high) → THEN (status level = level 1); IF (data change rate = high) AND (equipment importance = medium) → THEN (status level = level 2); Table 2 Equipment level description
[0045] For example: Table 3 Equipment status collection table
[0046] Equipment status classification: PLC-003: Level 1 (alarm + fault + high importance); PLC-001: Level 2 (normal operation status + high data change rate + medium importance); PLC-002: Level 3 (normal operation status + low data change rate + low importance, non-critical); The acquired device status classification is used as a key decision factor for dynamic acquisition frequency: Table 4 Collection frequency allocation table
[0047] Set a sliding time window, such as 10 sampling points in the past 5 minutes, calculate the data change rate within the time window, and automatically shorten the collection cycle when the data change rate exceeds the preset threshold (such as the change rate is greater than 20%); For example: Initial state: PLC-004: Level 2 equipment, 2-second acquisition cycle; Status after 5 minutes: PLC-004: Data fluctuation increases, data change rate is greater than 25% → collection period is adjusted to 1 second.
[0048] Methods for optimizing acquisition strategies include: The CPU usage rate of the edge gateway is collected in real time through the API to obtain the CPU load of the edge gateway. When the CPU load of the edge gateway exceeds the preset CPU load threshold of the edge gateway, the PLC network data polling interval is extended (for example, from 1 second to 2 seconds), and the number of concurrently collected PLC devices is reduced, and the PLC network data collection tasks of non-critical PLC devices are suspended. Monitor the bandwidth utilization of the network interface in real time, obtain network congestion status, and use lightweight compression algorithms (such as gzip, LZ4) to compress the collected PLC networking data to reduce transmission bandwidth occupancy.
[0049] Based on the improved Raft consensus algorithm, the method of synchronizing the optimized collection strategy between edge gateways includes: The improved Raft consensus algorithm is run on the edge gateway node. The improved Raft consensus algorithm includes a dynamic timeout mechanism. The dynamic timeout mechanism is used to monitor network quality parameters in real time, establish an edge gateway cluster, and complete the initial Leader election. Network quality parameters include round-trip delay, packet loss rate, and network jitter indicators. The network quality comprehensive index is calculated by weighted average network quality parameters. The network quality comprehensive index is: ;in, Indicates the current time Comprehensive indicators of network quality at the time of Indicates the current time Round trip delay; Indicates the preset benchmark round trip delay; Indicates the current time Packet loss rate; Indicates the current time Network jitter at the time Indicates the current time; Represents the weight coefficient of round-trip delay; Indicates the weight coefficient of packet loss rate; represents the weight coefficient of network jitter; and ; Based on the comprehensive network quality indicators, the exponential decay model is used to dynamically adjust the election timeout and log replication timeout of the improved Raft algorithm, and a smoothing factor is applied to avoid drastic fluctuations in the timeout; The election timeout is: ;in, Indicates the adjusted election timeout; Indicates the preset benchmark timeout period; Indicates the maximum extension factor; represents the sensitivity parameter; When the network quality decreases, the timeout will increase exponentially; when the network quality is good, the timeout is close to the baseline value. To avoid drastic fluctuations in the timeout, a smoothing factor mechanism is introduced so that the new timeout is a weighted average of the current calculated value and the historical value, ensuring that the system performs stably when the network fluctuates.
[0050] The collection strategy after synchronization optimization by improving the Raft consensus algorithm is sent to each edge gateway node; the collection strategy after synchronization optimization by improving the Raft consensus algorithm includes maintaining an independent log replication success probability model for each gateway node, Dynamically adjust the retry interval to the optimal value based on the current round-trip delay and packet loss rate. The optimal retry interval is: ;in, Indicates the gateway node At current time The optimal retry interval, that is, the time value for how long the Leader node should wait to send a request again after failing to receive the log replication confirmation from the node; Indicates the current time To the gateway node The round trip delay of Represents a gateway node At current time The packet loss rate indicates the proportion of sent data packets that fail to reach the destination successfully. It is a dimensionless value between 0 and 1. The design principle of this formula is as follows: the baseline retry time should be proportional to the current round-trip delay. The higher the packet loss rate, the longer the retry interval should be to avoid network congestion. A logarithmic function is used to make the adjustment smoother, especially in low packet loss cases. The retry interval is extended when the network quality is poor, and is shortened when the network quality is good to improve consensus efficiency. Each edge gateway node performs network topology data collection according to the optimized collection strategy. A baseline detection frequency and a preset network quality threshold are preset, and the detection frequency is dynamically adjusted according to the current network quality. When the network quality is less than the preset network quality threshold, the detection frequency is reduced. When the network quality is greater than or equal to the preset network quality threshold, detection is performed at the baseline frequency. The collected topology data is synchronized to the Leader node through the improved Raft consensus mechanism. The Leader node merges the topology data of each gateway node, calculates the topology consistency metric, and evaluates the accuracy of the global view. This indicator calculates the average value of the intersection and union ratio of each gateway's local topology to the global topology, reflecting the consistency of the topology information. Preset the consistency index threshold. When the consistency index is lower than the preset consistency index threshold, the system will trigger an additional topology synchronization process. When the network partition is restored, the system needs to merge topology information that may be in conflict. The credibility of the edge is determined by the proportion of gateways that observe the edge and the timeliness of the edge information. The higher the proportion of observed gateways, the higher the credibility; the newer the information, the higher the credibility. This mechanism ensures that the merged topology reflects the consensus of the majority of gateways and gives priority to retaining the latest network status information. Preset the credibility threshold. Only edges whose credibility exceeds the preset credibility threshold are included in the merged topology. The running status of the edge gateway is monitored by sending heartbeat messages regularly. When a gateway fails to respond to the heartbeat for multiple consecutive times or responds abnormally, the Leader node marks it as suspicious and increases the monitoring frequency. For example, when a gateway fails to respond to the heartbeat for 20 consecutive times or responds abnormally, the Leader node marks it as suspicious and increases the monitoring frequency. If there is still no effective response within the preset fault confirmation time window, the system will officially mark the gateway as a faulty state, automatically update the cluster member configuration to isolate it, trigger the topology reconstruction process, recalculate the network path, and broadcast the updated cluster status information to other normal gateways. The isolated faulty gateway will no longer participate in consensus decision-making and data synchronization until it returns to normal and reintegrates into the cluster through the rejoining protocol. The entire process does not require manual intervention, ensuring the high availability and self-healing capability of the edge network. The network topology view is automatically updated and synchronized to each edge gateway node.
[0051] The preset data change rate threshold is set by the staff based on the historical data analysis results. The historical analysis process includes the system collecting the change rate of multiple data points and calculating their average value as a reference. Similarly, the preset edge gateway CPU load threshold, preset network quality threshold, preset consistency index threshold and preset credibility threshold are also set by the staff based on the system's historical operation data and specific application scenario requirements. These preset thresholds can be adjusted by the staff according to actual conditions during the system operation process.
[0052] This embodiment effectively solves the IP address conflict problem that may exist in industrial field PLC devices through virtual IP allocation and NAT mapping mechanism, so that heterogeneous PLC devices with duplicate private addresses can coexist and communicate normally in the same physical network; the virtual subnet isolation technology based on SDN realizes the logical isolation between PLC devices of different brands, different protocols or different functional groups; through automated device identification and virtual subnet division, the complexity of industrial network configuration is greatly reduced, and manual operation errors are reduced; virtualization technology makes network topology and policy adjustment no longer dependent on physical connection changes, and virtual subnet division and access control policies can be dynamically adjusted through the SDN controller to adapt to the ever-changing needs of industrial networks.
[0053] Through the combined architecture of virtual switches and virtual routers, complete logical isolation between different virtual subnets is achieved, allowing PLC devices with the same IP address to operate independently in their respective virtual subnets without modifying the original IP configuration of the device, solving the core problem in industrial network integration; the multi-level access control mechanism based on preset configuration flow table rules realizes all-round security protection from the data link layer to the application layer, and can accurately control communication permissions according to protocol characteristics, device types and business needs; standardized virtual switch and virtual router configuration templates greatly reduce the complexity of network deployment. Network administrators only need to focus on policy definitions rather than underlying implementation details, reducing the risk of configuration errors and improving deployment efficiency.
[0054] Through the dynamic timeout mechanism, the system can adaptively adjust the parameters of the Raft algorithm, effectively deal with delay fluctuations, packet loss and network jitter in the edge network environment, and significantly improve the stability of the consensus algorithm under harsh network conditions. The improved Raft algorithm intelligently extends the timeout time when the network quality decreases, effectively reducing the number of unnecessary Leader elections caused by network fluctuations, reducing the computing burden of the edge gateway, and reducing system resource consumption; the optimal retry interval calculation based on network quality makes the timing of sending log replication requests more reasonable, accelerates consensus when the network is good, avoids invalid retries when the network is congested, and improves the overall efficiency of collection strategy synchronization. Through the adaptive detection frequency adjustment mechanism, the system actively reduces the frequency of topology data collection when the network quality is poor, reduces the transmission burden of the edge network, and prevents the deterioration of network congestion; through the optimized consensus mechanism and topology synchronization strategy, the system can maximize the real-time performance of data while ensuring data consistency, and meet the strict requirements of edge computing scenarios for data timeliness.
[0055] Example 2 See also Figure 2 As shown, the part not described in detail in this embodiment is described in Example 1, which provides a PLC networking data collection method based on an edge gateway, including: S1. By deploying SDN controllers and using deep packet inspection technology, different PLC devices are identified and classified, and automatically assigned to virtual subnets to obtain virtual IPs. Each virtual subnet isolates PLC devices with the same IP address through virtual switches and virtual routers. The virtual IP and actual physical network port information of the PLC device are recorded in a mapping table to establish a network topology view. S2, connect the edge gateway to the PLC device based on the network topology view, integrate the PLC communication protocol library and use FPGA hardware acceleration to perform protocol parsing, and read the PLC networking data from the PLC device in real time; S3, read the real-time status of PLC based on PLC networking data, dynamically adjust the collection cycle, and optimize the collection strategy according to the edge gateway CPU load and network congestion; S4. Based on the improved Raft consensus algorithm, the optimized collection strategy is synchronized between edge gateways, and the heartbeat mechanism is used to detect the status of edge gateways, isolate the faulty edge gateways, and automatically update the network topology view; use the updated network topology view to re-read the PLC networking data from the PLC device in real time; S5. Transmit the read PLC networking data to the acquisition server through the standardized data access interface.
[0056] Since the electronic device introduced in this embodiment is an electronic device used to implement a PLC networking data acquisition system based on an edge gateway in the embodiment of the present application, based on the PLC networking data acquisition system based on an edge gateway introduced in the embodiment of the present application, a person skilled in the art can understand the specific implementation of the electronic device of the present embodiment and its various variations, so how the electronic device implements the method in the embodiment of the present application is not described in detail here. As long as a person skilled in the art implements an electronic device used by a PLC networking data acquisition system based on an edge gateway in the embodiment of the present application, it belongs to the scope of protection of this application.
[0057] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters and thresholds in the formula are set by technicians in this field according to actual conditions.
[0058] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technical operators in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A PLC networking data acquisition system based on edge gateway, characterized in that: include: The dynamic virtual isolation module deploys an SDN controller and uses deep packet inspection technology to identify and classify different PLC devices, automatically assign them to virtual subnets, and obtain virtual IPs. Each virtual subnet isolates PLC devices with the same IP address through virtual switches and virtual routers. The virtual IP and actual physical network port information of the PLC device are recorded in a mapping table to establish a network topology view. The multi-protocol parsing module connects the edge gateway to the PLC device based on the network topology view, integrates the PLC communication protocol library and uses FPGA hardware acceleration to perform protocol parsing, and reads the PLC networking data from the PLC device in real time; AI intelligent scheduling module reads the real-time status of PLC based on PLC networking data, dynamically adjusts the collection cycle, and optimizes the collection strategy according to the edge gateway CPU load and network congestion conditions; The gateway collaborative perception module, based on the improved Raft consensus algorithm, synchronizes the optimized collection strategy between edge gateways, uses the heartbeat mechanism to detect the edge gateway status, isolates the faulty edge gateway, and automatically updates the network topology view; uses the updated network topology view to re-read the PLC networking data from the PLC device in real time; The data transmission module transmits the read PLC networking data to the acquisition server through a standardized data access interface.
2. According to the PLC networking data acquisition system based on edge gateway according to claim 1, it is characterized in that: The method for obtaining a virtual IP includes: Deploy an SDN controller on the edge gateway to centrally manage virtual switches and virtual routers, and configure the connection between the SDN controller and the physical network port of the edge gateway; define virtual switches and virtual routers in the SDN controller as the boundaries of logically isolated virtual subnets; The SDN controller captures data packets in the network through the mirror port, uses DPI technology to parse the data packet payload, and extracts key features; the key features include protocol header fields, function codes, and device identifiers; a preset device fingerprint library, the elements of which include protocol features, manufacturer identifiers, and device models; based on the preset device fingerprint library, PLC devices of different brands and protocol types are identified and classified to obtain classification results; Define virtual subnet division strategies based on the classification results. Virtual subnet division strategies include brand isolation, protocol isolation, and functional group isolation. The SDN controller automatically creates virtual subnets based on the classification results, binds them to the corresponding virtual switches, configures the access control list of the virtual router, and restricts cross-subnet communication. Deploy a lightweight DHCP server in the virtual subnet, assign a unique virtual IP to each PLC, and manually bind the virtual IP to the physical network port for each PLC device through the SDN controller; configure NAT rules in the virtual router to map the PLC's physical IP to a globally unique virtual IP.
3. According to the PLC networking data acquisition system based on edge gateway according to claim 2, it is characterized in that: The method for isolating PLC devices with the same IP address includes: In the SDN controller, an independent virtual switch and virtual router are allocated to each virtual subnet; each virtual switch acts as the entrance or exit of the PLC device in the virtual subnet, controlling the traffic forwarding of the PLC device in the virtual subnet; preset configuration flow table rules, the virtual switch controls the traffic by configuring flow table rules, and only allows communication between PLC devices in the same virtual subnet; the preset configuration flow table rules include inlet traffic matching rules, default discard rules, VLAN isolation rules, NAT conversion rules, access control list rules and AI adaptive flow table rules; for different virtual subnets, the virtual switch isolates the traffic in different subnets based on VLAN tags; Each virtual subnet routes and forwards data packets through a virtual router; the virtual router only allows legal cross-subnet data transmission based on network policies and configurations. For devices with the same IP address but belonging to different virtual subnets, illegal cross-subnet communication is prevented by configuring access control policies.
4. According to the PLC networking data acquisition system based on edge gateway of claim 3, it is characterized in that: The method for acquiring the network topology view includes: Scan all connected PLC devices through the SDN controller, manually bind the virtual IP of the PLC device to the corresponding physical network port, and generate a PLC device mapping table; record the virtual IP, physical IP, MAC address and connected physical network port information of each PLC device through the PLC device mapping table; take the edge gateway as the central node, build a network topology view based on the PLC device mapping table, and use the topology drawing tool Graphviz to visualize the network topology view.
5. A PLC networking data acquisition system based on edge gateway according to claim 4, characterized in that: The method for connecting the edge gateway and the PLC device based on the network topology view includes: The edge gateway reads the virtual IP of each PLC device and its corresponding actual physical network port information based on the obtained network topology view, and establishes a virtual communication link with the PLC device; The frame format, field definition, verification algorithm and state machine logic of various PLC communication protocols are abstracted and encapsulated into a unified PLC communication protocol library; data request commands are generated based on the PLC communication protocol library, and data requests are sent to PLC devices through virtual communication links; PLC devices respond to the received data request commands and transmit original data packets to the edge gateway through virtual communication links; the edge gateway captures the original data packets transmitted by the virtual communication link, and performs protocol decoding and data extraction through FPGA hardware to obtain PLC networking data.
6. A PLC networking data acquisition system based on edge gateway according to claim 5, characterized in that: The PLC networking data includes device ID, communication protocol, timestamp, device status data, sensor data and device alarm data.
7. A PLC networking data acquisition system based on edge gateway according to claim 6, characterized in that: The method for dynamically adjusting the acquisition period includes: Based on the PLC networking data, the real-time status of the PLC is read, and the fuzzy logic is used to perform multi-dimensional analysis on the real-time status of the PLC to obtain the equipment status classification; based on the equipment status classification, the data collection cycle is dynamically allocated; based on the sliding time window, the collection cycle is adjusted in real time, and when the data change rate exceeds the preset data change rate threshold, the collection cycle is automatically shortened to improve the collection density.
8. A PLC networking data acquisition system based on edge gateway according to claim 7, characterized in that: The method for optimizing the acquisition strategy comprises: The CPU usage rate of the edge gateway is collected in real time through the API to obtain the CPU load of the edge gateway; when the CPU load of the edge gateway exceeds the preset CPU load threshold of the edge gateway, the PLC network data polling interval is extended, the number of PLC devices collected concurrently is reduced, and the PLC network data collection tasks of non-critical PLC devices are suspended; Monitor the bandwidth utilization of the network interface in real time, obtain network congestion status, and use a lightweight compression algorithm to compress the collected PLC networking data.
9. A PLC networking data acquisition system based on edge gateway according to claim 8, characterized in that: The method for synchronizing the optimized collection strategy between edge gateways based on the improved Raft consensus algorithm includes: The improved Raft consensus algorithm is run on the edge gateway node. The improved Raft consensus algorithm includes a dynamic timeout mechanism. The dynamic timeout mechanism is used to monitor network quality parameters in real time, establish an edge gateway cluster, and complete the initial Leader election. Network quality parameters include round-trip delay, packet loss rate, and network jitter indicators. The network quality comprehensive index is calculated by weighted average network quality parameters. Based on the network quality comprehensive index, the election timeout and log replication timeout of the improved Raft algorithm are dynamically adjusted through an exponential decay model. The collection strategy after synchronization optimization by improving the Raft consensus algorithm is sent to each edge gateway node; the collection strategy after synchronization optimization by improving the Raft consensus algorithm includes maintaining an independent log replication success probability model for each gateway node, Dynamically adjust the retry interval to the optimal value based on the current round-trip delay and packet loss rate; each edge gateway node performs network topology data collection according to the optimized collection strategy; synchronize the collected topology data to the Leader node through the improved Raft consensus mechanism; the Leader node merges the topology data of each gateway node; automatically updates the network topology view, and synchronizes the updated network topology view to each edge gateway node.
10. A PLC networking data acquisition method based on an edge gateway, used to implement a PLC networking data acquisition system based on an edge gateway as claimed in any one of claims 1 to 9, characterized in that: include: S1. By deploying SDN controllers and using deep packet inspection technology, different PLC devices are identified and classified, and automatically assigned to virtual subnets to obtain virtual IPs. Each virtual subnet isolates PLC devices with the same IP address through virtual switches and virtual routers. The virtual IP and actual physical network port information of the PLC device are recorded in a mapping table to establish a network topology view. S2, connect the edge gateway to the PLC device based on the network topology view, integrate the PLC communication protocol library and use FPGA hardware acceleration to perform protocol parsing, and read the PLC networking data from the PLC device in real time; S3, read the real-time status of PLC based on PLC networking data, dynamically adjust the collection cycle, and optimize the collection strategy according to the edge gateway CPU load and network congestion; S4. Based on the improved Raft consensus algorithm, the optimized collection strategy is synchronized between edge gateways, and the heartbeat mechanism is used to detect the status of edge gateways, isolate the faulty edge gateways, and automatically update the network topology view; use the updated network topology view to re-read the PLC networking data from the PLC device in real time; S5. Transmit the read PLC networking data to the acquisition server through the standardized data access interface.
Citation Information
Patent Citations
Data acquisition system based on edge calculation
CN116055525A
Distributed device IP address allocation management and control method and system
CN110691151A
Implementation method, device and system of software-defined Internet of Things
CN113364833A
Security control method and system based on SDN architecture
CN118784311A
Cloud computing virtual machine communication optimization method
CN118784485A
Cited By
Traffic processing system, traffic processing method and traffic processing cluster
CN120321193A
Traffic processing system, processing method and traffic processing cluster
CN120321193B
Multi-terminal remote equipment management method and system
CN120358075A
Self-adaptive distributed network integration system and method for virtual and real unmanned aerial vehicle cooperation
CN120658776A
Distributed dynamic migration service system based on eBPF
CN121603377A