A photovoltaic inverter protocol conversion method

CN121907939BActive Publication Date: 2026-06-19HUNAN ZHIKUN ENERGY TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUNAN ZHIKUN ENERGY TECH CO LTD
Filing Date
2026-03-24
Publication Date
2026-06-19

Smart Images

  • Figure CN121907939B_ABST
    Figure CN121907939B_ABST
Patent Text Reader

Abstract

This invention discloses a photovoltaic inverter protocol conversion method, which adopts a virtual inverter middleware architecture and achieves bidirectional decoupling between the uplink master station protocol and the downlink inverter protocol through a unified data model. This middleware standardizes the inverter's operating status, core data, configuration parameters, and control commands, converting multi-master station protocols and heterogeneous inverter protocols into an internal standard data format, completely eliminating strong coupling dependencies between protocols. Simultaneously, the inverter communication protocol and adaptive strategy are abstracted into a driver library, providing a unified operation interface and supporting online editing and hot updates. This design has low RAM requirements for the MCU and significantly shortens the new inverter access cycle. It also allows on-site maintenance personnel to quickly adjust strategies through configuration rather than code modification, greatly improving maintenance efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power electronics technology, and more specifically, to a photovoltaic inverter protocol conversion method. Background Technology

[0002] The operation and maintenance of photovoltaic power plants heavily rely on monitoring systems, requiring real-time collection of operating data such as inverter voltage, current, power, and power generation, as well as parameter settings and control command issuance as needed. However, photovoltaic power plants often contain multiple brands and models of inverters. Inverters from different manufacturers, and even different series from the same manufacturer, support significantly different communication protocols, including standard Modbus RTU, Modbus TCP, and IEC... According to IEC 61850, IEC 60870-5-104, and numerous proprietary protocols, protocol converters are widely used in photovoltaic power plant monitoring systems. Existing protocol converters mainly employ transparent conversion, static mapping conversion, or simple buffering conversion. While transparent conversion is simple to implement, it has serious drawbacks. For example, the uplink host must understand the protocol details of each inverter, and communication efficiency is entirely limited by the slowest inverter. When the uplink host concurrently requests data from multiple inverters, the low-speed serial communication link easily becomes a bottleneck, leading to frequent timeouts. Static mapping conversion has its mapping relationship fixed in the firmware. Adding or changing inverter models requires re-flashing the firmware, resulting in high on-site maintenance costs. Furthermore, the conversion process uses a synchronous blocking mode, requiring the uplink host to wait for inverter responses before returning data, making it unable to handle batch data reading demands. Simple buffering conversion lacks lifecycle management for buffered data. After an inverter shutdown or communication interruption, the converter may still return outdated data, making it unable to handle historical data replenishment needs, and data lost during communication interruptions may be permanently lost.

[0003] Therefore, the existing technology has defects and urgently needs improvement. Summary of the Invention

[0004] To address at least one of the aforementioned technical problems, the present invention aims to provide a photovoltaic inverter protocol conversion method that can significantly shorten the new inverter access cycle and support on-site maintenance personnel to quickly adjust strategies through configuration rather than code modification, thereby greatly improving maintenance efficiency.

[0005] This invention provides a photovoltaic inverter protocol conversion method, comprising:

[0006] When a request frame is received from the uplink host, the uplink protocol data object descriptor is obtained and an inverter forwarding task is created;

[0007] The uplink protocol data object descriptor is split to obtain atomic object data descriptors, and the data descriptors are converted into internal identifiers;

[0008] Based on the internal identifier, obtain the inverter object and its corresponding model on the target communication port;

[0009] Retrieve the corresponding inverter protocol from the protocol library based on the inverter model;

[0010] According to the inverter protocol, the internal identifier is converted into one or more specific register tables, and a register task queue is created;

[0011] According to the register task queue, communicate with the inverter to read or write register data sequentially;

[0012] The raw data received from the inverter is converted into an internal format and stored in the virtual inverter;

