Photovoltaic energy storage system battery upgrading method and device, terminal equipment and storage medium

By converting serial port upgrade commands to CAN upgrade commands, the problem of wasted hardware and labor costs in the upgrade of photovoltaic energy storage system battery packs is solved, and the upgrade success rate is improved.

CN118689512BActive Publication Date: 2026-06-16ROYPOW TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ROYPOW TECH CO LTD
Filing Date
2024-07-11
Publication Date
2026-06-16

AI Technical Summary

Technical Problem

In existing technologies, upgrading the battery pack of a photovoltaic energy storage system requires changing the hardware interface or relying on after-sales support from the battery manufacturer, resulting in a waste of hardware and labor costs.

Method used

By receiving the function code field from the serial port upgrade command and converting it into a CAN upgrade command, the battery pack can be upgraded directly, avoiding hardware modifications and after-sales support.

Benefits of technology

This improved the success rate of battery pack upgrades and saved on hardware and labor maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118689512B_ABST
    Figure CN118689512B_ABST
Patent Text Reader

Abstract

The application is suitable for the technical field of computer application, and provides a photovoltaic energy storage system battery upgrading method and device, terminal equipment and storage medium, the method comprises the following steps: receiving a serial port upgrading instruction sent by an upgrading terminal, wherein the serial port upgrading instruction comprises a function code field used to distinguish each upgrading step; converting the serial port upgrading instruction into a CAN upgrading instruction according to the function code field, wherein the CAN upgrading instruction comprises an identification field corresponding to the function code field; and sending the CAN upgrading instruction to a battery pack to upgrade the battery pack. Thus, the serial port upgrading instruction is converted according to the function code field in the serial port upgrading instruction to generate a CAN upgrading instruction matched with the interface of the battery pack, and the battery pack is upgraded, so that the hardware does not need to be changed, technical support of the battery manufacturer's after-sales personnel is not needed, and the artificial maintenance cost and hardware cost are saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of computer application technology, and in particular relates to a method, apparatus, terminal equipment and computer-readable storage medium for upgrading batteries in a photovoltaic energy storage system. Background Technology

[0002] A photovoltaic (PV) energy storage system is a renewable energy system that combines photovoltaic (PV) technology and energy storage technology. It includes an energy storage inverter and a battery pack. The battery pack uses a controller area network (CAN) interface for communication, while the energy storage inverter uses a serial port for external communication. All data exchange and software upgrades must pass through this serial port. The energy storage inverter and battery pack are tightly sealed in a single unit within a housing. PV energy storage systems utilize the photoelectric effect to convert light energy into electrical energy; therefore, the battery pack is crucial in PV energy storage systems. With the continuous development and advancement of PV energy storage technology, upgrades to the battery pack are necessary.

[0003] In related technologies, the battery pack interface may be modified to a serial port, or the battery pack may be upgraded directly using a USB flash drive. However, these methods require hardware modifications or technical support from the battery manufacturer's after-sales personnel, resulting in a waste of hardware and labor costs. Summary of the Invention

[0004] The purpose of this application is to provide a method, device, terminal equipment, and computer-readable storage medium for upgrading batteries in a photovoltaic energy storage system. This solution addresses the problem in related technologies where upgrading the battery pack by modifying the interface to a serial port or directly using a USB flash drive requires hardware modifications or technical support from the battery manufacturer's after-sales personnel, resulting in wasted hardware and labor costs.

[0005] In a first aspect, embodiments of this application provide a method for upgrading a battery in a photovoltaic energy storage system, comprising: receiving a serial port upgrade command sent by an upgrade terminal, wherein the serial port upgrade command includes a function code field for distinguishing each upgrade step; converting the serial port upgrade command into a CAN upgrade command based on the function code field, wherein the CAN upgrade command includes an identifier field corresponding to the function code field; and sending the CAN upgrade command to the battery pack to upgrade the battery pack.

[0006] In one possible implementation of the first aspect, after sending the CAN upgrade command to the battery pack and upgrading the battery pack, the method further includes:

[0007] Receive the CAN response command corresponding to the CAN upgrade command sent by the battery pack, wherein the CAN response command includes an identification field;

[0008] Based on the identifier field, the CAN response command is converted into a serial port response command;

[0009] Send the serial port reply command to the upgrade terminal.

[0010] Optionally, in another possible implementation of the first aspect, the upgrade steps include: a start upgrade step, a send file size step, a send upgrade file data step, and a stop upgrade step;

[0011] When the upgrade step is to start the upgrade step, the serial port upgrade command is the serial port upgrade start command, and the CAN upgrade command is the CAN upgrade start command.

[0012] When the upgrade step is to send the file size, the serial port upgrade command is the serial port upgrade file size command, and the CAN upgrade command is the CAN upgrade file size command.

[0013] When the upgrade step is to send upgrade file data, the serial port upgrade command is the serial port upgrade file command, and the CAN upgrade command is the CAN upgrade file command.

[0014] When the upgrade step is to end the upgrade step, the serial port upgrade command is the serial port upgrade end command, and the CAN upgrade command is the CAN upgrade end command.

[0015] Optionally, in another possible implementation of the first aspect, the upgrade step includes a file size sending step, wherein the serial port file size instruction includes the length of the file data used for the upgrade, and the conversion of the serial port upgrade instruction into a CAN upgrade instruction based on the function code field includes:

[0016] Based on the length of the file data and the first preset number of bytes, the total number of upgrade file packets is generated, where the first preset number of bytes is the maximum length of the file data sent by the upgrade terminal for upgrade in a single transaction;

[0017] Based on the function code field and the total number of upgrade files, the serial port upgrade file size instruction is converted into a CAN upgrade file size instruction.

[0018] Optionally, in another possible implementation of the first aspect, the upgrade steps include the step of sending upgrade file data, and before converting the serial port upgrade command to a CAN upgrade command based on the function code field, the steps further include:

[0019] Send a CAN file packet serial number command to the battery pack, wherein the CAN file packet serial number command includes the serial number corresponding to the file data;

[0020] Receive the CAN file packet serial number reply command sent by the battery pack.

