Power acquisition system non-inductive migration method based on dynamic port mapping

Through dynamic port mapping and optimized carrier relay routing, the power acquisition system achieves seamless migration after communication module replacement, solving the problem of service interruption, improving system stability and security, and reducing operating costs.

CN121940342APending Publication Date: 2026-04-28QINGDAO EASTSOFT COMM TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
QINGDAO EASTSOFT COMM TECH
Filing Date
2026-01-14
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

The existing power data acquisition system requires reconfiguration of connection parameters for each meter after the communication module is replaced, resulting in long service interruptions and affecting the continuity of meter reading services.

Method used

The system employs a dynamic port mapping method, which automatically obtains the asset number of the electricity meter through the transparent transmission module and binds it to the concentrator. Combined with carrier signal-to-noise ratio measurement, it constructs the optimal relay path to achieve seamless migration. The transparent transmission module has a built-in encryption unit to ensure data security, and the concentrator uses sparse port scanning and time-division multiple access mechanisms to optimize resource management.

Benefits of technology

This eliminates the need for meter-by-meter configuration after replacing the communication module in the power data acquisition system, shortening service interruption time, improving network stability and data transmission efficiency, reducing operating costs, and enhancing system security and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121940342A_ABST
    Figure CN121940342A_ABST
Patent Text Reader

Abstract

The invention provides an electric power acquisition system non-inductive migration method based on dynamic port mapping, and belongs to the technical field of electric power acquisition. Twelve asset numbers of an electric energy meter are actively obtained through a transparent transmission module and encrypted and stored, and a concentrator automatically allocates monitoring ports according to the last four asset numbers and establishes a port mapping table; a TCP transparent transmission server is started to realize bidirectional conversion between a carrier frame and a TCP message, an optimal relay path is determined by adopting a carrier relay routing optimization algorithm based on a graph theory minimum spanning tree, time division multiple access time slots are allocated, and a sparse port scanning acceleration algorithm based on compressed sensing is executed to quickly detect a port occupation state. The technical problem that the service interruption time is long due to the fact that the master station needs to reconfigure connection parameters table by table after the communication module of the power acquisition system is replaced is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of power acquisition technology, and more specifically, relates to a seamless migration method for power acquisition systems based on dynamic port mapping. Background Technology

[0002] In power data acquisition systems, the master station establishes a communication link with electricity meters via a public network module to achieve remote meter reading. Traditional public network modules use fixed IP addresses or domain names to establish connections, requiring the master station to configure a unique communication address for each meter. When the public network module needs to be replaced with a local carrier transparent transmission module due to operational costs or network coverage issues, the original public network IP address becomes invalid, and the communication link between the master station and the electricity meters is completely interrupted. Existing migration solutions require maintenance personnel to reconfigure the connection parameters on the master station side for each meter, changing the original public network IP address to the concentrator IP address and corresponding port number. This configuration work for the entire distribution area can take several hours or even days, during which meter reading services are completely suspended. In other words, existing technology suffers from the technical problem of long service interruptions caused by the need for the master station to reconfigure connection parameters for each meter after the communication module is replaced. Summary of the Invention

[0003] In view of this, the present invention provides a seamless migration method for power acquisition systems based on dynamic port mapping, which can solve the technical problem in the prior art that the main station needs to reconfigure the connection parameters table by table after the communication module of the power acquisition system is replaced, resulting in long service interruption time.

[0004] This invention is implemented as follows: It provides a seamless migration method for a power acquisition system based on dynamic port mapping. The method involves replacing the transparent transmission module in the modular slot built into the energy meter. The transparent transmission module sends a read meter number request message to the energy meter's main control chip via a TTL serial port channel to obtain and encrypt the energy meter's 12-digit asset number. The transparent transmission module then broadcasts the 12-digit asset number to the concentrator via a carrier channel. Upon receiving the 12-digit asset number, the concentrator performs a device validity check and establishes a binding relationship between the 12-digit asset number and the carrier MAC address in the port mapping table. Based on the last four digits of the 12-digit asset number... The concentrator automatically assigns monitoring ports using digits. It collects carrier signal-to-noise ratio measurements reported by all transparent transmission modules within the distribution area to construct an undirected weighted graph and executes a carrier relay routing optimization algorithm to determine the optimal relay path. The concentrator starts a TCP transparent transmission server and listens for connection requests from the master station within the monitoring port range. After receiving meter reading instructions from the master station, it queries the carrier MAC address of the target energy meter according to the port mapping table and converts the TCP packets into carrier frame format for forwarding to the transparent transmission module. The energy meter response data is encrypted by the transparent transmission module and transmitted back to the concentrator via the carrier channel, and then converted into TCP packets for transmission back to the master station.

[0005] The transparent transmission module adopts a physical interface and electrical specifications that are fully compatible with the original public network module, and has a built-in low-power microcontroller and flash memory unit.

[0006] The transparent transmission module has a built-in symmetric encryption unit that uses the AES-128-GCM algorithm to authenticate and encrypt the transmitted data. The root key is written into the one-time programmable storage area during the SMT assembly production stage.

[0007] The symmetric encryption unit extracts the root key from the one-time programmable storage area before data transmission, combines it with a 96-bit initialization vector generated by a hardware true random number generator to authenticate and encrypt the message, and generates a 128-bit authentication tag to be appended to the end of the ciphertext.

[0008] The port mapping table is stored in the concentrator's internal database, recording the correspondence between the twelve-digit asset number, carrier MAC address, listening port, and binding timestamp.

[0009] The listening port allocation rule automatically maps the last four digits of the twelve-digit asset number to the corresponding listening port in the range of 10000 to 19999.

[0010] Among them, the carrier relay routing optimization algorithm abstracts the power meter of the transformer area into an undirected weighted graph, and defines the edge weight as the reciprocal of the carrier signal-to-noise ratio measurement value. The Prim algorithm is used to construct the minimum spanning tree to determine the optimal relay path.

[0011] The concentrator runs the incremental minimum spanning tree update algorithm, which only recalculates the affected subtree when a new device joins the network or the carrier link quality changes.

[0012] The relay depth of the optimal relay path is limited to 3 hops, and time-division multiple access time slots are allocated according to the routing topology of the minimum spanning tree.

[0013] The concentrator uses an edge-triggered mode combined with zero-copy technology to handle concurrent connections. The zero-copy technology enables direct data transfer in kernel space through the sendfile or splice system calls.

[0014] The concentrator employs a memory pool pre-allocation buffer mechanism, which pre-allocates a fixed number of buffer blocks during the system initialization phase, with each buffer block being 4KB in size.

[0015] The concentrator periodically executes a sparse port scanning acceleration algorithm based on compressed sensing to detect the occupancy status of listening ports and generate a port allocation table.

[0016] Among them, the sparse port scanning acceleration algorithm based on compressed sensing constructs a random Gaussian measurement matrix with a dimension of 500 rows and 10,000 columns, which projects the 10,000-dimensional port space onto the 500-dimensional measurement space.

[0017] Among them, the orthogonal matching pursuit algorithm is used to reconstruct the true occupancy vector from the measurement vector. In each iteration of the orthogonal matching pursuit algorithm, the atom with the greatest correlation to the current residual is added to the support set.

[0018] In this process, time division multiple access (TDMA) time slot allocation divides the time frame into reserved time slots and contention time slots. Reserved time slots are allocated to network-connected devices using TDMA, while contention time slots implement a carrier sense multiple access collision avoidance mechanism.

[0019] Among them, the connection pool dynamic management changes the long connection to a short connection pulse mode. The master station and the concentrator temporarily establish a connection during each meter reading task, and close the connection to release resources immediately after the data transmission is completed.

[0020] This invention automatically acquires the 12-digit asset number by embedding an energy meter identity sniffing engine within the transparent transmission module. On the concentrator side, it automatically assigns a listening port and establishes a port mapping table based on the last four digits of the asset number. This allows the master station to continue accessing the energy meter via the concentrator's IP address and the automatically assigned listening port without requiring configuration changes. After replacing the original public network module, the transparent transmission module actively reads the energy meter asset number and broadcasts it to the concentrator. The concentrator automatically establishes the port mapping relationship and starts the TCP transparent transmission service. The entire process is invisible to the energy meter's main control chip and the master station's application software. This invention employs a deterministic port allocation rule based on the asset number, ensuring that the last four digits of the energy meter asset number within the same distribution area are unique through factory batch control. This guarantees the uniqueness and stability of the port mapping, solving the technical problem of long service interruptions caused by the need for the master station to reconfigure connection parameters for each meter after the power acquisition system's communication module is replaced. Attached Figure Description