[0013] Data corresponding to the internal identifier is extracted from the virtual inverter, and the data is converted into the uplink protocol format one by one and encoded to obtain the encoded response message APDU.

[0014] The APDU is returned to the uplink protocol for processing and generated as a response frame to be sent back to the uplink host.

[0015] In this solution, the step of converting the data descriptor into an internal identifier specifically includes:

[0016] Construct a hash mapping table between data descriptors and internal identifiers;

[0017] When a data descriptor is received, the hash map is queried. If a corresponding internal identifier exists, the internal identifier associated with the data descriptor is directly output.

[0018] If the corresponding internal identifier does not exist in the hash map table, a new internal identifier is dynamically generated based on the preset namespace allocation strategy, and the hash map table is updated synchronously.

[0019] In this solution, after obtaining the inverter object on the target communication port, the solution further includes:

[0020] Maintain a request waiting queue for each inverter object;

[0021] When multiple forwarding tasks contend for the same inverter object, a priority-based time-slice round-robin scheduling algorithm is used to calculate the dynamic priority of each task, and the formula is as follows:

[0022] ;in This indicates the dynamic priority of task i. Indicates the basic priority. Indicates the boost factor. This indicates the waiting time for task i. Indicates the maximum allowed waiting time;

[0023] The right to use the inverter object is allocated to different tasks in descending order of dynamic priority.

[0024] When two tasks are detected waiting for each other's resources, a preset deadlock detection timer is started. After the timer expires, the lower-priority task is forcibly terminated and its occupied resources are released.

[0025] In this solution, the step of creating the register task queue specifically includes:

[0026] Based on the register table, extract the starting address and length of the register to be operated on;

[0027] If the register length exceeds the maximum read length supported by the inverter protocol, the register table is divided into N subtasks based on a preset framing algorithm, and the register length of each subtask does not exceed the maximum read length.

[0028] The N smallest subtasks are inserted into the first-in-first-out task queue according to address continuity and priority.

[0029] In this solution, communication with the inverter also includes:

[0030] When a communication link with the inverter is detected to have been interrupted and then restored, the timestamp of the most recent successful communication stored in the virtual inverter is queried. ;

[0031] Determine the minimum time granularity of data recording based on the inverter model. Calculate the time period that needs to be supplemented. ;

[0032] If the time period for supplementary recording If the time exceeds the preset time threshold, a historical data reading task is constructed. A register task queue is generated according to the historical data reading method supported by the inverter protocol, and historical data within the missing time period is read sequentially.

[0033] The read historical data is inserted into the historical data area of ​​the virtual inverter in chronological order, and the latest timestamp is updated.

[0034] In this solution, communication with the inverter also includes:

[0035] Each inverter object is pre-configured with at least two physical communication links, which are divided into a primary communication link and a backup communication link;

[0036] Obtain the communication quality index value of each communication link when communicating with the inverter;

[0037] When the primary communication link fails or the communication quality index value falls below the preset communication quality index threshold, it automatically switches to the backup communication link.

[0038] After the switchover, a quick connectivity test is performed on the backup communication link. If the test passes, the original task queue continues to be executed; otherwise, the next backup communication link is tried.

[0039] Simultaneously, it generates main communication link fault information and reports it to the uplink host, and attempts to automatically restore the main communication link in the background.

[0040] In this solution, the storage in the virtual inverter specifically includes:

[0041] The virtual inverter is constructed in memory as a data structure, which includes an inverter operating parameter area, a status information area, and a fault record area.

[0042] When downlink return data is received, only the data points in the virtual inverter whose timestamps have changed are updated. For data points that have not changed, the original values ​​are retained and their aging counts are accumulated.

[0043] When the aging count exceeds a preset first threshold, the data point is marked as pending refresh in the next periodic maintenance task.

[0044] In this solution, the storage after the virtual inverter also includes:

[0045] Periodically send heartbeat messages to the inverter and record the response time;

[0046] When the response time exceeds the preset first time threshold, the corresponding heartbeat timeout is determined, and the number of consecutive heartbeat timeouts is recorded;

