Distributed household photovoltaic production data access method

By obtaining the device unique identifier and a two-way long and short-term memory neural network, the structured communication protocol template is constructed, which solves the problem of dynamic changes in device protocols in distributed user photovoltaic systems, realizes plug-and-play access and efficient data analysis, and reduces operation and maintenance costs and misjudgment rates.

CN120528994APending Publication Date: 2025-08-22HUANENG ANHUI MENGCHENG WIND POWER CO LTD +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510875443.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-27
Publication Date
2025-08-22

AI Technical Summary

Technical Problem

The existing technology is difficult to cope with the dynamic changes in equipment protocols in distributed household photovoltaic systems, resulting in problems such as interruption of communication, high mismatch rate, high operation and maintenance costs, and inaccurate data analysis, especially when the equipment scale is large, it significantly affects system efficiency and security.

Method used

By obtaining the device's unique identifier, combining the preset protocol feature library and a bidirectional long and short-term memory neural network, dynamically match and build a structured communication protocol template to realize plug-and-play access and protocol adaptive communication, reducing operation and maintenance complexity.

Benefits of technology

It realizes seamless access to photovoltaic equipment of multiple manufacturers, shortens the access cycle of new equipment, improves equipment compatibility and data analysis accuracy, reduces operation and maintenance costs and key leakage risks, and is suitable for equipment cluster management at the thousand-level equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120528994A_ABST
    Figure CN120528994A_ABST
Patent Text Reader

Abstract

The invention discloses a distributed household photovoltaic production data access method comprising the following steps: obtaining a unique identifier of a distributed household photovoltaic device, the unique identifier comprising a communication protocol association feature; judging whether a communication rule corresponding to the unique identifier is included in a preset communication protocol feature library of the cloud server or not; if the preset communication protocol feature library comprises a communication rule corresponding to the unique identifier, performing data communication with the distributed household photovoltaic equipment based on the communication rule; if the preset communication protocol feature library does not include the communication rule corresponding to the unique identifier, performing reverse analysis on original communication data of the distributed household photovoltaic equipment, constructing a structured communication protocol template, and performing data communication with the distributed household photovoltaic equipment based on the structured communication protocol template; and the cloud server is in data communication with a plurality of distributed household photovoltaic devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of photovoltaic equipment data exchange, and in particular to a distributed household photovoltaic production data access method. Background Art

[0002] With the rapid adoption of distributed household photovoltaic systems, protocol compatibility issues arising from the integration of massive heterogeneous devices have become a major technical bottleneck restricting the industry's development. Currently, manufacturers of photovoltaic inverters, smart meters, and other equipment generally use proprietary communication protocols. These protocols are frequently updated with hardware iterations, leading to significant instruction set differences and register address offsets between devices from different manufacturers. Traditional solutions rely on manual reverse engineering to extract protocol templates, and the integration cycle for a single new device can take as long as 3-5 business days. In scenarios with over 1,000 devices, protocol configuration costs account for over 40% of overall operation and maintenance expenses.

[0003] Existing static matching methods based on fixed protocol libraries struggle to cope with dynamic changes in device protocols. For example, a provincial photovoltaic monitoring platform experienced communication interruptions for over 20% of its existing devices due to its inability to promptly adapt to protocol changes caused by manufacturer firmware upgrades, resulting in direct economic losses reaching millions of yuan. Furthermore, existing solutions for connecting devices with unknown protocols often rely on shallow feature matching (such as fuzzy comparison of instruction headers), resulting in a mismatch rate of up to 35%, seriously threatening the accuracy of data analysis.

[0004] Traditional architectures exhibit significant flaws in data transmission security and efficiency. Centralized key management is vulnerable to single-point attacks. A key leak at a leading manufacturer in 2022 exposed hundreds of thousands of devices to the risk of unauthorized control. Furthermore, fixed encoding strategies struggle to adapt to complex network environments. Under weak network conditions, data retransmission rates exceed 50%, and real-time performance metrics (such as power fluctuation monitoring) cannot meet the millisecond-level response requirements of power grid dispatch.

[0005] Even more critically, existing protocol parsing technologies lack deep integration with the physical characteristics of equipment. Manually defined protocol templates often overlook the physical constraints of PV equipment operating parameters (such as the nonlinear relationship between power and voltage), leading to increased misjudgment of abnormal data. In one case, a distributed PV cluster in one location misidentified normal shading as equipment failure due to a protocol parsing error, triggering false alarms and unnecessary maintenance scheduling, resulting in wasted resources. Summary of the Invention

[0006] The purpose of the embodiments of the present invention is to provide a distributed household photovoltaic production data access method. By introducing a dynamic matching mechanism between a device unique identifier and a preset protocol feature library, combined with protocol reverse parsing using a bidirectional long short-term memory neural network, plug-and-play access and protocol adaptive communication for distributed household photovoltaic devices are achieved, significantly reducing the complexity of heterogeneous device management and operation and maintenance costs.

[0007] To solve the above technical problems, a first aspect of an embodiment of the present invention provides a distributed household photovoltaic production data access method, comprising the following steps:

[0008] Obtaining a unique identifier for a distributed household photovoltaic device, wherein the unique identifier includes a communication protocol association feature;

[0009] Determining whether a preset communication protocol feature library of the cloud server includes a communication rule corresponding to the unique identifier;

[0010] If the preset communication protocol feature library includes a communication rule corresponding to the unique identifier, data communication is performed with the distributed household photovoltaic device based on the communication rule;

[0011] If the preset communication protocol feature library does not include a communication rule corresponding to the unique identifier, reverse-engineering the original communication data of the distributed household photovoltaic device to construct a structured communication protocol template, and performing data communication with the distributed household photovoltaic device based on the structured communication protocol template;

[0012] The cloud server is connected to data of several distributed household photovoltaic devices.

[0013] Furthermore, the reverse parsing of the original communication data of the distributed household photovoltaic equipment to construct a structured communication protocol template includes:

[0014] Obtaining a preset number of frames of original communication data sent by the distributed household photovoltaic equipment, and dividing the frame boundaries based on the communication interval time or the sliding window algorithm to obtain a pre-processed data frame set;

[0015] Based on a bidirectional long short-term memory neural network, obtaining a data frame delimiter probability distribution result, a register address feature distribution result, and a check code prediction result in the preprocessed data frame set;

[0016] Locating the frame header identifier and the frame tail identifier based on the data frame delimiter probability distribution result, establishing an address-physical quantity mapping table based on the register address feature distribution result, and traversing candidate check algorithms based on the check code prediction result and reversely calculating and verifying the check rules;

[0017] The structured communication protocol template is constructed by combining the frame header identifier, the frame tail identifier, the address-physical quantity mapping table and the verification rule.

[0018] Furthermore, obtaining a probability distribution result of a data frame delimiter in the pre-processed frame data set includes:

[0019] Calculating a first probability value of each byte in the data frame as a frame header and a second probability value of each byte as a frame tail, wherein the data frame delimiter probability distribution result includes: a first probability value and a second probability value corresponding to each byte;

[0020] When a first probability value of a byte as a frame header is greater than a first preset probability threshold and the byte forms a continuous 2-byte combination with an adjacent byte, marking the byte as a candidate frame header;

[0021] When a second probability value of the byte being the frame end is greater than a second preset probability threshold and the byte is located at the end of the data frame, the byte is marked as a candidate frame end.

[0022] Furthermore, locating a frame header identifier and a frame tail identifier based on the data frame delimiter probability distribution result includes:

[0023] Traversing all byte positions marked as the candidate frame headers, and selecting a continuous 2-byte combination with the highest occurrence frequency in the pre-processed data frame set as a frame header identifier;

[0024] Traversing all byte positions marked as candidate frame end positions to verify whether they are located at the end of the preprocessed data frame; if the byte position of the candidate frame end deviates from the end position indicated by the data frame length field by ≤1 byte, then confirming it as a frame end identifier;

[0025] The byte offsets of the frame header identifier and the frame tail identifier are written into the frame format definition of the structured communication protocol template.

[0026] Furthermore, obtaining the register address feature distribution result in the pre-processed data frame set includes:

[0027] Calculating a third probability value that each byte position in the data frame belongs to the function code field and a fourth probability value that each byte position belongs to the register address field, wherein the register address feature distribution result includes the third probability value and the fourth probability value corresponding to each byte;

[0028] When the third probability value of the two consecutive bytes is greater than the third preset probability threshold and the fourth probability value is greater than the fourth preset probability threshold, it is determined that the two consecutive bytes are a function code + register address combination field;

[0029] The numerical range of the function code + register address combination field in all data frames is obtained, and the function code + register address combination field whose numerical range conforms to the photovoltaic device register address coding rule is screened to generate a candidate address set for establishing the address-physical quantity mapping table.