[0021] Figure 1 This is a flowchart of the method of the present invention.

[0022] Figure 2 This is a schematic diagram of the processing procedure in this embodiment.

[0023] Figure 3 This is a block diagram of the architecture of this embodiment.

[0024] Figure 4 This is a bar chart showing the distribution of devices at different relay depths in this embodiment.

[0025] Figure 5 This is a graph showing the reconstruction accuracy under different sparsity levels in this embodiment. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below.

[0027] like Figure 1 The diagram shown is a flowchart of a seamless migration method for a power acquisition system based on dynamic port mapping, provided by the present invention. This method includes the following steps:

[0028] S01. Replace the transparent transmission module in the built-in modular slot of the electricity meter. The transparent transmission module sends a read meter number request message to the main control chip of the electricity meter through the TTL serial port channel to obtain the twelve-digit asset number of the electricity meter and encrypt and store it in the built-in flash memory unit of the transparent transmission module. The built-in symmetric encryption unit of the transparent transmission module uses the AES-128-GCM algorithm to authenticate and encrypt the transmitted data.

[0029] S02. The transparent transmission module broadcasts the 12-digit asset number to the concentrator through the carrier channel. After receiving the 12-digit asset number, the concentrator performs a device validity check. After the check is passed, it establishes a binding relationship between the 12-digit asset number and the carrier MAC address in the port mapping table, and automatically allocates a listening port in the range of 10000 to 19999 according to the last four digits of the 12-digit asset number.

[0030] S03. The concentrator collects the carrier signal-to-noise ratio measurements reported by all transparent transmission modules within the station area, constructs an undirected weighted graph, and executes a carrier relay routing optimization algorithm based on graph theory minimum spanning tree to determine the optimal relay path and allocate time division multiple access time slots. The relay depth of the optimal relay path is limited to 3 hops.

[0031] S04. The concentrator starts the TCP pass-through server and listens for connection requests from the master station within the range of the listening port. It uses edge-triggered mode combined with zero-copy technology to handle concurrent connections. When the master station initiates a connection to the concentrator's IP address and corresponding listening port, a TCP channel is established.

[0032] S05. After receiving the meter reading instruction from the master station, the concentrator queries the carrier MAC address of the target energy meter according to the port mapping table, converts the TCP packet into a carrier frame format, and forwards it to the transparent transmission module through the optimal relay path. After decryption, the transparent transmission module forwards it to the energy meter through the TTL serial port channel.

[0033] S06. The energy meter response data is encrypted by the transparent transmission module and then transmitted back to the concentrator via the carrier channel. The concentrator converts the carrier frame format into TCP packets and transmits them back to the master station through the corresponding listening port to complete the bidirectional data transparent transmission. When the carrier link quality changes, the concentrator executes the incremental minimum spanning tree update algorithm to recalculate the affected subtree.

[0034] S07. The concentrator periodically executes a sparse port scanning acceleration algorithm based on compressed sensing to detect the occupancy status of the listening port and generate a port allocation table. The port allocation table is sent to the maintenance master station via the MQTT protocol or read locally via an infrared handheld device. When a port conflict is detected, a dynamic port reallocation process is triggered.

[0035] The transparent transmission module is a customized protocol transparent transmission module, employing physical interfaces and electrical specifications fully compatible with the original manufacturer's public network module. It integrates a low-power microcontroller and flash memory unit, running a lightweight embedded real-time operating system. The core of the transparent transmission module is the electricity meter identity sniffing engine, which proactively initiates a meter number read request message upon power-on, obtaining the electricity meter's unique twelve-digit asset number through the TTL serial port channel. For the electricity meter's main control chip, this entire process is merely a routine parameter read operation; the original application software of the electricity meter does not need to be aware of the transparent transmission module replacement.

[0036] The symmetric encryption unit employs a hardware security engine to accelerate the AES-128-GCM algorithm. The root key is written to the one-time programmable storage area of ​​the transparent transmission module via physical contact during the SMT assembly stage using a programmer. This one-time programmable storage area has hardware-level protection against reading, erasing, and side-channel attacks. Once written, it is permanently bound to the silicon-based physical fingerprint of the transparent transmission module's main control chip. Before data transmission, the symmetric encryption unit automatically extracts the root key from the one-time programmable storage area and, combined with a 96-bit initialization vector generated by a hardware true random number generator, authenticates and encrypts the message, generating a 128-bit authentication tag appended to the end of the ciphertext. The entire encryption and decryption operation is completed within the transparent transmission module.

[0037] The port mapping table is stored in the concentrator's internal database, recording the correspondence between the 12-digit asset number, the carrier MAC address, the monitoring port, and the binding timestamp. The monitoring port allocation rule automatically maps the last four digits of the 12-digit asset number to the corresponding monitoring port by default. At the factory, batch control ensures that the last four digits of the 12-digit asset number of meters within the same distribution area are not duplicated. When a port conflict occurs, on-site maintenance personnel access the concentrator's local maintenance interface via an infrared handheld device and manually adjust the monitoring port allocation of the conflicting meters in the graphical menu. The adjusted mapping relationship is synchronized to the concentrator's internal port rule table in real time without requiring a service restart.

[0038] The carrier relay routing optimization algorithm based on graph theory minimum spanning tree abstracts the electricity meters in the distribution area into an undirected weighted graph. Each node in the graph represents an electricity meter or concentrator, and the edge weight is defined as the reciprocal of the measured carrier signal-to-noise ratio (SNR). A higher SNR indicates better communication quality, and a smaller edge weight. After the concentrator collects the received signal strength indications of all transparent transmission modules in the distribution area from adjacent devices, it uses the Prim algorithm to construct a minimum spanning tree to determine the optimal relay path. The Prim algorithm starts from the concentrator node and selects the node with the smallest edge weight connected to the current tree to add to the tree each time, until all nodes are covered. The resulting minimum spanning tree is the routing topology that minimizes the total communication cost.

[0039] The concentrator runs the incremental minimum spanning tree update algorithm. When a new device joins the network or the carrier link quality changes, only the affected subtree is recalculated to avoid global reconstruction. The incremental minimum spanning tree update algorithm first determines whether the changed edge is in the current minimum spanning tree. If the weight of the newly added edge is less than the weight of the path connecting the same node pair in the tree, the original path is replaced. If the edge in the tree is invalid, the algorithm finds the replacement edge with the smallest weight among the remaining edges. The relay depth is limited to 3 hops to prevent latency accumulation. When the device is more than 3 hops away from the concentrator, access is rejected or the routing topology is adjusted. The time division multiple access (TDMA) slots are allocated according to the routing topology of the minimum spanning tree to avoid hidden terminal issues. Parent nodes and child nodes are allocated different TDMA slots. Nodes at the same level are allocated TDMA slots sequentially after deterministic sorting by device identifier. The parent node selection is dynamically adjusted to balance the load and prevent overload of a single relay node.

[0040] The proposed carrier relay routing optimization algorithm based on graph theory minimum spanning tree transforms the carrier networking problem into a graph theory optimization problem, achieving globally optimal path planning in multi-hop relay scenarios. Traditional carrier networking relies on devices autonomously selecting relay nodes, which can easily lead to suboptimal routes or uneven load distribution, causing some nodes to experience a surge in energy consumption or communication congestion due to frequent forwarding. The proposed carrier relay routing optimization algorithm constructs the minimum spanning tree based on the global carrier signal-to-noise ratio measurement information, ensuring that each communication link selects the relay path with the best quality, significantly reducing packet loss and retransmission rate and improving overall network throughput. The incremental minimum spanning tree update algorithm avoids full-network route reconstruction when devices join the network or when carrier link quality fluctuates, compressing the route topology adjustment time from seconds to milliseconds, ensuring service continuity. The combination of relay depth limitation and time division multiple access time slot allocation effectively suppresses broadcast storms and MAC layer contention deadlock problems. In scenarios where hundreds of devices are powered on simultaneously, the network access success rate is increased from 62% in traditional solutions to 98%, and the average network access latency is reduced from 45 seconds to 8 seconds, solving the core technical bottleneck in large-scale carrier networking.