[0047] When the number of consecutive heartbeat timeouts exceeds the preset first threshold, it is determined that the inverter has been reset and a full data refresh task is triggered.

[0048] Based on the full data refresh task, all operating parameters are read according to the inverter protocol and compared with the corresponding data in the virtual inverter.

[0049] If all operating parameters in the inverter protocol are inconsistent with the corresponding data in the virtual inverter, the virtual inverter will be updated based on the newly read values, and the data will be marked as "synchronized". At the same time, the number of inconsistent data points will be recorded, and the proportion of inconsistent data points will be calculated.

[0050] If the proportion of inconsistent data points exceeds a preset proportion threshold, the status of the entire virtual inverter will be marked as "pending verification" and the uplink host will be notified.

[0051] In this solution, the data is converted into uplink protocol format one by one and then encoded, specifically as follows:

[0052] Based on the protocol message format in the request frame, invoke the corresponding encoder;

[0053] The encoder adopts a plug-in architecture, dynamically linking the corresponding encoding dynamic library according to the uplink protocol type;

[0054] During the encoding process, the key-value pairs stored in the virtual inverter are assembled according to the mapping relationship between the object identifier of the uplink protocol and the internal identifier of the inverter.

[0055] In this scheme, before returning the encoded APDU to the uplink protocol for processing, the following steps are also included:

[0056] When extracting data corresponding to the internal identifier from the virtual inverter, the time of data extraction is recorded. ;

[0057] When the raw data is converted to an internal format and stored in the virtual inverter, the corresponding storage time is recorded. ;

[0058] The data acquisition latency is determined based on the time of data extraction and the corresponding storage time.

[0059] Determine the corresponding data quality index value based on the data collection delay;

[0060] If the corresponding data quality index value is greater than the preset quality index threshold, an invalid data alarm will be attached to the returned APDU.

[0061] One or more technical solutions proposed in this application have at least the following technical effects:

[0062] 1. By introducing a virtual inverter as a data buffer pool, the high-speed requests from the uplink host are decoupled from the low-speed response of the inverter; when the uplink host makes a request, it directly returns data from the virtual inverter without waiting for physical communication in real time, thus avoiding uplink host blocking caused by slow inverter response.

[0063] 2. When encountering an unknown inverter model, it automatically enters learning mode, captures message features and compares them with the known protocol feature library, generates new protocol feature codes and adds them to the protocol library; greatly enhancing protocol compatibility and adaptability;

[0064] 3. By using dynamic priority scheduling and deadlock avoidance mechanisms, the priority of waiting tasks is increased to avoid starvation; at the same time, deadlock detection is initiated, and low-priority tasks are forcibly terminated after a timeout.

[0065] In summary, this invention, through systematic technological innovation, comprehensively solves the shortcomings of existing photovoltaic inverter protocol conversion technologies in terms of efficiency, compatibility, reliability, security, and intelligence, providing solid technical support for the efficient monitoring, stable operation, and intelligent maintenance of photovoltaic power plants. Attached Figure Description

[0066] Figure 1 A flowchart of a photovoltaic inverter protocol conversion method according to the present invention is shown. Detailed Implementation

[0067] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.

[0068] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.

[0069] Figure 1 A flowchart of a photovoltaic inverter protocol conversion method according to the present invention is shown.

[0070] like Figure 1 As shown, this invention discloses a photovoltaic inverter protocol conversion method, comprising:

[0071] When a request frame is received from the uplink host, the uplink protocol data object descriptor is obtained and an inverter forwarding task is created;

[0072] The uplink protocol data object descriptor is split to obtain atomic object data descriptors, and the data descriptors are converted into internal identifiers;

[0073] Based on the internal identifier, obtain the inverter object and its corresponding model on the target communication port;

[0074] Retrieve the corresponding inverter protocol from the protocol library based on the inverter model;

[0075] According to the inverter protocol, the internal identifier is converted into one or more specific register tables, and a register task queue is created;

