An interworking high-quality transmission control protocol implementation method and system applied to a smart meter

CN123020684APending Publication Date: 2026-10-30CORE ENERGY MICROELECTRONICS TECHNOLOGY (HENAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611214197.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-11
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0012]本发明要解决的技术问题是现有技术中协议互通性差、传输质量不稳定、安全机制不完善和适配成本高的技术问题,为解决上述问题,提供一种应用于智能电表的互通高质量传输控制协议实现方法及系统

Benefits of technology

[0023]本发明的有益效果:协议互通性大幅提升:通过动态协议识别与自适应切换机制,提升了多厂商设备兼容率。传输质量显著改善:提升了抄表成功率。安全性增强,满足新型电力系统要求。适配成本降低:通信模块更换成本降低,实现“即插即用”。资源利用率提高:超限通信技术使带宽利用率提升了,延长了电池寿命延长。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123020684A_ABST
    Figure CN123020684A_ABST
Patent Text Reader

Abstract

The application discloses an interworking high-quality transmission control protocol implementation method and system applied to a smart meter, and the method comprises the following steps: step A: a plurality of physical communication media are compatible through a physical adaptation layer, a unified hardware abstract interface is provided to an upper layer, channel quality is automatically detected and transmission parameters are dynamically adjusted; step B: a multi-protocol analysis engine built in a protocol adaptation layer is used to automatically identify a protocol type used by a communication opposite end, and data formats of different protocols are uniformly converted into an internal standard format; step B: a security enhancement layer is used to increase bidirectional identity authentication, data encrypted transmission and anti-replay attack functions on the basis of an existing protocol check mechanism; and step D: an application interoperation layer is used to adopt an object-oriented data modeling method to define a unified access interface for all metering data. Protocol interworking is greatly improved: through a dynamic protocol identification and self-adaptive switching mechanism, the compatibility of multi-vendor equipment is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electronic information technology, specifically to a method and system for implementing a high-quality transmission control protocol for smart meters. Background Technology

[0002] Currently, the main communication protocols used in the field of smart meters include the DL / T 645 series protocols, the IEC 62056 (DLMS / COSEM) protocol, and the Modbus protocol.

[0003] (1) DL / T 645 series protocols This is the most widely used standard in China's power industry, currently existing in 1997 and 2007 versions. The protocol employs a master-slave half-duplex communication mode with a fixed frame format, including a start character, address field, control code, data field, checksum, and end character. Data identification uses a four-level tree structure, employing four fields (2 bytes each) to identify the data type and attribute. However, in practical applications, different manufacturers have varying understandings and implementations of the protocol, leading to inconsistent address encoding methods; for example, some meters use a 12-bit address, while others only use the last few bits.

[0004] (2) IEC 62056 (DLMS / COSEM) protocol This is an internationally recognized object-oriented modeling standard that uses OBIS (Object Identification System) to provide a unique identifier for each piece of data. The protocol stack is divided into a physical layer, a data link layer (using the HDLC protocol), and an application layer (using ASN.1 syntax to describe data). This protocol has strong interoperability, but its implementation is complex and requires significant hardware resources.

[0005] (3) Modbus protocol Modbus is widely used in industrial control, employing a master-slave point-to-point communication model that allows data communication between one master and multiple slave devices. Modbus RTU operates on an RS-485 bus, while Modbus TCP is based on Ethernet transmission. The national recommended standard GB / T 29871-2013 specifically specifies the requirements for energy metering instruments based on the Modbus communication protocol.

[0006] (4) Physical layer transmission method These mainly include RS-485 bus (strong anti-interference capability, long transmission distance), NB-IoT (wide coverage, massive connection, low power consumption), LoRa (long communication distance, strong penetration) and Ethernet, etc.

[0007] These protocols have the following problems in practical applications: Poor protocol interoperability: Different manufacturers implement the same protocol standard differently. For example, the address encoding method in the DL / T 645 protocol is not uniform. Some meters use 12-bit addresses, while others only use the last few bits, making it difficult for devices to interconnect.

[0008] Unstable transmission quality: In complex electromagnetic environments, RS-485 bus long-distance transmission suffers from signal attenuation; wireless methods such as NB-IoT have communication blind spots in enclosed environments such as basements.

[0009] Inadequate security mechanisms: Existing protocols mostly use simple CRC checksums or vertical information checksums, lacking robust identity authentication and data encryption mechanisms.

[0010] High protocol adaptation costs: Smart meters need to support multiple communication protocols, but existing solutions usually require replacing hardware modules or burning different firmware, which cannot achieve "plug and play".

[0011] Therefore, there is an urgent need for a communication control protocol that can be compatible with multiple protocols, adaptively adjust transmission parameters, enhance security, and reduce adaptation costs. Summary of the Invention

[0012] The technical problem to be solved by the present invention is the poor interoperability of protocols, unstable transmission quality, imperfect security mechanisms and high adaptation costs in the prior art. In order to solve the above problems, a method and system for implementing a high-quality transmission control protocol for smart meters is provided.

[0013] The object of this invention is achieved in the following manner: A method for implementing a high-quality transmission control protocol for interoperability in smart meters, wherein the data processing flow of this method includes both receiving and transmitting directions, and includes the following steps: Step A: In the receiving direction, the physical adaptation layer is compatible with multiple physical communication media and provides a unified hardware abstraction interface to the upper layer. The physical adaptation layer also supports the redundancy management of multiple communication links and the fragmentation and reassembly of ultra-long data packets, and automatically detects channel quality and dynamically adjusts transmission parameters. Step B: Receive the raw data stream output from Step A, and automatically identify the protocol type used by the communication peer through the multi-protocol parsing engine built into the protocol adaptation layer, and convert the data formats of different protocols into the internal standard format. Step C: Receive the standard format data output from Step B, and add two-way authentication, encrypted data transmission, and anti-replay attack functions to the existing protocol verification mechanism through the security enhancement layer; Step D: Receive the security-verified data output from Step C, and define a unified access interface for all measurement data by using an object-oriented data modeling method through the application interoperability layer. In the sending direction, the data undergoes reverse processing through steps D, C, B, and A in sequence to complete the data transmission or response reporting.