[0041] The compressed sensing-based sparse port scanning acceleration algorithm utilizes the sparsity of the listening port occupancy status to project a 10,000-dimensional port space onto a 500-dimensional measurement space. The algorithm first constructs a random Gaussian measurement matrix, where each element follows a standard normal distribution, and the matrix has 500 rows and 10,000 columns. The concentrator sends probe signals to the port space via multicast probe packets. The received response vector is the measurement vector, which is equal to the product of the random Gaussian measurement matrix and the actual occupancy vector. The actual occupancy vector is a 10,000-dimensional binary vector, where the i-th element is 1 indicating that the i-th listening port is occupied, and 0 indicating that it is idle.

[0042] The Orthogonal Matching Pursuit (ORP) algorithm is used to reconstruct the true occupancy vector from the measurement vector. ORP is an iterative greedy algorithm; in each iteration, the atom with the highest correlation to the current residual is added to the support set. ORP initializes the residual vector to be equal to the measurement vector, and the support set is empty. In each iteration, the inner product of each column of the random Gaussian measurement matrix and the residual vector is calculated. The column index with the largest absolute value of the inner product is added to the support set. Then, the measurement vector is projected using least squares in the subspace spanned by the columns of the support set corresponding to the random Gaussian measurement matrix to obtain the current estimate. The residual vector is then updated by subtracting the current estimate from the measurement vector. The iteration terminates when the norm of the residual vector is less than a preset threshold or the number of iterations reaches a sparsity K. When the sparsity K is 200, the reconstruction accuracy reaches 99.5%. The indices corresponding to the non-zero elements in the reconstructed true occupancy vector are the occupied listening port numbers.

[0043] The compressed sensing-based sparse port scanning acceleration algorithm overcomes the linear time complexity limitation of traditional port-by-port polling, achieving sublinear time scanning through dimensionality reduction measurement and sparse reconstruction. In a typical transformer substation scenario, only about 200 of 10,000 available listening ports are actually occupied, representing a 2% occupancy rate and exhibiting high sparsity. Traditional scanning methods require traversing all listening ports, sending multicast probe packets, and waiting for timeout responses, taking approximately 30 seconds. In contrast, the compressed sensing-based sparse port scanning acceleration algorithm requires only 500 measurements to reconstruct the complete listening port occupancy status with 99.5% accuracy, reducing the scanning time to 1.2 seconds and improving efficiency by 25 times. This compressed sensing-based sparse port scanning acceleration algorithm plays a crucial role in solving the problem of concentrator TCP stack resource exhaustion during large-scale concurrent meter reading. Quickly locating idle listening ports makes dynamic connection pool management more efficient, avoiding connection establishment failures caused by listening port scanning delays. In fault location scenarios, maintenance personnel can obtain a panoramic view of the occupancy status of the monitoring port within seconds, quickly identify abnormal occupancy or port conflicts, and significantly shorten fault recovery time.

[0044] The edge-triggered mode is one of the operating modes of the Linux system's epoll mechanism, as opposed to the level-triggered mode. In this mode, the kernel only notifies the application when the file descriptor state changes. The application must read or write all ready data at once; otherwise, it will not receive further notification. The zero-copy technology uses the sendfile or splice system calls to directly transfer data within kernel space, avoiding multiple copies of data between user space and kernel space, thus reducing CPU utilization and increasing throughput.

[0045] The concentrator employs a memory pool pre-allocation buffer mechanism to handle large-scale concurrent meter reading scenarios. During system initialization, a fixed number of buffer blocks are pre-allocated, each 4KB in size, and these blocks are managed using a linked list or array. When a new connection arrives, a free buffer block is retrieved from the memory pool and allocated to the new connection. After the new connection closes, the buffer block is returned to the memory pool, avoiding memory fragmentation and performance degradation caused by frequent malloc and free operations. Enabling the TCP_DEFER_ACCEPT option ensures that the TCP socket only delivers the connection to the application after receiving actual data, reducing half-open connection occupation and invalid wake-ups.

[0046] The dynamic connection pool management replaces the traditional long-lived connection with a short-connection pulse mode. Instead of maintaining a continuous TCP connection between the master station and the concentrator, a temporary connection is established for each meter reading task, and the connection is immediately closed to release resources after data transmission is complete. The concentrator maintains a connection object pool, reusing the memory structure and file descriptor resources of TCP connection objects to avoid the system call overhead caused by frequent connection creation and destruction. During peak periods when thousands of electricity meters simultaneously transmit data, the dynamic connection pool management, combined with the memory pool pre-allocation buffer mechanism, increases the concentrator's concurrent processing capacity from 500 connections in the traditional solution to 5000 connections, while reducing memory usage from 2GB to 800MB, completely resolving the TCP stack resource exhaustion problem.

[0047] The Time Division Multiple Access (TDMA) time slots divide time into periodically repeating time frames, each time frame being further subdivided into several time slots. Different devices are assigned different time slots for data transmission, and only one device transmits data within the same time slot to avoid collisions. The Carrier Sense Multiple Access (CSMA) collision avoidance mechanism involves a device listening to the channel to check for idleness before transmitting data. If the channel is busy, a backoff algorithm is executed, waiting for a random period before relistening. The backoff algorithm employs a binary exponential backoff strategy, with the contention window after the nth collision ranging from 0 to... The time slot is doubled, and the contention window cap CWmax prevents the backoff time from growing indefinitely.

[0048] The hybrid mechanism of Time Division Multiple Access (TDMA) and Carrier Sense Multiple Access (CSMA) collision avoidance divides the time frame into two parts: a reserved time slot and a contention time slot. The reserved time slot is allocated to existing network devices using TDMA for periodic data reporting. The contention time slot is used for new device network access or burst data transmission and executes the CSMA collision avoidance mechanism. The deterministic backoff algorithm based on device identifiers calculates an initial backoff value based on the unique identifier of the device. The initial backoff values ​​of different devices are staggered to avoid conflicts and livelock after a large number of devices have backed up simultaneously. The concentrator dynamically adjusts the contention window upper limit (CWmax) parameter and the ratio of the reserved time slots according to the current network load. When the network load is high, the contention window upper limit (CWmax) is increased to reduce the probability of conflicts and expand the ratio of the reserved time slots. When the network load is low, the contention window upper limit (CWmax) is decreased to reduce access latency. The hybrid mechanism of TDMA and CSMA collision avoidance effectively solves the broadcast storm and MAC layer contention deadlock problems in the carrier networking process, reducing the network access time from minutes to seconds in scenarios where hundreds of devices are powered on simultaneously.

[0049] The TCP stack resource exhaustion problem refers to the phenomenon where, during peak periods, thousands of electricity meters simultaneously transmit data, each TCP connection requires approximately 4KB of kernel buffer and file descriptors, leading to insufficient concentrator memory and connection queue overflow. The MAC layer contention deadlock problem refers to the phenomenon where, when hundreds of devices power on simultaneously and send network access requests, the contention window of the CSMA / CA backoff algorithm grows exponentially under high load, resulting in some devices re-competing after their backoff timeout, creating a livelock.

[0050] The specific implementation methods of the above steps are described in detail below.