[0021] Optionally, in another possible implementation of the first aspect, the upgrade step includes sending upgrade file data, the serial port upgrade file instruction includes file data for upgrade, and the conversion of the serial port upgrade instruction into a CAN upgrade instruction based on the function code field includes:

[0022] Based on the file data, function code field, and second preset byte count, the serial port upgrade file instruction is converted into multiple CAN upgrade file instructions. The number of CAN upgrade file instructions is determined according to the length of the file data and the second preset byte count, which is the maximum length of the file data sent to the battery pack in a single transmission.

[0023] Optionally, in another possible implementation of the first aspect, the upgrade step includes ending the upgrade step, sending a CAN upgrade command to the battery pack, and upgrading the battery pack, including:

[0024] Send each CAN upgrade file instruction to the battery pack;

[0025] Generate CRC checksum values ​​based on the instructions in each CAN upgrade file;

[0026] Generate a CAN check value command based on the CRC check value, and send the CAN check value command to the battery pack to upgrade the battery pack.

[0027] Secondly, this application also provides a battery upgrade device for a photovoltaic energy storage system, comprising: a first receiving module for receiving a serial port upgrade command sent by an upgrade terminal, wherein the serial port upgrade command includes a function code field for distinguishing each upgrade step; a first conversion module for converting the serial port upgrade command into a CAN upgrade command according to the function code field, wherein the CAN upgrade command includes an identifier field corresponding to the function code field; and a first sending module for sending the CAN upgrade command to the battery pack to upgrade the battery pack.

[0028] In one possible implementation of the second aspect, the aforementioned photovoltaic energy storage system battery upgrade device further includes:

[0029] The second receiving module receives the CAN response command corresponding to the CAN upgrade command sent by the battery pack, wherein the CAN response command includes an identification field;

[0030] The second conversion module converts the CAN response command into a serial port response command based on the identifier field.

[0031] The second sending module sends the serial port reply command to the upgrade terminal.

[0032] Optionally, in another possible implementation of the second aspect, the upgrade steps include: a start upgrade step, a send file size step, a send upgrade file data step, and a stop upgrade step;

[0033] When the upgrade step is to start the upgrade step, the serial port upgrade command is the serial port upgrade start command, and the CAN upgrade command is the CAN upgrade start command.

[0034] When the upgrade step is to send the file size, the serial port upgrade command is the serial port upgrade file size command, and the CAN upgrade command is the CAN upgrade file size command.

[0035] When the upgrade step is to send upgrade file data, the serial port upgrade command is the serial port upgrade file command, and the CAN upgrade command is the CAN upgrade file command.

[0036] When the upgrade step is to end the upgrade step, the serial port upgrade command is the serial port upgrade end command, and the CAN upgrade command is the CAN upgrade end command.

[0037] Optionally, in another possible implementation of the second aspect, the upgrade step includes a file size sending step, the serial port file size instruction includes the length of the file data used for the upgrade, and the first conversion module further includes:

[0038] The first generation unit is used to generate the total number of upgrade file packages based on the length of the file data and the first preset number of bytes, wherein the first preset number of bytes is the maximum length of the file data for upgrade sent by the upgrade terminal in a single transmission.

[0039] The first conversion unit is used to convert the serial port upgrade file size instruction into the CAN upgrade file size instruction based on the function code field and the total number of upgrade file packages.

[0040] Optionally, in another possible implementation of the second aspect, the aforementioned photovoltaic energy storage system battery upgrade device further includes:

[0041] The third transmitting module is used to send a CAN file packet serial number instruction to the battery pack, wherein the CAN file packet serial number instruction includes the serial number corresponding to the file data;

[0042] The third receiving module is used to receive the CAN file packet serial number reply command sent by the battery pack.

[0043] Optionally, in another possible implementation of the second aspect, the upgrade step includes a step of sending upgrade file data, the serial port upgrade file instruction includes file data for upgrade, and the first conversion module includes:

[0044] The second conversion unit converts the serial port upgrade file instruction into multiple CAN upgrade file instructions based on the file data, the function code field, and the second preset number of bytes. The number of CAN upgrade file instructions is determined based on the length of the file data and the second preset number of bytes, which is the maximum length of the file data sent to the battery pack in a single transmission.

[0045] Optionally, in another possible implementation of the second aspect, the upgrade steps include a termination upgrade step, and the first sending module includes:

[0046] The transmitting unit is used to send various CAN upgrade file instructions to the battery pack;

[0047] The second generation unit is used to generate CRC check values ​​according to the instructions in each CAN upgrade file.

[0048] The upgrade unit is used to generate a CAN check value command based on the CRC check value and send the CAN check value command to the battery pack to upgrade the battery pack.

[0049] Thirdly, this application also provides a terminal device. The terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor executes the computer program to implement any of the implementation methods described in the first aspect.

[0050] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the method of any of the implementations of the first aspect described above.

[0051] Fifthly, this application also provides a computer program product that, when run on an electronic device, causes the electronic device to execute any of the implementation methods of the first aspect described above.

[0052] The beneficial effects of this application embodiment compared with the prior art are as follows: by converting the serial port upgrade command according to the function code field in the serial port upgrade command, a CAN upgrade command matching the battery pack interface is generated to upgrade the battery pack, thereby solving the problem that the serial port command cannot be directly transmitted to the battery pack through the CAN interface, and without changing the hardware or requiring technical support from the battery manufacturer's after-sales personnel, saving labor maintenance costs and hardware costs. Attached Figure Description

[0053] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0054] Figure 1 This is a schematic flowchart of a photovoltaic energy storage system battery upgrade method provided in an embodiment of this application;

[0055] Figure 2 This is a schematic diagram illustrating the communication between the upgrade terminal, monitoring software, and battery pack provided in one embodiment of this application;

[0056] Figure 3 This is a schematic diagram of the structure of the photovoltaic energy storage system battery upgrade device provided in the embodiments of this application;

[0057] Figure 4 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application. Detailed Implementation

[0058] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0059] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0060] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0061] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0062] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0063] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0064] A photovoltaic energy storage system is a renewable energy system that combines photovoltaic technology and energy storage technology. It includes an energy storage inverter and a battery pack, which are tightly sealed in a single unit. Figure 2 As shown, the energy storage inverter includes monitoring software. The communication interface of the battery pack is a CAN interface, while the external communication interface of the energy storage inverter is a serial port. All data interaction and software upgrades need to go through this serial port. However, the data transmitted through the serial port cannot be directly sent to the battery pack through the CAN port.