[0014] The physical adaptation layer includes the following hardware units and their interconnections: The main control unit has its data ports connected to the physical layer interface unit, security unit, storage unit, and standardized interface, respectively. The physical layer interface unit includes an RS-485 transceiver, an NB-IoT module, a LoRa module, and an Ethernet PHY chip. The data output terminals of each interface unit are connected to different serial communication interfaces of the main control unit. The security unit is connected to the main control unit via an I2C or SPI bus; The storage unit is connected to the main control unit via the SPI bus; The power management unit has its input connected to an external DC power supply and its output connected to the power pins of the main control unit, physical layer interface unit, security unit, and storage unit, respectively. The standardized interface has signal pins including power pins, UART pins, SPI pins, GPIO pins, and reset pins. This interface is plugged into the corresponding interface on the meter body or fixedly connected via DIN rail clips.

[0015] The protocol adaptation layer performs the following logical steps: Step B1: After the physical layer receives the data frame, it records the complete frame data and timestamp, extracts the first 2-4 bytes of the frame as a feature code, and matches it with the pre-stored protocol feature vector table. Step B2: If the signature is matched successfully, parse the address field according to the corresponding protocol format and verify the validity of the address field; Step B3: After the complete frame has been received, verify the frame checksum according to the protocol specifications; Step B4: After successful verification, confirm the protocol type and cache the protocol information corresponding to the address in the protocol cache table; Step B5: If communication fails three times in a row, clear the cache for that address and re-enter the identification stage.

[0016] The two-way authentication logic of the security enhancement layer includes: The master station sends an authentication request to the meter, which includes the master station certificate serial number and a first random number R1; The meter verifies the validity of the master station certificate, generates a second random number R2, and calculates the session key Key = KDF(R1||R2); The meter returns an authentication response, which includes R2, a session key encrypted with the master station's public key, and a meter certificate signed with the meter's private key. The main station decrypts the session key, verifies the meter certificate, and enters secure communication mode after both parties confirm.

[0017] It also includes the implementation steps of over-limit communication technology: When the data packet of the physical meter exceeds the byte capacity limit constrained by the communication protocol, it is split into multiple sub-data packets, each sub-data packet corresponding to a virtual meter identifier; Establish a dynamic mapping table to record the correspondence between physical meter addresses, virtual meter address ranges, and data fragmentation identifiers; The receiving end merges and reassembles data packets belonging to the same physical meter based on the virtual meter address and fragmentation identifier to restore the original complete data; The fragment size is dynamically adjusted based on channel quality: large fragments are used when the channel quality is higher than the threshold, and small fragments are used when the channel quality is lower than the threshold, with forward error correction coding added.

[0018] It also includes a communication quality adaptive adjustment step: The comprehensive channel quality assessment value Q is calculated as follows: Q = w1×SNR + w2×(1 / BER) + w3×RSSI + w4×(1 / retransmission rate), where: SNR represents the signal-to-noise ratio, BER represents the bit error rate, RSSI represents the received signal strength, the retransmission rate is the number of retransmissions in the last 10 communications / 10, and w1~w4 are weighting coefficients, which are configurable. When the Q value is lower than the first threshold T1, the RS-485 communication rate will be reduced by one level. When the Q value is lower than the second threshold T2, switch to the backup communication channel; The wireless communication transmit power is dynamically adjusted based on RSSI, with a step size of 2dBm.

[0019] A high-quality transmission and control system for interconnection in smart meters, comprising: The physical adaptation layer module is used to be compatible with multiple physical communication media and provide a unified hardware abstraction interface. This module includes an automatic channel quality detection unit and a dynamic adjustment unit for transmission parameters. The protocol adaptation layer module has its input end connected to the output end of the physical adaptation layer module. It includes a protocol identification unit and a protocol conversion unit. The protocol identification unit automatically identifies the peer protocol type through feature code matching. The protocol conversion unit converts the data format of different protocols into the internal standard format. The security enhancement layer module, whose input is connected to the output of the protocol adaptation layer module, includes a two-way authentication unit, a data encryption unit, and a replay attack prevention unit. The application interoperability layer module, whose input is connected to the output of the security enhancement layer module, includes an object-oriented data modeling unit and a unified data access interface unit. The modules mentioned above exchange data and control signals through standard API interfaces. The modules at each layer communicate with each other via an internal data bus and control signal lines. Each module supports bidirectional data processing in both the receiving and transmitting directions. In the transmitting direction, the data flows in reverse order through the application interoperability layer module, the security enhancement layer module, the protocol adaptation layer module, and the physical adaptation layer module.

[0020] The physical adaptation layer module is integrated into a separate communication module, which includes: The PCB board has two layers: the upper layer is used to arrange the main control chip and radio frequency circuit, and the lower layer is used to arrange the interface circuit and power supply circuit. The outer casing is provided with guide rail clips and / or pins, wherein the pins are directly plugged into the standardized interface socket of the meter body, and the guide rail clips are engaged with DIN rails; The main control chip is an ARM Cortex-M4 core microcontroller. Its SPI interface is connected to the SPI Flash storage chip, its I2C interface is connected to the security chip, and its UART interface is connected to the RS-485 transceiver, NB-IoT module, LoRa module and Ethernet PHY chip respectively.