[0051] The specific implementation of step S01 is as follows: First, maintenance personnel open the electricity meter casing, locate the built-in modular slot, remove the original public network communication module from the slot, and then insert the transparent transmission module into the modular slot. The transparent transmission module and the modular slot achieve a plug-and-play connection through a standardized physical interface, without the need for soldering or modification of the main circuit of the electricity meter. After the transparent transmission module is powered on, the internal electricity meter identity sniffing engine is immediately activated, and sends a read meter number request message conforming to the DL / T645 communication protocol specification to the electricity meter main control chip through the TTL serial port channel. The read meter number request message contains a command field with the data identifier 00000000H. After receiving the read meter number request message, the electricity meter main control chip reads the twelve-digit asset number from its internal memory and returns it to the transparent transmission module through the TTL serial port channel. After receiving the 12-digit asset number, the transparent transmission module encrypts it using the AES-128 algorithm and stores it in the module's built-in flash memory. Simultaneously, the symmetric encryption unit reads the root key from the one-time programmable storage area. The root key is 128 bits long and uses the AES-128-GCM algorithm to encrypt subsequent transmitted data packets. The AES-128-GCM algorithm combines symmetric encryption and message authentication code functionality, generating a 128-bit authentication tag to verify data integrity and prevent data tampering or forgery during transmission. The hardware true random number generator generates an unpredictable random number sequence based on thermal noise or quantum effects as the 96-bit initialization vector, ensuring that a different initialization vector is used for each encryption to enhance security. The purpose of this step is to achieve the physical replacement of the communication module and complete the automatic collection and encrypted storage of device identity information, laying the foundation for subsequent carrier networking and port mapping.

[0052] The specific implementation of step S02 is as follows: the transparent transmission module sends a broadcast frame to the carrier channel through its built-in carrier communication chip. The broadcast frame carries the encrypted 12-digit asset number and the physical layer address of the transparent transmission module, i.e., the carrier MAC address. The carrier MAC address is 48 bits long and uses the IEEE 802 standard format. The concentrator continuously monitors the broadcast frames on the carrier channel through its carrier receiving module. Upon receiving the broadcast frame, it first performs a decryption operation to extract the 12-digit asset number. Then, it compares the 12-digit asset number with the area's electricity meter files pre-stored in the concentrator's database to verify whether the 12-digit asset number belongs to a legitimate device in this area. If the verification is successful, the subsequent binding process is executed. The concentrator creates a new record in the port mapping table. This record includes the 12-digit asset number field, the carrier MAC address field, the listening port field, and the binding timestamp field. The listening port field is assigned by extracting the last four digits of the 12-digit asset number and adding 10000 to obtain the port number. The port number value ranges from 10000 to 19999. The binding timestamp records the current system time accurate to the second. This step uses a broadcast-based automatic discovery mechanism to replace the traditional manual configuration method, significantly reducing the workload of on-site deployment. Simultaneously, identity verification and binding locking mechanisms prevent network chaos caused by unauthorized device access or device roaming across different areas.

[0053] The specific implementation of step S03 is as follows: the concentrator sends a carrier signal-to-noise ratio (SNR) measurement command to all bound transparent transmission modules within the distribution area. After receiving the measurement command, the transparent transmission module starts its carrier receiver to measure the power of the carrier signals sent by adjacent devices, calculates the received signal strength indication value, and converts it into the carrier SNR measurement value. The carrier SNR measurement value is in dB, and its typical range is between 5 dB and 40 dB. After collecting all the carrier SNR measurement values, the concentrator constructs the undirected weighted graph. The total number of nodes in the graph is equal to the number of electricity meters in the distribution area plus 1. The concentrator is the root node, and each electricity meter corresponds to a slave node. There are edges between nodes if and only if the carrier SNR measurement value measured between two devices is greater than a preset threshold. The preset threshold is 10 dB, and the edge weight is assigned as the reciprocal of the carrier SNR measurement value multiplied by 100 and then rounded down. The concentrator runs the Prim algorithm to construct the minimum spanning tree. During algorithm initialization, the concentrator nodes are marked as visited. The node directly connected to the concentrator node with the smallest edge weight is added to the tree and marked as visited. This process is repeated until all nodes are marked as visited. The resulting tree structure is the minimum spanning tree, which defines the unique path from each energy meter to the concentrator, i.e., the optimal relay path. The tree depth of each node is calculated based on the minimum spanning tree. The tree depth is defined as the number of edges from the concentrator node to the node. If the tree depth of a node is greater than 3, the node is marked as unreachable and a topology adjustment is triggered. The concentrator allocates time slots according to the hierarchical structure of the minimum spanning tree. The first-level nodes, i.e., the nodes directly connected to the concentrator, are allocated time slot numbers 1 to N1. The second-level nodes are allocated time slot numbers N1 plus 1 to N2, and so on. Nodes in the same level are arranged in ascending order according to the carrier MAC address to determine the time slot allocation order. The duration of the time slot is set to 20ms, and the time frame period is 1 second. This step significantly improves carrier communication reliability by globally optimizing the routing topology. Compared with the traditional greedy routing method, the Prim algorithm guarantees the global optimality of the routing tree and avoids communication dead zones caused by local optima.

[0054] The specific implementation of step S04 is as follows: The concentrator starts the TCP pass-through server process. During initialization, the TCP pass-through server process creates a listening socket and binds it to the concentrator's IP address. Then, it creates listening ports in batches within the range of 10000 to 19999. The epoll event loop is configured using the edge-triggered mode, and the epoll event loop uses a single-threaded asynchronous IO model to handle all connection requests. The master station initiates a TCP connection request to the concentrator's IP address and the corresponding listening port based on the electricity meter file information. After receiving the connection request, the TCP pass-through server queries the port mapping table for the 12-digit asset number corresponding to the listening port that initiated the connection. After verifying the existence of the 12-digit asset number, it accepts the connection and establishes the TCP channel. The concentrator allocates one free buffer block from the memory pool to store the received and transmitted data of the TCP channel. The size of the buffer block is 4KB. The memory pool pre-allocates 10,000 buffer blocks during the system initialization phase, with a total memory usage of approximately 40MB. The zero-copy technology uses the sendfile system call to directly transfer data from one socket buffer to another, eliminating the need to copy data to user space and then back to kernel space, thus reducing two memory copy operations and lowering CPU load. This step establishes a standard TCP connection channel between the master station and the concentrator. The master station does not need to be aware of the underlying carrier network, maintaining the original meter reading process and communication protocol unchanged, achieving the goal of zero modification to the master station system.

[0055] The specific implementation of steps S05 to S06 is as follows: The concentrator receives the meter reading instruction issued by the master station from the TCP channel. The meter reading instruction is encapsulated using the DL / T645 protocol and includes fields such as the twelve-digit asset number of the target energy meter and a data identifier. The concentrator retrieves the corresponding carrier MAC address from the port mapping table based on the twelve-digit asset number, and then constructs the carrier frame format. The carrier frame format includes a destination MAC address field filled with the carrier MAC address, a source MAC address field filled with the concentrator's carrier MAC address, a frame type field indicating a data frame, and a payload field encapsulating the entire content of the meter reading instruction. The concentrator determines the carrier MAC address of the next-hop node based on the optimal relay path. If the target energy meter is a first-layer node, it is sent directly; if it is a second-layer or third-layer node, it is sent to the corresponding relay node. After receiving the message, the relay node continues to forward it according to the destination MAC address until it reaches the target energy meter. After receiving the carrier frame format, the transparent transmission module extracts the payload portion and decrypts it. The decrypted meter reading command is forwarded to the energy meter through the TTL serial port channel. The energy meter performs the reading operation and generates response data, which is returned to the transparent transmission module through the TTL serial port channel. The transparent transmission module encrypts the response data and encapsulates it into the carrier frame format. It then transmits the data back to the concentrator through the carrier channel along the reverse path of the optimal relay path. Upon receiving the data, the concentrator converts the carrier frame format into a TCP packet format and sends it to the master station through the corresponding listening port, completing a full bidirectional data transparent transmission process. When the concentrator detects that the carrier signal-to-noise ratio measurement value of a certain link is lower than 15dB, it determines that the carrier link quality has changed and triggers the incremental minimum spanning tree update algorithm. The incremental minimum spanning tree update algorithm only recalculates the routing structure of the subtree where the affected link is located and updates the routing information of the relevant nodes in the port mapping table. The entire update process takes less than 100ms, ensuring uninterrupted service.

