A data reading method based on an energy router device model configuration file
By using modeled configuration files and automatic organization of frame sending methods in energy routers, the development complexity and cost problems caused by device replacement and parameter increase and decrease in the prior art are solved, and the flexibility and development convenience of the equipment are improved.
Patent Information
- Application Number
- CN202211454421.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-21
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2042-11-21
AI Technical Summary
When the existing energy router equipment communication methods replace equipment from different manufacturers, add or delete the number of reading parameters and classify reading, configuration files and programs need to be frequently modified, which increases the development cycle, cost and complexity, and reduces the flexibility and development convenience of the equipment.
The data copying method is adopted based on the energy router device modeling configuration file. By setting the modeled configuration file in the energy router, including the device description and parameter description, the program parses the configuration file to obtain the device and parameter configuration, automatically organizes the sending of frames, and performs data copying and reading.
It improves the flexibility and development convenience of energy routers, reduces the program content that needs to be modified due to replacing equipment from different manufacturers or adding or deleting copy and reading parameters, and reduces the complexity and cost of project development.
Smart Images

Figure CN115733873B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of power communication, and particularly relates to a data reading method based on a device model configuration file of an energy router. Background Art
[0002] In a microgrid system, an energy router device needs to communicate frequently with energy storage devices, photovoltaic inverter devices, load devices, wind turbines and other devices in the microgrid system. Among them, energy storage devices generally follow the CAN protocol or the Modbus protocol, load devices generally follow the Modbus protocol, DLT698 protocol or DLT645 protocol, and most of the photovoltaic inverter devices, wind turbines and other devices follow the Modbus protocol.
[0003] In the existing communication solution, the number of sending frames, the starting register address of each sending frame, the number of register addresses, and the parameter description order are added to the configuration file of the energy router device according to the protocol of the device to be read; in the energy router device program, the data reading and receiving parsing structure in the program is solidified according to the parameter starting address, the number of register addresses, and the parameter description order. The energy router device reads the parameter data of the Modbus protocol device by parsing the configuration file to obtain the number of sending frames, the starting register address of each sending frame, and the number of register addresses to form a sending frame.
[0004] This communication solution binds the description order of the parameters in the energy router device configuration file to the data reading and receiving parsing structure of the parameters in the program. Among them, the starting register address required for the program sending structure to organize the sending frame, the number of registers, and the number of sending frames required to read all parameters are provided by the configuration file and cannot be automatically organized by the program. Therefore, in the case of replacing similar devices from different manufacturers, increasing or decreasing the number of read parameters, and hierarchical reading (important parameters are read frequently, and unimportant parameters are read at intervals), it is necessary to modify the number of sending frames, the starting register address of each sending frame, the number of register addresses, and the parameter description order in the configuration file; it is necessary to modify the receiving parsing structure of each parameter in the program. This communication method increases the project development cycle, development cost and complexity, and at the same time makes the original intention of the flexibility, convenience and easy development of the energy router using the configuration file meaningless. Summary of the Invention
[0005] In view of the above inconveniences and defects existing in the current existing interactive communication method, the present invention provides a data reading method based on a device model configuration file of an energy router, and improves the data reading method of the energy router to improve the flexibility and development convenience of the energy router.
[0006] To solve the above technical problems, the technical solution adopted by the present invention is as follows: A data reading method based on a model-based configuration file of an energy router device, comprising the following steps:
[0007] S1. Set a model-based configuration file in the energy router. The configuration file includes device description and parameter description. In the parameter description, all photovoltaic inverters use the same model;
[0008] S2. After the energy router is powered on, parse the model-based configuration file to obtain the device description of the connected photovoltaic inverters and the model-based parameter description information of the photovoltaic inverters to be read, and store them in the memory;
[0009] S3. According to the extracted device description and parameter description information, organize a sending frame for the device parameters of the photovoltaic inverter and send it out;
[0010] S4. Traverse all the photovoltaic inverters, repeat step S3, and complete the data reading of all the photovoltaic inverters.
[0011] The specific steps of step S3 are as follows:
[0012] S301. Extract the device description and parameter description information, and sort all the parameters of the photovoltaic inverter in ascending order according to the register address of the parameter to obtain an array;
[0013] S302. Starting from the second parameter, judge whether the register address of the current parameter and the previous parameter is continuous, whether the function code of the current parameter and the previous parameter is the same, and whether the reading interval of the current parameter and the previous parameter is the same. If all three conditions are met, accumulate the parameters and judge whether the next parameter meets the three conditions; if any one of the three conditions is not met, enter the frame organization process;
[0014] S303. Determine the starting register address of the current sending frame and the accumulated parameter quantity, organize a sending frame, and add the organized sending frame to the sending task and send it out;
[0015] S304. Judge whether all the parameters of the current photovoltaic inverter have been framed and sent. If not, return to step S302 to traverse all the parameters after sorting the photovoltaic inverter.
[0016] The specific steps of step S303 are as follows:
[0017] S3031. Obtain the host address and function code;
[0018] S3032. According to the accumulated parameter quantity, obtain the parameter number to which the starting register in the current sending frame belongs;
[0019] S3033. Obtain the starting register address according to the number of the parameter to which the starting register in the sending frame belongs;
[0020] S3034. Obtain the length of the characters read in the current sending frame according to the accumulated number of registers;
[0021] S3035. Calculate the CRC check value;
[0022] S3036. Add a sending task and send the reading frame;
[0023] S3037. Clear both the accumulated number of registers and the number of parameters to zero.
[0024] The host address and function code are obtained through the information description pointer of the current photovoltaic inverter.
[0025] The method for obtaining the number of the parameter to which the starting register in the current sending frame belongs is as follows:
[0026] When the current frame is the last frame: Subtract the accumulated number of parameters from the current parameter number, and then subtract 1, which is the number of the parameter to which the starting register belongs;
[0027] When the current frame is not the last frame, subtract the accumulated number of parameters from the current parameter number, which is the number of the parameter to which the starting register belongs.
[0028] The length of the characters read in the current sending frame is equal to the accumulated number of registers multiplied by 2.
[0029] In step S304, it further includes the step of recording the number of parameters in the sending frame, the current photovoltaic inverter number, the starting register address of the current frame, the number of register addresses, the device protocol, and the function code into global variables for use in parsing the data responded by the photovoltaic inverter.
[0030] In the configuration file, the device description includes: device number, device protocol, type of photovoltaic inverter, interface where the photovoltaic inverter is connected to the energy router, host address, communication configuration, device name.
[0031] In the configuration file, the parameter description includes: parameter name, starting register address, number of registers corresponding to the parameter, function code, algorithm.
[0032] In step S2, the specific steps for parsing the model-based configuration file to obtain the device description of the connected photovoltaic inverter and the model-based parameter description information of the photovoltaic inverter to be read are as follows:
[0033] S201. Obtain the information description pointer of the current photovoltaic inverter according to the current photovoltaic inverter number;
[0034] S202. Obtain the parameter information description pointer of the current PV inverter according to the information description pointer of the current PV inverter.
[0035] S203. Obtain the total number of parameters of the current PV inverter according to the parameter information description pointer of the current PV inverter.
[0036] S204. According to the parameter information description pointer of the current PV inverter, sort all the parameters of the PV inverter in ascending order according to the register address of the parameters to obtain an array.
[0037] S205. Configure the priority, communication parameters, receive callback, and receive frame timeout of the sending task.
[0038] The present invention has the following beneficial effects compared with the prior art:
[0039] 1. The present invention provides a data reading method based on the model-based configuration file of the energy router device. The model-based configuration file of the energy router contains the device description of the devices connected to the energy router and the model-based description of the parameters of this device. The energy router device program obtains the device and parameter configurations by parsing the model-based configuration file, sorts the register addresses of each parameter, and then combines the parameters according to the difference between adjacent register addresses, the reading interval, and the function code to organize the sending frame. Then, it is not necessary for the configuration file to provide the number of sending frames, the starting register address of each sending frame, and the number of register addresses. The reading and receiving parsing structure of the parameters in the program is not affected by the number, storage order, register address, reading interval, etc. of the parameters in the model-based configuration file.
[0040] 2. High degree of automation: In the present invention, the energy router device reads the data of the PV inverter device by applying the model-based configuration file, and the program automatically analyzes and judges the model-based parameter description in the memory to organize the sending frame, without the model-based configuration file providing the number of sending frames, the starting register address of the sending frame, and the number of registers additionally.
[0041] 3. The present invention has strong compatibility: The parameters in the configuration file can be sorted arbitrarily, and the number of device parameters can be increased or decreased. It is not necessary to modify the configuration file structure and the program. Thus, the problem of modifying the program caused by replacing PV inverter devices of different manufacturers is avoided, the development time of the energy router compatible with new PV inverter devices is reduced, and the development and implementation work efficiency is improved. The model-based configuration file is simplified, and the complexity of project development is reduced. Furthermore, the energy router has high compatibility, and replacing devices of different manufacturers, increasing or decreasing the number of parameters, and hierarchical reading of parameters only require modifying the configuration file without modifying the program.
[0042] 4. The present invention has strong scalability and good versatility. The number of sending frames, the starting register address of the sending frames, and the number of register addresses for the energy router device to read the device data are not directly obtained from the configuration file. This method can be extended to other types of devices (such as energy storage systems, loads, etc.) and devices using other protocols (such as CAN protocol, DLT698 protocol, DLT645 protocol). That is, the parameters of different types of devices and devices using different protocols can be modeled in the configuration file. For devices of the same type but different protocols and devices of the same type and the same protocol, the same processing method is used in the program to organize the sending frames. In actual application, the modeled configuration file can be simply modified directly according to the situation of the devices connected to the energy router on-site, without the need to modify the program again. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 FIG. is a schematic flowchart of a data reading method based on a modeled configuration file of an energy router device provided in Embodiment 1 of the present invention;
[0044] Figure 2 FIG. is a schematic flowchart of extracting parameter description information of a photovoltaic inverter device;
[0045] Figure 3 FIG. is a schematic flowchart of initializing a sending task for a photovoltaic inverter device;
[0046] Figure 4 FIG. is a schematic flowchart of organizing sending frames. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0047] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0048] Embodiment 1
[0049] As Figure 1 shown, Embodiment 1 of the present invention provides a data reading method based on a modeled configuration file of an energy router device, which is implemented based on the following hardware environment: one energy router device, multiple photovoltaic inverter devices, and the photovoltaic inverter devices using the Modbus communication protocol are connected to the energy router through the 485 method; the function to be achieved is: the energy router reads the data of the connected Modbus photovoltaic inverter devices. (It can be extended to: the energy router reads the data of the energy storage system using the CAN protocol, the energy router reads the data of the DLT698 national grid meter, and the energy router reads the data of the DLT645 national grid meter).
[0050] As Figure 1 shown, a data reading method based on a model-based configuration file of an energy router device provided in this embodiment includes the following steps:
[0051] S1. Set a model-based configuration file in the energy router. The configuration file includes device description and parameter description. In the parameter description, all photovoltaic inverters use the same model.
[0052] In the configuration file, the device description includes: device number, device protocol, type of photovoltaic inverter, interface where the photovoltaic inverter is connected to the energy router, host address, communication configuration, device name.
[0053] In the configuration file, the parameter description includes: parameter name, starting register address, number of registers corresponding to the parameter, function code, algorithm.
[0054] S2. After the energy router is powered on, parse the model-based configuration file to obtain the device description of the connected photovoltaic inverter and the model-based parameter description information of the photovoltaic inverter to be read, and store them in the memory.
[0055] In this embodiment, the model-based configuration file is made manually or by software according to the built environment. It covers the device description of the photovoltaic inverter to be read and the model-based parameter description. The focus of the embodiment of the present invention is the process of automatically framing using the information provided by the model-based configuration file. Extract the device description information of the photovoltaic inverter and the description information of the model-based parameters of the photovoltaic inverter and save them in a memory linked list for use in organizing the transmission frame for reading the parameter data of the photovoltaic inverter later.
[0056] In the step S2, the specific method for parsing the model-based configuration file to obtain the device description of the connected photovoltaic inverter and the model-based parameter description information of the photovoltaic inverter to be read is as follows:
[0057] S201. Obtain the current photovoltaic inverter information description pointer according to the current photovoltaic inverter number;
[0058] S202. Obtain the current photovoltaic inverter parameter information description pointer according to the current photovoltaic inverter information description pointer;
[0059] S203. Obtain the total number of parameters of the current photovoltaic inverter according to the current photovoltaic inverter parameter information description pointer;
[0060] S204. According to the current photovoltaic inverter parameter information description pointer, sort all the parameters of the current photovoltaic inverter in ascending order according to the register address of the parameter to obtain an array;
[0061] S205. Configure the priority of the sending task, communication parameters (including information such as baud rate, parity check, host address, etc.), receive callback, and receive frame timeout.
[0062] The process of extracting the parameter description information of the photovoltaic inverter device is as Figure 2 shown. Then, the system of the energy router organizes the sending frame to read data according to the device and modeled device parameter descriptions stored in the memory. The specific process is as follows: Initialize the sending task for the photovoltaic inverter device: Extract the photovoltaic inverter device and modeled parameter information in the memory linked list into the global variable for the photovoltaic inverter. This global variable for the photovoltaic inverter contains all the photovoltaic inverter device description information (hardware communication channel, baud rate, parity check, stop bit, host number, etc.) extracted from the modeled configuration file and the description information of all the corresponding modeled device parameters (parameter type describing integer or floating point, register address, reading interval, number of register addresses, function code, and algorithm). Then loop through the photovoltaic inverter devices. For example, if there are 5 photovoltaic inverter devices, loop through 5 times. In the loop, obtain the channel used for the sending task according to the hardware communication channel, and then analyze all the parameters of the current photovoltaic inverter device and automatically organize and send the frame.
[0063] In addition, it also includes the step of initializing the sending task for the photovoltaic inverter device, and its specific process is as Figure 3 shown.
[0064] Among them, the current photovoltaic inverter information description pointer points to the device, parameter, and task description addresses of the current photovoltaic inverter in the memory. Through this pointer, all the photovoltaic inverter device description information in the configuration file can be obtained, the description information of each photovoltaic inverter parameter, and the sending channel information can be obtained. After the energy router is powered on, the current photovoltaic inverter device number is passed in through the function dg_mb_poll. Combining the current inverter device number with the current photovoltaic inverter information description pointer, the addresses of the device description information, parameter description information, and sending channel information of the current photovoltaic inverter in the memory can be obtained. The current photovoltaic inverter parameter description pointer points to the address of the parameter description information of the current photovoltaic inverter in the memory. Through this pointer, all the parameter information of the current photovoltaic inverter to be read can be obtained.
[0065] S3. Organize the sending frame for the photovoltaic inverter device parameters according to the extracted device description and parameter description information, and send it out.
[0066] The data reading method of the present invention is mainly implemented by combining a modeled parameter configuration file and a self-organizing data sending frame. In the process of self-organizing the sending frame, the energy router automatically combines relevant parameters according to the device and the description information of all modeled parameters in the memory linked list mentioned in the modeled configuration file to organize the sending frame.
[0067] Further, in this embodiment, the specific steps of step S3 are as follows:
[0068] S301. Extract the device description and parameter description information, and sort all the parameters of the photovoltaic inverter in ascending order according to the register address of the parameters to obtain an array;
[0069] S302. Starting from the second parameter, judge whether the register address of the current parameter and the previous parameter is continuous, whether the function code of the current parameter and the previous parameter is the same, and whether the reading interval of the current parameter and the previous parameter is the same. If all three conditions are met, accumulate the parameters and judge whether the next parameter meets the three conditions; if any one of the three conditions is not met, enter the frame organization process;
[0070] S303. Determine the starting register address of the current sending frame and the accumulated number of parameters, organize a sending frame, and add the organized sending frame to the sending task and send it out;
[0071] S304. Judge whether all the parameters of the current photovoltaic inverter have been framed and sent. If not, return to step S302 to traverse all the parameters of the photovoltaic inverter after sorting.
[0072] In this embodiment, the parameter combination is realized through step S302, that is, the parameters with continuous register addresses, the same function code and reading interval are combined into one frame for sending. The communication address and function code required in the sending frame are provided by the device description and modeled parameter description in the configuration file. The starting register address and the number of registers are completely calculated automatically by the program operation, which can simplify the number of sending frames and improve the communication efficiency.
[0073] In addition, since the parameter sorting in the memory is the same as the parameter sorting in the configuration file, the register addresses of the parameters in the memory may not be sorted in ascending or descending order. For the standard modbus protocol, the values of multiple registers can be read starting from a certain register address. Therefore, in this embodiment, all the parameter register addresses of the current photovoltaic inverter are sorted to realize self-organizing sending frames.
[0074] In addition, in this embodiment, the organization and transmission of frames are performed by comparing whether the next parameter and the previous parameter meet three conditions. Assuming that the second parameter and the first parameter meet these three conditions, it indicates that they can be combined for transmission. At this time, the number of parameters and the number of registers in the current transmission frame are accumulated. Then, it continues to determine whether the third parameter meets the above conditions with the second parameter. If it meets, it continues to determine the fourth parameter; if it does not meet, the transmission frame is organized to transmit the first parameter and the second parameter, and at the same time, the number of parameters and the number of registers are reset to zero. In the next loop, it starts to determine whether the fourth parameter and the third parameter meet the above three conditions. If they meet, it is considered that they can be combined for transmission, and the number of parameters and the number of registers in the current transmission frame are accumulated again; then it continues to determine the fifth parameter. If it does not meet, the transmission frame needs to be organized to transmit the third parameter and the fourth parameter. And so on until all parameters are transmitted.
[0075] The situation that needs to be considered after looping through all parameters: In the last loop, when the last parameter is compared with the previous parameters, if one of the three conditions is not met, the last parameter cannot form a frame with the previous parameters. At this time, the previous parameters need to be combined into one frame for framed transmission, and the last parameter is read separately in a single transmission frame. At this time, the starting register position of the last transmission frame can be obtained by combining the parameter number of the last parameter with the parameter description pointer of the photovoltaic inverter; the function code and the host number are obtained by combining the parameter number of the last parameter with the photovoltaic inverter information description pointer.
[0076] Further, in this embodiment, as Figure 4 shown, in this embodiment, the specific steps of step S303 are as follows:
[0077] S3031. Obtain the host address and function code;
[0078] S3032. According to the accumulated number of parameters, obtain the parameter number to which the starting register in the current transmission frame belongs;
[0079] S3033. Obtain the starting register address according to the number of the parameter to which the starting register in the transmission frame belongs;
[0080] S3034. According to the accumulated number of registers, obtain the character length read in the current transmission frame;
[0081] S3035. Calculate the CRC check value;
[0082] S3036. Add a transmission task to transmit the read frame;
[0083] S3037. Clear both the accumulated number of registers and the number of parameters to zero.
[0084] Further, in this embodiment, the host address and function code are obtained through the information description pointer of the current photovoltaic inverter.
[0085] Further, in this embodiment, the method for obtaining the parameter number to which the starting register in the current transmission frame belongs is as follows:
[0086] When the current frame is the last frame: Subtract the cumulative number of parameters from the current parameter number, and then subtract 1, which is the parameter number to which the starting register belongs;
[0087] When the current frame is not the last frame, subtract the cumulative number of parameters from the current parameter number, which is the parameter number to which the starting register belongs.
[0088] Further, the length of the characters read in the current transmission frame is equal to the cumulative number of registers multiplied by 2.
[0089] Further, in step S304 of this embodiment, it further includes the step of recording the number of parameters in the transmission frame, the current photovoltaic inverter number, the starting register address of the current frame, the number of register addresses, the device protocol, and the function code into global variables for use in parsing the data responded by the photovoltaic inverter.
[0090] S4. Traverse all the photovoltaic inverters, and repeat step S3 to complete the data reading of all the photovoltaic inverters.
[0091] In summary, the present invention provides a data reading method based on an energy router device model configuration file, which has the following advantages:
[0092] 1. When reading the data of the photovoltaic inverter, it is not necessary to determine in advance how many frames need to be sent to read all the parameters of the current photovoltaic inverter; nor is it necessary to determine in advance which data is read in each frame. Since the reading method that knows in advance how many frames need to be sent to read all the parameters of the current photovoltaic inverter and knows which data is read in each frame must parse the response frame according to which parameters are read in the current transmission frame in the program. When reading the photovoltaic inverter devices of other manufacturers, it is necessary to recalculate the number of frames required for reading according to the protocol, which parameters are read in each frame, and add a parsing function for the received frames of the new manufacturer's inverter again. Therefore, the present invention reads data based on the model configuration file, and only needs to modify the parameter description information in the model configuration file when replacing the photovoltaic inverter devices of different manufacturers, without modifying the program, which is convenient for the deployment of new projects and the change of access conditions of old projects.
[0093] 2. It enriches the reading methods. When reading the data of a PV inverter, some parameters such as total power generation and daily power generation do not need to be read frequently. Therefore, the reading intervals of such parameters can be set longer in the model configuration file. In this process, such parameters can be filtered out according to the reading intervals for merging or framed separately for reading data.
[0094] 3. In the present invention, before merging parameter framing, the modeled parameters are sorted according to the register size, without the need to limit the number and arrangement order of the parameters of the current PV inverter in the model configuration file, making the configuration file more flexible and batch-generable.
[0095] 4. The present invention has strong portability and can be applied to the energy router to read the data of other devices. For example, the energy router can read the data of energy storage inverters, energy storage systems, environmental devices (temperature and humidity sensors), and load data. When replacing such devices with devices from different manufacturers or different protocols, or when hierarchically reading the parameters of such devices and adding or subtracting reading parameters, there is no need to modify the program, greatly reducing the development and debugging work of developers and also reducing the time for the energy router to adapt to newly connected devices, improving work efficiency.
[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features. And these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data reading method based on an energy router device modeling configuration file, characterized in that, It includes the following steps: S1. Set a modeled configuration file in the energy router. The configuration file includes device descriptions and parameter descriptions. In the parameter descriptions, all photovoltaic inverters use the same model; S2. After the energy router is powered on, parse the modeled configuration file to obtain the device descriptions of the connected photovoltaic inverters and the modeled parameter description information of the photovoltaic inverters to be read, and store them in the memory; S3. According to the extracted device descriptions and parameter description information, organize a transmission frame for the device parameters of the photovoltaic inverter and send it out; S4. Traverse all the photovoltaic inverters, repeat step S3 to complete the data reading of all photovoltaic inverters. The specific steps of step S3 are: S301. Extract the device descriptions and parameter description information, and sort all the parameters of the photovoltaic inverter in ascending order according to the register address of the parameters to obtain an array; S302. Starting from the second parameter, judge whether the register address of the current parameter and the previous parameter is continuous, whether the function code of the current parameter and the previous parameter is the same, and whether the reading interval of the current parameter and the previous parameter is the same. If all three conditions are met, accumulate the parameters and judge whether the next parameter meets the three conditions; If any one of the three conditions is not met, enter the frame assembly process; S303. Determine the starting register address of the current transmission frame and the accumulated number of parameters, organize a transmission frame, and add the organized transmission frame to the transmission task and send it out; S304. Judge whether all the parameters of the current photovoltaic inverter have been framed and sent. If not, return to step S302 to traverse all the parameters after sorting the photovoltaic inverter; 2. The data reading method based on the energy router device modeling configuration file according to claim 1, wherein, The specific steps of step S303 are: S3031. Obtain the host address and function code; S3032. According to the accumulated number of parameters, obtain the parameter number to which the starting register in the current transmission frame belongs; S3033. Obtain the starting register address according to the number of the parameter to which the starting register in the transmission frame belongs; S3034. According to the accumulated number of registers, obtain the length of the characters read in the current transmission frame; S3035. Calculate the CRC check value; S3036. Add a transmission task and send a reading frame; S3037. Clear both the accumulated number of registers and the number of parameters to zero.
3. A data reading method based on an energy router device modeling configuration file according to claim 2, characterized in that The host address and function code are obtained through the information description pointer of the current photovoltaic inverter.
4. A data reading method based on an energy router device modeling configuration file according to claim 2, characterized in that The method for obtaining the parameter number to which the starting register in the current transmission frame belongs is: When the current frame is the last frame: subtract the accumulated number of parameters from the current parameter number, and then subtract 1, which is the parameter number to which the starting register belongs; When the current frame is not the last frame, subtract the accumulated number of parameters from the current parameter number, which is the parameter number to which the starting register belongs.
5. A data reading method based on an energy router device modeling configuration file according to claim 2, characterized in that The length of the characters read in the current transmission frame is equal to the accumulated number of registers multiplied by 2.
6. A data reading method based on an energy router device modeling configuration file according to claim 1, characterized in that In step S304, it also includes the step of recording the number of parameters in the transmission frame, the current photovoltaic inverter number, the starting register address of the current frame, the number of register addresses, the device protocol and the function code in the global variables for use in parsing the data replied by the photovoltaic inverter.
7. A data reading method based on an energy router device modeling configuration file according to claim 1, characterized in that, In the configuration file, the device description includes: device number, device protocol, type of photovoltaic inverter, interface where the photovoltaic inverter is connected to the energy router, host address, communication configuration, and device name.
8. A data reading method based on an energy router device modeling configuration file according to claim 1, characterized in that In the configuration file, the parameter description includes: parameter name, starting register address, number of registers corresponding to the parameter, function code, and algorithm.
9. A data reading method based on an energy router device model configuration file according to claim 1, characterized in that In step S2, the specific steps for parsing the modeled configuration file to obtain the device description of the connected photovoltaic inverter and the modeled parameter description information of the photovoltaic inverter to be read are as follows: S201. Obtain the information description pointer of the current photovoltaic inverter according to the current photovoltaic inverter number. S202. Obtain the parameter information description pointer of the current photovoltaic inverter according to the information description pointer of the current photovoltaic inverter. S203. Obtain the total number of parameters of the current photovoltaic inverter according to the parameter information description pointer of the current photovoltaic inverter. S204. According to the parameter information description pointer of the current photovoltaic inverter, sort all the parameters of the photovoltaic inverter in ascending order according to the register address of the parameter to obtain an array. S205. Configure the priority of the sending task, communication parameters, receive callback, and receive frame timeout time.
Citation Information
Patent Citations
Modbus protocol file encoding method, Modbus protocol file decoding method, encoder and decoder
CN106712902A
Power carrier embedded equipment management method and system based on configuration file
CN114185616A