[0021] It also includes a multi-channel redundant transmission unit, the logical connection relationship of which is as follows: The main channel sends a request. If it fails, the failure information is recorded and the system switches to the backup channel. If the backup channel succeeds, the data is cached and copied back after the main channel recovers. If all channels fail, the data is stored in the retry queue.

[0022] It also includes a cooperative Mesh network unit that implements IPv6 over IEEE 802.15.4 based on the 6LoWPAN protocol stack. Each node maintains a neighbor table and a routing table, uses the RPL routing protocol to dynamically select the optimal path, and supports redundant transmission of data packets along multiple paths.

[0023] The beneficial effects of this invention include: significantly improved protocol interoperability: Dynamic protocol identification and adaptive switching mechanisms enhance compatibility with devices from multiple vendors. Significantly improved transmission quality: Increased meter reading success rate. Enhanced security, meeting the requirements of new power systems. Reduced adaptation costs: Lower communication module replacement costs, achieving "plug and play". Improved resource utilization: Over-limit communication technology improves bandwidth utilization and extends battery life. Attached Figure Description

[0024] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

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

[0026] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used herein have the same technical meaning as commonly understood by one of ordinary skill in the art to which this application pertains.

[0027] A method for implementing a high-quality transmission control protocol for interoperability in smart meters, wherein the data processing flow of this method includes both receiving and transmitting directions, and includes the following steps: Step A: In the receiving direction, the physical adaptation layer is compatible with multiple physical communication media and provides a unified hardware abstraction interface to the upper layer. The physical adaptation layer also supports the redundancy management of multiple communication links and the fragmentation and reassembly of ultra-long data packets, and automatically detects channel quality and dynamically adjusts transmission parameters. Step B: Receive the raw data stream output from Step A, and automatically identify the protocol type used by the communication peer through the multi-protocol parsing engine built into the protocol adaptation layer, and convert the data formats of different protocols into the internal standard format. Step C: Receive the standard format data output from Step B, and add two-way authentication, encrypted data transmission, and anti-replay attack functions to the existing protocol verification mechanism through the security enhancement layer; Step D: Receive the security-verified data output from Step C, and define a unified access interface for all measurement data by using an object-oriented data modeling method through the application interoperability layer. In the sending direction, the data undergoes reverse processing through steps D, C, B, and A in sequence to complete the data transmission or response reporting.

[0028] The physical adaptation layer includes the following hardware units and their interconnections: The main control unit has its data ports connected to the physical layer interface unit, security unit, storage unit, and standardized interface, respectively. The physical layer interface unit includes an RS-485 transceiver, an NB-IoT module, a LoRa module, and an Ethernet PHY chip. The data output terminals of each interface unit are connected to different serial communication interfaces of the main control unit. The security unit is connected to the main control unit via an I2C or SPI bus; The storage unit is connected to the main control unit via the SPI bus; The power management unit has its input connected to an external DC power supply and its output connected to the power pins of the main control unit, physical layer interface unit, security unit, and storage unit, respectively. The standardized interface has signal pins including power pins, UART pins, SPI pins, GPIO pins, and reset pins. This interface is plugged into the corresponding interface on the meter body or fixedly connected via DIN rail clips.

[0029] The protocol adaptation layer performs the following logical steps: Step B1: After the physical layer receives the data frame, it records the complete frame data and timestamp, extracts the first 2-4 bytes of the frame as a feature code, and matches it with the pre-stored protocol feature vector table. Step B2: If the signature is matched successfully, parse the address field according to the corresponding protocol format and verify the validity of the address field; Step B3: After the complete frame has been received, verify the frame checksum according to the protocol specifications; Step B4: After successful verification, confirm the protocol type and cache the protocol information corresponding to the address in the protocol cache table; Step B5: If communication fails three times in a row, clear the cache for that address and re-enter the identification stage.

[0030] The two-way authentication logic of the security enhancement layer includes: The master station sends an authentication request to the meter, which includes the master station certificate serial number and a first random number R1; The meter verifies the validity of the master station certificate, generates a second random number R2, and calculates the session key Key = KDF(R1||R2); The meter returns an authentication response, which includes R2, a session key encrypted with the master station's public key, and a meter certificate signed with the meter's private key. The main station decrypts the session key, verifies the meter certificate, and enters secure communication mode after both parties confirm.

[0031] The application interoperability layer uses an object identifier tree structure to define a unified data model and defines the following data access primitives: The read data object primitive includes parameters for object identifier, object identifier length, data buffer, and buffer length, and is used to read the data object corresponding to the specified object identifier. The write data object primitive includes the object identifier, object identifier length, data to be written, and data length parameters, and is used to write data to the specified object identifier; The execution method primitive includes an object identifier, a method identifier, method parameters, and a parameter length parameter, and is used to execute the control command corresponding to the specified object identifier; The registration notification primitive contains an object identifier and a callback function pointer, which is used to trigger the callback function when the data of the specified object identifier changes.

[0032] It also includes the implementation steps of over-limit communication technology: When the data packet of the physical meter exceeds the byte capacity limit constrained by the communication protocol, it is split into multiple sub-data packets, each sub-data packet corresponding to a virtual meter identifier; Establish a dynamic mapping table to record the correspondence between physical meter addresses, virtual meter address ranges, and data fragmentation identifiers; The receiving end merges and reassembles data packets belonging to the same physical meter based on the virtual meter address and fragmentation identifier to restore the original complete data; The fragment size is dynamically adjusted based on channel quality: large fragments are used when the channel quality is higher than the threshold, and small fragments are used when the channel quality is lower than the threshold, with forward error correction coding added.