[0065] Photovoltaic energy storage systems utilize the photoelectric effect to convert light energy into electrical energy. Therefore, the battery pack is crucial in photovoltaic energy storage systems. With the continuous development of photovoltaic energy storage technology, battery pack upgrades are necessary. Current technologies either modify the battery pack interface to a serial port or directly upgrade the battery pack using a USB flash drive. However, these methods require hardware modifications or technical support from the battery manufacturer's after-sales personnel, leading to wasted manpower maintenance costs and hardware costs.

[0066] Based on this, this application creatively proposes a method for generating CAN instructions from serial port instructions, utilizing the function code field in the serial port instructions to convert the serial port instructions into CAN instructions. The following description, with reference to the accompanying drawings, details the photovoltaic energy storage system battery upgrade method, apparatus, terminal equipment, storage medium, and computer program provided in this application.

[0067] Figure 1 The illustration shows a flowchart of a method for upgrading a photovoltaic energy storage system battery according to an embodiment of this application.

[0068] Step 101: Receive the serial port upgrade command sent by the upgrade terminal, wherein the serial port upgrade command includes a function code field used to distinguish each upgrade step.

[0069] First, the serial port command framework format in this application will be introduced:

[0070] (1) The format of the serial port command received from the upgrade terminal is as follows:

[0071]

[0072] (2) The serial port command frame format for replying to the upgrade terminal is as follows:

[0073]

[0074] For example, the bit numbers in the serial port instruction frame can be defined as follows: Frame start: "0xAA" 0xAA”; Inverter address: “0x01”; Upgrade terminal address: “0x01”; Control code: “0x34”; Function code: “Start upgrade—0x81, Send file size—0x82, Send upgrade file data—0x83, End upgrade—0x84”; Data length: CPU code + total number of bytes occupied by data content (if the data length is 1, that is, the data length is only 1 byte of CPU code, and the data content is none), the data length of the reply instruction is generally 2, and the data content is only 1 byte. Returning “0x06” means the data verification is correct, returning “0x15” means the data verification is incorrect, and if an error is returned, the upgrade is abandoned; CPU code: “0x03”; Data content: Filled as needed. If the data length is 1, that is, the data length is only 1 byte of CPU code, and the data content is none; Checksum: Summed up all bytes before the checksum and then bitwise inverted and 1 added; Frame end: “0xCC 0xCC”, all numbers are represented in hexadecimal.

[0075] (3) The CAN instruction frame format is as follows:

[0076] CANID Data length Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte7 CMD

[0077] For example, the CAN command frame can be defined as follows: the CAN ID in the CAN command sent by the monitoring software is “0x100”, and the CAN ID in the CAN command sent by the battery pack is “0x140”. Byte0 is an identification field (except for the CAN upgrade file command), used to distinguish different upgrade steps. In the CAN command sent by the monitoring software: “Start upgrade—0x10, send file size—0x20, send packet sequence number—0x30, send CRC check value—0x35, end upgrade—0x40”.

[0078] As one possible implementation of this application, when upgrading the battery pack, a serial port upgrade command sent by the upgrade terminal can be received. The serial port upgrade command is generated according to the above-mentioned serial port command framework and can be transmitted through the serial port interface. It can include a function code field to distinguish each upgrade step. The function code field can be different code values ​​to represent the function of each command. The specific function and the corresponding code value can be pre-agreed and generated by the upgrade terminal and the monitoring software.

[0079] Furthermore, the upgrade steps may include a start upgrade step, a file size sending step, an upgrade file data sending step, and an end upgrade step, thereby sending instructions to the battery pack at both the start and end of the upgrade, improving the success rate of the battery pack upgrade. That is, in one possible implementation of this application embodiment, the above upgrade steps may include: a start upgrade step, a file size sending step, an upgrade file data sending step, and an end upgrade step;

[0080] When the upgrade step is to start the upgrade step, the serial port upgrade command is the serial port upgrade start command, and the CAN upgrade command is the CAN upgrade start command.

[0081] When the upgrade step is to send the file size, the serial port upgrade command is the serial port upgrade file size command, and the CAN upgrade command is the CAN upgrade file size command.

[0082] When the upgrade step involves sending upgrade file data, the serial port upgrade command is the serial port upgrade file command, and the CAN upgrade command is the CAN upgrade file command.

[0083] When the upgrade step is to end the upgrade step, the serial port upgrade command is the serial port upgrade end command, and the CAN upgrade command is the CAN upgrade end command.

[0084] As one possible implementation of this application, the upgrade process can be divided into an upgrade start step, a file size sending step, an upgrade file data sending step, and an upgrade end step. The upgrade start step involves sending a command to the battery pack to notify it that the upgrade is about to begin. The file size sending step involves sending the upgrade file size to the battery pack. The upgrade file data sending step involves sending the upgrade file data to the battery pack via a command. The upgrade end step indicates that the upgrade has ended via a command. During the upgrade start step, the monitoring software can receive a serial upgrade start command sent by the upgrade terminal via a serial port and convert it into a CAN upgrade start command. After receiving the command indicating this step, the battery pack stops running and enters Bootloader mode to wait for the upgrade. During the file size sending step, the monitoring software can receive a serial upgrade file size command sent by the upgrade terminal via a serial port and convert it into a CAN upgrade file size command. During the upgrade file data sending step, the monitoring software can receive a serial upgrade file command sent by the upgrade terminal via a serial port and convert it into a CAN upgrade file command. During the upgrade end step, the monitoring software can receive a serial upgrade end command sent by the upgrade terminal via a serial port and convert it into a CAN upgrade end command.

[0085] For example, the upgrade terminal can be an upgrade tool such as a host computer used to send upgrade commands. The received serial port upgrade start command is:

[0086]

[0087] The function code "0x81" indicates that the upgrade process has begun.

[0088] For example, if the file data length is 166KB, which is 166 × 1024B = 169984B, and converted to hexadecimal is 0x00029800, then according to big-endian padding to the serial port file size upgrade command, it can be represented as:

[0089]

[0090] The function code "0x82" indicates the step of sending the file size.