[0076] According to the register task queue, communicate with the inverter to read or write register data sequentially;

[0077] The raw data received from the inverter is converted into an internal format and stored in the virtual inverter;

[0078] Data corresponding to the internal identifier is extracted from the virtual inverter, and the data is converted into the uplink protocol format one by one and encoded to obtain the encoded response message APDU.

[0079] The APDU is returned to the uplink protocol for processing and generated as a response frame to be sent back to the uplink host.

[0080] According to an embodiment of the present invention, taking the request frame of the data copying command as an example, when the inverter data copying command frame from the uplink host is received, the data object descriptor is extracted, an inverter forwarding task is established, and the current uplink message processing flow is suspended; when the downlink inverter communication port is idle, the inverter forwarding task will be granted permission to run. At this time, the uplink protocol data object descriptor is split into several atomic object data descriptors contained therein, such as the voltage data object descriptor 20000200 of the DLT698 protocol; it can be split into phase A voltage 20000201, phase B voltage 20000202, and phase C voltage 20000203; for example, "phase A voltage of inverter No. 1" is converted into the internal identifier " Then, based on the inverter protocol library associated with the inverter brand, the register list corresponding to these inverter atomic data identifiers is obtained, and an inverter register reading task queue is established. Then, the registers in the task queue are read one by one. After all the registers in the queue have been read, the corresponding data of the inverter is converted into the internal format according to the inverter protocol library and the internal format definition of the inverter object, and the result value is placed in the specified location in the virtual inverter object data storage area. According to the internal identifier of the inverter atomic data, the corresponding data is retrieved from the virtual inverter object one by one, and the data is converted into the uplink protocol format according to the mapping table between the line protocol atomic data object and the internal identifier of the inverter atomic data. Then, the data is encoded according to the encoding format in the uplink protocol data object format definition to form the APDU (Application Protocol Data Unit) of the response message.

[0081] According to an embodiment of the present invention, the step of converting the data descriptor into an internal identifier specifically includes:

[0082] Construct a hash mapping table between data descriptors and internal identifiers;

[0083] When a data descriptor is received, the hash map is queried. If a corresponding internal identifier exists, the internal identifier associated with the data descriptor is directly output.

[0084] If the corresponding internal identifier does not exist in the hash map table, a new internal identifier is dynamically generated based on the preset namespace allocation strategy, and the hash map table is updated synchronously.

[0085] It should be noted that the data descriptor is the atomic object data descriptor. When the converter receives the data descriptor, it first checks whether a corresponding relationship exists in the hash map table in memory. The hash map table adopts a key-value pair structure, where the key is the data descriptor and the value is the internal identifier. If a match is found, the internal identifier is returned directly. If no match is found, a new ID is dynamically generated according to preset rules, and the corresponding relationship is stored in the hash map table for subsequent use.

[0086] According to an embodiment of the present invention, after obtaining the inverter object on the target communication port, the method further includes:

[0087] Maintain a request waiting queue for each inverter object;

[0088] When multiple forwarding tasks contend for the same inverter object, a priority-based time-slice round-robin scheduling algorithm is used to calculate the dynamic priority of each task, and the formula is as follows:

[0089] ;in This indicates the dynamic priority of task i. Indicates the basic priority. Indicates the boost factor. This indicates the waiting time for task i. Indicates the maximum allowed waiting time;

[0090] The right to use the inverter object is allocated to different tasks in descending order of dynamic priority.

[0091] When two tasks are detected waiting for each other's resources, a preset deadlock detection timer is started. After the timer expires, the lower-priority task is forcibly terminated and its occupied resources are released.

[0092] It should be noted that when task A holds resource 1 and requests resource 2, and task B holds resource 2 and requests resource 1, a deadlock occurs. The system starts a deadlock detection timer, such as 5 seconds. If a circular wait is detected after the timeout, the lower priority task is forcibly terminated and the resources are released.

[0093] According to an embodiment of the present invention, the step of creating a register task queue specifically includes:

[0094] Based on the register table, extract the starting address and length of the register to be operated on;

[0095] If the register length exceeds the maximum read length supported by the inverter protocol, the register table is divided into N subtasks based on a preset framing algorithm, and the register length of each subtask does not exceed the maximum read length.

[0096] The N smallest subtasks are inserted into the first-in-first-out task queue according to address continuity and priority.

[0097] It should be noted that inverter protocols typically limit the maximum number of registers that can be read in a single operation. For example, Modbus limits it to 125 registers. When an uplink host requests to read a large amount of continuous data, it cannot be read all at once and must be split into smaller parts. After the system extracts the starting address and length, it checks whether the maximum read length is exceeded by the protocol. If it is, the large task is split into N subtasks. Let the total number of registers be M, and the maximum number of registers read per frame be... The number of subtasks For the first (N-1) subtasks, the reading length of each subtask is... The read length of the Nth subtask is , where ceil represents the function for rounding up.

[0098] According to an embodiment of the present invention, when communicating with the inverter, the method further includes:

[0099] When a communication link with the inverter is detected to have been interrupted and then restored, the timestamp of the most recent successful communication stored in the virtual inverter is queried. ;

[0100] Determine the minimum time granularity of data recording based on the inverter model. Calculate the time period that needs to be supplemented. ;

[0101] If the time period for supplementary recording If the time exceeds the preset time threshold, a historical data reading task is constructed. A register task queue is generated according to the historical data reading method supported by the inverter protocol, and historical data within the missing time period is read sequentially.

[0102] The read historical data is inserted into the historical data area of ​​the virtual inverter in chronological order, and the latest timestamp is updated.

[0103] It should be noted that the converter monitors the communication status with the inverter in real time. When a link interruption is detected (such as three consecutive heartbeat overruns) and then restored, the system queries the timestamp of the most recent successful communication in the virtual inverter. Determine whether the inverter model supports historical data storage and the minimum time granularity. For example, if the inverter experiences a 30-minute power outage due to a communication line interruption, after the power is restored... If the time is 10:00 AM and the current time is 10:30 AM, then the time period that needs to be supplemented is 30 minutes. If the inverter supports recording historical data every 5 minutes, then 6 records need to be added. The system constructs 6 read tasks to obtain and store the data into the virtual inverter in sequence.

[0104] According to an embodiment of the present invention, when communicating with the inverter, the method further includes:

[0105] Each inverter object is pre-configured with at least two physical communication links, which are divided into a primary communication link and a backup communication link;

[0106] Obtain the communication quality index value of each communication link when communicating with the inverter;

[0107] When the primary communication link fails or the communication quality index value falls below the preset communication quality index threshold, it automatically switches to the backup communication link.

[0108] After the switchover, a quick connectivity test is performed on the backup communication link. If the test passes, the original task queue continues to be executed; otherwise, the next backup communication link is tried.

[0109] Simultaneously, it generates main communication link fault information and reports it to the uplink host, and attempts to automatically restore the main communication link in the background.

[0110] It should be noted that at least two physical communication links are pre-configured for each inverter, such as an RS485 main communication link and a 4G wireless backup communication link; the system monitors the communication quality indicators of each communication link in real time, such as bit error rate, average response time and link connectivity status; the communication quality indicators are weighted and calculated to determine the communication quality indicator value of the corresponding communication link.

[0111] According to an embodiment of the present invention, the storage in the virtual inverter specifically includes:

[0112] The virtual inverter is constructed in memory as a data structure, which includes an inverter operating parameter area, a status information area, and a fault record area.

[0113] When downlink return data is received, only the data points in the virtual inverter whose timestamps have changed are updated. For data points that have not changed, the original values ​​are retained and their aging counts are accumulated.

[0114] When the aging count exceeds a preset first threshold, the data point is marked as pending refresh in the next periodic maintenance task.