[0030] Furthermore, establishing an address-physical quantity mapping table based on the register address feature distribution result includes:

[0031] Obtain the values ​​of all function code + register address combination fields in the candidate address set;

[0032] According to the function code type and register address range, combined with the preset photovoltaic equipment physical quantity coding table, determine the physical quantity type corresponding to the candidate address;

[0033] According to the dimension conversion rules in the preset photovoltaic equipment physical quantity code table, the original value of each candidate address is reversely deduced to determine the dimension conversion formula;

[0034] The function code, register address, physical quantity type and dimension conversion formula are associated to generate an address-physical quantity mapping table.

[0035] Furthermore, obtaining the check code prediction result in the pre-processed data frame set includes:

[0036] calculating a fifth probability value that each byte position in the data frame belongs to the check field;

[0037] When the fifth probability value of the two consecutive bytes is greater than the fifth preset probability threshold, determining that the two consecutive bytes are check field revelation positions;

[0038] According to the length of the check field and the characteristics of the adjacent data fields, the probability of the candidate check algorithm type is obtained.

[0039] Furthermore, the step of traversing candidate verification algorithms based on the verification code prediction result and reversely calculating and verifying verification rules includes:

[0040] intercepting a data field byte stream from the pre-processed data frame set according to the starting position and length of the check field;

[0041] Traversing preset candidate checksum algorithms in order of priority to calculate expected checksums of the data field byte stream;

[0042] Compare the expected check code with the actual check field in the pre-processed data frame byte by byte, and if there is a difference of ≤1 byte and the comparison is successful for a preset number of consecutive times, confirm that the current candidate check algorithm is valid;

[0043] The type and calculation range of the valid verification algorithm are written into the verification rule field of the structured communication protocol template, where the calculation range is the byte range in the data frame that the verification algorithm needs to calculate the verification code.

[0044] Furthermore, after constructing the structured communication protocol template, the following steps are further included:

[0045] Generate standardized test instructions based on the structured communication protocol template and send them to the distributed household photovoltaic equipment;

[0046] Receiving response data corresponding to the standardized test instruction sent by the distributed household photovoltaic device, the response data including physical quantity data, device status data and original register value;

[0047] Verifying whether the numerical range of the response data complies with the physical constraints of the photovoltaic device;

[0048] If so, the preprocessed data frame set and the corresponding structured communication protocol template are added to the data training set of the bidirectional long short-term memory neural network.

[0049] Furthermore, the structured communication protocol template includes: a frame format definition, an address-physical quantity mapping table, and a verification rule. The frame format definition includes the byte position of the frame header identifier, the length field offset, and the end order rule. The address-physical quantity mapping table includes the function code type, the register address range, and the dimension conversion formula. The verification rule includes the algorithm type, the calculation range, and the fault tolerance flag offset.

[0050] The physical constraint conditions include: the real-time power generation value of the distributed household photovoltaic equipment is less than the nominal maximum power value of the equipment, the real-time temperature value of the distributed household photovoltaic equipment is within a preset temperature range, and the DC output voltage fluctuation range of the distributed household photovoltaic equipment is less than a preset proportion value of the equipment nominal voltage.

[0051] Accordingly, a second aspect of an embodiment of the present invention provides a distributed household photovoltaic production data access system, which performs data access with household photovoltaic equipment based on the above-mentioned distributed household photovoltaic production data access method, including:

[0052] An identification acquisition module, which is used to obtain a unique identifier of a distributed household photovoltaic device, wherein the unique identifier includes a communication protocol association feature;

[0053] a feature library connection module, configured to determine whether a preset communication protocol feature library of the cloud server includes a communication rule corresponding to the unique identifier;

[0054] a data communication module configured to perform data communication with the distributed household photovoltaic device based on the communication rules corresponding to the unique identifier if the preset communication protocol feature library includes the communication rules;

[0055] a protocol construction module configured to reversely parse original communication data of the distributed household photovoltaic device, construct a structured communication protocol template, and perform data communication with the distributed household photovoltaic device based on the structured communication protocol template if the preset communication protocol feature library does not include a communication rule corresponding to the unique identifier;

[0056] The cloud server is connected to data of several distributed household photovoltaic devices.

[0057] Accordingly, a third aspect of an embodiment of the present invention provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the above-mentioned distributed household photovoltaic production data access.

[0058] Accordingly, a fourth aspect of an embodiment of the present invention provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the above-mentioned distributed household photovoltaic production data access.

[0059] The above technical solutions of the embodiments of the present invention have the following beneficial technical effects:

[0060] 1. By precisely matching the device's unique identifier with the pre-set protocol signature library, combined with protocol reverse parsing technology using a bidirectional long short-term memory (LSTM) neural network, seamless integration of photovoltaic equipment from multiple manufacturers is achieved. When pre-set protocols are missing, the frame structure, register mapping, and verification rules can be automatically inferred from the raw communication data, shortening the new equipment integration cycle from 3-5 days with traditional manual analysis to under 10 minutes. Compatible with over 200 proprietary protocol variants from major manufacturers, this significantly improves device compatibility and reduces operation and maintenance costs.

[0061] 2. Based on dynamically generated protocol templates, the system employs a dual verification mechanism of end-to-end encrypted communication and physical constraints. By defining the algorithm type and calculation range (from the frame header to the first byte of the checksum field) in the verification rules, combined with the physical quantity threshold verification of the response data, the system improves the detection rate of abnormal data and reduces the risk of key leakage.

[0062] 3. By feeding verified protocol templates and preprocessed data back into the LSTM neural network training set, the protocol parsing model is continuously iteratively optimized. For every 100 new device data, the model parsing accuracy increases by 8%-12%, and the misjudgment rate remains stable at less than 1%. At the same time, the standardized storage of protocol templates (frame format, address mapping table, and verification rules) supports the unified management of clusters of tens of thousands of devices, making it suitable for large-scale scenarios such as rural rooftop photovoltaics and industrial and commercial distributed power stations. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] Figure 1 This is a flow chart of a distributed household photovoltaic production data access method provided by an embodiment of the present invention;

[0064] Figure 2 This is a module block diagram of a distributed household photovoltaic production data access system provided by an embodiment of the present invention.

[0065] Reference numerals:

[0066] 1. Identification acquisition module, 2. Feature library connection module, 3. Data communication module, 4. Protocol construction module. DETAILED DESCRIPTION

[0067] To make the objectives, technical solutions, and advantages of the present invention more clearly understood, the present invention will be further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings. It should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present invention. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present invention.

[0068] Please refer to Figure 1 A first aspect of an embodiment of the present invention provides a distributed household photovoltaic production data access method, comprising the following steps:

[0069] Step S100: obtaining a unique identifier of a distributed household photovoltaic device, where the unique identifier includes a communication protocol association feature.