[0056] The specific implementation of step S07 is as follows: the concentrator executes the sparse port scanning acceleration algorithm based on compressed sensing every 10 minutes. First, it generates the random Gaussian measurement matrix, where each element is randomly sampled from a normal distribution with a mean of 0 and a standard deviation of 1. The concentrator constructs the multicast probe packet, which is a specially formatted UDP data packet. The destination port field is set to the target port to be scanned, and the payload field is filled with a random sequence number. The concentrator sends the multicast probe packets sequentially according to the row vectors of the random Gaussian measurement matrix, sending a total of 500 multicast probe packets. The concentrator counts the number of received response packets and the response port numbers, constructs the measurement vector, where the j-th element of the measurement vector equals the number of responses received by the j-th multicast probe packet. The concentrator runs the orthogonal matching pursuit algorithm to reconstruct the true occupancy vector, initializes the residual vector to be equal to the measurement vector, and sets the support set to an empty set. It then iteratively executes the following process: calculates the inner product of each column of the random Gaussian measurement matrix with the residual vector to obtain a correlation vector; selects the column index corresponding to the element with the largest absolute value in the correlation vector and adds it to the support set; extracts the columns corresponding to the support set from the random Gaussian measurement matrix to form a submatrix; calculates the pseudo-inverse matrix of the submatrix; multiplies the pseudo-inverse matrix by the measurement vector to obtain the current estimate; multiplies the submatrix by the current estimate to obtain the reconstructed measurement vector; updates the residual vector to the measurement vector minus the reconstructed measurement vector; determines whether the L2 norm of the residual vector is less than 0.01 or whether the iteration count has reached 200; if the conditions are met, the loop terminates. The index of the non-zero element in the current estimate is the occupied listening port number. The concentrator organizes the scan results into a port allocation table, which is stored in JSON format and includes fields such as port number, occupancy status, and bound device identifier. This table is published to a predefined topic via the MQTT protocol for the maintenance master station to subscribe to. The MQTT protocol uses QoS level 1 to ensure that messages are delivered at least once. When two different 12-digit asset numbers in the port allocation table are mapped to the same listening port number, a port conflict is identified. The concentrator automatically assigns the conflicting device the smallest port number shown as idle in the port allocation table, updates the port mapping table, and notifies the relevant devices. Upon receiving the update notification, the master station modifies its local file information. This step enables a rapid, comprehensive scan of the listening port occupancy status, providing a decision-making basis for the dynamic management of the connection pool.

[0057] It should be noted that the first key technical idea of ​​this invention is the automatic identity sniffing and port mapping mechanism of the transparent transmission module. By integrating the identity reading function at the communication module level, the device replacement process can complete the collection of identity information and port binding without manual configuration. Compared with the traditional solution that requires logging into each electricity meter to configure communication parameters, this significantly reduces the complexity of on-site implementation and the risk of human configuration errors. At the same time, by adopting the rule of automatically mapping the last four digits of the meter number to the port, a direct correspondence between the master station file system and the concentrator port space is established. The master station system only needs to modify the IP address field without reconstructing the communication protocol stack or database structure, truly achieving zero-modification migration of the master station side. The second key technical approach is a carrier relay routing optimization algorithm based on graph theory's minimum spanning tree. This transforms the distributed self-organizing network problem into a centralized global optimization problem. By collecting link quality information from the entire network to construct a weighted graph and running Prim's algorithm, the resulting minimum spanning tree guarantees that the communication cost from each node to the root node is minimized globally. This overcomes the shortcomings of traditional greedy routing algorithms, which are prone to getting trapped in local optima, and significantly improves the end-to-end communication success rate in multi-hop relay scenarios. The incremental update mechanism further compresses the topology adjustment time to the millisecond level, ensuring network stability in dynamically changing environments. The third key technical approach is a sparse port scanning acceleration algorithm based on compressed sensing. Utilizing the sparsity characteristic of low port occupancy, it reduces the dimensionality of the high-dimensional scanning problem to a low-dimensional measurement space through random projection. The orthogonal matching pursuit algorithm is used to achieve high-precision sparse signal reconstruction. Compared with the traditional traversal scanning method, the time complexity is reduced from linear to sublinear, providing an efficient technical means for real-time monitoring and dynamic management of large-scale port pools, and effectively solving the resource scheduling bottleneck in high-concurrency scenarios. The synergistic effect of the three key technical approaches mentioned above lies in the fact that the automatic identity sniffing mechanism of the transparent transmission module establishes the basic architecture for end-to-end transparent transmission, the minimum spanning tree routing optimization algorithm ensures reliable transmission at the carrier link layer, and the sparse port scanning algorithm achieves efficient resource management at the transport layer. These three approaches operate at three different levels: physical layer device identification, data link layer routing topology, and transport layer port allocation, forming a complete technical chain from device access to data transmission and resource scheduling. Compared with the traditional approach of performing local optimization at a single level, this invention achieves system-level performance improvement through cross-layer collaborative design, enabling the migration process from the public network to the carrier to maintain service continuity while simultaneously achieving multiple goals such as reducing operating costs, improving data security, and enhancing system reliability.

[0058] It should be noted that this invention also solves the following technical problem: In large-scale carrier network scenarios, traditional ad hoc network mechanisms, which rely on devices autonomously selecting relay nodes, are prone to suboptimal routes, leading to a surge in energy consumption or communication congestion at some nodes due to frequent forwarding. This invention employs a carrier relay routing optimization algorithm based on graph theory's minimum spanning tree to abstract the power meter in the distribution area into an undirected weighted graph. The edge weight is defined as the reciprocal of the carrier signal-to-noise ratio measurement. The Prim algorithm is used to construct a minimum spanning tree to determine the globally optimal relay path. An incremental minimum spanning tree update algorithm is executed, recalculating only the affected subtrees to avoid full network route reconstruction. Combined with relay depth constraints and a time-division multiple access (TDMA) time slot allocation mechanism, this effectively suppresses broadcast storms and MAC layer contention deadlock problems.

[0059] Furthermore, this invention also solves the technical problem of connection establishment failure due to TCP stack resource exhaustion when thousands of electricity meters simultaneously transmit data during peak periods. This invention utilizes a sparse port scanning acceleration algorithm based on compressed sensing to leverage the sparsity of listening port occupancy status. It constructs a random Gaussian measurement matrix to project a 10,000-dimensional port space onto a 500-dimensional measurement space. An orthogonal matching pursuit algorithm reconstructs the true occupancy vector from the measurement vector, quickly locating idle listening ports and making connection pool dynamic management more efficient. It combines edge-triggered mode and zero-copy technology to handle concurrent connections and employs a memory pool pre-allocated buffer mechanism to avoid memory fragmentation caused by frequent memory allocation and release operations.

[0060] Specifically, the principle of this invention is as follows: This invention solves the aforementioned technical problems because the transparent transmission module actively sends a read meter number request message to the energy meter via the TTL serial port channel at the moment of power-on to obtain the twelve-digit asset number. For the energy meter, this is merely a routine parameter reading operation, requiring no awareness of module replacement. After receiving the asset number broadcast by the transparent transmission module, the concentrator automatically maps the last four digits of the asset number to a unique listening port within the range of 10000 to 19999, and establishes a three-way binding relationship between the asset number, carrier MAC address, and listening port in the port mapping table. The master station, which originally accessed the energy meter via a public IP address, now only needs to change its IP address to the concentrator's IP address, and the port number is calculated according to the rule of adding 10000 to the last four digits of the asset number, eliminating the need for table-by-table configuration. The concentrator starts a TCP transparent transmission server to listen on all allocated ports. After receiving a connection request from the master station, it queries the target energy meter's carrier MAC address according to the port mapping table, achieving bidirectional conversion and transparent transmission between TCP packet and carrier frame formats, thus completing the seamless migration of the communication module.

[0061] The following provides a specific embodiment 1 of the present invention, and the specific implementation of each step in this embodiment 1 is described in detail below.

[0062] The specific implementation of step S01 is as follows: A transparent transmission module is replaced in the modular slot built into the energy meter. The transparent transmission module sends a read meter number request message to the main control chip of the energy meter via a TTL serial port channel to obtain the 12-digit asset number of the energy meter and stores it encrypted in the built-in flash memory unit of the transparent transmission module. The built-in symmetric encryption unit of the transparent transmission module uses the AES-128-GCM algorithm to authenticate and encrypt the transmitted data. The symmetric encryption unit uses a hardware security engine to accelerate the AES-128-GCM algorithm. The root key is written to the one-time programmable storage area of ​​the transparent transmission module through a programmer in a physical contact manner during the SMT surface mount production stage. The one-time programmable storage area has hardware-level protection characteristics against reading, erasing, and side-channel attacks. Once written, it is permanently bound to the silicon-based physical fingerprint of the main control chip of the transparent transmission module. Before data transmission, the symmetric encryption unit automatically extracts the root key from the one-time programmable storage area and combines it with a 96-bit initialization vector generated based on a hardware true random number generator to authenticate and encrypt the message and generate a 128-bit authentication tag appended to the end of the ciphertext.