[0033] It also includes a communication quality adaptive adjustment step: The comprehensive channel quality assessment value Q is calculated as follows: Q = w1×SNR + w2×(1 / BER) + w3×RSSI + w4×(1 / retransmission rate), where: SNR represents the signal-to-noise ratio (dB), BER represents the bit error rate, RSSI represents the received signal strength (dBm), the retransmission rate is the number of retransmissions in the last 10 communications / 10, and w1~w4 are weighting coefficients, which are configurable. When the Q value is lower than the first threshold T1, the RS-485 communication rate will be reduced by one level. When the Q value is lower than the second threshold T2, switch to the backup communication channel; The wireless communication transmit power is dynamically adjusted based on RSSI, with a step size of 2dBm.

[0034] A high-quality transmission and control system for interconnection in smart meters, comprising: The physical adaptation layer module is used to be compatible with multiple physical communication media and provide a unified hardware abstraction interface. This module includes an automatic channel quality detection unit and a dynamic adjustment unit for transmission parameters. The protocol adaptation layer module has its input end connected to the output end of the physical adaptation layer module. It includes a protocol identification unit and a protocol conversion unit. The protocol identification unit automatically identifies the peer protocol type through feature code matching. The protocol conversion unit converts the data format of different protocols into the internal standard format. The security enhancement layer module, whose input is connected to the output of the protocol adaptation layer module, includes a two-way authentication unit, a data encryption unit, and a replay attack prevention unit. The application interoperability layer module, whose input is connected to the output of the security enhancement layer module, includes an object-oriented data modeling unit and a unified data access interface unit. The modules at each layer communicate with each other via standard API interfaces to exchange data and control signals.

[0035] The physical adaptation layer module is integrated into a separate communication module, which includes: The PCB board has two layers: the upper layer is used to arrange the main control chip and radio frequency circuit, and the lower layer is used to arrange the interface circuit and power supply circuit. The outer casing is provided with guide rail clips and / or pins, wherein the pins are directly plugged into the standardized interface socket of the meter body, and the guide rail clips are engaged with DIN rails; The main control chip is an ARM Cortex-M4 core microcontroller. Its SPI interface is connected to the SPI Flash storage chip, its I2C interface is connected to the security chip, and its UART interface is connected to the RS-485 transceiver, NB-IoT module, LoRa module and Ethernet PHY chip respectively.

[0036] The protocol identification unit internally stores a protocol feature vector table, which includes at least the following fields: protocol type, frame start feature, address field feature, verification method feature, and response timeout feature. The protocol identification unit performs identification in the following logical order: feature code matching → address field validity verification → frame checksum verification → protocol type confirmation → address-protocol cache.

[0037] The data encryption unit of the security enhancement layer uses the CBC mode of the national cryptographic SM4 algorithm to encrypt the data field, and adds a 16-byte initialization vector before the encrypted data and an 8-byte message authentication code after the encrypted data to form an extended secure data frame structure.

[0038] It also includes a multi-channel redundant transmission unit, the logical connection relationship of which is as follows: Send a request through the main channel → If it fails, record the failure information and switch to the backup channel → If the backup channel succeeds, cache the data and rewrite it after the main channel recovers → If all channels fail, store the data in the retry queue.

[0039] It also includes a dynamic loading protocol library unit, which is stored in SPI Flash. When the system starts, only the core protocol is loaded, and high-frequency protocols are cached in RAM according to the protocol usage frequency statistics. Low-frequency protocols are temporarily loaded from Flash when in use. This unit supports online upgrades of the protocol library via OTA.

[0040] It also includes a cooperative Mesh network unit that implements IPv6 over IEEE 802.15.4 based on the 6LoWPAN protocol stack. Each node maintains a neighbor table and a routing table, uses the RPL routing protocol to dynamically select the optimal path, and supports redundant transmission of data packets along multiple paths.

[0041] Example: Independent communication module solution.

[0042] This embodiment provides an independent communication module for use in State Grid smart meters. This module connects to the meter body via a standardized interface, enabling "plug-and-play" operation.

[0043] 1.1 Hardware Composition and Connection Relationships The communication module includes: Main control unit: Employs an ARM Cortex-M4 core microcontroller (model: STM32F407), with a main frequency of 168MHz, and built-in 1MB Flash and 192KB RAM. The main control unit's data ports are connected to the physical layer interface unit, security unit, storage unit, and standardized interface, respectively.

[0044] Physical layer interface unit: The RS-485 transceiver (model: SP3485) has its data output terminal connected to the UART1 interface of the main control unit; The NB-IoT module (model: BC95-G) has its data output terminal connected to the UART2 interface of the main control unit; The LoRa module (model: SX1278) has its data output terminal connected to the UART3 interface of the main control unit; The Ethernet PHY chip (model: LAN8720A) is connected to the main control unit via the RMII interface.

[0045] Security Unit: Independent security chip (model: ATECC608A), connected to the main control unit via I2C bus, used for secure key storage, random number generation and hardware encryption operations.

[0046] Storage unit: SPI Flash chip (model: W25Q64), which is connected to the main control unit via SPI bus and is used to store protocol library, configuration parameters and logs.

[0047] Power Management Unit: Wide voltage input (9-24V DC), multiple outputs (3.3V / 1.8V). Its input terminal is connected to an external DC power supply, and its output terminals are connected to the power pins of the main control unit, physical layer interface unit, security unit and storage unit respectively.

[0048] Standardized Interface: A 20-pin interface conforming to the IEEE P3197 draft specification, with signal pins including power pins, UART pins, SPI pins, GPIO pins, and a reset pin. This interface connects directly to the corresponding socket on the meter body via pins, or snaps onto a DIN rail via a DIN rail clip.