[0091] For example, the file data used for upgrading can be Bin file data. After receiving the instruction to confirm the battery pack upgrade, the system can receive a serial port upgrade file instruction sent by the host computer. The serial port upgrade file instruction can be represented as:

[0092]

[0093] Example of data content: "2A 02 00 00 04 00 3E BC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 5A 3A 04 80 0000 00 7E DA F4 30 0 ... 22 00 96 94 0A 48 92 48 52 10 68F6 2B48 92 48 52 10 67 0A 58 48 8F 00B3 80D8 23 2B 94 0A 4892 48A8 0E 5A 3A 20A492 00 76 1F 02”.

[0094] In the example above, "0x83" in the function code field indicates that the current instruction is to send upgrade file data, and the file data is 128 bytes long.

[0095] For example, the serial port upgrade end command can be represented as:

[0096]

[0097] The function code "0x84" indicates that the upgrade process has ended.

[0098] Step 102: Convert the serial port upgrade command into a CAN upgrade command based on the function code field. The CAN upgrade command includes an identifier field corresponding to the function code field.

[0099] As one possible implementation of this application, after receiving the serial port upgrade command, the value of the function code field of the serial port upgrade command can be determined, the upgrade step corresponding to the serial port upgrade command can be determined according to the value of the function code field, and the value of the identifier field in the CAN upgrade command corresponding to the upgrade step can be determined according to the CAN communication rules agreed between the monitoring software and the battery pack, thereby converting the serial port upgrade command into a CAN upgrade command.

[0100] For example, when the upgrade process begins, the serial port upgrade command is the serial port upgrade start command, and the CAN upgrade command is the CAN upgrade start command. Converting the serial port upgrade start command in the example above, the generated CAN upgrade start command can be represented as:

[0101] CANID Data length Byte0 Byte1 Byte2 0x100 3 0x10 0x8C 0xBE

[0102] Among them, the identifier field "0x10" is the identifier field value in the CAN upgrade command that indicates the start of the upgrade, and "0x8C" and "0xBE" are special characters that are pre-defined in the CAN upgrade command to indicate the start of the upgrade step.

[0103] As an example, when the upgrade step ends, the serial port upgrade command is the serial port upgrade file size command, and the CAN upgrade command is the CAN upgrade file size command. Converting the serial port upgrade end command in the above example, the generated CAN upgrade end command can be represented as:

[0104] CANID Data length Byte0 Byte1 Byte2 0x100 3 0x40 0x41 0x42

[0105] Among them, "0x41" and "0x42" are special characters that indicate the end of the upgrade process.

[0106] Furthermore, when the upgrade step corresponding to the current serial port instruction is determined to be a file size sending step based on the function code field in the serial port instruction, the amount of data used for the upgrade file may be very large, exceeding the amount of data that the serial port can transmit in a single transmission. Therefore, the upgrade terminal needs to split the file data used for the upgrade and send it through multiple serial port upgrade file instructions. Thus, based on the length of the file data in the serial port instruction and the maximum length of file data that the serial port interface can send in a single transmission, the number of file data packets to be sent can be determined, and the total number of file packets can be sent to the battery pack, thereby improving the success rate of the battery pack upgrade. That is, in one possible implementation of this application embodiment, the above upgrade step includes a file size sending step, the above serial port file size instruction includes the length of the file data used for the upgrade, and the above conversion of the serial port upgrade instruction into a CAN upgrade instruction based on the function code field may include:

[0107] Based on the length of the file data and the first preset number of bytes, the total number of upgrade file packets is generated, where the first preset number of bytes is the maximum length of the file data sent by the upgrade terminal for upgrade in a single transaction;

[0108] Based on the function code field and the total number of upgrade files, the serial port upgrade file size instruction is converted into a CAN file size instruction.

[0109] As one possible implementation of this application, the first preset byte count is the maximum length of the file data sent by the upgrade terminal in a single transmission. The total number of upgrade file packets can be determined by dividing the length of the file data in the serial port upgrade file size instruction by the first preset byte count (if there is a remainder after division, add 1). Based on the value of the function code field, the value of the identifier field in the CAN upgrade file size instruction is determined, and the total number of upgrade file packets is converted to hexadecimal and filled into the CAN upgrade file size instruction in big-endian mode to generate the CAN upgrade file size instruction. In this way, the battery pack can determine whether the file data transmission is complete based on the total number of upgrade file packets, thereby avoiding upgrade failures caused by data transmission errors and improving the success rate of battery upgrades.

[0110] For example, in the serial port upgrade file size instruction in the above example, the file data length is 169984. Assuming the maximum length of file data sent by the upgrade terminal in a single serial port transmission is 128 bytes, the total number of upgrade file packets is 169984 / 128 = 1328 (if not an integer, the data content in the last serial port upgrade file instruction sent by the upgrade terminal may be less than 128 bytes, which can be padded with "0xFF"). Converted to hexadecimal, this is 0x0530. According to the convention, the identifier field corresponding to the file size transmission step is "0x20". The CAN upgrade file size instruction can be represented as:

[0111] CANID Data length Byte0 Byte1 Byte2 0x100 3 0x20 0x05 0x30

[0112] Furthermore, since the upgrade terminal needs to split the file data used for the upgrade and send it through multiple serial port upgrade file commands, it is also necessary to send the sequence number corresponding to the file data to be sent to the battery pack before generating the CAN upgrade file command. That is, in one possible implementation of this application embodiment, before step 102 above, the following may be included:

[0113] Send a CAN file packet serial number instruction to the battery pack, wherein the CAN file packet serial number instruction includes the serial number corresponding to the file data used for upgrade;

[0114] Receive the CAN file packet serial number reply command sent by the battery pack.

[0115] As one possible implementation, the received serial port upgrade file instructions can be counted to determine the sequence number of the file data received for upgrade. A CAN file packet sequence number instruction can be generated based on a pre-agreed identifier field that represents the serial number of the transmission packet, and then sent to the battery pack through the CAN interface.

[0116] As an example, assuming the current serial port upgrade file instruction corresponds to the sequence number 1, which is represented as 0x01 in hexadecimal, then "0x01" can be filled into the CAN file packet sequence number instruction in big-endian mode. This CAN file packet sequence number instruction can be represented as:

[0117] CANID Data length Byte0 Byte1 Byte2 0x100 3 0x30 0x00 0x01

[0118] As one possible implementation of this application, the battery pack can respond after receiving the CAN file packet serial number instruction. Therefore, the monitoring software can also receive the CAN file packet serial number reply instruction sent by the battery pack through the CAN interface. The CAN file packet serial number reply instruction includes the identification field Byte0 and Byte1 and Byte2, which are the same as the CAN file packet serial number instruction.

[0119] As an example, the identifier field Byte0 can be "0x70", indicating that the sent command is a CAN file packet sequence number reply command. The CAN file packet sequence number reply command corresponding to the above CAN file packet sequence number command can be represented as:

[0120] CANID Data length Byte0 Byte1 Byte2 0x140 3 0x70 0x00 0x01

[0121] Furthermore, since the maximum number of bytes that the CAN interface can send at one time is less than the maximum number of bytes that the serial port can send at one time, when the upgrade step is the step of sending upgrade file data, the file data in each serial port command can be split according to the maximum number of bytes that the CAN interface can send at one time. The file data in the serial port command can then be sent to the battery pack through multiple CAN commands, thereby improving the upgrade efficiency of the battery pack. That is, in one possible implementation of this application embodiment, the above upgrade step includes the step of sending upgrade file data, the above serial port upgrade file command includes file data for upgrade, and the above step 102 may include:

[0122] Based on the file data, function code field, and second preset byte count, the serial port upgrade file instruction is converted into multiple CAN upgrade file instructions. The number of CAN upgrade file instructions is determined according to the length of the file data and the second preset byte count, which is the maximum length of the file data sent to the battery pack in a single transmission.

[0123] As one possible implementation of this application, the second preset byte number is the maximum length of file data that the CAN interface can send to the battery pack at one time. The number of CAN upgrade file instructions can be determined based on the length of the file data used for upgrade and the second preset byte number. That is, the length of the file data can be divided by the second preset byte number (usually the length of the file data transmitted through a single serial port upgrade file instruction is an integer multiple of the second preset byte number) to determine the number of CAN upgrade file instructions. The file data is split according to the second preset byte number, and the CAN upgrade file instructions are generated based on the split file data.

[0124] As an example, assuming the file data length for the upgrade is 128 bytes and the second preset number of bytes is 8 bytes, then 16 CAN upgrade file instructions need to be generated, with each 8 bytes determining one CAN upgrade file instruction (each byte corresponds to one Byte bit, filled sequentially from Byte0 to Byte7).

[0125] As one possible implementation of this application, after sending the CAN upgrade file instruction, there is no need for the battery pack to return a reply instruction. The Byte0 bit in the CAN upgrade file instruction is used to transmit file data and does not include an identification field. Therefore, the CANID in the CAN upgrade file instruction can be different from other instructions.

[0126] As an example, if the serial port upgrade file instruction in the above example is received, it can be determined that the value "0x83" of the function code field is the agreed code value for sending upgrade file data. The file data can be split, for example, into segments of 8 bytes each, which can be split into 16 segments, generating 16 CAN upgrade file instructions. The CANID in the CAN upgrade file instruction can be represented by "0x180". The CAN upgrade file instruction generated based on the first 8 bytes (2A 0200 00 04 00 3E BC) of the data content of the above serial port upgrade file instruction can be represented as:

[0127] CANID Data length Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte7 0x180 0x08 0x2A 0x02 0x00 0x00 0x04 0x00 0x3E 0xBC

[0128] Step 103: Send the CAN upgrade command to the battery pack to upgrade the battery pack.

[0129] As one possible implementation, the monitoring software of the energy storage inverter can send CAN upgrade commands to the battery pack (e.g., to the battery management system of the battery pack) to upgrade it.

[0130] Furthermore, after the monitoring software of the energy storage inverter sends each packet of file data to the battery pack, it can send the CRC checksum corresponding to each packet of file data calculated by the monitoring software to the battery pack. At this time, the battery pack will also calculate the CRC checksum of the received packet of file data and reply to the monitoring software to verify the correctness of the data. If the checksums match, the upgrade step can continue; if the checksums do not match, the transmission of file data is terminated, the upgrade is abandoned, and the battery pack reverts to the software before the upgrade, thereby avoiding battery pack upgrade failure due to data errors. That is, in one possible implementation of the embodiments of this application, the above step 103 may include:

[0131] Send each CAN upgrade file instruction to the battery pack;

[0132] Generate CRC checksum values ​​based on the instructions in each CAN upgrade file;

[0133] Generate a CAN check value command based on the CRC check value, and send the CAN check value command to the battery pack to upgrade the battery pack;

[0134] As one possible implementation, during the step of sending upgrade file data, the file data for upgrade sent via serial port is transmitted in multiple packets. One packet of file data corresponds to one serial port upgrade command, and one serial port upgrade command can be converted into multiple CAN upgrade file commands. After sending each CAN upgrade file command to the battery pack, a CRC check value can be calculated for the file data in the multiple CAN upgrade file commands corresponding to each serial port upgrade command. Specifically, it can be calculated according to the CRC16 check algorithm. The CRC check value is filled in big-endian mode, and a CAN check value command is generated according to the agreed identifier field. The CAN check value command is then sent to the battery pack to upgrade the battery pack. After receiving the CAN check value command, if the verification is correct, the battery pack will perform the upgrade.

[0135] For example, after the monitoring software sends 128 bytes per packet via 16 CAN upgrade file instructions (each instruction sending 8 bytes), it can calculate a 128-byte CRC checksum and send it to the battery pack. After receiving the 16 packets of 8-byte data, the battery pack will also calculate a 128-byte CRC checksum and reply to the monitoring software. Assuming the CRC checksum value is "0xDFE8", and according to the convention, the identifier field for sending the CRC checksum is "0x35", then the CAN checksum instruction can be represented as:

[0136] CANID Data length Byte0 Byte1 Byte2 0x100 3 0x35 0xDF 0xE8

