Local upgrading method and system for new energy voltage and current detection equipment
By upgrading the software on the host computer of the new energy voltage and current detection equipment, the main control module and the sub-control module are upgraded separately. Encrypted firmware and TCP/IP communication are used to solve the high cost and versatility issues of equipment upgrades and achieve low-cost, high-efficiency , safe equipment upgrades.
Patent Information
- Application Number
- CN202410974974.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-10-22
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing new energy voltage and current detection equipment does not function as expected under specific working conditions, requiring hardware or software updates, and existing upgrade methods are costly, especially the upgrade of multi-module equipment, which has issues with versatility and safety.
Provide a local upgrade method for new energy voltage and current detection equipment. The main control module and sub-control module are upgraded separately through the host computer upgrade software. Encrypted firmware is used for error prevention, and TCP/IP network communication is used to accelerate the upgrade process. Combined with heartbeat information and packetized transport protocols to ensure security and efficiency.
It realizes low-cost, safe and efficient equipment upgrade locally, ensures the correctness of the firmware and the reliability of the equipment, supports continuous upgrade of multiple modules, and reduces logistics and labor costs.
Smart Images

Figure CN118819601A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of equipment upgrading, and in particular to a local upgrading method and system for new energy voltage and current detection equipment. Background Art
[0002] New energy voltage and current detection equipment is a device used to monitor and measure voltage and current in new energy systems. It plays a key role in new energy applications such as solar energy, wind energy, electric vehicles, etc. Here are some key points about this device: Function: (1) Voltage measurement: Accurately measure the voltage in new energy systems, usually supporting a wide range of voltage inputs.
[0003] (2) Current measurement: Monitor the current in the system to ensure that the equipment operates within a safe range.
[0004] (3) Data logging: Record voltage and current data for analyzing and monitoring system performance.
[0005] (4) Alarm function: When the voltage or current exceeds the set threshold, an alarm is issued to prevent equipment damage or other dangerous situations.
[0006] (4) Communication interface: Data is transmitted to the monitoring system or control center through the communication interface (such as RS485, CAN, Ethernet, etc.).
[0007] Application areas: (1) Solar power generation system: monitor the output voltage and current of solar panels to optimize power generation efficiency.
[0008] (2) Wind power generation system: monitor the electrical parameters of wind turbines to ensure stable operation of the system.
[0009] (3) Electric vehicles: monitor the voltage and current of electric vehicle batteries to ensure driving safety.
[0010] (4) Energy storage system: monitor the voltage and current of energy storage equipment and optimize charging and discharging management.
[0011] For new energy voltage and current detection equipment, it has been strictly tested before it is put on the market. However, there is always a loophole. It is possible that some functions do not meet expectations under specific working conditions. At this time, the equipment hardware or software needs to be updated. In many cases, software upgrades are sufficient. In addition, if customers need to add some functions to the existing hardware, the equipment firmware also needs to be upgraded.
[0012] Based on the above two situations, the new energy voltage and current detection equipment that has been shipped out of the factory should either be returned to the factory for repair or upgraded locally by the user. Obviously, upgrading locally by the user is cheaper. So in order to be able to upgrade locally by the user, a simple and easy method is needed, and a simple and easy-to-use upper computer upgrade software on the PC side is very much needed.
[0013] A manufacturer generally produces more than one type of new energy voltage and current detection equipment. It is very necessary to make the host computer upgrade software of this new energy voltage and current detection equipment universal. At the same time, new energy voltage and current detection equipment is generally composed of multiple modules, including the main control module and the sub-control module. This host computer upgrade software should be able to upgrade the main control module and the sub-control module separately.
[0014] At the same time, since this host computer upgrade software should load more than one type of firmware, error prevention must be done, otherwise the behavior of upgrading the firmware of type B detection device to type A detection device will often occur. In order to avoid this situation, it is very necessary to confirm the product information.
[0015] In addition, the possibility of the loaded firmware being tampered with cannot be ruled out. In order to avoid this situation, the firmware must be encrypted. After the encrypted firmware is loaded into the general platform host software, it must be de-shelled before further data transmission can be performed. Summary of the invention
[0016] In response to the above problems, the purpose of the present invention is to provide a local upgrade method and system for a new energy voltage and current detection device, which can make the upper computer upgrade software for upgrading the new energy voltage and current detection device universal and can upgrade the main control module and the sub-control module separately.
[0017] The above-mentioned object of the present invention is achieved through the following technical solutions: A local upgrade method for a new energy voltage and current detection device comprises the following steps: S1: Based on the UI module of the host computer upgrade software, fill in the basic information of the new energy voltage and current detection device to be upgraded, and select the firmware to be upgraded. After selection, the host computer upgrade software automatically loads and decrypts the encrypted file of the firmware to be upgraded, and uses the verification information in the encrypted file to check the correctness of the encrypted file; S2: The host computer upgrade software periodically sends heartbeat information to try to establish a connection with the new energy voltage and current detection device, creates a socket object, uses the bind command to bind the host and port number, and uses the listen command to listen to the connection to complete the three-way handshake with the new energy voltage and current detection device, and establishes a connection between the host computer upgrade software and the new energy voltage and current detection device to be upgraded; S3: After the connection is established, the host computer upgrade software sends heartbeat data to the new energy voltage and current detection device. After receiving the heartbeat data, the new energy voltage and current detection device uploads its respective product information to the UI module of the host computer upgrade software for display. On the UI module, the new energy voltage and current detection device to be upgraded is selected according to the product information. The host computer upgrade software subpackages the firmware to be upgraded and uses the transmission module to transmit data, and transmits the subpackages of the firmware to be upgraded to the selected new energy voltage and current detection device to be upgraded in turn.
[0018] Further, in step S1, based on the UI module, fill in the basic information of the new energy voltage and current detection device to be upgraded, and select the firmware to be upgraded. After the selection, the host computer upgrade software automatically loads and decrypts the encrypted file of the firmware to be upgraded, specifically: The basic information includes the IP address and PORT of the host computer upgrade software main module, and the device type and device ID of the new energy voltage and current detection device to be upgraded in the same network segment as the main module; Based on the UI module, the firmware to be upgraded is selected. After the selection, the host computer upgrade software automatically loads the encrypted file of the firmware to be upgraded, automatically decrypts the encrypted file, and checks the correctness of the encrypted file.
[0019] Further, the encrypted file of the firmware to be upgraded is decrypted, and the correctness of the encrypted file is checked using the verification information in the encrypted file, specifically: The encrypted file includes an information header, a burning program, a SHA encryption key and verification information, and the information header includes the product code, serial number and encryption date of the new energy voltage and current detection device; The encrypted file splices the information header and the burning program into a whole when encrypting, and uses an encryption algorithm to encrypt the whole of the information header and the burning program, so the SHA encryption key is used to decrypt the whole of the information header and the burning program when decrypting, and the information header is removed after decryption to retain the valid burning program; The SHA-256 algorithm is used to calculate the hash value of the decrypted data of the burning program, and the hash value is compared with the verification information. If they match, the encrypted file is correct, complete and has not been tampered with.
[0020] Further, in step S2, a connection is established between the host computer upgrade software and the new energy voltage and current detection device to be upgraded, specifically: After the new energy voltage and current detection device is powered on, the host computer upgrade software periodically sends heartbeat information to try to establish a connection with the new energy voltage and current detection device. After receiving the heartbeat information, the new energy voltage and current detection device uploads the device information including software version information, hardware version information, and compilation date to the host computer upgrade software. The host computer upgrade software displays the device information in the form of a list on the UI module.
[0021] Further, in step S3, after the connection is established, the host computer upgrade software automatically subpackages the firmware to be upgraded and uses the transmission module to transmit data, and sequentially transmits the subpackages of the firmware to be upgraded to the selected new energy voltage and current detection device to be upgraded, specifically: The size of the sub-packet is determined according to the receiving capability of the new energy voltage and current detection device. The upper computer upgrade software divides the firmware to be upgraded according to the size of each sub-packet and sequentially transmits the sub-packet to the main control module of the new energy voltage and current detection device. If the sub-packet data is the program of the main control module, the firmware to be upgraded is directly burned into the backup area of the main control module. If the sub-packet data is the program of the sub-control module, the firmware to be upgraded is transferred from the main control module to the program area of the sub-control module through the serial communication protocol CAN bus. The host computer upgrade software main module receives the transmission result data returned by the new energy voltage and current detection device, passes the transmission result data to the data analysis module to parse the data, passes the analysis result to the UI module for display, and at the same time transmits a part of the data to the transmission module through the structure, and the transmission module sends the remaining sub-packet data according to the validity of the returned data.
[0022] Among them, the size of the subpacket is determined according to the receiving capability of the new energy voltage and current detection device, specifically: a status byte for describing the subpacket receiving capability is set on the new energy voltage and current detection device, the status byte is represented by a binary representation of several bits, and the corresponding size of the subpacket is set for each binary value, and when the binary value of a certain bit is 1, the subpacket with a size matching the current bit is allowed to be transmitted.
[0023] Furthermore, the local upgrade method of the new energy voltage and current detection device further includes: transmitting each of the sub-packets using a fixed transmission protocol, wherein the transmission protocol is specifically: The transmission protocol adopts a protocol format of a message header, a message body and a checksum; The message header is used to indicate the sending direction of the subpacket, including two sending directions: the host computer upgrade software -> the new energy voltage and current detection device, and the new energy voltage and current detection device -> the host computer upgrade software; The message body includes the message body length and message body content. The message body content includes command word, device ID, message type, message command, total number of packages, sub-package number and data body. The command word adds the device type to be upgraded. The device type includes the main control device type and the sub-control device type. The message command includes message mechanisms including requesting connection, sending data, confirming receiving packets, disconnecting, and confirming disconnecting. The message types include types including upgrade, version information, and debugging information. The check word is used to compare with the check value of CRC32 check of all data of the message header and the message body of each subpacket. If the check value is found to be the same as the check word, it means that the subpacket is valid.
[0024] Furthermore, in the process of transmitting data in step S3, the abnormalities occurring in the data transmission are also monitored and displayed on the UI module, and recorded in the log, and the abnormal information includes abnormalities such as communication interruption, cancellation of upgrade, and no data return.
[0025] A local upgrade system for a new energy voltage and current detection device for executing the local upgrade method for the new energy voltage and current detection device as described above comprises: The UI module is used to fill in the basic information of the new energy voltage and current detection equipment to be upgraded, select the firmware to be upgraded, and display the abnormal monitoring information that occurs during data transmission; A transmission module, used for transmitting data to the new energy voltage and current detection device after the host computer upgrade software packages the firmware to be upgraded; A data analysis module, used to analyze the transmission result data and pass the analysis result to the UI module for display; The main module is used to receive the transmission result data returned by the new energy voltage and current detection device, and pass the transmission result data to the data analysis module for data analysis.
[0026] A computer device comprises a memory and one or more processors, wherein the memory stores computer codes, and when the computer codes are executed by the one or more processors, the one or more processors execute the above method.
[0027] A computer-readable storage medium stores computer codes. When the computer codes are executed, the above method is executed.
[0028] Compared with the prior art, the present invention has the following beneficial effects: (1) A local upgrade method for a new energy voltage and current detection device is provided, comprising: S1: based on a UI module of a host computer upgrade software, fill in the basic information of the new energy voltage and current detection device to be upgraded, and select the firmware to be upgraded. After the selection, the host computer upgrade software automatically loads and decrypts the encrypted file of the firmware to be upgraded, and uses the verification information in the encrypted file to check the correctness of the encrypted file; S2: the host computer upgrade software periodically sends heartbeat information to try to establish a connection with the new energy voltage and current detection device, creates a socket object, uses the bind command to bind the host and port number, and uses the listen command to listen to the connection to complete the connection with the new energy voltage and current detection device. The detection device performs a three-way handshake to establish a connection between the host computer upgrade software and the new energy voltage and current detection device to be upgraded; S3: After the connection is established, the host computer upgrade software sends heartbeat data to the new energy voltage and current detection device. After receiving the heartbeat data, the new energy voltage and current detection device uploads its own product information to the UI module of the host computer upgrade software for display. On the UI module, the new energy voltage and current detection device to be upgraded is selected according to the product information. The host computer upgrade software automatically subpackages the firmware to be upgraded and uses the transmission module to transmit data, and transmits the subpackages of the firmware to be upgraded to the selected new energy voltage and current detection device to be upgraded in turn. The above technical solution can make the host computer upgrade software for upgrading the new energy voltage and current detection device universal, and can upgrade the main control module and the sub-control module separately, and can perform error prevention and tampering prevention processing on the loaded firmware.
[0029] (2) The loaded burning program is encrypted, which can solve the problem of malicious modification of the program causing the burned program to become unusable, thus ensuring the reliability of the program. In addition, the encryption program is based on the burning program and adds the burning program's information header. The encrypted file contains the information header, SHA encryption key, and verification information. The information header contains the product code, serial number, encryption date, etc. of the new energy product. This product information makes it easy for the host computer software to display what model of product the currently loaded program belongs to; it is also convenient to further check whether the product to be upgraded is consistent with the loaded product type when clicking the upgrade program.
[0030] (3) There is a text bar in the host computer upgrade software that clearly indicates which stage the current upgrade is in; in the event of an error, diagnostic information will be output; and there is a clear progress bar at the bottom of the software to remind the current upgrade progress. The progress bar is basically determined by the proportion of each sub-package to the total package. However, the boot part also takes up a part of the time, because after the burning program is sent from the new energy host computer software upgrade tool to the device, it is first stored in the backup area and then transferred to the boot area for work. The code in the boot area writes the code in the backup area to the execution area. This copying action from the backup area to the execution area takes up a certain amount of progress bar time, which is also determined by the proportion of the number of sub-packages and the entire burning program.
[0031] (4) Heartbeat processing is added to the host computer upgrade software. When the periodic return signal does not return for more than 10 seconds, a timeout diagnostic message will be output and the upgrade will fail. This will prevent the product from being stuck and the host computer software will always be in the upgrade state.
[0032] (5) During the upgrade process, you can disconnect at any time to exit the upgrade. After exiting, you can upgrade the product again and resume the download. After disconnecting, you can interrupt the current upgrade process and upgrade another product. This disconnection is achieved through the socket's disconnet. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is an overall flow chart of the local upgrade method of the new energy voltage and current detection device of the present invention; Figure 2 It is a schematic diagram of the UI module of the present invention; Figure 3 is a schematic diagram of the transmission protocol of the present invention; Figure 4 This is a flowchart of processing errors in the firmware content to be upgraded according to the present invention; Figure 5 A process flow chart showing that the present invention cannot establish a connection with a device; Figure 6 This is a processing flow chart of a response timeout failure of the present invention; Figure 7 A flowchart of processing a data packet error according to the present invention; Figure 8 This is an overall structural diagram of the local upgrade system of the new energy voltage and current detection equipment of the present invention. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0035] Those skilled in the art will appreciate that, unless otherwise stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0036] The present invention is a local upgrade method and system based on host computer upgrade software developed to solve the software upgrade of new energy voltage and current detection equipment. The host computer upgrade software is mainly developed using visual studio development platform, C# language, TCP / IP and other technologies.
[0037] New energy voltage and current detection equipment generally includes a main control module and a sub-control module. The main control module communicates with the PC, receives parameters sent by the PC, and distributes them to each sub-control module; the main control module receives data sent by the sub-control module, including product information data and reception confirmation information data, as well as alarm information. The sub-control module is usually a 4-channel voltage or current detection channel. The specific detection channel type can be voltage or current, and its type can be configured through the PC.
[0038] New energy voltage and current detection equipment that has entered the market will also face the need to update the device hardware or software. Generally, local software upgrades are sufficient. In the prior art, many local upgrades use the UART upgrade method. On the one hand, this upgrade method has a relatively slow upgrade speed. On the other hand, the need to open the cover of sealed waterproof equipment also makes the upgrade more troublesome. Others use the OTA upgrade method. In terms of cost, this upgrade method requires the addition of a remote communication module, which is a relatively large price for products shipped in batches. At the same time, many current upgrade methods are single-module upgrades, which are not suitable for application scenarios where multiple sub-modules are continuously upgraded. In addition, some new energy voltage and current detection devices have burned the product into a product that cannot work properly after loading an illegal burning program.
[0039] The return of new energy voltage and current detection equipment to the factory for repair can solve the need for firmware upgrades, but the logistics and labor costs will increase significantly. The previous method of burning with J-Flash is outdated, and there is a need for a method that can use local software upgrades instead of direct upgrades with the burner.
[0040] In addition, for different types of new energy voltage and current detection equipment, different host computer upgrade software is not required, and all can be completed by a common host computer upgrade software. The present invention technically implements the company's private communication protocol, firmware decryption processing, firmware identification, software upgrade diagnosis, multi-module one-time upgrade and other processing.
[0041] In view of the shortcomings of the existing technology, the present invention performs the following processing: (1) Using TCP / IP network communication, the speed will be greatly improved with the support of 1000M Ethernet.
[0042] (2) The host computer upgrade software reduces the cost of using remote communication chips because the main module chip has a built-in simple PHY interface.
[0043] (3) Our host computer upgrade software not only solves the upgrade of a single module, but also solves the continuous upgrade of multiple sub-modules, saving time for upgrading modules.
[0044] (4) To ensure the security of the new energy burning program, the purpose is to prevent illegal theft of the new firmware. The new firmware is required to be encrypted, and the host computer upgrade software needs to automatically decrypt the firmware and perform new security processing.
[0045] The technical solution of the upper computer upgrade software provided by the present invention mainly includes a UI module, a transmission module, a data analysis module and a main module. The UI module is mainly used to receive the device information filled in by the customer and store it in the corresponding storage area for use; the UI module displays the processing results to the user in an appropriate manner; the UI module imports the firmware into the transmission module through the customer. The transmission module transmits data with the device through Ethernet, and the transmission module sends the decrypted firmware to the new energy voltage and current detection device through packet processing. The main module receives the data returned by the new energy voltage and current detection device, passes the data to the data analysis module, the data analysis module parses the data, and transmits the analysis results to the UI module.
[0046] The local upgrade method of the new energy voltage and current detection device based on the host computer upgrade software of the present invention is described below through a specific embodiment: Example
[0047] like Figure 1 As shown, this embodiment provides a local upgrade method for a new energy voltage and current detection device, comprising the following steps: S1: Based on the UI module of the host computer upgrade software, fill in the basic information of the new energy voltage and current detection equipment to be upgraded, and select the firmware to be upgraded. After selection, the host computer upgrade software automatically loads and decrypts the encrypted file of the firmware to be upgraded, and uses the verification information in the encrypted file to check the correctness of the encrypted file.
[0048] In this embodiment, to locally upgrade the new energy voltage and current detection device, it is first necessary to fill in the basic information of the new energy voltage and current detection device to be upgraded based on the UI module on the host computer upgrade software set for local upgrade, and select the firmware information to be upgraded on the UI module.
[0049] like Figure 2 As shown, it is a schematic diagram of a specific implementation of the UI module in this embodiment. The basic information filled in includes the IP address and PORT of the host computer upgrade software main module, and the device type and device ID of the new energy voltage and current detection device to be upgraded in the same network segment as the main module. The device types mainly include Busnode (bus node device) and AI (sub-node device).
[0050] After the basic information is set, it is necessary to select the firmware to be upgraded based on the UI module. After the selection, the host computer upgrade software automatically loads the encrypted file of the firmware to be upgraded, automatically decrypts the encrypted file, and checks the correctness of the encrypted file, specifically: In this embodiment, Figure 2 As shown in the figure, find "..." on the UI module to select the path where the firmware to be upgraded is located, select the firmware to be upgraded (.bin) file to be upgraded in the selection bar on the right side of the .bin file on the interface, and after selecting the file, the UI module will trigger the program to automatically load the encrypted file of the firmware to be upgraded. In other words, when the UI module receives the path where the firmware to be upgraded is located and the corresponding firmware to be upgraded (.bin) file, it finds the pre-stored encrypted file program through the firmware to be upgraded (.bin) file and loads the program into the memory for processing.
[0051] The firmware to be upgraded has been encrypted with the SHA public key. Therefore, after loading the firmware to be upgraded, the encrypted part needs to be stripped to generate a complete and valid .bin burning program. To this end, this processing module pre-adds an information header to the burning program. The information header contains the product code, serial number and encryption date of the new energy voltage and current detection device as information. That is, The encrypted file is an information header added to the burning program. The encrypted file includes the information header, the burning program, the SHA encryption key and the verification information. The information header includes the product code, serial number and encryption date of the new energy voltage and current detection device.
[0052] Only the encrypted encrypted file can be loaded into the upper computer upgrade software, otherwise an error will be reported during loading. When encrypting the encrypted file, the information header and the burning program are spliced into a whole, and the encryption algorithm is used to encrypt the information header and the burning program as a whole. The decryption process is the reverse process of encryption, so the SHA encryption key is used to decrypt the information header and the burning program as a whole during decryption, and after decryption, the information header is removed to retain the valid .bin burning program. The decryption process is performed after the UI module loads the encrypted file.
[0053] At the same time, the program will use the SHA-256 algorithm to calculate the hash value of the decrypted data of the burning program, and compare the hash value with the verification information. If they match, the encrypted file is correct, complete and has not been tampered with.
[0054] S2: The host computer upgrade software periodically sends heartbeat information to try to establish a connection with the new energy voltage and current detection device, creates a socket object, uses the bind command to bind the host and port number, and uses the listen command to listen to the connection to complete the three-way handshake with the new energy voltage and current detection device, and establishes a connection between the host computer upgrade software and the new energy voltage and current detection device to be upgraded.
[0055] In this embodiment, a connection is established between the host computer upgrade software and the new energy voltage and current detection device to be upgraded, specifically: after the new energy voltage and current detection device is powered on, the host computer upgrade software periodically sends heartbeat information (such as once every 10 seconds) to try to establish a connection with the new energy voltage and current detection device. After the new energy voltage and current detection device receives the heartbeat information, the device information including software version information, hardware version information, and compilation date is uploaded to the host computer upgrade software through Busnode (bus node device), and the host computer upgrade software displays the device information in the form of a list on the UI module.
[0056] In this embodiment, Figure 2In the interface, after the IP address and PORT are set, the host computer upgrade software is powered on, and after receiving the trigger of the user clicking the "Connect" button, the host computer starts the upgrade software to establish a connection with the new energy voltage and current detection device, searches and displays the number and information of the new energy voltage and current detection device, and checks whether the information of the new energy voltage and current detection device matches the basic information selected in step S1. If the connection is successful, Figure 2 A small green dot will be displayed in the lower left corner of the interface shown. If the connection fails, a message indicating the connection failure will be displayed in the text box in the upper right corner.
[0057] Among them, when trying to establish a connection with the new energy voltage and current detection device, the host computer upgrade software completes a three-way handshake with the new energy voltage and current detection device by creating a socket object, binding the host and port number using the bind instruction, and listening to the connection using the listen instruction, thereby establishing a connection between the host computer upgrade software and the new energy voltage and current detection device.
[0058] Create a socket object, use the bind command to bind the host and port number, and use the listen command to listen to the connection to complete the three-way handshake with the new energy voltage and current detection device. The specific example is: (1) Create a socket object server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) This line of code creates a TCP / IP socket. AF_INET means using an IPv4 address, and SOCK_STREAM means using the TCP protocol.
[0059] (2) The bind command binds the host and port number host = '0.0.0.0' # You can use a specific IP address port = 12345 # Any unused port server_socket.bind((host, port)) This line of code binds the socket to the specified IP address and port. 0.0.0.0 means bind to all available network interfaces and port number is 12345.
[0060] (3) The listen command listens for connections server_socket.listen(5) This line of code sets the socket to listening mode. The parameter 5 means that up to 5 connections can be queued for processing.
[0061] A specific example of a three-way handshake is: (1) First handshake: client sends SYN The client sends a SYN (Synchronize Sequence Number) packet to the server, requesting to establish a connection.
[0062] The client enters the SYN_SENT state.
[0063] (2) Second handshake: server sends SYN-ACK The server receives the SYN packet and returns a SYN-ACK (synchronization sequence number and acknowledgment number) packet, indicating that it agrees to establish a connection.
[0064] The server enters the SYN_RECEIVED state.
[0065] (3) Third handshake: client sends ACK The client receives the SYN-ACK packet and sends an ACK (acknowledgement number) packet to the server to confirm that the connection is established.
[0066] Both the client and the server enter the ESTABLISHED state and the connection establishment is complete.
[0067] S3: After the connection is established, the host computer upgrade software sends heartbeat data to the new energy voltage and current detection device. After receiving the heartbeat data, the new energy voltage and current detection device uploads its respective product information to the UI module of the host computer upgrade software for display. On the UI module, the new energy voltage and current detection device to be upgraded is selected according to the product information. The host computer upgrade software subpackages the firmware to be upgraded and uses the transmission module to transmit data, and transmits the subpackages of the firmware to be upgraded to the selected new energy voltage and current detection device to be upgraded in turn.
[0068] In this embodiment, step S3 is specifically as follows: The size of the sub-packet is determined according to the receiving capability of the new energy voltage and current detection device. The upper computer upgrade software divides the firmware to be upgraded according to the size of each sub-packet and sequentially transmits the sub-packet to the main control module of the new energy voltage and current detection device. If the sub-packet data is the program of the main control module, the firmware to be upgraded is directly burned into the backup area of the main control module. If the sub-packet data is the program of the sub-control module, the firmware to be upgraded is transferred from the main control module to the program area of the sub-control module through the serial communication protocol CAN bus. The host computer upgrade software main module receives the transmission result data returned by the new energy voltage and current detection device, passes the transmission result data to the data analysis module to parse the data, passes the analysis result to the UI module for display, and at the same time transmits a part of the data to the transmission module through the structure, and the transmission module then sends the remaining subpacket data according to the returned data.
[0069] Among them, the size of the subpacket is determined according to the receiving capability of the new energy voltage and current detection device, specifically: a status byte for describing the subpacket receiving capability is set on the new energy voltage and current detection device, the status byte is represented by a binary representation of several bits, and the corresponding size of the subpacket is set for each binary value, and when the binary value of a certain bit is 1, the subpacket with a size matching the current bit is allowed to be transmitted.
[0070] For example, since different master devices and sub-control devices may have different memory, in order to meet resource requirements, we will adapt the performance of different devices before upgrading. For example, the status byte used to describe the packet receiving capability is set to 10101100 on the new energy voltage and current detection device, which can be parsed as: bit7=1: supports 4096 bytes bit6=0: 2048 bytes are not supported bit5=1: supports 1024 bytes bit4=0: 512 bytes not supported bit3=1: supports 256 bytes bit2=1: supports 128 bytes It can be concluded that the single packet size supported by this product is: 4096 bytes, 1024 bytes, 256 bytes and 128 bytes. By increasing the size of single packet data, the number of interactions can be reduced, the efficiency of sending data can be improved, and the total packet data sending time can be reduced.
[0071] Corresponding to Figure 2In the UI module shown, after the host computer upgrade software is powered on, click Connect and connect, and all online new energy voltage and current detection devices that need to be upgraded will be searched in the selection box below. The specific number depends on the device type selection and the main control module or sub-control module actually connected in series with the hardware. The search process is that after the new energy product is powered on, the host computer upgrade software sends a periodic heartbeat message, which is sent once every 10 seconds. After receiving the heartbeat message, the new energy voltage and current detection device uploads the software version information, hardware version information, compilation date and other product information to the host computer upgrade software. Since the loaded firmware information will also appear in this search box, so that the user can make their own choice to upgrade based on the observed results, you can check the previous check box. If you find that the firmware to be upgraded is lower than the current version of the product, you can force a check in the box. If you want to upgrade multiple products at a time, you can check multiple product selection boxes. Finally, click the Upgrade button. After waiting for about 1 minute, the product will enter the Boot upgrade mode, and the product will be upgraded in less than 1 minute. The upgraded product will automatically complete the restart action. If there are multiple products, complete the above steps accordingly. After the upgrade is completed, the status bar in the search bar will show the upgrade success status.
[0072] Furthermore, in step S3, it further includes: transmitting each of the sub-packets using a fixed transmission protocol, specifically: The transmission module of the upper computer upgrade software transmits data with the new energy voltage and current detection device through Ethernet. The transmission module processes the decrypted firmware to be upgraded through subpackaging and sends the data to the new energy voltage and current detection device, involving a set of existing transmission protocols.
[0073] like Figure 3 As shown, the transmission protocol adopts a protocol format of splicing a message header, a message body and a checksum; The message header includes three bytes for indicating the sending direction of the subpacket, including two sending directions: the host computer upgrade software -> the new energy voltage and current detection device, and the new energy voltage and current detection device -> the host computer upgrade software; The message body includes the message body length and message body content. The message body content includes command word, device ID, message type, message command, total number of packages, sub-package number and data body. The command word adds the device type to be upgraded. The device type includes the main control device type and the sub-control device type. The message command includes message mechanisms including requesting connection, sending data, confirming receiving packets, disconnecting, and confirming disconnecting. The message types include types including upgrade, version information, and debugging information. In this embodiment, the check word uses 4 bytes, which are used to compare with the CRC32 check value of the message header and all data in the message body of each subpacket. If the check value is found to be the same as the check word, it means that the subpacket is valid.
[0074] Furthermore, in the process of transmitting data in step S3, this embodiment also includes monitoring the abnormalities that occur during data transmission and displaying them on the UI module, and recording them in the log to facilitate user tracing. If an abnormality occurs during the transmission process, an alarm message will be prompted on the UI interface. The abnormal information includes abnormalities such as communication interruption, cancellation of upgrade, and no data returned.
[0075] In addition, the host computer upgrade software of this embodiment also includes a diagnostic module for detecting the following four faults and taking remedial measures.
[0076] When the firmware to be upgraded selected by the user is incorrect or the firmware to be upgraded selected by the user is not the firmware file required by the connected new energy voltage and current detection device, an upgrade firmware error will be generated and the user will be prompted to reselect the file. The processing flow chart is as follows: Figure 4 shown.
[0077] When the user clicks the "Connect" button but still cannot connect to the new energy voltage and current detection device, a diagnostic message that a connection cannot be established with the device will be generated. The processing flow chart is as follows: Figure 5 shown.
[0078] When the host computer upgrade software sends a data packet and does not receive a response for a long time, a transmission data process response timeout fault message will be generated. The processing flow chart is shown in Figure 6.
[0079] When the new energy voltage and current detection device reports a current packet error or an upgrade data error, a new energy voltage and current detection device reports a communication data packet error fault message. The processing flow chart is as follows: Figure 7 shown.
[0080] Second embodiment like Figure 8 As shown, this embodiment provides a local upgrade system for a new energy voltage and current detection device for executing the local upgrade method for the new energy voltage and current detection device in the first embodiment, including: UI module 1 is used to fill in the basic information of the new energy voltage and current detection equipment to be upgraded, select the firmware to be upgraded, and display the abnormal monitoring information that occurs during data transmission; Transmission module 2, used for transmitting data to the new energy voltage and current detection device after the host computer upgrade software packages the firmware to be upgraded; The data analysis module 3 is used to analyze the transmission result data and pass the analysis result to the UI module for display; The main module 4 is used to receive the transmission result data returned by the new energy voltage and current detection device, and pass the transmission result data to the data analysis module for data analysis.
[0081] A computer-readable storage medium stores computer code. When the computer code is executed, the above method is executed. A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program. The program can be stored in a computer-readable storage medium. The storage medium can include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0082] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
[0083] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0084] It should be noted that the above embodiments can be freely combined as needed. The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered as the protection scope of the present invention.
Claims
1. A local upgrade method for new energy voltage and current detection equipment, characterized in that: The following steps are involved: S1: Based on the UI module of the host computer upgrade software, fill in the basic information of the new energy voltage and current detection device to be upgraded, and select the firmware to be upgraded. After selection, the host computer upgrade software automatically loads and decrypts the encrypted file of the firmware to be upgraded, and uses the verification information in the encrypted file to check the correctness of the encrypted file; S2: The host computer upgrade software periodically sends heartbeat information to try to establish a connection with the new energy voltage and current detection device, creates a socket object, uses the bind command to bind the host and port number, and uses the listen command to listen to the connection to complete the three-way handshake with the new energy voltage and current detection device, and establishes a connection between the host computer upgrade software and the new energy voltage and current detection device to be upgraded; S3: After the connection is established, the host computer upgrade software sends heartbeat data to the new energy voltage and current detection device. After receiving the heartbeat data, the new energy voltage and current detection device uploads its respective product information to the UI module of the host computer upgrade software for display. On the UI module, the new energy voltage and current detection device to be upgraded is selected according to the product information. The host computer upgrade software subpackages the firmware to be upgraded and uses the transmission module to transmit data, and transmits the subpackages of the firmware to be upgraded to the selected new energy voltage and current detection device to be upgraded in turn.
2. The local upgrade method of the new energy voltage and current detection device according to claim 1 is characterized in that: In step S1, based on the UI module, fill in the basic information of the new energy voltage and current detection device to be upgraded, and select the firmware to be upgraded. After selection, the host computer upgrade software automatically loads and decrypts the encrypted file of the firmware to be upgraded, specifically: The basic information includes the IP address and PORT of the host computer upgrade software main module, and the device type and device ID of the new energy voltage and current detection device to be upgraded in the same network segment as the main module; Based on the UI module, the firmware to be upgraded is selected. After the selection, the host computer upgrade software automatically loads the encrypted file of the firmware to be upgraded, automatically decrypts the encrypted file, and checks the correctness of the encrypted file.
3. The local upgrade method of the new energy voltage and current detection device according to claim 2 is characterized in that: Decrypting the encrypted file of the firmware to be upgraded, and using the verification information in the encrypted file to check the correctness of the encrypted file, specifically: The encrypted file includes an information header, a burning program, a SHA encryption key and verification information, and the information header includes the product code, serial number and encryption date of the new energy voltage and current detection device; The encrypted file splices the information header and the burning program into a whole when encrypting, and uses an encryption algorithm to encrypt the whole of the information header and the burning program, so the SHA encryption key is used to decrypt the whole of the information header and the burning program when decrypting, and the information header is removed after decryption to retain the valid burning program; The SHA-256 algorithm is used to calculate the hash value of the decrypted data of the burning program, and the hash value is compared with the verification information. If they match, the encrypted file is correct, complete and has not been tampered with.
4. The local upgrade method of the new energy voltage and current detection device according to claim 1 is characterized in that: In step S2, a connection is established between the host computer upgrade software and the new energy voltage and current detection device to be upgraded, specifically: After the new energy voltage and current detection device is powered on, the host computer upgrade software periodically sends heartbeat information to try to establish a connection with the new energy voltage and current detection device. After receiving the heartbeat information, the new energy voltage and current detection device uploads the device information including software version information, hardware version information, and compilation date to the host computer upgrade software. The host computer upgrade software displays the device information in the form of a list on the UI module.
5. The local upgrade method of the new energy voltage and current detection device according to claim 1 is characterized in that: In step S3, after the connection is established, the host computer upgrade software automatically subpackages the firmware to be upgraded and uses the transmission module to transmit data, and sequentially transmits the subpackages of the firmware to be upgraded to the selected new energy voltage and current detection device that needs to be upgraded, specifically: The size of the sub-packet is determined according to the receiving capability of the new energy voltage and current detection device. The upper computer upgrade software divides the firmware to be upgraded according to the size of each sub-packet and sequentially transmits the sub-packet to the main control module of the new energy voltage and current detection device. If the sub-packet data is the program of the main control module, the firmware to be upgraded is directly burned into the backup area of the main control module. If the sub-packet data is the program of the sub-control module, the firmware to be upgraded is transferred from the main control module to the program area of the sub-control module through the serial communication protocol CAN bus. The host computer upgrade software main module receives the transmission result data returned by the new energy voltage and current detection device, passes the transmission result data to the data analysis module to parse the data, passes the analysis result to the UI module for display, and at the same time transmits a part of the data to the transmission module through the structure, and the transmission module sends the remaining sub-packet data according to the validity of the returned data.
6. The local upgrade method of the new energy voltage and current detection device according to claim 5 is characterized in that: The size of the sub-packet is determined according to the receiving capability of the new energy voltage and current detection device, specifically: A status byte for describing the packet receiving capability is set on the new energy voltage and current detection device. The status byte is represented by a binary number of bits, and the corresponding size of the packet is set for each binary value. When the binary value of a certain bit is 1, transmission of the packet with a size matching the current bit is allowed.
7. The local upgrade method of the new energy voltage and current detection device according to claim 5 is characterized in that: Also includes: Each of the sub-packets is transmitted using a fixed transmission protocol, wherein the transmission protocol is specifically: The transmission protocol adopts a protocol format of a message header, a message body and a checksum; The message header is used to indicate the sending direction of the subpacket, including two sending directions: the host computer upgrade software -> the new energy voltage and current detection device, and the new energy voltage and current detection device -> the host computer upgrade software; The message body includes the message body length and message body content. The message body content includes command word, device ID, message type, message command, total number of packages, sub-package number and data body. The command word adds the device type to be upgraded. The device type includes the main control device type and the sub-control device type. The message command includes message mechanisms including requesting connection, sending data, confirming receiving packets, disconnecting, and confirming disconnecting. The message types include types including upgrade, version information, and debugging information. The check word is used to compare with the check value of CRC32 check of all data of the message header and the message body of each subpacket. If the check value is found to be the same as the check word, it means that the subpacket is valid.
8. The local upgrade method of the new energy voltage and current detection device according to claim 1 is characterized in that: The process of transmitting data in step S3 also includes monitoring the anomalies that occur during data transmission and displaying them on the UI module, and recording them in the log. The anomaly information includes anomalies such as communication interruption, cancellation of upgrade, and no data returned.
9. A local upgrade system for a new energy voltage and current detection device for executing the local upgrade method for a new energy voltage and current detection device as claimed in any one of claims 1 to 8, characterized in that: include: The UI module is used to fill in the basic information of the new energy voltage and current detection equipment to be upgraded, select the firmware to be upgraded, and display the abnormal monitoring information that occurs during data transmission; A transmission module, used for transmitting data to the new energy voltage and current detection device after the host computer upgrade software packages the firmware to be upgraded; A data analysis module, used to analyze the transmission result data and pass the analysis result to the UI module for display; The main module is used to receive the transmission result data returned by the new energy voltage and current detection device, and pass the transmission result data to the data analysis module for data analysis. 10 . A computer-readable storage medium storing a computer code, wherein when the computer code is executed, the method according to claim 1 is executed.
Citation Information
Patent Citations
ECU software upgrading method based on vehicle-mounted Ethernet
CN107864207A
FOTA firmware remote upgrading system on new energy automobile and method of FOTA firmware remote upgrading system
CN110489143A
Interactive IAP upgrading method
CN112579130A
Remote upgrading system and upgrading method for FOTA firmware on new energy automobile
WO2021008184A1