[0049] 1.2 Structural Layout The communication module adopts a double-layer PCB design, measuring 55mm × 40mm × 12mm. The upper layer houses the main control chip and RF circuitry, while the lower layer contains the interface circuitry and power supply circuitry. The module housing is equipped with guide rail clips and pins.

[0050] 1.3 Work Process After the module is powered on, perform the following steps: The main control unit initializes all peripheral interfaces and loads the configuration file from the SPI Flash. Establish communication with the meter body through a standardized interface to read basic meter information (model, manufacturer, supported protocols, etc.). Enter listening mode according to the configuration and wait for the concentrator or master station to initiate communication; Upon receiving a communication request, it is processed according to the protocol adaptive mechanism of the present invention (see embodiment: protocol identification and adaptive switching for details). After processing, the results are returned to the meter via a standardized interface, or directly to the main station via wireless means.

[0051] Example: Embedded Software Solution 2.1 Implementation Method Protocol recognition engine: Implemented using a lightweight finite state machine, with code size kept under 8KB.

[0052] Protocol stack trimming: Only the DL / T 645 and Modbus protocol stacks are retained, and the complex functions of IEC 62056 are trimmed.

[0053] Simplified security features: No hardware encryption is used; only simple dynamic token verification is added.

[0054] Storage optimization: The protocol library uses compressed storage and is dynamically decompressed at runtime.

[0055] 2.2 Workflow After the meter is powered on, the protocol identification engine first attempts to listen to the bus using the DL / T 645-2007 protocol. If there is no response, it polls and tries other protocols (Modbus RTU, Modbus TCP, etc.) within a set time window (e.g., 500ms). Once identification is successful, the protocol type is stored in the EEPROM, and subsequent communications will prioritize this protocol. If three consecutive communications fail, the EEPROM record is cleared, and the identification phase is restarted.

[0056] Example: Protocol Identification and Adaptive Switching (Software Logic) This embodiment describes in detail the specific implementation of the protocol adaptation layer.

[0057] 3.1 Protocol Feature Vector Table The following protocol feature vector table is pre-built and stored in SPI Flash:

[0058] 3.2 Recognition Algorithm Steps The protocol identification unit performs identification in the following logical order: The physical layer receives data frames and records the complete frame data and timestamp. Extract the first 2-4 bytes of the frame as a feature code and match it with the feature vector table; If the signature is matched successfully, the address field is parsed according to the corresponding protocol format; Verify the validity of the address field (e.g., DL / T 645 requires the address to be in BCD format, with the last bit being a checksum). Wait for the complete frame to be received, and then verify the frame checksum according to the protocol specifications. After successful verification, the protocol type is confirmed, and the protocol information corresponding to the address is cached. If multiple attempts fail to identify the frame, the system enters learning mode and records the features of the unknown frames for future upgrades.

[0059] 3.3 Adaptive Switching Logic Initialization phase: A probe polling method is used to send probe frames of different protocols in sequence.

[0060] Operation phase: Establish a protocol cache table and directly query the corresponding protocol type based on the slave address.

[0061] Error handling: If communication fails 3 times in a row, clear the cache and re-enter the identification stage.

[0062] Dynamic adjustment: Based on communication success rate statistics, the protocol identification order is automatically adjusted (those with higher success rates take priority).

[0063] Example: Enhanced Secure Communication (Security Enhancement Layer) This embodiment describes the specific implementation of the security enhancement layer.

[0064] 4.1 Secure Data Frame Structure While maintaining compatibility with existing protocols, security functions are implemented by extending the data field. Taking the DL / T 645 frame format as an example: Original frame format: | 68H | Address field (6) | 68H | Control code | Data length (L) | Data field (N) | Checksum | 16H |; Enhanced Security Frame Format (Data Field Extension): | 68H | Address field (6) | 68H | Control code | Data length (L) | [Security header] | [Encrypted data] | [Security tail] | Checksum | 16H |; in: Security header (4 bytes): Version (1) + Algorithm identifier (1) + Random number (2); Security tail (8 bytes): Message authentication code (8); 4.2 Two-way authentication process The master station sends an authentication request to the meter, which includes the master station certificate serial number and a first random number R1; The meter verifies the validity of the master station certificate, generates a second random number R2, and uses the key derivation function to calculate the concatenation result of R1 and R2 to obtain the session key Key; The meter returns an authentication response, which includes R2, a session key encrypted with the master station's public key, and a meter certificate signed with the meter's private key. The main station decrypts the session key to verify the meter certificate. After both parties confirm, they enter secure communication mode.

[0065] 4.3 Implementation of Encrypted Data Transmission Data encryption is performed using the CBC mode of the national cryptographic SM4 algorithm, as detailed below: Generate a 16-byte initialization vector IV (consisting of a random number and a frame counter); The plaintext data field is encrypted using the SM4-CBC mode to obtain the ciphertext; The IV is placed at the beginning of the ciphertext to form a complete encrypted data block; The message authentication code is calculated using the SM4-CMAC algorithm and appended to the end of the encrypted data block; The receiving end first verifies the MAC address, then decrypts and recovers the plaintext.

[0066] Example: Unified Data Model (Application Interoperability Layer) This embodiment describes the specific implementation of the application interoperability layer.