[0115] It should be noted that the virtual inverter is a complex data structure in memory, including multiple areas: operating parameter area (current, voltage, power), status information area (operation / stop / fault), fault record area (historical fault codes), etc. Each data point not only stores the value, but also stores a timestamp and aging count. When new data is read from the inverter, only the data points whose values ​​have changed are updated, and their aging counts are reset to zero. The data points that have not changed retain their original values, but their aging counts are incremented by 1. The aging count indicates the number of times the data has not been updated. When the aging count exceeds a preset first threshold (e.g., 10 times), it indicates that the data may be outdated, and the system marks it as pending refresh in the background maintenance task for priority reading next time.

[0116] According to an embodiment of the present invention, the storage after the virtual inverter further includes:

[0117] Periodically send heartbeat messages to the inverter and record the response time;

[0118] When the response time exceeds the preset first time threshold, the corresponding heartbeat timeout is determined, and the number of consecutive heartbeat timeouts is recorded;

[0119] When the number of consecutive heartbeat timeouts exceeds the preset first threshold, it is determined that the inverter has been reset and a full data refresh task is triggered.

[0120] Based on the full data refresh task, all operating parameters are read according to the inverter protocol and compared with the corresponding data in the virtual inverter.

[0121] If all operating parameters in the inverter protocol are inconsistent with the corresponding data in the virtual inverter, the virtual inverter will be updated based on the newly read values, and the data will be marked as "synchronized". At the same time, the number of inconsistent data points will be recorded, and the proportion of inconsistent data points will be calculated.

[0122] If the proportion of inconsistent data points exceeds a preset proportion threshold, the status of the entire virtual inverter will be marked as "pending verification" and the uplink host will be notified.

[0123] It should be noted that the converter periodically (e.g., every 30 seconds) sends heartbeat messages to the inverter and records the response time. If the number of consecutive heartbeat timeouts exceeds a preset first threshold (e.g., 3 times), the system determines that the inverter may have been reset. For example, after the inverter restarts, the actual power changes from 100kW to 0kW, but the virtual inverter still displays 100kW. After the heartbeat detects a timeout and resumes, a full refresh is triggered. It is found that 18 out of 20 parameters, such as power and current, are inconsistent. The corresponding inconsistency ratio is 18 / 20 = 90%. If the preset ratio threshold is 20%, then 90% is greater than 20%, and the virtual inverter is marked as pending verification. The uplink host receives the alarm and resynchronizes.

[0124] According to an embodiment of the present invention, the data is converted into uplink protocol format one by one and encoded, specifically as follows:

[0125] Based on the protocol message format in the request frame, invoke the corresponding encoder;

[0126] The encoder adopts a plug-in architecture, dynamically linking the corresponding encoding dynamic library according to the uplink protocol type;

[0127] During the encoding process, the key-value pairs stored in the virtual inverter are assembled according to the mapping relationship between the object identifier of the uplink protocol and the internal identifier of the inverter.

[0128] It should be noted that the uplink host may use multiple protocols and may be upgraded or changed. The converter adopts a plug-in design, with each uplink protocol corresponding to an independent encoding dynamic library.

[0129] According to an embodiment of the present invention, before returning the encoded APDU to the uplink protocol for processing, the method further includes:

[0130] When extracting data corresponding to the internal identifier from the virtual inverter, the time of data extraction is recorded. ;

[0131] When the raw data is converted to an internal format and stored in the virtual inverter, the corresponding storage time is recorded. ;

[0132] The data acquisition latency is determined based on the time of data extraction and the corresponding storage time.

[0133] Determine the corresponding data quality index value based on the data collection delay;

[0134] If the corresponding data quality index value is greater than the preset quality index threshold, an invalid data alarm will be attached to the returned APDU.