[0137] As one possible implementation, the battery pack can calculate the CRC check value corresponding to the actual received file data based on the received CAN upgrade file instruction, compare it with the CRC check value sent by the monitoring software, generate a check value comparison result, generate an identification field based on the comparison result, and generate a CAN check value reply instruction based on the CRC check value corresponding to the actual received file data, and send it to the monitoring software. The monitoring software can receive the CAN check value reply instruction sent by the battery pack.

[0138] As one possible implementation of this application, before the file data for the upgrade is completely transmitted, the battery pack can write the transmitted file data into the Flash backup area. If an error occurs during the file data transmission process, the serial port will interrupt the transmission, abandon the upgrade, and restore the normal operation of the program before the upgrade. If the checksum of all file data is successfully compared during the transmission, the file data will be written from the Flash backup area to the Flash application area to upgrade to the latest program.

[0139] For example, the file used for the upgrade is 169,984 bytes in size. Each serial port upgrade file command sends 128 bytes, and each CAN upgrade file command sends 8 bytes. Each serial port upgrade file command corresponds to 16 CAN upgrade file commands. Therefore, it takes 1,328 serial port upgrade file commands to complete the entire file transfer. After every 16 CAN upgrade file commands are sent, a CAN checksum command can be sent. If the battery pack receives 1,328 checksum commands and they are all correctly matched, then the battery upgrade operation can be performed.

[0140] Furthermore, after the monitoring software sends the CAN upgrade command to the battery pack, the battery pack will respond to the received CAN command via the CAN interface. The monitoring software can receive the CAN response command sent by the battery pack, convert the CAN response command into a serial port response command, and send it to the upgrade terminal, thereby further improving the success rate of the battery pack upgrade. That is, in one possible implementation of this application embodiment, after step 103 above, it may further include:

[0141] Receive the CAN response command corresponding to the CAN upgrade command sent by the battery pack, wherein the CAN response command includes an identification field;

[0142] Based on the identifier field, the CAN response command is converted into a serial port response command;

[0143] Send the serial port reply command to the upgrade terminal.

[0144] As one possible implementation of this application, after the battery pack receives the CAN upgrade command, it generates a corresponding CAN reply command. The monitoring software can receive the CAN reply command sent by the battery pack through the CAN interface, convert the CAN reply command into a corresponding serial port reply command according to the identifier field in the CAN reply command, and send the serial port reply command to the upgrade terminal. The serial port reply command includes the inverse code of the function code in the corresponding serial port upgrade command.

[0145] As an example, when the CAN upgrade command corresponds to the start of the upgrade step, the CAN reply command can include the identifier field and special characters corresponding to the reply "upgrade start step". The CAN reply command can be represented as:

[0146] CANID Data length Byte0 Byte1 Byte2 0x140 3 0x50 0xCC 0xFE

[0147] In this context, the identifier field "0x50" is the code value in the CAN command that corresponds to the reply to the CAN upgrade start command, while "0xCC" and "0xFE" are special characters pre-defined in the CAN command that correspond to the reply to the CAN upgrade start command. Converting this to a serial port reply command, the serial port reply command corresponding to the start upgrade step can be represented as:

[0148]

[0149] As an example, when the CAN upgrade command corresponds to the step of sending file size, the CAN reply command can include an identifier field corresponding to "sent file size" and the length of the file data. The CAN reply command can be represented as:

[0150] CANID Data length Byte0 Byte1 Byte2 0x140 3 0x60 0x05 0x30

[0151] In this context, the identifier field "0x60" represents the code value corresponding to the CAN file size reply instruction in the CAN command, while "0x05" and "0x30" represent the length of the file data in the CAN file size instruction. Converting this to a serial port reply instruction, the serial port reply instruction corresponding to the file size sending step can be represented as:

[0152]

[0153] As an example, when the CAN upgrade command corresponds to the step of sending upgrade file data, the CAN reply command can include an identifier field corresponding to "sending upgrade file data" and a CRC checksum value corresponding to the actual received file data. The CAN reply command can be represented as:

[0154] CANID Data length Byte0 Byte1 Byte2 0x140 3 0x75 / 0x74 0xDF 0xE8

[0155] In this context, "0x75" and "0x74" are the values ​​corresponding to the identifier field, indicating successful and unsuccessful checksum matching, respectively. "0xDF" and "0xE8" are the CRC checksum values ​​corresponding to the actual received file data, filled in big-endian mode. The checksum matching success or failure can be determined based on the identifier field, converted into a code value representing success or failure in the serial port command, and then filled into the data content of the serial port command to generate a serial port reply command. The serial port reply command can be represented as:

[0156] As an example, when the CAN upgrade command corresponds to the end of the upgrade step, the CAN reply command can include an identifier field corresponding to replying "end upgrade" and a special character for the battery pack to reply to the end of the upgrade step. The CAN reply command can be represented as:

[0157] CANID Data length Byte0 Byte1 Byte2 0x140 3 0x80 0x81 0x82

[0158] Wherein, "0x80" is the agreed-upon identifier field used to reply with the CAN upgrade completion command, and "0x81" and "0x82" are agreed-upon special characters for the battery pack's upgrade completion reply steps. Converted to a serial port reply command, it can be represented as:

[0159]

[0160] As one possible implementation of this application, the correspondence between the function code field in the serial port instruction and the identifier field in the CAN instruction corresponding to each step can be determined by the following serial-to-CAN conversion protocol:

[0161]

[0162]

[0163] It should be noted that the values ​​corresponding to each bit number of the above instructions are merely illustrative. In actual use, they can be determined according to actual usage requirements and application scenarios. This application embodiment does not limit this.

[0164] The photovoltaic energy storage system battery upgrade method provided in this application upgrades the battery pack by converting the serial port upgrade command according to the function code field in the serial port upgrade command, generating a CAN upgrade command that matches the battery pack interface, and upgrading the battery pack. This solves the problem that serial port commands cannot be directly transmitted to the battery pack through the CAN interface, and requires no hardware changes or technical support from battery manufacturer after-sales personnel, saving labor maintenance costs and hardware costs. Furthermore, the method splits the file data used for upgrade in the serial port upgrade file command into packets, solving the problem of inconsistent maximum data transmission length between the serial port and the CAN port. The method converts the start upgrade command, upgrade file size command, upgrade file command, and end upgrade command transmitted through the serial port into CAN commands and sends them to the battery pack. The CAN interface reply command of the battery pack is converted into a serial port command and sent to the upgrade terminal. This allows the battery pack to determine whether the upgrade file has been transmitted completely based on the total length of the upgrade file and the end upgrade command, avoiding upgrade failures due to data transmission interruptions. In addition, a checksum is sent to the battery pack, and the battery pack's reply result is converted into a serial port command and sent to the upgrade terminal, avoiding upgrade failures due to data transmission errors, thus improving the success rate and safety of battery upgrades.