[0067] 5.1 Object Identifier (OID) Tree Design: Referring to the OBIS specifications of DL / T 698 and IEC 62056, a simplified OID structure is designed, for example: 1.8.0.0.0.255: Total positive active energy (corresponding to DL / T 645 data identifier 9010); 1.8.1.0.0.255: Positive active power rate of 1 unit of electricity; 1.8.2.0.0.255: Positive active power rate 2 for electricity; 2.8.0.0.0.255: Total reverse active energy; 16.7.0.0.0.255: Phase A voltage; 16.13.0.0.0.255: Phase A current; 5.2 Definition of Data Access Primitives Define the following data access primitives: Read data object primitive: Includes object identifier, object identifier length, data buffer, and buffer length parameters, used to read the data object corresponding to the specified object identifier; Write data object primitive: Includes object identifier, object identifier length, data to be written and data length parameters, used to write data to the specified object identifier; Execution method primitives: These include an object identifier, a method identifier, method parameters, and a parameter length parameter, and are used to execute the control command corresponding to the specified object identifier. Registration notification primitive: Contains an object identifier and a callback function pointer, used to trigger the callback function when the data of the specified object identifier changes.

[0068] 5.3 Protocol Conversion Engine The protocol conversion engine is responsible for converting unified data access requests into PDUs of specific protocols. For example, the process of converting OID 1.8.0.0.0.255 into a DL / T 645-2007 data identifier is as follows: Look up the mapping table: OID 1.8.0.0.0.255 → Data ID 90 10 00 FF; Construct the data identifier field: 90 10 00 FF; Construct the complete frame: 68 AA AA AA AA AA AA 68 11 04 90 10 00 FF CS 16.

[0069] Example: Adaptive Adjustment of Communication Quality This embodiment describes the channel quality detection and adaptive adjustment function of the physical adaptation layer.

[0070] 6.1 Channel Quality Assessment Indicators Define the integrated channel quality evaluation function: Q = w1×SNR + w2×(1 / BER) + w3×RSSI + w4×(1 / retransmission rate) Where: SNR: Signal-to-noise ratio (dB); BER: Bit error rate; RSSI: Received signal strength (dBm); Retransmission rate: Number of retransmissions in the last 10 communications / 10; w1~w4: Weighting coefficients (configurable, typical value is 0.25).

[0071] 6.2 Adaptive Adjustment Strategy Rate adjustment: When the Q value is lower than the threshold T1 (e.g., 50), the RS-485 communication rate will be reduced by one level (e.g., from 9600bps to 4800bps). Channel switching: When the Q value is lower than the threshold T2 (e.g., 30), try to switch to the backup communication channel (e.g., switch from RS-485 to NB-IoT). Power adjustment: For wireless communication, the transmit power is dynamically adjusted according to RSSI in 2dBm increments; Retry strategy: Dynamically adjust the number of retries and timeout based on channel quality.

[0072] 6.3 Multi-channel redundancy mechanism The multi-channel redundant transmission unit operates according to the following logic: The main channel sends a request (such as RS-485); If the transmission is successful, the process ends. If the transmission fails, record the failure information; Switch to a backup channel (such as NB-IoT) and extend the timeout period; If the backup channel sends the data successfully, the data will be cached and copied again once the main channel is restored. If all channels fail, the data is stored in the retry queue and will wait for the next retry.

[0073] Example: Over-limit communication technology This embodiment describes the specific implementation of over-limit communication technology, which is used to overcome the limitations of traditional protocols on data capacity.

[0074] 7.1 Data Splitting Mechanism When the data packet from the physical meter exceeds the byte capacity limit constrained by the communication protocol (e.g., DL / T 645 specifies a maximum data length of 200 bytes per frame, while the actual data is 512 bytes), it is split into multiple sub-data packets, each corresponding to a virtual meter identifier. For example: The physical meter data packet (512 bytes) is split into: Virtual meter 1 (128 bytes): positive active power + rate 1 + rate 2; Virtual meter 2 (128 bytes): Reverse active power + reactive power + voltage; Virtual meter 3 (128 bytes): Current + Power factor + Frequency; Virtual meter 4 (128 bytes): Event logs + frozen data.

[0075] 7.2 Dynamic Virtual Mapping Establish a dynamic mapping table to record the correspondence between physical meter addresses and virtual meter addresses:

[0076] 7.3 Data Merging and Reorganization The receiving end (concentrator / data collector) merges and reassembles data packets belonging to the same physical meter based on the virtual meter address and fragmentation identifier to restore the original complete data.

[0077] 7.4 Adaptive Sharding Strategy (Optimization Scheme) The fragment size is dynamically adjusted according to the channel quality: when the channel quality is good (Q>70), a large fragment (256 bytes) is used to reduce the number of fragments; when the channel quality is poor (Q<40), a small fragment (64 bytes) is used to improve the success rate of a single frame, and forward error correction coding (FEC) is added to enhance anti-interference capability.

[0078] Example: Dynamically loading protocol libraries This embodiment provides an optimization solution to address the balance between multi-protocol support and resource consumption.

[0079] 8.1 Technical Solution Each protocol stack is implemented as an independent dynamic link library and stored in SPI Flash; When the system starts up, only the core protocol (DL / T 645) is loaded, and other protocols are dynamically loaded as needed; Establish protocol usage frequency statistics, cache frequently used protocols in RAM, and temporarily load less frequently used protocols when they are used; It supports OTA online upgrades of the protocol library, allowing support for new protocols without replacing hardware.

[0080] 8.2 Implementation Details Define a protocol library dynamic loading interface, including the following fields: Protocol ID, Protocol Name, Flash Address, Size, Load Count, Initialization Function Pointer, Parsing Function Pointer, and Construction Function Pointer. During on-demand loading, the protocol library is first searched for in Flash. If not loaded, it is read from Flash into RAM, the ELF format is parsed to obtain the function entry point, initialization is performed, and then the process returns.

[0081] Example: Collaborative Mesh Network This embodiment provides an optimization scheme to improve wireless communication coverage and data reliability.