[0135] It should be noted that the data acquisition latency reflects data freshness, and the corresponding data quality index value is set as Q, with the formula being: ,in The formula for representing data acquisition latency is: , This represents the confidence level, calculated based on the signal-to-noise ratio (SNR) of the communication, and reflects the reliability of the communication. For example, when the SNR is greater than 30dB... When SNR is less than 10dB, When the SNR is greater than or equal to 10dB and less than or equal to 30dB, the SNR is normalized to obtain a confidence level. and These are weighting coefficients, which can be adjusted according to the application scenario, such as real-time control scenarios. Value greater than Data analysis scenarios Greater than ,and “ " indicates multiplication; for example, if the preset quality index threshold is 0.6, then when the data quality index value Q is less than or equal to 0.6, an invalid data alarm will be attached to the returned APDU.

[0136] This invention discloses a photovoltaic inverter protocol conversion method, which adopts a virtual inverter middleware architecture and achieves bidirectional decoupling between the uplink master station protocol and the downlink inverter protocol through a unified data model. This middleware standardizes the inverter's operating status, core data, configuration parameters, and control commands, converting multi-master station protocols and heterogeneous inverter protocols into an internal standard data format, completely eliminating strong coupling dependencies between protocols. Simultaneously, the inverter communication protocol and adaptive strategy are abstracted into a driver library, providing a unified operation interface and supporting online editing and hot updates. This design has low RAM requirements for the MCU and significantly shortens the new inverter access cycle. It also allows on-site maintenance personnel to quickly adjust strategies through configuration rather than code modification, greatly improving maintenance efficiency.

[0137] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0138] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0139] In addition, in the various embodiments of the present invention, each functional unit can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0140] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0141] Alternatively, if the integrated units of this invention are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.

Claims

1. A photovoltaic inverter protocol conversion method, characterized by, include: When a request frame is received from the uplink host, the uplink protocol data object descriptor is obtained and an inverter forwarding task is created; The uplink protocol data object descriptor is split to obtain atomic object data descriptors, and the data descriptors are converted into internal identifiers; Based on the internal identifier, obtain the inverter object and its corresponding model on the target communication port; Retrieve the corresponding inverter protocol from the protocol library based on the inverter model; According to the inverter protocol, the internal identifier is converted into one or more specific register tables, and a register task queue is created; According to the register task queue, communicate with the inverter to read or write register data sequentially; The raw data received from the inverter is converted into an internal format and stored in the virtual inverter; Data corresponding to the internal identifier is extracted from the virtual inverter, and the data is converted into the uplink protocol format one by one and encoded to obtain the encoded response message APDU. The APDU is returned to the uplink protocol for processing and generated as a response frame to be sent back to the uplink host; The storage in the virtual inverter specifically includes: The virtual inverter is constructed in memory as a data structure, which includes an inverter operating parameter area, a status information area, and a fault record area. When downlink return data is received, only the data points in the virtual inverter whose timestamps have changed are updated. For data points that have not changed, the original values ​​are retained and their aging counts are accumulated. When the aging count exceeds a preset first threshold, the data point is marked as to be refreshed in the next periodic maintenance task; The storage after the virtual inverter also includes: Periodically send heartbeat messages to the inverter and record the response time; When the response time exceeds the preset first time threshold, the corresponding heartbeat timeout is determined, and the number of consecutive heartbeat timeouts is recorded; When the number of consecutive heartbeat timeouts exceeds the preset first threshold, it is determined that the inverter has been reset and a full data refresh task is triggered. Based on the full data refresh task, all operating parameters are read according to the inverter protocol and compared with the corresponding data in the virtual inverter. If all operating parameters in the inverter protocol are inconsistent with the corresponding data in the virtual inverter, the virtual inverter is updated based on the newly read values, and the data is marked as "synchronized". At the same time, the number of inconsistent data points is recorded, and the proportion of inconsistent data points is calculated. If the proportion of inconsistent data points exceeds a preset proportion threshold, the status of the entire virtual inverter will be marked as "pending verification" and the uplink host will be notified.