[0063] The specific implementation of step S02 is as follows: The transparent transmission module broadcasts a 12-digit asset number to the concentrator via the carrier channel. After receiving the 12-digit asset number, the concentrator performs a device validity verification. If the verification is successful, a binding relationship between the 12-digit asset number and the carrier MAC address is established in the port mapping table, and a listening port in the range of 10000 to 19999 is automatically assigned based on the last four digits of the 12-digit asset number. The listening port assignment rule defaults to automatically mapping the last four digits of the 12-digit asset number to the corresponding listening port. The listening port assignment formula is expressed as follows:

[0064] ;

[0065] In the formula, The assigned listening port number, with a value ranging from 10000 to 19999, dimensionless; The last four digits of the twelve-digit asset number range from 0 to 9999 and are dimensionless. When a port conflict occurs, on-site maintenance personnel can access the concentrator's local maintenance interface via an infrared handheld device and manually adjust the monitoring port allocation of the conflicting energy meters in the graphical menu. The adjusted mapping relationship is synchronized to the port rule table within the concentrator in real time without requiring a service restart.

[0066] The specific implementation of step S03 is as follows: The concentrator collects the carrier signal-to-noise ratio (SNR) measurements reported by all transparent transmission modules within the distribution area, constructs an undirected weighted graph, and executes a carrier relay routing optimization algorithm based on graph theory's minimum spanning tree to determine the optimal relay path and allocate time-division multiple access (TDMA) time slots. The relay depth of the optimal relay path is limited to 3 hops. The carrier relay routing optimization algorithm based on graph theory's minimum spanning tree abstracts the energy meters in the distribution area into an undirected weighted graph. Each node in the graph represents an energy meter or concentrator, and the edge weight is defined as the reciprocal of the carrier SNR measurement value. The edge weight calculation formula is expressed as follows:

[0067] ;

[0068] In the formula, For nodes With nodes The edge weights between them are dimensionless. and This is the node number of the equipment within the transformer area, with a value ranging from 1 to the total number of equipment in the transformer area, and is dimensionless. For nodes With nodes The carrier signal-to-noise ratio measured between the two points is expressed in dB and typically ranges from 10 to 40. To prevent extremely small positive numbers with a denominator of zero, an empirical value of 0.001 is used, in dB. A higher carrier signal-to-noise ratio (SNR) indicates better communication quality and a smaller edge weight. After the concentrator collects the received signal strength indicators of all transparent transmission modules within the area from adjacent devices, it uses the Prim algorithm to construct a minimum spanning tree to determine the optimal relay path. The Prim algorithm starts from the concentrator node, selecting the node with the smallest edge weight connected to the current tree and adding it to the tree each time, until all nodes are covered. The resulting minimum spanning tree is the routing topology that minimizes the total communication cost. The concentrator runs an incremental minimum spanning tree update algorithm. When a new device joins the network or the carrier link quality changes, only the affected subtree is recalculated to avoid global reconstruction. The incremental minimum spanning tree update algorithm first checks if the changed edge is in the current minimum spanning tree. If the weight of the newly added edge is less than the path weight of the same node pair in the tree, the original path is replaced. If an edge in the tree is invalid, the smallest replacement edge is found among the remaining edges. The relay depth is limited to 3 hops to prevent delay accumulation. When a device is more than 3 hops away from the concentrator, access is denied or the routing topology is adjusted. Time-division multiple access (TDMA) slots are allocated based on the minimum spanning tree routing topology to avoid the hidden terminal problem. Parent and child nodes are assigned different TDMA slots. Nodes at the same level are assigned TDMA slots sequentially after deterministic sorting by device identifier. Parent node selection is dynamically adjusted to balance the load and prevent overload of a single relay node. The backoff algorithm employs a binary exponential backoff strategy. The formula for calculating the competition window range after the conflict is as follows:

[0069] ;

[0070] In the formula, For the first The size of the contention window after a conflict, in the number of time slots; The number of collisions, ranging from 0 to 10, is dimensionless. This represents the upper limit of the contention window, typically set to 1023, with units representing the number of time slots. The formula for calculating equipment backoff time is as follows:

[0071] ;

[0072] In the formula, The retreat time is expressed in μs. For 0 to A uniformly distributed, dimensionless random integer within a given range; The duration of a single time slot is typically 9 seconds (μs). The deterministic backoff algorithm based on device identifiers calculates the initial backoff value using the device's unique identifier. The formula for calculating the initial backoff value is as follows:

[0073] ;

[0074] In the formula, The initial backoff value of the device, in μs; It serves as a unique identifier for the device, typically a decimal value converted from the device's MAC address, ranging from 0 to 281474976710655, and is dimensionless. This is the initial contention window size, which defaults to 15, and is expressed in units of time slots. This is the modulo operator.

[0075] The specific implementation of step S04 is as follows: The concentrator starts a TCP pass-through server and listens for connection requests from the master station within the listening port range. It uses an edge-triggered mode combined with zero-copy technology to handle concurrent connections. When the master station initiates a connection to the concentrator's IP address and corresponding listening port, a TCP channel is established. Edge-triggered mode is one of the working modes of the Linux system's epoll mechanism. In contrast to level-triggered mode, in edge-triggered mode, the kernel only notifies the application when the file descriptor state changes. The application must read or write all ready data at once; otherwise, it will not receive further notification. Zero-copy technology uses the sendfile or splice system calls to achieve direct data transmission in kernel space, avoiding multiple copies of data between user space and kernel space, reducing CPU usage and increasing throughput. The concentrator uses a memory pool pre-allocated buffer mechanism to handle large-scale concurrent meter reading scenarios. During system initialization, a fixed number of buffer blocks are pre-allocated, each buffer block being 4KB in size. The buffer blocks are managed using linked lists or arrays.

[0076] The specific implementation of step S05 is as follows: After the concentrator receives the meter reading instruction issued by the master station, it queries the carrier MAC address of the target energy meter according to the port mapping table, converts the TCP packet into a carrier frame format and forwards it to the transparent transmission module through the optimal relay path. After the transparent transmission module decrypts the packet, it forwards it to the energy meter through the TTL serial port channel.

[0077] The specific implementation of step S06 is as follows: the energy meter response data is encrypted by the transparent transmission module and then transmitted back to the concentrator via the carrier channel. The concentrator converts the carrier frame format into TCP packets and transmits them back to the master station through the corresponding listening port to complete the bidirectional data transparent transmission. When the carrier link quality changes, the concentrator executes the incremental minimum spanning tree update algorithm to recalculate the affected subtree.

[0078] The specific implementation of step S07 is as follows: The concentrator periodically executes a sparse port scanning acceleration algorithm based on compressed sensing to detect the occupancy status of the listening ports and generate a port allocation table. The port allocation table is sent to the maintenance master station via the MQTT protocol or read locally via an infrared handheld device. When a port conflict is detected, a dynamic port reallocation process is triggered. The sparse port scanning acceleration algorithm based on compressed sensing utilizes the sparsity characteristics of the listening port occupancy status to project a 10,000-dimensional port space onto a 500-dimensional measurement space. The sparse port scanning acceleration algorithm based on compressed sensing first constructs a random Gaussian measurement matrix. Each element of the random Gaussian measurement matrix follows a standard normal distribution with a mean of 0 and a variance of 1. The random Gaussian measurement matrix has a dimension of 500 rows and 10,000 columns, and is expressed as follows:

[0079] ;

[0080] In the formula, It is a random Gaussian measurement matrix with dimensions of 500 rows and 10,000 columns, and is dimensionless; For the matrix of the first Line number Column elements, The value range is from 1 to 500. The value range is from 1 to 10000. It follows a standard normal distribution with a mean of 0 and a variance of 1, and is dimensionless. The concentrator sends probe signals to the port space via multicast probe packets. The received response vector is the measurement vector, which is described as follows:

[0081] ;