[0082] 9.1 Technical Solution The communication modules of smart meters automatically form a mesh network; Each node is both a terminal and a relay, supporting multi-hop transmission; Implement IPv6 over IEEE 802.15.4 based on the 6LoWPAN protocol stack; The RPL routing protocol (IPv6 routing protocol for low-power lossy networks) is used to dynamically select the optimal path; The Trickle algorithm is used to optimize the routing update frequency and avoid network congestion; Data packets can be transmitted redundantly along multiple paths, improving the arrival rate.

[0083] 9.2 Beneficial Effects The coverage radius is expanded by 3-5 times; The meter reading success rate increased from 99.6% to 99.99%; The failure of a single node does not affect the overall network connectivity.

[0084] Example: Complete Working Process Taking the reading of electricity meter data in a certain community by a concentrator as an example, the complete workflow is as follows: 10.1 Initialization Phase When the communication module is powered on, it loads the configuration file (including protocol signature library, security certificate, etc.) from Flash. Initialize all physical interfaces and start the channel quality monitoring task; Basic information about the electricity meter is read through a standardized interface to create an equipment information table.

[0085] 10.2 Protocol Identification Phase The concentrator sends broadcast probe frames (trying DL / T 645, Modbus, and IEC 62056 in sequence). The communication module receives the probe frame and calls the protocol recognition engine to analyze the frame features. The concentrator was identified as using the DL / T 645-2007 protocol, and the protocol information was recorded. A confirmation frame is returned, completing the protocol handshake.

[0086] 10.3 Security Certification Phase The concentrator initiates a two-way authentication process (see Example 4); The communication module verifies the concentrator certificate and negotiates the session key; Authentication successful. Enter secure communication mode.

[0087] 10.4 Data Request Phase The concentrator sends a unified data access request (OID=1.8.0.0.0.255). The protocol conversion engine maps OIDs to DL / T 645 data identifiers (90 10 00 FF). The security enhancement layer encrypts data fields using session keys and adds a security header and a security trailer. The physical layer selects the RS-485 channel (channel quality assessment Q=85, which is higher than the threshold) and sends frame data.

[0088] 10.5 Data Processing Stage The communication module received the response frame returned by the electricity meter; The security layer verifies the message authentication code and decrypts the data field; The protocol conversion engine parses the DL / T 645 format power data into a unified data format; The data is returned to the concentrator to complete the transcription.

[0089] 10.6 Exception Handling Scenarios Assume that RS-485 communication fails three times in a row (channel quality Q drops to 45). The adaptive adjustment module automatically switches to the NB-IoT backup channel; The data was successfully read wirelessly and synchronized to the RS-485 cache. Once RS-485 is restored, the historical data will be copied back.

[0090] Example: A Physically Unclonable Security Scheme Based on PUF (Optimized Scheme) To further enhance the secure storage of keys, this embodiment provides a PUF-based security solution.

[0091] 11.1 Technical Solution The randomness of the SRAM inside the MCU during power-on is used as the entropy source of the physically unclonable function (PUF); Instead of storing the plaintext key, it stores the PUF auxiliary data of the key; The key is reconstructed each time power is applied, and the key exists in volatile memory only during runtime; Combined with a physical anti-tamper design, the temporary key is automatically erased when the casing is detected to be open or in an abnormal environment.

[0092] 11.2 Beneficial Effects Even if an attacker obtains the Flash content, they cannot obtain the key; Each device has a unique physical fingerprint, enhancing its anti-cloning capabilities; It meets the State Grid's safety requirements for metering equipment.

[0093] The above description is only a preferred embodiment of the present invention. It should be noted that those skilled in the art can make several changes and improvements without departing from the overall concept of the present invention, and these should also be considered within the scope of protection of the present invention.

Claims

1. A method for implementing a high-quality transmission control protocol for interoperability in smart meters, characterized in that, The data processing flow of this method includes both receiving and sending directions, and includes the following steps: Step A: In the receiving direction, the physical adaptation layer is compatible with multiple physical communication media and provides a unified hardware abstraction interface to the upper layer. The physical adaptation layer also supports the redundancy management of multiple communication links and the fragmentation and reassembly of ultra-long data packets, and automatically detects channel quality and dynamically adjusts transmission parameters. Step B: Receive the raw data stream output from Step A, and automatically identify the protocol type used by the communication peer through the multi-protocol parsing engine built into the protocol adaptation layer, and convert the data formats of different protocols into the internal standard format. Step C: Receive the standard format data output from Step B, and add two-way authentication, encrypted data transmission, and anti-replay attack functions to the existing protocol verification mechanism through the security enhancement layer; Step D: Receive the security-verified data output from Step C, and define a unified access interface for all measurement data by using an object-oriented data modeling method through the application interoperability layer. In the sending direction, the data undergoes reverse processing through steps D, C, B, and A in sequence to complete the data transmission or response reporting.

2. The method for implementing a high-quality transmission control protocol for interoperability in smart meters according to claim 1, characterized in that, The physical adaptation layer includes the following hardware units and their interconnections: The main control unit has its data ports connected to the physical layer interface unit, security unit, storage unit, and standardized interface, respectively. The physical layer interface unit includes an RS-485 transceiver, an NB-IoT module, a LoRa module, and an Ethernet PHY chip. The data output terminals of each interface unit are connected to different serial communication interfaces of the main control unit. The security unit is connected to the main control unit via an I2C or SPI bus; The storage unit is connected to the main control unit via the SPI bus; The power management unit has its input connected to an external DC power supply and its output connected to the power pins of the main control unit, physical layer interface unit, security unit, and storage unit, respectively. The standardized interface has signal pins including power pins, UART pins, SPI pins, GPIO pins, and reset pins. This interface is plugged into the corresponding interface on the meter body or fixedly connected via DIN rail clips.