[0165] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0166] Corresponding to the photovoltaic energy storage system battery upgrade method in the above embodiment, Figure 3 A structural block diagram of a photovoltaic energy storage system battery upgrade device provided in an embodiment of this application is shown. For ease of explanation, only the parts related to the embodiment of this application are shown.

[0167] Reference Figure 3 The device 30 includes:

[0168] The first receiving module 31 receives the serial port upgrade command sent by the upgrade terminal, wherein the serial port upgrade command includes a function code field used to distinguish each upgrade step;

[0169] The first conversion module 32 converts the serial port upgrade command into a CAN upgrade command based on the function code field. The CAN upgrade command includes an identifier field corresponding to the function code field.

[0170] The first transmitting module 33 sends the CAN upgrade command to the battery pack to upgrade the battery pack.

[0171] In practical use, the photovoltaic energy storage system battery upgrade device provided in this application embodiment can be configured in any terminal device to execute the aforementioned photovoltaic energy storage system battery upgrade method.

[0172] The photovoltaic energy storage system battery upgrade device provided in this application upgrades the battery pack by converting the serial port upgrade command according to the function code field in the serial port upgrade command, generating a CAN upgrade command that matches the battery pack interface, and upgrading the battery pack. This solves the problem that serial port commands cannot be directly transmitted to the battery pack through the CAN interface, and does not require hardware changes or technical support from battery manufacturer after-sales personnel, saving labor maintenance costs and hardware costs.

[0173] In one possible implementation of this application, the aforementioned photovoltaic energy storage system battery upgrade device 30 further includes:

[0174] The second receiving module receives the CAN response command corresponding to the CAN upgrade command sent by the battery pack, wherein the CAN response command includes an identification field;

[0175] The second conversion module converts the CAN response command into a serial port response command based on the identifier field.

[0176] The second sending module sends the serial port reply command to the upgrade terminal.

[0177] Furthermore, in another possible implementation of this application, the above upgrade steps include: a start upgrade step, a file size sending step, an upgrade file data sending step, and an end upgrade step;

[0178] When the upgrade step is to start the upgrade step, the serial port upgrade command is the serial port upgrade start command, and the CAN upgrade command is the CAN upgrade start command.

[0179] When the upgrade step is to send the file size, the serial port upgrade command is the serial port upgrade file size command, and the CAN upgrade command is the CAN upgrade file size command.

[0180] When the upgrade step is to send upgrade file data, the serial port upgrade command is the serial port upgrade file command, and the CAN upgrade command is the CAN upgrade file command.

[0181] When the upgrade step is to end the upgrade step, the serial port upgrade command is the serial port upgrade end command, and the CAN upgrade command is the CAN upgrade end command.

[0182] Furthermore, in another possible implementation of this application, the upgrade step includes a file size sending step, the serial port file size instruction includes the length of the file data used for the upgrade, and the first conversion module further includes:

[0183] The first generation unit is used to generate the total number of upgrade file packages based on the length of the file data and the first preset number of bytes, wherein the first preset number of bytes is the maximum length of the file data for upgrade sent by the upgrade terminal in a single transmission.

[0184] The first conversion unit is used to convert the serial port upgrade file size instruction into the CAN upgrade file size instruction based on the function code field and the total number of upgrade file packages.

[0185] Furthermore, in yet another possible implementation of this application, the aforementioned photovoltaic energy storage system battery upgrade device further includes:

[0186] The third transmitting module is used to send a CAN file packet serial number instruction to the battery pack, wherein the CAN file packet serial number instruction includes the serial number corresponding to the file data;

[0187] The third receiving module is used to receive the CAN file packet serial number reply command sent by the battery pack.

[0188] Furthermore, in another possible implementation of this application, the above-mentioned upgrade step includes a step of sending upgrade file data, and the above-mentioned serial port upgrade file instruction includes file data for upgrade. The above-mentioned first conversion module includes:

[0189] The second conversion unit converts the serial port upgrade file instruction into multiple CAN upgrade file instructions based on the file data, the function code field, and the second preset number of bytes. The number of CAN upgrade file instructions is determined based on the length of the file data and the second preset number of bytes, which is the maximum length of the file data sent to the battery pack in a single transmission.

[0190] Furthermore, in another possible implementation of this application, the above-mentioned upgrade step includes a termination upgrade step, and the above-mentioned first sending module includes:

[0191] The transmitting unit is used to send various CAN upgrade file instructions to the battery pack;

[0192] The second generation unit is used to generate CRC check values ​​according to the instructions in each CAN upgrade file.

[0193] The upgrade unit is used to generate a CAN check value command based on the CRC check value and send the CAN check value command to the battery pack to upgrade the battery pack.

[0194] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0195] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0196] To implement the above embodiments, this application also proposes a terminal device.

[0197] Figure 4 This is a schematic diagram of the structure of a terminal device according to an embodiment of this application.

[0198] like Figure 4 As shown, the terminal device 200 includes:

[0199] The system includes a memory 210 and at least one processor 220, and a bus 230 connecting different components (including the memory 210 and the processor 220). The memory 210 stores a computer program, which, when executed by the processor 220, implements the photovoltaic energy storage system battery upgrade method described in this application embodiment.

[0200] Bus 230 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.

[0201] Terminal device 200 typically includes various electronically readable media. These media can be any available media that can be accessed by terminal device 200, including volatile and non-volatile media, removable and non-removable media.

[0202] Memory 210 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 240 and / or cache memory 250. Terminal device 200 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 260 may be used to read and write non-removable, non-volatile magnetic media (…). Figure 4 Not shown; usually referred to as a "hard drive"). Although Figure 4 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 230 via one or more data media interfaces. Memory 210 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application.