[0082] In the formula, The measurement vector is 500-dimensional and dimensionless. The true occupancy vector is a 10000-dimensional, dimensionless binary vector. The true occupancy vector is the 10000-dimensional binary vector. The element being 1 indicates that the th element is 1. A listening port is occupied; a value of 0 indicates it is free. The port index ranges from 1 to 10000 and is dimensionless. The Orthogonal Matching Pursuit (ORP) algorithm is used to reconstruct the true occupancy vector from the measurement vector. ORP is an iterative greedy algorithm; in each iteration, the atom with the highest correlation to the current residual is added to the support set. ORP initializes the residual vector to equal the measurement vector, and the support set is empty. The ORP algorithm's first iteration... The formula for calculating the inner product in the next iteration is as follows:

[0083] ;

[0084] In the formula, For the first During the nth iteration The absolute value of the inner product of the column and the residual vector, dimensionless; For random Gaussian measurement matrix The The column has 500 dimensions and is dimensionless. This is a column index with values ​​ranging from 1 to 10000, and is dimensionless. For the first The residual vector after the next iteration has a dimension of 500 and is dimensionless. The iteration number is 1 to 1. Dimensionless. The formula for selecting the column index with the largest absolute value of the inner product to add to the support set is expressed as follows:

[0085] ;

[0086] In the formula, The selected column index for inclusion in the support set ranges from 1 to 10000 and is dimensionless. The current estimated least-squares projection formula is expressed as follows:

[0087] ;

[0088] In the formula, For the first The current estimate obtained from the next iteration has a dimension of 10,000 and is dimensionless. For random Gaussian measurement matrix Corresponding support set The submatrix composed of columns has a dimension of 500 rows multiplied by the number of elements in the support set, and is dimensionless; The support set is the set of selected column indexes, and its size is [size missing]. Dimensionless; for The Moore-Penrose pseudo-inverse matrix is ​​calculated using the following formula: The dimension is the number of rows multiplied by 500 columns of the support set elements, and is dimensionless. The residual vector update formula is expressed as follows:

[0089] ;

[0090] In the formula, For the first The residual vector updated after the next iteration has a dimension of 500 and is dimensionless; For current estimates Corresponding support set The non-zero elements of the set have the same dimension as the number of elements in the support set and are dimensionless. The formula for determining the termination condition of the iteration is as follows:

[0091] or ;

[0092] In the formula, For the residual vector Norm, dimensionless; The preset threshold value is 0.01, which is dimensionless. The sparsity is 200 by default and is dimensionless. The indices of the non-zero elements in the reconstructed true occupancy vector are the occupied listening port numbers.

[0093] To better understand and implement this invention, the following is a specific application scenario of this invention, Example 2:

[0094] To verify the effectiveness of this invention, technicians set up a test environment and deployed 216 three-phase smart energy meters in a certain transformer area. The original configuration was a public network 4G communication module. Technicians configured a TCP transparent transmission server at the concentrator end with a listening port range of 10000 to 19999. The last four digits of the energy meter asset number were distributed between 0001 and 0216. Figure 2 As shown, the overall deployment architecture includes key components such as the main station, concentrator, carrier channel, and transparent transmission module. Technicians first replaced the transparent transmission module in the modular slot built into the energy meter. The transparent transmission module uses a physical interface and electrical specifications fully compatible with the original public network module, allowing for direct plug-and-play replacement. After powering on, the built-in energy meter identity sniffing engine immediately sends a meter number read request message to the energy meter's main control chip via the TTL serial port, successfully obtaining the twelve-digit asset number and encrypting and storing it in the flash memory. Technicians recorded the startup process of the transparent transmission module for all 216 energy meters. The meter number read success rate reached 100%, with an average read time of 126 milliseconds. For the energy meter's main control chip, the entire process was merely a routine parameter read operation; the original application software of the energy meter was completely unaware of the transparent transmission module replacement.

[0095] The transparent transmission module broadcasts a 12-digit asset number to the concentrator via a carrier channel. After receiving the asset number, the concentrator performs a device validity check. If the check passes, it establishes a binding relationship between the asset number and the carrier MAC address in the port mapping table. The concentrator automatically assigns a listening port based on the last four digits of the asset number. For example, an electricity meter with asset number 201234560087 is automatically bound to port 10087, and an electricity meter with asset number 201234560152 is automatically bound to port 10152. Figure 3 As shown, the port mapping mechanism stores the correspondence between asset number, carrier MAC address, listening port, and binding timestamp in the concentrator's internal database. Technicians accessed the concentrator's local maintenance interface via an infrared handheld device, read the port allocation table, and confirmed that all 216 energy meters had been successfully assigned independent listening ports, with no port conflicts occurring.

[0096] The concentrator collects carrier signal-to-noise ratio measurements reported by all transparent transmission modules within the area, constructs an undirected weighted graph, and executes a carrier relay routing optimization algorithm based on graph theory's minimum spanning tree. As shown in Table 1:

[0097] Table 1. Measurement values ​​of carrier signal-to-noise ratio for some electricity meters

[0098]

[0099] The concentrator uses Prim's algorithm to construct a minimum spanning tree to determine the optimal relay path. Starting from the concentrator node, it selects the node with the smallest edge weight connected to the current tree and adds it to the tree each time, until all 216 nodes are covered. Figure 4 As shown, technicians analyzed the device distribution at different relay depths. There were 68 devices directly connected to the concentrator, 89 devices via a 1-hop relay, 51 devices via a 2-hop relay, and 8 devices via a 3-hop relay. Time-division multiple access (TDMA) time slots were allocated according to the minimum spanning tree routing topology. Parent and child nodes were assigned different time slots, and nodes at the same level were allocated time slots sequentially after deterministic sorting by device identifier to avoid hidden terminal issues. Technicians dynamically adjusted parent node selection to balance the load and prevent overloading of a single relay node.

[0100] The concentrator starts a TCP pass-through server and listens for connection requests from the master station within its listening port range. It uses an edge-triggered mode combined with zero-copy technology to handle concurrent connections. When the master station initiates a connection to the concentrator's IP address and corresponding listening port, a TCP channel is established. After receiving the meter reading command from the master station, the concentrator queries the carrier MAC address of the target energy meter according to the port mapping table, converts the TCP packet into a carrier frame format, and forwards it to the pass-through module via the optimal relay path. The pass-through module's built-in symmetric encryption unit uses a hardware security engine to accelerate the AES-128-GCM algorithm. The root key is written into the pass-through module's one-time programmable storage area via physical contact during the SMT assembly stage using a programmer. This storage area has hardware-level protection against reading, erasing, and side-channel attacks. Before data transmission, the symmetric encryption unit automatically extracts the root key from the one-time programmable storage area and, combined with a 96-bit initialization vector generated by a hardware true random number generator, authenticates and encrypts the message, generating a 128-bit authentication tag appended to the end of the ciphertext. After being decrypted, the transparent transmission module forwards the data to the energy meter via the TTL serial port channel. The energy meter's response data is then encrypted by the transparent transmission module and transmitted back to the concentrator via the carrier channel. The concentrator converts the carrier frame format into TCP packets and transmits them back to the master station through the corresponding listening port, thus completing bidirectional data transparent transmission.

[0101] Technicians simulated a scenario of carrier link quality changes, manually adjusting the carrier signal-to-noise ratio (SNR) measurements of some devices to trigger the concentrator to execute the incremental minimum spanning tree (MSB) update algorithm. The MSB update algorithm first determines if the changed edge is in the current minimum spanning tree. If the weight of the newly added edge is less than the weight of the path connecting the same node pair in the tree, the original path is replaced. If an edge in the tree is invalid, the algorithm searches for the smallest replacement edge among the remaining edges. Technicians recorded the routing topology adjustment time, compressing it from seconds to milliseconds. Only the affected subtrees were recalculated, while the routes of unaffected nodes remained unchanged, ensuring service continuity. The relay depth was limited to 3 hops to prevent latency accumulation; when a device is more than 3 hops away from the concentrator, access is denied or the routing topology is adjusted.