3. The method for implementing a high-quality transmission control protocol for interoperability in smart meters according to claim 1, characterized in that, The protocol adaptation layer performs the following logical steps: Step B1: After the physical layer receives the data frame, it records the complete frame data and timestamp, extracts the first 2-4 bytes of the frame as a feature code, and matches it with the pre-stored protocol feature vector table. Step B2: If the signature is matched successfully, parse the address field according to the corresponding protocol format and verify the validity of the address field; Step B3: After the complete frame has been received, verify the frame checksum according to the protocol specifications; Step B4: After successful verification, confirm the protocol type and cache the protocol information corresponding to the address in the protocol cache table; Step B5: If communication fails three times in a row, clear the cache for that address and re-enter the identification stage.

4. The method for implementing a high-quality interoperability transmission control protocol for smart meters according to claim 1, characterized in that, The two-way authentication logic of the security enhancement layer includes: The master station sends an authentication request to the meter, which includes the master station certificate serial number and a first random number R1; The meter verifies the validity of the master station certificate, generates a second random number R2, and calculates the session key Key = KDF(R1||R2); The meter returns an authentication response, which includes R2, a session key encrypted with the master station's public key, and a meter certificate signed with the meter's private key. The main station decrypts the session key, verifies the meter certificate, and enters secure communication mode after both parties confirm.

5. The method for implementing a high-quality transmission control protocol for interoperability in smart meters according to claim 1, characterized in that, It also includes the implementation steps of over-limit communication technology: When the data packet of the physical meter exceeds the byte capacity limit constrained by the communication protocol, it is split into multiple sub-data packets, each sub-data packet corresponding to a virtual meter identifier; Establish a dynamic mapping table to record the correspondence between physical meter addresses, virtual meter address ranges, and data fragmentation identifiers; The receiving end merges and reassembles data packets belonging to the same physical meter based on the virtual meter address and fragmentation identifier to restore the original complete data; The fragment size is dynamically adjusted based on channel quality: large fragments are used when the channel quality is higher than the threshold, and small fragments are used when the channel quality is lower than the threshold, with forward error correction coding added.

6. The method for implementing a high-quality transmission control protocol for interoperability in smart meters according to claim 1, characterized in that, It also includes a communication quality adaptive adjustment step: The comprehensive channel quality assessment value Q is calculated as follows: Q = w1×SNR + w2×(1 / BER) + w3×RSSI + w4×(1 / retransmission rate), where: SNR represents the signal-to-noise ratio, BER represents the bit error rate, RSSI represents the received signal strength, the retransmission rate is the number of retransmissions in the last 10 communications / 10, and w1~w4 are weighting coefficients, which are configurable. When the Q value is lower than the first threshold T1, the RS-485 communication rate will be reduced by one level. When the Q value is lower than the second threshold T2, switch to the backup communication channel; The wireless communication transmit power is dynamically adjusted based on RSSI, with a step size of 2dBm.

7. A high-quality transmission control system for interconnection in smart meters, characterized in that, include: The physical adaptation layer module is used to be compatible with multiple physical communication media and provide a unified hardware abstraction interface. This module includes an automatic channel quality detection unit and a dynamic adjustment unit for transmission parameters. The protocol adaptation layer module has its input end connected to the output end of the physical adaptation layer module. It includes a protocol identification unit and a protocol conversion unit. The protocol identification unit automatically identifies the peer protocol type through feature code matching. The protocol conversion unit converts the data format of different protocols into the internal standard format. The security enhancement layer module, whose input is connected to the output of the protocol adaptation layer module, includes a two-way authentication unit, a data encryption unit, and a replay attack prevention unit. The application interoperability layer module, whose input is connected to the output of the security enhancement layer module, includes an object-oriented data modeling unit and a unified data access interface unit. The modules mentioned above exchange data and control signals through standard API interfaces. The modules at each layer communicate with each other via an internal data bus and control signal lines. Each module supports bidirectional data processing in both the receiving and transmitting directions. In the transmitting direction, the data flows in reverse order through the application interoperability layer module, the security enhancement layer module, the protocol adaptation layer module, and the physical adaptation layer module.

8. The high-quality transmission control system for interconnection applied to smart meters according to claim 7, characterized in that, The physical adaptation layer module is integrated into a separate communication module, which includes: The PCB board has two layers: the upper layer is used to arrange the main control chip and radio frequency circuit, and the lower layer is used to arrange the interface circuit and power supply circuit. The outer casing is provided with guide rail clips and / or pins, wherein the pins are directly plugged into the standardized interface socket of the meter body, and the guide rail clips are engaged with DIN rails; The main control chip is an ARM Cortex-M4 core microcontroller. Its SPI interface is connected to the SPI Flash storage chip, its I2C interface is connected to the security chip, and its UART interface is connected to the RS-485 transceiver, NB-IoT module, LoRa module and Ethernet PHY chip respectively.

9. The high-quality transmission control system for interconnection applied to smart meters according to claim 7, characterized in that, It also includes a multi-channel redundant transmission unit, the logical connection relationship of which is as follows: The main channel sends a request. If it fails, the failure information is recorded and the system switches to the backup channel. If the backup channel succeeds, the data is cached and copied back after the main channel recovers. If all channels fail, the data is stored in the retry queue.

10. The high-quality transmission control system for interconnection applied to smart meters according to claim 7, characterized in that, It also includes a cooperative Mesh network unit that implements IPv6 over IEEE 802.15.4 based on the 6LoWPAN protocol stack. Each node maintains a neighbor table and a routing table, uses the RPL routing protocol to dynamically select the optimal path, and supports redundant transmission of data packets along multiple paths.