[0203] A program / utility 280 having a set (at least one) of program modules 270 may be stored in, for example, memory 210. Such program modules 270 include—but are not limited to—an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 270 typically perform the functions and / or methods described in the embodiments of this application.

[0204] Terminal device 200 can also communicate with one or more external devices 290 (e.g., keyboard, pointing device, display 291, etc.), and with one or more devices that enable a user to interact with terminal device 200, and / or with any device that enables terminal device 200 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 292. Furthermore, terminal device 200 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 293. As shown, network adapter 293 communicates with other modules of terminal device 200 via bus 230. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with terminal device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0205] The processor 220 performs various functional applications and data processing by running programs stored in the memory 210.

[0206] It should be noted that the implementation process and technical principles of the terminal device in this embodiment are explained in the foregoing description of the photovoltaic energy storage system battery upgrade method in this application embodiment, and will not be repeated here.

[0207] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.

[0208] This application provides a computer program product that, when run on a terminal device, enables the terminal device to implement the steps described in the various method embodiments above.

[0209] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographing device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0210] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0211] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0212] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0213] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0214] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method for upgrading batteries in a photovoltaic energy storage system, characterized in that, The method is applied to the energy storage inverter of a photovoltaic energy storage system, and the method includes: Receive serial port upgrade instructions sent by the upgrade terminal, wherein the serial port upgrade instructions include a function code field used to distinguish each upgrade step; Based on the function code field, the serial port upgrade instruction is converted into a CAN upgrade instruction, wherein the CAN upgrade instruction includes an identifier field corresponding to the function code field; The CAN upgrade command is sent to the battery pack to upgrade the battery pack; Receive a CAN response command corresponding to the CAN upgrade command sent by the battery pack, wherein the CAN response command includes the identification field; Based on the identification field, the CAN response command is converted into a serial port response command; Send the serial port reply command to the upgrade terminal; The upgrade steps include: starting the upgrade, sending the file size, sending the upgrade file data, and ending the upgrade. When the upgrade step is the start upgrade step, the serial port upgrade command is the serial port upgrade start command, and the CAN upgrade command is the CAN upgrade start command; When the upgrade step is the file size sending step, the serial port upgrade instruction is the serial port file size upgrade instruction, and the CAN upgrade instruction is the CAN file size upgrade instruction; When the upgrade step is the step of sending upgrade file data, the serial port upgrade command is the serial port upgrade file command, and the CAN upgrade command is the CAN upgrade file command; When the upgrade step is the end upgrade step, the serial port upgrade command is the serial port upgrade end command, and the CAN upgrade command is the CAN upgrade end command.

2. The method as described in claim 1, characterized in that, The upgrade steps include the step of sending the file size, whereby the serial port file size instruction includes the length of the file data used for the upgrade, and the step of converting the serial port upgrade instruction into a CAN upgrade instruction according to the function code field includes: Based on the length of the file data and the first preset number of bytes, the total number of upgrade file packages is generated, wherein the first preset number of bytes is the maximum length of the file data sent by the upgrade terminal for upgrade in a single transmission; Based on the function code field and the total number of upgrade file packages, the serial port upgrade file size instruction is converted into the CAN upgrade file size instruction.

3. The method as described in claim 1, characterized in that, The upgrade step includes the step of sending upgrade file data. Before converting the serial port upgrade command into a CAN upgrade command based on the function code field, it further includes: Send a CAN file packet serial number instruction to the battery pack, wherein the CAN file packet serial number instruction includes the serial number corresponding to the file data; Receive the CAN file packet serial number reply command sent by the battery pack.

4. The method as described in claim 1, characterized in that, The upgrade step includes the step of sending upgrade file data, the serial port upgrade file instruction includes the file data for upgrading, and the step of converting the serial port upgrade instruction into a CAN upgrade instruction according to the function code field includes: Based on the file data, the function code field, and the second preset number of bytes, the serial port upgrade file instruction is converted into multiple CAN upgrade file instructions. The number of CAN upgrade file instructions is determined according to the length of the file data and the second preset number of bytes, where the second preset number of bytes is the maximum length of the file data sent to the battery pack in a single transmission.

5. The method as described in claim 1, characterized in that, The upgrade steps include the step of ending the upgrade, wherein sending the CAN upgrade command to the battery pack to upgrade the battery pack includes: Send each of the CAN upgrade file instructions to the battery pack; Generate CRC checksum values ​​according to the instructions in each of the CAN upgrade files; A CAN check value instruction is generated based on the CRC check value, and the CAN check value instruction is sent to the battery pack to upgrade the battery pack.

6. A battery upgrade device for a photovoltaic energy storage system, characterized in that, The device is used in the energy storage inverter of a photovoltaic energy storage system, and the device includes: The first receiving module receives a serial port upgrade command sent by the upgrade terminal, wherein the serial port upgrade command includes a function code field used to distinguish each upgrade step; The first conversion module converts the serial port upgrade instruction into a CAN upgrade instruction based on the function code field, wherein the CAN upgrade instruction includes an identifier field corresponding to the function code field; The first transmitting module sends the CAN upgrade command to the battery pack to upgrade the battery pack; The second receiving module is used to receive the CAN response command corresponding to the CAN upgrade command sent by the battery pack, wherein the CAN response command includes the identification field; The second conversion module is used to convert the CAN reply command into a serial port reply command based on the identification field. The second sending module is used to send the serial port reply command to the upgrade terminal; The upgrade steps include: starting the upgrade, sending the file size, sending the upgrade file data, and ending the upgrade. When the upgrade step is the start upgrade step, the serial port upgrade command is the serial port upgrade start command, and the CAN upgrade command is the CAN upgrade start command; When the upgrade step is the file size sending step, the serial port upgrade instruction is the serial port file size upgrade instruction, and the CAN upgrade instruction is the CAN file size upgrade instruction; When the upgrade step is the step of sending upgrade file data, the serial port upgrade command is the serial port upgrade file command, and the CAN upgrade command is the CAN upgrade file command; When the upgrade step is the end upgrade step, the serial port upgrade command is the serial port upgrade end command, and the CAN upgrade command is the CAN upgrade end command.

7. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it causes the terminal device to implement the method as described in any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by an electronic device, it implements the method as described in any one of claims 1 to 5.