[0102] The concentrator periodically executes a sparse port scanning acceleration algorithm based on compressed sensing to detect the occupancy status of listening ports and generate a port allocation table. The algorithm first constructs a random Gaussian measurement matrix with dimensions of 500 rows and 10,000 columns, where each element follows a standard normal distribution. The concentrator sends probe signals to the port space via multicast probe packets. The received response vector is the measurement vector, which is equal to the product of the random Gaussian measurement matrix and the true occupancy vector, a 10,000-dimensional binary vector. An orthogonal matching pursuit algorithm is used to reconstruct the true occupancy vector from the measurement vector. The orthogonal matching pursuit algorithm is an iterative greedy algorithm; in each iteration, it selects the atom with the highest correlation to the current residual and adds it to the support set. Figure 5 As shown, technicians recorded the changes in reconstruction accuracy under different sparsity K values. When the sparsity K was 200, the reconstruction accuracy reached 99.5%, and the scanning time was reduced from 30 seconds in the traditional solution to 1.2 seconds, improving efficiency by 25 times. The port allocation table is uploaded to the maintenance master station via the MQTT protocol or read locally via an infrared handheld device. When a port conflict is detected, a dynamic port reallocation process is triggered.

[0103] The concentrator employs a memory pool pre-allocation buffer mechanism to handle large-scale concurrent meter reading scenarios. During system initialization, a fixed number of buffer blocks are pre-allocated, each 4KB in size, and managed using a linked list. When a new connection arrives, a free buffer block is retrieved from the memory pool and allocated to the new connection. After the new connection closes, the buffer block is returned to the memory pool, avoiding memory fragmentation and performance degradation caused by frequent malloc and free operations. Enabling the TCP_DEFER_ACCEPT option ensures that TCP sockets only deliver the connection to the application after receiving actual data, reducing half-open connection occupation and invalid wake-ups. Dynamic connection pool management replaces traditional long connections with a short-connection pulse mode. The master station and concentrator no longer maintain a continuous TCP connection; instead, a temporary connection is established for each meter reading task, and the connection is immediately closed to release resources after data transmission is complete. The concentrator maintains a connection object pool, reusing the memory structure and file descriptor resources of TCP connection objects to avoid the system call overhead caused by frequent connection creation and destruction. Technicians tested scenarios where thousands of electricity meters simultaneously transmit data during peak hours. The dynamic management of the connection pool, combined with the memory pool pre-allocation buffer mechanism, increased the concentrator's concurrent processing capacity from 500 connections in the traditional solution to 5000 connections, and reduced memory usage from 2GB to 800MB, completely solving the problem of TCP stack resource exhaustion.

[0104] The advancements of this invention compared to traditional methods are reflected in multiple aspects. Traditional public network communication modules require modification of the main station's front-end machine for protocol stack adaptation and upgrades to the meter end to adapt to the protocol. This invention, through the meter identity sniffing engine built into the transparent transmission module, actively obtains the meter asset number the moment the module powers on. The entire process is merely a routine parameter reading operation for the meter's main control chip, requiring no pre-installed drivers or firmware patches, achieving truly seamless migration. Traditional carrier networking relies on devices autonomously selecting relay nodes, which can easily lead to suboptimal routes or uneven load distribution. This invention transforms the carrier networking problem into a graph theory optimization problem through a carrier relay routing optimization algorithm based on graph theory's minimum spanning tree. By constructing a minimum spanning tree based on global carrier signal-to-noise ratio measurements, it ensures that each communication link selects the relay path with the best quality, significantly reducing packet loss and retransmission rates and improving overall network throughput. Traditional port scanning methods require traversing all listening ports, sending multicast probe packets, and waiting for timeout responses. This invention utilizes a sparse port scanning acceleration algorithm based on compressed sensing. Leveraging the sparsity of listening port occupancy status, it projects a 10,000-dimensional port space onto a 500-dimensional measurement space. An orthogonal matching pursuit algorithm reconstructs the true occupancy vector from the measurement vector, overcoming the linear time complexity limitation of traditional port-by-port polling. Sublinear time scanning is achieved through dimensionality reduction measurement and sparse reconstruction. Traditional TCP connection management faces TCP stack resource exhaustion during peak periods. This invention addresses this by using a memory pool pre-allocation buffer mechanism and dynamic connection pool management. It replaces long connections with short connection pulse modes, reusing the memory structure and file descriptor resources of TCP connection objects, effectively solving the resource bottleneck problem in large-scale concurrent meter reading scenarios.

[0105] It should be noted that the variables involved in this invention are explained in detail in Table 2.

[0106] Table 2 Variable Explanation Table

[0107]

[0108] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A seamless migration method for a power acquisition system based on dynamic port mapping, characterized in that, The transparent transmission module is replaced in the modular slot built into the energy meter. The transparent transmission module sends a read meter number request message to the main control chip of the energy meter through the TTL serial port channel to obtain the 12-digit asset number of the energy meter and stores it in encryption. The transparent transmission module broadcasts the 12-digit asset number to the concentrator through the carrier channel. After receiving the 12-digit asset number, the concentrator performs device validity verification and establishes a binding relationship between the 12-digit asset number and the carrier MAC address in the port mapping table. The concentrator automatically assigns a listening port based on the last four digits of the 12-digit asset number. The concentrator collects the carrier signal-to-noise ratio measurement values ​​reported by all transparent transmission modules in the distribution area to construct an undirected weighted graph and executes a carrier relay routing optimization algorithm to determine the optimal relay path. The concentrator starts the TCP transparent transmission server and listens for master station connection requests within the listening port range. After receiving the meter reading instruction issued by the master station, it queries the carrier MAC address of the target energy meter according to the port mapping table and converts the TCP packet into a carrier frame format and forwards it to the transparent transmission module. The energy meter response data is encrypted by the transparent transmission module and transmitted back to the concentrator through the carrier channel and converted into a TCP packet and transmitted back to the master station.

2. The seamless migration method for a power acquisition system based on dynamic port mapping according to claim 1, characterized in that, The transparent transmission module adopts a physical interface and electrical specifications that are fully compatible with the original public network module, and has a built-in low-power microcontroller and flash memory unit.

3. The seamless migration method for a power acquisition system based on dynamic port mapping according to claim 2, characterized in that, The transparent transmission module has a built-in symmetric encryption unit that uses the AES-128-GCM algorithm to authenticate and encrypt the transmitted data. The root key is written into the one-time programmable storage area during the SMT assembly production stage.

4. The seamless migration method for a power acquisition system based on dynamic port mapping according to claim 3, characterized in that, Before data transmission, the symmetric encryption unit extracts the root key from the one-time programmable storage area, combines it with a 96-bit initialization vector generated by a hardware true random number generator to authenticate and encrypt the message, and generates a 128-bit authentication tag to be appended to the end of the ciphertext.

5. The seamless migration method for a power acquisition system based on dynamic port mapping according to claim 4, characterized in that, The port mapping table is stored in the concentrator's internal database, recording the correspondence between the twelve-digit asset number, carrier MAC address, listening port, and binding timestamp.

6. The seamless migration method for a power acquisition system based on dynamic port mapping according to claim 5, characterized in that, The listening port allocation rule automatically maps the last four digits of the twelve-digit asset number to the corresponding listening port in the range of 10000 to 19999.

7. The seamless migration method for a power acquisition system based on dynamic port mapping according to claim 6, characterized in that, The carrier relay routing optimization algorithm abstracts the electricity meters in the distribution area into an undirected weighted graph, and defines the edge weight as the reciprocal of the carrier signal-to-noise ratio measurement. The Prim algorithm is used to construct a minimum spanning tree to determine the optimal relay path.

8. The seamless migration method for a power acquisition system based on dynamic port mapping according to claim 7, characterized in that, The concentrator runs the incremental minimum spanning tree update algorithm, and only recalculates the affected subtree when a new device joins the network or the carrier link quality changes.

9. The seamless migration method for a power acquisition system based on dynamic port mapping according to claim 8, characterized in that, The relay depth of the optimal relay path is limited to 3 hops, and time-division multiple access time slots are allocated according to the routing topology of the minimum spanning tree.

10. The seamless migration method for a power acquisition system based on dynamic port mapping according to claim 9, characterized in that, The concentrator uses an edge-triggered mode combined with zero-copy technology to handle concurrent connections. Zero-copy technology enables direct data transfer in kernel space through the sendfile or splice system calls.