[0070] When distributed household photovoltaic equipment is connected to the cloud server, it is necessary to generate a unique identifier through its hardware characteristics. This identifier is not a simple device serial number, but a composite identity credential generated by collecting the underlying hardware characteristics of the device (such as the physical unclonable function characteristics of the chip, the communication port configuration mode, the manufacturer's firmware version number, etc.) and integrating it with a hash algorithm. For example, laser etching technology is used to extract the microstructure characteristics of the chip, and the MAC address and firmware version information are combined to generate an unclonable unique identification code through an encryption algorithm. This design not only ensures the uniqueness of the device identity, but also provides a semantic indexing basis for subsequent protocol matching through protocol-related features (such as manufacturer ID and hardware version). Through the unique identifier, the protocol family and possible version branches of the device can be quickly located, laying the foundation for dynamic protocol adaptation.

[0071] Step S200: Determine whether the preset communication protocol feature library of the cloud server includes a communication rule corresponding to the unique identifier.

[0072] The preset communication protocol feature library maintained by the cloud server is a dynamic knowledge graph with a multi-layer structure, in which each protocol template is deeply bound to a specific device identification feature (such as manufacturer ID, hardware version number). The protocol feature library not only stores standard instruction sets (such as Modbus function code definitions), but also contains extension rules for different manufacturer protocol variants (such as the private register address offset of a certain manufacturer's inverter). After receiving the device unique identifier, the entry that matches the protocol-associated feature in the identifier is first retrieved from the feature library. If there is a matching communication rule (such as a known protocol version of a certain model of equipment from a certain manufacturer), the corresponding communication rule set step S300 is directly loaded. If the preset communication protocol feature library includes communication rules corresponding to the unique identifier, data communication is performed with the distributed household photovoltaic equipment based on the communication rules.

[0073] When the communication rules are matched successfully, the standardized communication process is entered. The cloud server accurately divides the data stream according to the frame format definition in the protocol template (such as data header and tail identifiers, length field offset), and parses the physical quantity data according to the register address mapping table (such as converting the original value of the 0x0400 address into the actual power value). At the same time, the communication process adopts a layered encryption strategy: at the transport layer, data integrity is guaranteed based on the verification rules in the protocol template (such as the CRC16 algorithm); at the application layer, end-to-end encryption is achieved through a dynamic key distribution mechanism (such as session key generation based on the device's unique identifier). In addition, the network status (such as delay, packet loss rate) is monitored in real time, and the optimal coding strategy (such as Turbo code or Fountain code) is automatically selected to ensure stable data transmission efficiency in high-noise environments.

[0074] Step S400: If the preset communication protocol feature library does not include a communication rule corresponding to the unique identifier, reverse-engineering the original communication data of the distributed household photovoltaic device is performed, a structured communication protocol template is constructed, and data communication is performed with the distributed household photovoltaic device based on the structured communication protocol template.

[0075] In an embodiment of the present invention, a bidirectional long short-term memory neural network is used to reverse-engineer the original communication data. Its bidirectional timing processing capability can accurately model protocol context features (such as the transaction identifier increment pattern and check bit distribution in the Modbus / TCP request-response mode), and the attention mechanism is combined to adaptively parse variable-length data frames (such as the OBIS coding level focus in the DLMS / COSEM protocol). The forget gate is used to filter channel noise and maintain a field recognition accuracy of more than 92% at a signal-to-noise ratio as low as 15dB. At the same time, dynamic semantics are automatically extracted based on a multi-layer gating mechanism (such as the register address offset pattern of the timestamp XOR encoding in the inverter's private protocol), and protocol self-evolution is achieved through online incremental learning (automatic adaptation of MPPT channel data mapping after firmware upgrade within 24 hours). With the help of a transfer learning framework, the feature extraction layer weights are generalized to similar protocol parsing, ultimately forming a protocol template self-construction system that supports "plug and play" access of multi-source heterogeneous devices, significantly reducing the operation and maintenance complexity and reverse engineering cost of real-time monitoring of distributed photovoltaic equipment.

[0076] For devices that don't match the preset rules, a protocol reverse parsing process based on a bidirectional long short-term memory (LSTM) neural network is initiated. First, the raw communication data is divided into frame boundaries using a sliding window algorithm and time interval analysis to construct a standardized data frame set. The LSTM neural network then performs multi-level feature extraction on the data frames: learning the probability distribution of frame headers and footers at the byte level, identifying the association pattern between function codes and register addresses at the semantic level, and inferring the verification algorithm rules at the logical level.

[0077] For example, the model locates the frame header by analyzing the fixed byte combination (such as 0xA00x12) that appears in continuous data frames, and derives the register mapping relationship through the numerical increment rule of the address fields of adjacent frames. The protocol template finally generated is not a static configuration file, but a dynamic structure containing adaptive parameters - the frame format definition supports the dynamic expansion of variable-length fields, the address mapping table can automatically optimize the dimension conversion coefficient according to the device operation data, and the verification rule module has a built-in multi-algorithm fault-tolerant switching mechanism. Specifically, in step S400, the original communication data of the distributed household photovoltaic equipment is reversely parsed based on the bidirectional long short-term memory neural network to construct a structured communication protocol template, including:

[0078] Step S410 , obtaining a preset number of frames of original communication data sent by the distributed household photovoltaic equipment, and dividing the frame boundaries based on the communication interval time or the sliding window algorithm to obtain a pre-processed data frame set.

[0079] When the device is first connected or the protocol is unknown, the original binary data stream is captured by monitoring the device communication link. To ensure the reliability of the analysis, at least 100 frames of original communication data must be continuously intercepted to cover typical operating scenarios (such as power generation reporting, fault alarms, etc.). To address the problem of fuzzy data frame boundaries, two complementary segmentation strategies are adopted: for devices that follow standard communication interval protocols (such as the 3.5-character silence time of Modbus), the data frame is directly segmented based on the time threshold; for devices using private protocols, a sliding window algorithm is enabled, with a window length of 256 bytes and a step size of 8 bytes for sliding scanning. When a high-frequency repeated fixed byte pattern is detected in the window, forced segmentation occurs.

[0080] Step S420 , based on the bidirectional long short-term memory neural network, obtain the data frame delimiter probability distribution result, the register address feature distribution result and the check code prediction result in the pre-processed data frame set.

[0081] The model input is sequence data in which each byte is converted into a 256-dimensional one-hot encoded vector. The model uses a bidirectional structure to simultaneously capture the forward and reverse temporal dependencies. At the feature extraction layer, the model generates probability distributions for three key protocol elements:

[0082] Data frame delimiter probability distribution results: By analyzing the statistical patterns of byte occurrences at the frame header / footer positions, the model outputs the probability value of each byte being a frame header or footer. For example, the model may recognize that bytes 0-1 have high-probability characteristics in 90% of data frames. Register address feature distribution results: The model learns the joint distribution pattern of function codes and register addresses, marking byte intervals with a high probability of carrying semantic information. For example, if consecutive bytes 4-5 have a high probability of presenting both function codes and address fields in 80% of frames, they can be determined to be a key parameter storage area. Checksum prediction results: Based on the distribution characteristics of the checksum field (such as fixed location at the end of the frame and strong numerical randomness), the model outputs candidate checksum algorithm types and their confidence levels. For example, the probability of the CRC16_MODBUS algorithm is 85%.

[0083] Step S430, locate the frame header identifier and the frame tail identifier based on the data frame delimiter probability distribution result, establish an address-physical quantity mapping table based on the register address feature distribution result, traverse the candidate verification algorithm based on the verification code prediction result and reversely calculate and verify the verification rules.

[0084] For frame structure analysis, candidate header / footer candidates are counted for frequency and position verification. For example, if bytes 0-1 appear as the start character in 95% of frames and logically match the length field, the frame header is confirmed as a legitimate one. For scenarios with multiple candidates (e.g., firmware compatibility across multiple versions), address-to-physical quantity mapping is constructed. Numerical sequences are extracted from high-probability address fields, their variation patterns (such as continuous address stepping and function code consistency) are analyzed, and a mapping table is established based on the physical parameter characteristics of the photovoltaic device (e.g., the dimensional relationship between power and voltage). When the value at address 0x0400 is detected to vary linearly with light intensity, it is bound to the "real-time generated power" parameter and a dimensional conversion coefficient is derived. For checksum rule verification, an iterative reverse verification strategy is employed, prioritizing high-confidence algorithms. Using CRC16_MODBUS as an example, the data field byte stream is intercepted and the checksum is recalculated, then compared bit by bit with the actual field. If the error is ≤1 byte for three consecutive calculations and the value meets the device's physical constraints, the algorithm is considered valid. For candidates that fail verification, an adaptive retry mechanism is started and the verification algorithm library is dynamically expanded.

[0085] Step S440 : constructing a structured communication protocol template by combining the frame header identifier, the frame tail identifier, the address-physical quantity mapping table and the verification rule.

[0086] The frame format definition supports dynamic expansion of variable-length fields, such as automatically adjusting the data domain parsing range through length field offsets. The address-physical quantity mapping table has a built-in real-time calibration module that automatically triggers coefficient recalculation when the dimension conversion result deviates from physical constraints (such as power value exceeding the limit). The verification rules integrate a multi-algorithm fault-tolerant mechanism, allowing for temporary switching to low-complexity verification methods (such as XOR verification) in the event of network anomalies. The generated templates will be stored as new knowledge items in the preset protocol feature library, and versioning management will support the rapid matching of historical equipment with new equipment.

[0087] Furthermore, obtaining the data frame delimiter probability distribution result in the pre-processed frame data set in step S420 includes:

[0088] Step S421a, calculating a first probability value of each byte in the data frame being a frame header and a second probability value of each byte being a frame tail, wherein the data frame delimiter probability distribution result includes: a first probability value and a second probability value corresponding to each byte.

[0089] Identifying data frame delimiters (header / trailer) is fundamental to protocol reverse engineering. A bidirectional long short-term memory (LSTM) neural network learns the temporal characteristics of raw communication data and probabilistically models the semantic role of each byte. Specifically, the model converts the hexadecimal value of each byte into a 256-dimensional one-hot encoded vector. After input into the network, bidirectional propagation captures contextual dependencies. The output layer uses a two-way softmax activation function to generate a first probability value for the byte as a header and a second probability value for the byte as a trailer. For example, if a byte is located at the beginning of a data frame and frequently appears with fixed-function codes, its first probability value will be significantly higher than that of other positions. On the other hand, a byte located at the end of a data frame and with a random distribution of values ​​may have a high second probability value. This probabilistic output provides a quantifiable decision-making basis for subsequent rule derivation.

[0090] Below, an example is used to explain and illustrate the calculation method of the first probability value of the frame header and the second probability value of the frame tail: During the protocol reverse parsing process, the identification of the frame header and the frame tail relies on the deep mining of the time series characteristics of the communication data by the bidirectional long short-term memory (LSTM) neural network. Taking a certain inverter communication data frame as an example, its hexadecimal representation is [A0]

[12]

[00]

[03]

[01]

[04]

[00]

[00]

[00]

[64] [1F][B3], where the first two bytes [A0] and

[12] are fixed frame headers, and the last two bytes [1F] and [B3] are frame tails composed of CRC16 checksums. First, each byte is converted into a 256-dimensional one-hot encoding vector. For example, the vector corresponding to byte A0 (decimal 160) has 1 in the 160th dimension and the rest are 0. The LSTM network analyzes the contextual relationship of the byte sequence through a bidirectional propagation mechanism: during forward propagation, byte 0 [A0] obtains a first probability value of 0.95 as the frame header because it appears stably at the start position of the data frame and is strongly associated with the function code; byte 1

[12] follows closely and the combination is stable, and the first probability value reaches 0.93. During the reverse propagation process, byte 11 [B3] is the absolute end byte, and its second probability value as the frame end is increased to 0.91; although byte 10 [1F] is located in the second to last position, it still obtains a second probability value of 0.88 through the fault tolerance mechanism because it has a position deviation of +1 byte with the length field (bytes 2-300 03 indicates that the data field ends at byte 9). In the candidate marking stage, bytes 0-1 are marked as candidate frame headers due to their continuous high probability (0.95+0.93) and combination stability. Byte 11 is confirmed as the formal frame end due to its probability advantage (0.91>0.85 threshold) and end position. Byte 10 participates in subsequent conflict resolution as an alternative frame end. Step S421b: When a byte has a first probability value greater than a first preset probability threshold and forms a continuous 2-byte combination with adjacent bytes, the byte is marked as a candidate frame header.

[0091] When the first probability value of a byte exceeds a preset threshold (such as 0.9), it is preliminarily determined that it may be part of the frame header. However, in actual protocols, the frame header usually exists in the form of a continuous multi-byte combination (such as the "device address + function code" structure of Modbus). Therefore, it is further verified whether the byte and the adjacent bytes form a high-frequency continuous combination. For example, if the first probability value of byte 0 is 0.95 and the first probability value of byte 1 is 0.93, and the frequency of continuous occurrence of both in the pre-processed data frame set is greater than 90%, then the two-byte combination is marked as a candidate frame header. This mechanism effectively filters out isolated high-probability noise points (such as randomly repeated padding bytes) to ensure the integrity and stability of the frame header identification.

[0092] Step S421c: When the second probability value of a byte as a frame end is greater than a second preset probability threshold and the byte is located at the end of the data frame, the byte is marked as a candidate frame end.

[0093] Unlike the frame header, the position of the frame trailer is typically strictly tied to the data frame length field or a fixed structure. Based on the selection of bytes with a high second probability value (e.g., >0.85), the candidate frame trailer is required to be located at the end of the data frame (the last 1-2 bytes), with a deviation of no more than 1 byte from the end position indicated by the length field. For example, if the length field indicates that the data field ends at byte 10, the candidate frame trailer is only allowed to appear between bytes 9 and 11. This dual constraint (probability + position) significantly reduces the false positive rate and prevents random high-probability bytes in the data field from being mistakenly marked as the frame trailer.

[0094] Accordingly, locating the frame header identifier and the frame tail identifier based on the data frame delimiter probability distribution result in step S430 includes:

[0095] Step S431a: traverse all byte positions marked as candidate frame headers, and select the continuous 2-byte combination with the highest occurrence frequency in the pre-processed data frame set as the frame header identifier.

[0096] In the process of protocol reverse parsing, the accurate positioning of the frame header and frame tail is the core link in building reliable communication rules. First, all byte positions marked as candidate frame headers are traversed and their occurrence frequencies in the pre-processed data frame set are counted. For example, if the continuous 2-byte combination [A0],

[12] appears stably at the starting position in 90% of the data frames, while other candidate combinations (such as

[00] ,

[03] ) are only sporadically distributed, the former is selected as the official frame header identifier. For cases where there are multiple high-frequency candidates (such as devices supporting multiple protocol versions), a probability weighting mechanism is introduced to comprehensively consider the occurrence frequency of byte combinations and their probability values ​​in the LSTM model (such as [A0],

[12] probability 0.95 vs B5 3F probability 0.89), and give priority to combinations with higher confidence to ensure the stability of protocol adaptation.

[0097] Step S431b, traverse all byte positions marked as candidate frame end, verify whether they are located at the end of the preprocessed data frame, if the byte position of the candidate frame end deviates from the end position indicated by the data frame length field by ≤1 byte, then confirm it as the frame end identifier.

[0098] Verification of candidate end-of-frames requires satisfying two constraints: a probability threshold and positional logic. Bytes with a second probability value greater than a preset threshold (e.g., 0.85) are first screened, and then their physical location is rigorously verified to ensure they are at the end of the data frame. For example, when the length field (e.g.,

[00] ,

[03] in bytes 2-3) indicates that the data field ends at byte 9, a valid end-of-frame should appear within bytes 9-11 (allowing a padding tolerance of ±1 byte). If a candidate end-of-frame (e.g., [1F] in byte 10) has a high probability value (0.88) but its location deviates by more than 1 byte from the end point indicated by the length field, it is deemed invalid. This mechanism significantly reduces the risk of misidentifying high-probability random values ​​in the data field as the end-of-frame by leveraging the inherent logical consistency of the protocol (the length field is linked to the end-of-frame position), preventing, for example, fixed bytes in a heartbeat packet from being mistakenly marked as the end-of-frame.

[0099] Step S431c: Write the byte offsets of the frame header identifier and the frame tail identifier into the frame format definition of the structured communication protocol template.

[0100] The final determined frame header and frame tail identifiers are written into the frame format definition module of the structured communication protocol template in the form of byte offsets. For example, the frame header identifier is recorded as a starting offset of 0, and the frame tail identifier is recorded as an offset of 10. At the same time, the offset of the length field is marked as 2 and its endianness rule (big endian / little endian). Furthermore, the register address feature distribution result in the pre-processed data frame set in step S420 includes:

[0101] Step S422a, calculating the third probability value of each byte position in the data frame belonging to the function code field and the fourth probability value of each byte position belonging to the register address field, and the register address feature distribution result includes the third probability value and the fourth probability value corresponding to each byte.

[0102] In protocol reverse engineering, accurate register address identification relies on a deep decomposition of the combined semantics of function codes and address fields. A bidirectional long short-term memory (LSTM) neural network analyzes the contextual relevance of byte sequences, assigning each byte a probability of belonging to a function code and register address. Taking the data frame of a photovoltaic inverter as an example, its function codes and register addresses typically appear as consecutive bytes (e.g., 0x01 0x04 0x00 indicates reading a register starting at address 0x0400). The LSTM model converts the hexadecimal value of each byte into a 256-dimensional one-hot vector for input into the network. Through bidirectional propagation, it captures the fixed characteristics of function codes (e.g., frequent occurrence at specific offset positions, values ​​confined within a limited range such as 0x01 and 0x03) and the continuity characteristics of register addresses (e.g., adjacent addresses step by ±1, values ​​conforming to device physical parameter encoding rules). For example, byte 4 (value 0x01) is assigned a third probability value of 0.92 for the function code field because it stably appears in the logical position of the function code and its value conforms to the read operation definition. Bytes 5-6 (values ​​0x04 0x00) receive fourth probability values ​​of 0.88 and 0.85 for the register address field, respectively, because their values ​​increase in the order of 0x0400 → 0x0401 → 0x0402 with different data frames and overlap with the register encoding interval of the photovoltaic power parameters.

[0103] The following is an explanation and description of the calculation method of the third probability value belonging to the function code field and the fourth probability value belonging to the register address field using an embodiment:

[0104] In protocol reverse parsing, a bidirectional long short-term memory (LSTM) neural network calculates the probability of each byte belonging to a function code and register address by analyzing the contextual semantic relationship of the data frame. Taking the Modbus variant protocol data frame [A0]

[12]

[00]

[03]

[01]

[04]

[00]

[00]

[00]

[64] [1F][B3] of a photovoltaic inverter as an example, the hexadecimal value of each byte (such as 0x01 corresponds to decimal 1) is first converted into a 256-dimensional one-hot encoding vector (the first dimension is 1, and the rest are 0). The model learns semantic patterns in byte sequences through bidirectional propagation. During forward propagation, it recognizes that byte 4 (0x01) frequently appears in a fixed position in the function code (the fourth byte after the frame header), and its value remains stable within the typical function code range (read as 0x01). It assigns a third probability value of 0.94 to the function code field. During backward propagation, it finds that the values ​​of bytes 5-6 (0x04 0x00) increase from 0x0400 to 0x0401 to 0x0402 across different data frames, consistent with the continuous encoding characteristics of register addresses. Therefore, it assigns fourth probabilities of 0.89 and 0.87 to the register address field, respectively. The output layer uses a two-way softmax function to map the hidden state to the probability distribution of the function code and register address, ultimately forming a set of third and fourth probability values ​​for each byte, which provides a quantitative basis for subsequent field determination.

[0105] Step S422b: when the third probability value of the two consecutive bytes is greater than the third preset probability threshold and the fourth probability value is greater than the fourth preset probability threshold, it is determined that the two consecutive bytes are a function code + register address combination field.

[0106] When both the third and fourth probability values ​​of two consecutive bytes exceed a preset threshold (e.g., 0.8), they are determined to constitute a function code + register address combination field. For example, the sequence 0x01 0x04 0x00 formed by byte 4 (function code probability 0.92) and bytes 5-6 (address probabilities 0.88 / 0.85) is marked as a valid combination field because it meets the threshold conditions and conforms to the protocol syntax of "function code + starting address." This determination mechanism, through dual verification of probabilistic coupling and semantic coherence, effectively avoids interference from isolated high-probability noise bytes (e.g., the fixed value 0xFF in a heartbeat packet may have a high address probability but is eliminated due to lack of function code association).

[0107] Step S422c, obtaining the value range of the function code + register address combination field in all data frames, screening the function code + register address combination fields whose value ranges conform to the photovoltaic device register address coding rules, and generating a candidate address set for establishing an address-physical quantity mapping table.

[0108] The valid combination fields in all data frames are further traversed, their values ​​are extracted, and address sets that comply with the PV device register encoding rules are selected. For example, if a manufacturer's equipment specifies a user data area address range of 0x0000-0x7FFF, addresses above 0x8000 (such as 0x9000) will be eliminated, and illegal addresses such as all 0s or all 1s will be filtered out. For values ​​that appear continuously in the address range of 0x0400-0x040F, combined with the device's physical parameter table (such as 0x0400 for real-time power and 0x0401 for accumulated power generation), a structured candidate address set is formed.

[0109] Accordingly, the step S430 of establishing an address-physical quantity mapping table based on the register address feature distribution result includes:

[0110] Step S432a, obtaining the values ​​of all function code+register address combination fields in the candidate address set.

[0111] Extract all function code and register address combination field values ​​from the candidate address set. These candidate addresses have been preliminarily screened to ensure compliance with the PV device register encoding specifications (e.g., address range limited to 0x0000-0x7FFF) and to exclude illegal values ​​(e.g., all zeros or addresses outside the device's physical parameter range). For example, candidate addresses for an inverter might include register addresses 0x0400 and 0x0500 under function code 0x01 (read operation), with each address associated with multiple frames of raw data (e.g., the raw value sequence for 0x0400 is 1000, 2000, 3000). This process must adhere to the device protocol specifications to avoid introducing noise or invalid data.

[0112] Step S432b: Determine the physical quantity type corresponding to the candidate address based on the function code type and register address range in combination with a preset photovoltaic device physical quantity coding table.

[0113] By presetting a photovoltaic device physical quantity coding table, candidate addresses are mapped to specific physical quantity types. The coding table defines the semantic relationship between function code types and address ranges. For example, under function code 0x01 (read operation), addresses 0x0400-0x040F correspond to "real-time generated power," and 0x0500-0x050F correspond to "DC voltage." The coding table entries are matched according to the address value range, and the physical quantity type is determined based on the device's physical characteristics (such as the dimensional difference between power and voltage). For example, the value at address 0x0400 varies linearly with light intensity and is within the power parameter coding range, so it is marked as "real-time generated power." The value fluctuation at address 0x0500 conforms to the voltage characteristic and is mapped to "DC voltage." The above mapping process should take into account both protocol rules and the actual operating logic of the device to ensure semantic consistency.

[0114] Step S432c: According to the dimension conversion rules in the preset photovoltaic equipment physical quantity coding table, the original value of each candidate address is reversely deduced to determine the dimension conversion formula.

[0115] The relationship between the original value and the actual physical quantity is inferred through the preset dimensional conversion rules. For addresses clearly defined in the coding table (such as 0x0400), the rules (such as "actual power = original value × 0.1") are directly applied for conversion; for undefined addresses, they are dynamically deduced based on historical data and the nominal parameters of the device. For example, if the original value of address 0x0600 is 5000 at maximum load, and the nominal maximum current of the device is 50A, the dimensional formula can be inferred to be "actual current = original value × 0.01". The correlation between the original value and the actual environmental parameters (such as temperature and irradiance) is analyzed through linear regression to verify the rationality of the formula and force the conversion results to comply with physical laws (such as current cannot be negative and temperature cannot exceed the material tolerance value).

[0116] Step S432d: associate the function code, register address, physical quantity type and dimension conversion formula to generate an address-physical quantity mapping table.

[0117] This system associates function codes, register addresses, physical quantity types, and dimensional formulas to generate a structured address-physical quantity mapping table. For example, the entry {Function code: 0x01, Address: 0x0400, Physical quantity: "Real-time generated power", Formula: "Original value × 0.1"} explicitly describes the conversion logic from raw data to actual power. The mapping table supports a dynamic optimization mechanism: when an abnormal conversion result is detected (such as a power value exceeding the device's nominal value), the formula coefficients are automatically recalibrated (for example, adjusting 0.1 to 0.09), and version change history is recorded.

[0118] Furthermore, obtaining the check code prediction result in the pre-processed data frame set in step S420 includes:

[0119] Step S423a: Calculate a fifth probability value that each byte position in the data frame belongs to the check field.

[0120] A bidirectional long short-term memory (LSTM) neural network performs semantic analysis on the byte sequence of a data frame, calculating the fifth probability of each byte belonging to the checksum field. The model converts the hexadecimal value of each byte into a 256-dimensional one-hot encoded vector and learns the distribution characteristics of the checksum field through bidirectional propagation: forward propagation captures the correlation between the checksum field and the data field (e.g., the checksum field is typically located at the end of the data frame), while backward propagation identifies the random characteristics of the checksum value (e.g., its strong XOR relationship with the data field). For example, bytes 10 (0x1F) and 11 (0xB3) at the end of an inverter data frame are assigned fifth probabilities of 0.91 and 0.89, respectively, due to their random distribution and high frequency with changes in the data field length. These are significantly higher than other bytes in the data field (e.g., the probability of the power value in bytes 5-6 is only 0.12). This probabilistic modeling effectively distinguishes fixed data content from dynamic checksums.

[0121] The following is an explanation and description of the calculation method of the fifth probability value that the byte position belongs to the check field using an embodiment:

[0122] In protocol reverse parsing, a bidirectional long short-term memory (LSTM) neural network calculates the fifth probability value of each byte belonging to the checksum field by analyzing the contextual features of the data frame. Taking the data frame ([A0]

[12]

[00]

[03]

[01]

[04]

[00]

[00]

[00]

[64] [1F][B3]) of a photovoltaic inverter as an example, each byte (such as the last [1F] and [B3]) is first converted into a 256-dimensional one-hot encoding vector and input into the model. During forward propagation, the model recognizes that bytes 10-11 ([1F], [B3]) are located at the end of the data frame and are adjacent to the end position of the data field (byte 9) indicated by the length field (bytes 2-3

[00] ,

[03] ), which meets the typical position characteristics of the checksum field. During backward propagation, the model detects that the numerical distribution of these two bytes is strongly random (such as there is no fixed pattern in the XOR value with the data field bytes) and is highly correlated with the calculation results of the candidate checksum algorithm (such as CRC16_MODBUS). Through the softmax function of the output layer, bytes 10 and 11 are assigned fifth probability values ​​of 0.91 and 0.89, respectively, while the bytes in the data domain (such as power values ​​

[00] ,

[00] ,

[00] ,

[64] ) have fifth probability values ​​lower than 0.1 due to their strong numerical regularity.

[0123] Step S423b: When the fifth probability value of the two consecutive bytes is greater than the fifth preset probability threshold, the two consecutive bytes are determined to be the check field revelation position.

[0124] The starting position of the checksum field is determined by two constraints: first, the fifth probability value of consecutive bytes must exceed a threshold (e.g., 0.85), and second, the position must conform to protocol logic (e.g., immediately adjacent to the end of the data field). For example, in a data frame, bytes 10-11 have fifth probability values ​​of 0.91 and 0.89, respectively, and are located after the end position (byte 9) indicated by the length field (bytes 2-3 00 03), with a deviation of +1 byte. This meets the tolerance condition and is therefore determined to be the starting position of the checksum field. If a byte meets the probability threshold (e.g., 0.87 for byte 8) but is located in the middle of the data field, it is excluded.

[0125] Step S423c: Obtain the probability of the candidate check algorithm type based on the check field length and the characteristics of the adjacent data fields.

[0126] Candidate checksum algorithm types are inferred based on the checksum field length and the characteristics of the adjacent data fields. For example, if the checksum field is 2 bytes and the data field length is fixed, the CRC16 algorithm is preferred. If the checksum field is 1 byte and the data field values ​​are evenly distributed, a sum check or an exclusive-or check is preferred. The model analyzes the numerical relationship between the checksum field and the data field (for example, the calculation range of CRC16_MODBUS covers the frame header to the end of the data field) and combines it with a pre-defined library of algorithms (including CRC, LRC, and sum checksum) to generate candidate algorithm probabilities. For example, if the checksum field 0x1F B3 of a data frame is verified to be consistent with the CRC16_MODBUS result through reverse calculation, this algorithm is assigned the highest probability (0.95), while other algorithms (such as Modbus-LRC) have a probability of less than 0.05 due to match failure. This process ensures the credibility of the checksum rules by strongly linking the algorithm characteristics with the data features.

[0127] Accordingly, the step S430 of traversing candidate verification algorithms based on the verification code prediction result and reversely calculating and verifying the verification rules includes:

[0128] Step S433a: intercepting the data field byte stream from the pre-processed data frame set according to the starting position and length of the check field.

[0129] Based on the starting position and length of the check field, the data field byte stream involved in the checksum calculation is accurately intercepted from the preprocessed data frame set. For example, if the check field starts at byte 10 and is 2 bytes long, the data field range is the continuous byte sequence from the frame header to byte 9 (e.g., bytes 0-9). This interception must strictly adhere to the frame format defined in the protocol template (e.g., length field offset and endianness rules) to ensure the integrity of the data field. For variable-length frames, the length field value is dynamically parsed to determine the data field boundary. For example, if the length field is 00 03, indicating that the data field occupies 3 words (6 bytes), 6 bytes are intercepted starting from the 4th byte after the frame header. This step, through the dual constraints of protocol rules and data characteristics, avoids errors in the checksum calculation range caused by misjudgment of the frame structure.

[0130] Step S433b: traverse the preset candidate check algorithms in order of priority to calculate the expected check code of the data field byte stream.

[0131] The pre-set candidate checksum algorithms (such as CRC16_MODBUS, Modbus-LRC, and sum checksum) are traversed by priority, and the expected checksum is calculated for the data field byte stream. Priority is set based on historical statistical results from the device manufacturer's protocol signature library. For example, if 90% of a manufacturer's devices use CRC16_MODBUS, this algorithm will be tried first. During the calculation process, algorithm specifications are strictly adhered to, such as the CRC16_MODBUS polynomial (0x8005), initial value (0xFFFF), and calculation direction (big endian). For simple algorithms such as XOR, possible XOR start bits and calculation step sizes (such as byte-by-byte XOR or word-by-word XOR) are traversed. This stage exhaustively enumerates and optimizes algorithm parameters to cover both mainstream and proprietary checksum rule variants, thereby improving the verification success rate.

[0132] Step S433c: compare the expected check code with the actual check field in the pre-processed data frame byte by byte. If there is a difference of ≤1 byte and the comparison is successful for a preset number of consecutive times, the current candidate check algorithm is confirmed to be valid.

[0133] The expected checksum is compared byte by byte with the actual checksum field, and a fault-tolerance mechanism is introduced to accommodate complex scenarios. For example, when the expected checksum is 0x1F B3 and the actual value is 0x1F B4, if the difference is only 1 byte and the fault-tolerance condition is met for three consecutive calculations (e.g., the difference is ≤ 1 byte), the algorithm is deemed valid. This fault-tolerance design can cope with real-world interference such as network transmission errors and minor differences in device firmware. For a complete match, the algorithm's validity is immediately confirmed. For a partial match, the matching degree is recorded and multiple rounds of verification are performed (e.g., verifying five consecutive frames of data) to prevent misjudgments caused by occasional errors. This mechanism balances the stringency of the verification rules with the complexity of the real-world environment.

[0134] Step S433d, write the type and calculation range of the valid verification algorithm into the verification rule field of the structured communication protocol template, where the calculation range is the byte range in the data frame that the verification algorithm needs to calculate the verification code.

[0135] The type of verification algorithm and calculation range that have passed the verification are written into the verification rule field of the protocol template. The calculation range clearly marks the data domain interval where the verification algorithm acts (such as "from the second byte of the frame header to the end of the data domain") to ensure the consistency of the verification calculations of the communicating parties. For example, if the calculation range of CRC16_MODBUS is incorrectly defined to include only part of the bytes in the data domain, the verification will fail. During the writing process, the calculation range is syntax-checked (such as whether the offset is out of bounds) and the algorithm parameters (such as polynomial, initial value) are recorded. This structured storage supports dynamic protocol adaptation - when it is detected that the verification algorithm has changed after the device firmware upgrade, the new rules can be loaded quickly without interrupting the existing communication process, thereby ensuring continuous and reliable operation.

[0136] Furthermore, after constructing the structured communication protocol template in step S400, the following steps are further included:

[0137] Step S410: Generate standardized test instructions based on the structured communication protocol template and send them to the distributed household photovoltaic equipment.

[0138] Standardized test commands are generated based on a structured communication protocol template. The construction of these test commands strictly adheres to the frame format, function code type, and register address range defined in the protocol template. For example, if the protocol template specifies that function code 0x01 is used to read real-time generated power within the address range 0x0400-0x040F, the generated command might be [A0]

[12]

[00]

[03]

[01]

[04]

[00]

[00]

[00] [CR C], where A0 12 is the frame header, 00 03 is the length field, and 01 04 00 00 00 indicates reading three consecutive registers starting at address 0x0400. The command is then sent to the target device via the cloud server, triggering it to return a response frame containing the specified register data. This process dynamically adapts to different devices through the protocol template's rule engine, ensuring full compatibility between the command syntax and the device protocol.

[0139] Step S420: receiving response data corresponding to the standardized test instruction sent by the distributed household photovoltaic equipment, where the response data includes physical quantity data, equipment status data, and original register values.

[0140] The response data returned by the receiving device includes physical quantity data, device status data, and raw register values. For example, a device response frame might be [A0]

[12]

[00]

[06]

[01]

[04]

[00]

[00]

[64]

[00] [1F][B3]. The data field 00 00 64 00 indicates that the raw value of address 0x0400 is 0x00006400 (decimal 25600). Based on the dimensional conversion formula in the protocol template (e.g., actual power = raw value × 0.1), this translates to a real-time power of 2560W. Device status data might include an operating status code (e.g., 0x00 for normal operation) or a fault code (e.g., 0x10 for an overvoltage alarm). Raw register values ​​retain unconverted binary data for subsequent verification and model optimization.

[0141] Step S430 , checking whether the numerical range of the response data complies with the physical constraints of the photovoltaic equipment.

[0142] The numerical range of the response data is physically constrained and checked. The checking rules are based on the technical parameters of the equipment and the laws of physics. For example, the real-time power generation power must not exceed the nominal maximum power of the equipment (such as 10kW), the DC voltage fluctuation range is limited to ±10% of the nominal value (such as 540-660V is allowed when the nominal value is 600V), and the component temperature must be within the material tolerance range of -40°C to 85°C. By traversing the physical quantity data, it is verified whether it meets the preset constraints. For example, if the parsed power value is 12000W (corresponding to the original value 120000), and the nominal maximum power of the equipment is 10kW, the data is judged to be abnormal and an alarm is triggered. This process combines the equipment operation log with environmental parameters (such as light intensity) to eliminate occasional anomalies caused by transient interference.

[0143] Step S440: If yes, then the pre-processed data frame set and the corresponding structured communication protocol template are added to the data training set of the bidirectional long short-term memory neural network.

[0144] After the data verification passes, the preprocessed data frame set and the corresponding protocol template are added to the training set of the bidirectional long short-term memory (LSTM) neural network. When the training set is updated, the newly added data is annotated, for example, the verified frame header / frame footer position, register address mapping relationship, and verification rules are used as supervision signals. The model optimizes feature extraction capabilities through incremental learning, for example, enhancing the recognition accuracy of specific vendor protocol variants or adapting to minor adjustments to the verification algorithm (such as changes in the CRC polynomial). At the same time, the protocol template version is stored in association with the training data, supporting historical data backtracking and model rollback. This closed-loop optimization mechanism enables the continuous improvement of the accuracy and efficiency of unknown protocol parsing while maintaining stable compatibility with adapted devices.

[0145] Specifically, the structured communication protocol template includes: frame format definition, address-physical quantity mapping table and verification rules. The frame format definition includes the byte position of the frame header identifier, the length field offset and the end order rule. The address-physical quantity mapping table includes the function code type, register address range and dimension conversion formula. The verification rules include the algorithm type, calculation range and fault tolerance identification bit offset.

[0146] When constructing a structured communication protocol template, layered definitions ensure accurate data parsing and reliable communication. The frame format definition, serving as the protocol's foundational architecture, clearly specifies the location and parsing rules for key fields in the data frame. For example, in a certain inverter protocol, the frame header identifier is fixed at bytes 0-1 (e.g., 0xA0 0x12), and the length field offset is set to bytes 2-3, indicating the actual number of bytes in the data field (e.g., 0x00 0x03 indicates that the data field occupies 3 words, or 6 bytes). The endianness rule defines the parsing order of multi-byte values—in big-endian mode, the length field 0x00 0x03 is parsed as decimal 3, while in little-endian mode, it is 0x0300, or 768. This rule directly affects the data field truncation range and subsequent checksum calculations. Through precise frame format definitions, valid data units can be accurately segmented from the original binary stream, avoiding parsing confusion caused by field misalignment.

[0147] The address-to-physical quantity mapping table is the semantic core of the protocol template. It converts raw data into understandable physical quantities by associating function codes with register addresses. The function code type (e.g., 0x01 for a read operation, 0x03 for a write operation) determines the operational intent of the data frame, while the register address range (e.g., 0x0400-0x040F) defines the storage location of specific parameters. For example, the raw value of real-time generated power is stored at address (0x0400) in a device. This value is converted to a physical quantity of 2560W using a dimensional conversion formula (e.g., actual power = raw value × 0.1). The mapping table also handles complex scenarios: if the same address has different semantics under different function codes (e.g., 0x0400 represents a power threshold in write mode), dynamic parsing is implemented through function code branching logic. This design enables the protocol template to adapt to both standard protocols (e.g., Modbus) and proprietary vendor extensions.

[0148] Verification rules ensure data integrity through algorithm type, calculation scope, and fault tolerance mechanisms. The choice of verification algorithm type (e.g., CRC16_MODBUS) must match the device protocol characteristics. For example, CRC16 is widely used in industrial communications due to its strong error detection capabilities, while XOR is used in low-complexity scenarios. The calculation scope clearly defines the data interval within which the verification algorithm operates (e.g., "from the frame header to the end of the data field") to ensure calculation consistency between the sender and receiver. For example, if the data field is bytes 4-9, the verification calculation must cover these bytes rather than the entire frame to avoid verification failures due to the inclusion of the frame header or length field. The fault tolerance bit offset allows for tolerable bit errors (e.g., single-bit flips caused by network interference) at specific locations (e.g., the last bit of the checksum field). Such errors are flagged rather than discarded, triggering a retransmission mechanism. This rule design balances communication efficiency and reliability, significantly reducing the bit error rate, especially in noisy environments.

[0149] The three work together to form a closed-loop protocol parsing system: the frame format definition provides a structural framework, the address-physical quantity mapping table gives data semantics, and the verification rules ensure reliable transmission. For example, when parsing a data frame, the data field is first intercepted based on the frame header position and length field, then the register value is converted into a physical quantity using the mapping table, and finally the data integrity of the calculated range is verified. If the verification fails, the fault-tolerance rules are combined to determine whether it can be repaired or needs to be retransmitted. This layered design makes the protocol template highly scalable. New devices only need to update the mapping table and verification algorithm library, without the need to reconstruct the parsing engine, greatly improving generalization capabilities and maintenance efficiency.

[0150] Specifically, the physical constraints include: the real-time power generation value of the distributed household photovoltaic equipment is less than the rated maximum power value of the equipment, the real-time temperature value of the distributed household photovoltaic equipment is within the preset temperature range, and the DC output voltage fluctuation range of the distributed household photovoltaic equipment is less than the preset proportion value of the equipment nominal voltage.

[0151] In the implementation of the distributed household photovoltaic production data access method, the verification of physical constraints is the core link to ensure the validity of data analysis and the safety of equipment operation. After the cloud server obtains the device data through reverse analysis or preset protocols, it is necessary to compare the parsed physical quantity values ​​with the preset constraint boundaries. This process is essentially a verification of the legitimacy of the equipment's operating status. For example, the constraint verification of the real-time power generation value needs to be based on the photovoltaic conversion physical model of the photovoltaic module: when the power value reported by the inverter exceeds the nominal maximum power, it may mean that there is an abnormal concentration effect in the photovoltaic array or the MPPT algorithm fails. Such data will be marked as abnormal. At this time, it is necessary to combine the historical irradiance data with the component temperature parameters for cross-validation to determine whether it is a data collection error or a real overload risk, thereby triggering the equipment power limit control or operation and maintenance alarm.

[0152] Constraint verification of device temperature values ​​must account for the time lag characteristics of thermodynamic transfer processes. Due to the gradient difference between the PV module backplane temperature sensor data and the actual operating temperature of the cell, the boundaries of the preset temperature range must be dynamically compensated based on the thermal conductivity of the module packaging material. For example, when the sensor temperature reports approaching the preset upper limit, the thermal balance equation must be calculated based on ambient temperature, wind speed, and module tilt data to predict the temperature trend within the cell. If the predicted value exceeds the material tolerance threshold, the inverter operating mode must be adjusted in advance to reduce heat generation. Verifying this constraint not only relies on single-point data threshold judgments but also requires time series analysis of multi-source data to avoid misjudgments due to delayed temperature acquisition.

[0153] The constraint verification of the DC output voltage fluctuation range needs to be coordinated with the grid dispatch requirements. The preset ratio value of the voltage fluctuation amplitude is usually formulated with reference to the power transient stability standard, and its verification process needs to distinguish between short-term disturbances and continuous over-limit scenarios. For example, when the voltage fluctuates due to rapid changes in irradiance, the integral of the fluctuation duration and amplitude needs to be calculated. If the energy accumulation threshold corresponding to the preset ratio is exceeded, it is determined to be an over-limit event. This type of verification needs to be embedded in the local control loop of the inverter, suppressing voltage fluctuations through a feedforward compensation mechanism, and uploading the over-limit event data to the cloud server for root cause analysis, such as detecting output characteristic distortion caused by group string faults or shadowing.

[0154] The results of the physical constraint verification directly influence the direction of protocol reverse parsing optimization for data access. If the verification reveals that the parsed physical quantity consistently deviates from the constraint boundaries, the address-physical quantity mapping relationship in the structured communication protocol template is backtracked to verify the accuracy of the dimensional conversion formula. For example, if the temperature value verification is abnormal, it may be due to an error in register address parsing, which mistakenly maps humidity data to temperature, or the dimensional conversion may have reversed the order of the high and low bytes of the original data.

[0155] Accordingly, please refer to Figure 2 A second aspect of an embodiment of the present invention provides a distributed household photovoltaic production data access system, which performs data access with household photovoltaic equipment based on the above-mentioned distributed household photovoltaic production data access method, including:

[0156] Identification acquisition module 1, which is used to obtain the unique identifier of the distributed household photovoltaic equipment, the unique identifier includes the communication protocol association feature;

[0157] A feature library connection module 2 is used to determine whether the preset communication protocol feature library of the cloud server includes a communication rule corresponding to the unique identifier;

[0158] A data communication module 3 is configured to perform data communication with the distributed household photovoltaic device based on the communication rules corresponding to the unique identifier if a preset communication protocol feature library includes the communication rules;

[0159] A protocol construction module 4 is configured to reverse-engineer the original communication data of the distributed household photovoltaic device if the preset communication protocol feature library does not include a communication rule corresponding to the unique identifier, construct a structured communication protocol template, and perform data communication with the distributed household photovoltaic device based on the structured communication protocol template;

[0160] The cloud server is connected to data of several distributed household photovoltaic devices.

[0161] Accordingly, a third aspect of an embodiment of the present invention provides an electronic device comprising: at least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor performs the above-mentioned distributed household photovoltaic production data access.

[0162] Accordingly, a fourth aspect of an embodiment of the present invention provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the above-mentioned distributed household photovoltaic production data access.

[0163] The embodiment of the present invention aims to protect a distributed household photovoltaic production data access method, which has the following effects:

[0164] 1. By precisely matching the device's unique identifier with the pre-set protocol signature library, combined with protocol reverse parsing technology using a bidirectional long short-term memory (LSTM) neural network, seamless integration of photovoltaic equipment from multiple manufacturers is achieved. When pre-set protocols are missing, the frame structure, register mapping, and verification rules can be automatically inferred from the raw communication data, shortening the new equipment integration cycle from 3-5 days with traditional manual analysis to under 10 minutes. Compatible with over 200 proprietary protocol variants from major manufacturers, this significantly improves device compatibility and reduces operation and maintenance costs.

[0165] 2. Based on dynamically generated protocol templates, the system employs a dual verification mechanism of end-to-end encrypted communication and physical constraints. By defining the algorithm type and calculation range (from the frame header to the first byte of the checksum field) in the verification rules, combined with the physical quantity threshold verification of the response data, the system improves the detection rate of abnormal data and reduces the risk of key leakage.

[0166] 3. By feeding verified protocol templates and preprocessed data back into the LSTM neural network training set, the protocol parsing model is continuously iteratively optimized. For every 100 new device data, the model parsing accuracy increases by 8%-12%, and the misjudgment rate remains stable at less than 1%. At the same time, the standardized storage of protocol templates (frame format, address mapping table, and verification rules) supports the unified management of clusters of tens of thousands of devices, making it suitable for large-scale scenarios such as rural rooftop photovoltaics and industrial and commercial distributed power stations.

[0167] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0168] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0169] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0170] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0171] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered by the scope of protection of the claims of the present invention.

Claims

1. A distributed household photovoltaic production data access method, characterized in that: The steps include: Obtaining a unique identifier for a distributed household photovoltaic device, wherein the unique identifier includes a communication protocol association feature; Determining whether a preset communication protocol feature library of the cloud server includes a communication rule corresponding to the unique identifier; If the preset communication protocol feature library includes a communication rule corresponding to the unique identifier, data communication is performed with the distributed household photovoltaic device based on the communication rule; If the preset communication protocol feature library does not include a communication rule corresponding to the unique identifier, reverse-engineering the original communication data of the distributed household photovoltaic device to construct a structured communication protocol template, and performing data communication with the distributed household photovoltaic device based on the structured communication protocol template; The cloud server is connected to data of several distributed household photovoltaic devices.

2. The distributed household photovoltaic production data access method according to claim 1, characterized in that: The reverse parsing of the original communication data of the distributed household photovoltaic equipment to construct a structured communication protocol template includes: Obtaining a preset number of frames of original communication data sent by the distributed household photovoltaic equipment, and dividing the frame boundaries based on the communication interval time or the sliding window algorithm to obtain a pre-processed data frame set; Based on a bidirectional long short-term memory neural network, obtaining a data frame delimiter probability distribution result, a register address feature distribution result, and a check code prediction result in the preprocessed data frame set; Locating the frame header identifier and the frame tail identifier based on the data frame delimiter probability distribution result, establishing an address-physical quantity mapping table based on the register address feature distribution result, and traversing candidate check algorithms based on the check code prediction result and reversely calculating and verifying the check rules; The structured communication protocol template is constructed by combining the frame header identifier, the frame tail identifier, the address-physical quantity mapping table and the verification rule.

3. The distributed household photovoltaic production data access method according to claim 2, characterized in that: Obtaining a probability distribution result of a data frame delimiter in the preprocessed frame data set, including: Calculating a first probability value of each byte in the data frame as a frame header and a second probability value of each byte as a frame tail, wherein the data frame delimiter probability distribution result includes: a first probability value and a second probability value corresponding to each byte; When a first probability value of a byte as a frame header is greater than a first preset probability threshold and the byte forms a continuous 2-byte combination with an adjacent byte, marking the byte as a candidate frame header; When a second probability value of the byte being the frame end is greater than a second preset probability threshold and the byte is located at the end of the data frame, the byte is marked as a candidate frame end.

4. The distributed household photovoltaic production data access method according to claim 3, characterized in that: The locating the frame header identifier and the frame tail identifier based on the data frame delimiter probability distribution result includes: Traversing all byte positions marked as the candidate frame headers, and selecting a continuous 2-byte combination with the highest occurrence frequency in the pre-processed data frame set as a frame header identifier; Traversing all byte positions marked as candidate frame end positions to verify whether they are located at the end of the preprocessed data frame; if the byte position of the candidate frame end deviates from the end position indicated by the data frame length field by ≤1 byte, then confirming it as a frame end identifier; The byte offsets of the frame header identifier and the frame tail identifier are written into the frame format definition of the structured communication protocol template.

5. The distributed household photovoltaic production data access method according to claim 2, characterized in that: Get the register address feature distribution results in the preprocessed data frame set, including: Calculating a third probability value that each byte position in the data frame belongs to the function code field and a fourth probability value that each byte position belongs to the register address field, wherein the register address feature distribution result includes the third probability value and the fourth probability value corresponding to each byte; When the third probability value of the two consecutive bytes is greater than the third preset probability threshold and the fourth probability value is greater than the fourth preset probability threshold, it is determined that the two consecutive bytes are a function code + register address combination field; The numerical range of the function code + register address combination field in all data frames is obtained, and the function code + register address combination field whose numerical range conforms to the photovoltaic device register address coding rule is screened to generate a candidate address set for establishing the address-physical quantity mapping table.

6. The distributed household photovoltaic production data access method according to claim 5, characterized in that: The establishing of an address-physical quantity mapping table based on the register address feature distribution result includes: Obtain the values ​​of all function code + register address combination fields in the candidate address set; According to the function code type and register address range, combined with the preset photovoltaic equipment physical quantity coding table, determine the physical quantity type corresponding to the candidate address; According to the dimension conversion rules in the preset photovoltaic equipment physical quantity code table, the original value of each candidate address is reversely deduced to determine the dimension conversion formula; The function code, register address, physical quantity type and dimension conversion formula are associated to generate an address-physical quantity mapping table.

7. The distributed household photovoltaic production data access method according to claim 2, characterized in that: Get the checksum prediction results from the preprocessed data frame set, including: calculating a fifth probability value that each byte position in the data frame belongs to the check field; When the fifth probability value of the two consecutive bytes is greater than the fifth preset probability threshold, determining that the two consecutive bytes are check field revelation positions; According to the length of the check field and the characteristics of the adjacent data fields, the probability of the candidate check algorithm type is obtained.

8. The distributed household photovoltaic production data access method according to claim 7, characterized in that: The traversing candidate verification algorithms based on the verification code prediction result and reversely calculating and verifying the verification rules include: intercepting a data field byte stream from the pre-processed data frame set according to the starting position and length of the check field; Traversing preset candidate checksum algorithms in order of priority to calculate expected checksums of the data field byte stream; Compare the expected check code with the actual check field in the pre-processed data frame byte by byte, and if there is a difference of ≤1 byte and the comparison is successful for a preset number of consecutive times, confirm that the current candidate check algorithm is valid; The type and calculation range of the valid verification algorithm are written into the verification rule field of the structured communication protocol template, where the calculation range is the byte range in the data frame that the verification algorithm needs to calculate the verification code.

9. The distributed household photovoltaic production data access method according to any one of claims 2 to 8, characterized in that: After the structured communication protocol template is constructed, the method further includes: Generate standardized test instructions based on the structured communication protocol template and send them to the distributed household photovoltaic equipment; Receiving response data corresponding to the standardized test instruction sent by the distributed household photovoltaic device, the response data including physical quantity data, device status data and original register value; Verifying whether the numerical range of the response data complies with the physical constraints of the photovoltaic device; If so, the preprocessed data frame set and the corresponding structured communication protocol template are added to the data training set of the bidirectional long short-term memory neural network.

10. The distributed household photovoltaic production data access method according to claim 9, characterized in that: The structured communication protocol template includes: a frame format definition, an address-physical quantity mapping table, and a verification rule. The frame format definition includes the byte position of the frame header identifier, the length field offset, and the end order rule. The address-physical quantity mapping table includes the function code type, the register address range, and the dimension conversion formula. The verification rule includes the algorithm type, the calculation range, and the fault tolerance flag bit offset. The physical constraint conditions include: the real-time power generation value of the distributed household photovoltaic equipment is less than the nominal maximum power value of the equipment, the real-time temperature value of the distributed household photovoltaic equipment is within a preset temperature range, and the DC output voltage fluctuation range of the distributed household photovoltaic equipment is less than a preset proportion value of the equipment nominal voltage.

Citation Information

Cited By

  • Electric energy data secure transmission method and system for intelligent electric meter

    CN122268676A

  • A power data security transmission method and system for a smart meter

    CN122268676B