2. The photovoltaic inverter protocol conversion method according to claim 1, characterized in that, The step of converting the data descriptor into an internal identifier specifically includes: Construct a hash mapping table between data descriptors and internal identifiers; When a data descriptor is received, the hash map is queried. If a corresponding internal identifier exists, the internal identifier associated with the data descriptor is directly output. If the corresponding internal identifier does not exist in the hash map table, a new internal identifier is dynamically generated based on the preset namespace allocation strategy, and the hash map table is updated synchronously.

3. The photovoltaic inverter protocol conversion method according to claim 1, characterized in that, After obtaining the inverter object on the target communication port, the process also includes: Maintain a request waiting queue for each inverter object; When multiple forwarding tasks contend for the same inverter object, a priority-based time-slice round-robin scheduling algorithm is used to calculate the dynamic priority of each task, and the formula is as follows: ;in This indicates the dynamic priority of task i. Indicates the basic priority. Indicates the boost factor. This indicates the waiting time for task i. Indicates the maximum allowed waiting time; The right to use the inverter object is allocated to different tasks in descending order of dynamic priority. When two tasks are detected waiting for each other's resources, a preset deadlock detection timer is started. After the timer expires, the lower-priority task is forcibly terminated and its occupied resources are released.

4. The photovoltaic inverter protocol conversion method according to claim 1, characterized in that, The steps for creating the register task queue specifically include: Based on the register table, extract the starting address and length of the register to be operated on; If the register length exceeds the maximum read length supported by the inverter protocol, the register table is divided into N subtasks based on a preset framing algorithm, and the register length of each subtask does not exceed the maximum read length. The N smallest subtasks are inserted into the first-in-first-out task queue according to address continuity and priority.

5. The photovoltaic inverter protocol conversion method according to claim 1, characterized in that, When communicating with the inverter, it also includes: When a communication link with the inverter is detected to have been interrupted and then restored, the timestamp of the most recent successful communication stored in the virtual inverter is queried. ; Determine the minimum time granularity of data recording based on the inverter model. Calculate the time period that needs to be supplemented. ; in Indicates the current timestamp; If the time period for supplementary recording If the time exceeds the preset time threshold, a historical data reading task is constructed. A register task queue is generated according to the historical data reading method supported by the inverter protocol, and historical data within the missing time period is read sequentially. The read historical data is inserted into the historical data area of ​​the virtual inverter in chronological order, and the latest timestamp is updated.

6. The photovoltaic inverter protocol conversion method according to claim 1, characterized in that, When communicating with the inverter, it also includes: Each inverter object is pre-configured with at least two physical communication links, which are divided into a primary communication link and a backup communication link; Obtain the communication quality index value of each communication link when communicating with the inverter; When the primary communication link fails or the communication quality index value falls below the preset communication quality index threshold, it automatically switches to the backup communication link. After the switchover, a quick connectivity test is performed on the backup communication link. If the test passes, the original task queue continues to be executed; otherwise, the next backup communication link is tried. Simultaneously, it generates main communication link fault information and reports it to the uplink host, and attempts to automatically restore the main communication link in the background.

7. The photovoltaic inverter protocol conversion method according to claim 1, characterized in that, The data is converted into the uplink protocol format one by one and then encoded, specifically as follows: Based on the protocol message format in the request frame, invoke the corresponding encoder; The encoder adopts a plug-in architecture, dynamically linking the corresponding encoding dynamic library according to the uplink protocol type; During the encoding process, the key-value pairs stored in the virtual inverter are assembled according to the mapping relationship between the object identifier of the uplink protocol and the internal identifier of the inverter.

8. A photovoltaic inverter protocol conversion method according to claim 1, characterized in that, Before returning the APDU to the uplink protocol for processing, the process also includes: When extracting data corresponding to the internal identifier from the virtual inverter, the time of data extraction is recorded. ; When the raw data is converted to an internal format and stored in the virtual inverter, the corresponding storage time is recorded. ; The data acquisition latency is determined based on the time of data extraction and the corresponding storage time. Determine the corresponding data quality index value based on the data collection delay; If the corresponding data quality index value is greater than the preset quality index threshold, an invalid data alarm will be attached to the returned APDU.