Remote upgrade method and system for electric vehicle controller
By using two-way authentication and binary difference algorithms for remote upgrades in electric vehicle controllers, the problems of low upgrade efficiency and insufficient security in the existing technology are solved, and an efficient and secure remote upgrade process is achieved, improving user experience and products are improved Competitiveness.
Patent Information
- Application Number
- CN202410765743.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-06-14
AI Technical Summary
The remote upgrade efficiency of existing electric vehicle controllers is inefficient, and there are security and reliability problems during the upgrade process, especially the insufficient security of data transmission and fault tolerance processing in the upgrade process, resulting in potential risks and functional abnormalities.
Receive upgrade requests and encrypted upgrade packages from remote servers through the on-board communication module, judge the vehicle's rest status and power level, use a two-way authentication mechanism to verify the source and integrity of the upgrade requests and upgrade packages, and use a binary difference algorithm to generate only the difference part Minimum update set, accurate updates ensure efficient and secure upgrades.
Improve upgrade efficiency and safety, reduce potential risks, ensure efficient and safeness of the upgrade process, provide intelligent management and seamless user experience, extend the service life of the vehicle, and reduce maintenance costs.
Smart Images

Figure CN118368308B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of vehicle data processing, and in particular to a remote upgrade method and system for an electric vehicle controller. Background Art
[0002] In the current rapidly developing new energy vehicle field, electric vehicles (EVs), as a key branch, are undergoing continuous technological innovation and application expansion. Among them, the electric vehicle controller, as the core component of the vehicle power system, is responsible for managing the distribution of battery energy, the control of the drive motor, and the monitoring of the vehicle status. Its performance directly affects the driving efficiency, safety and user experience of electric vehicles. With the deepening of the trend of intelligence and networking, higher requirements are placed on the functional upgrade and fault repair of electric vehicle controllers. The traditional offline upgrade method (such as through diagnostic instruments at maintenance stations) can no longer meet the market's demand for efficient and convenient services.
[0003] Therefore, realizing the remote upgrade (Over-The-Air, OTA) technology of electric vehicle controllers has become an urgent need for the development of the industry. Remote upgrade technology allows manufacturers to update the vehicle's software system through wireless networks without affecting the user's daily use, including but not limited to control strategy optimization, new function addition, vulnerability repair, etc., greatly improving service efficiency and user convenience. This technology can not only accelerate the pace of application of technological innovation, but also effectively extend the product life cycle, reduce maintenance costs, and enhance the safety protection capabilities of vehicles.
[0004] However, in the prior art, parts that do not need to be repeatedly updated are also replaced to ensure that there are no operating errors after the system is upgraded. This upgrade method is inefficient. Summary of the invention
[0005] The embodiments of the present application provide a remote upgrade method and system for an electric vehicle controller, so as to solve the technical problems in the remote upgrade of electric vehicles.
[0006] In a first aspect, an embodiment of the present application provides a remote upgrade method for an electric vehicle controller, comprising:
[0007] Receiving an upgrade request and an encrypted upgrade package from a remote server through an on-board communication module;
[0008] Determine whether the vehicle has been stationary for more than a predetermined time, and if the vehicle has been stationary for more than the predetermined time, determine whether the battery power level meets the minimum standard required for upgrading;
[0009] If the conditions are met, a two-way authentication mechanism is used to verify the source and integrity of the upgrade request and upgrade package;
[0010] If the verification is passed, the encrypted upgrade package is decrypted, and a binary difference algorithm is applied to generate a minimum update set containing only the difference parts, and the minimum update set is used to update only the changed parts in the controller of the electric vehicle.
[0011] Optionally, if the conditions are met, the steps of using a two-way authentication mechanism to verify the source and integrity of the upgrade instruction and upgrade package include:
[0012] Upon receiving an upgrade request, verifying the validity of the digital certificate carried in the upgrade request;
[0013] If approved, the integrity and authenticity of the upgrade instruction are verified using the public key in the digital certificate.
[0014] If successful, obtain the initial hash value calculated by the server when packaging the upgrade package;
[0015] Independently calculate the hash value of the received upgrade package, and compare the calculation result with the initial hash value provided by the server when packaging the upgrade package;
[0016] If the two match exactly, it means that the source and integrity of the upgrade package have not been modified during the transmission process.
[0017] Optionally, if the verification is passed, after the encrypted upgrade package is decrypted, the step of using a differential upgrade algorithm to update only the changed parts in the controller of the electric vehicle includes:
[0018] Apply a binary difference algorithm to generate a minimal update set containing only the differences;
[0019] Compress the update set to obtain compressed difference data to reduce the amount of data transmission;
[0020] The compressed difference data is safely written to the controller in batches.
[0021] Optionally, the step of applying a binary difference algorithm to generate a minimum update set containing only the difference parts comprises:
[0022] Determine the file version in the controller of the electric vehicle as the old file, and determine the corresponding file version in the upgrade package as the new file;
[0023] The minimum update set is calculated using the following formula group:
[0024] ;
[0025] ;
[0026] in, Represents the difference set between the old file and the new file, NewVersion represents the new file, OldVersion represents the old file, and UpdateSet is the minimum update set to be updated. Represents a data element in the old file, Represents the data elements in the new file, and the minimum update set is a set obtained by verifying the changes of the data blocks through a hash function.
[0027] Optionally, it also includes:
[0028] If the minimum update set exceeds the preset file size, the minimum update set is divided into multiple data blocks, and a sliding window is applied to these blocks to compare the data blocks of the new file and the data blocks of the old file corresponding to the data blocks of the new file one by one to obtain the latest minimum update set.
[0029] Optionally, the step of dividing the minimum update set into a plurality of data blocks, and applying a sliding window to the blocks to compare the data blocks of the new file and the data blocks of the old file corresponding to the data blocks of the new file one by one, comprises:
[0030] Set the sliding window size and determine the starting positions of the data blocks of the new file and the old file;
[0031] Starting from the starting position, for each traversed position i, the sliding window will cover w consecutive data blocks starting from i, and get and ,in, It represents the set of data blocks covered by the window when traversing to position i in the new file. It represents the set of data blocks covered by the window when traversing to position i in the old file;
[0032] Compute local difference sets , which is expressed as follows:
[0033] ;
[0034] in, Represents a unique data block in the new file, Represents data blocks unique to the old file;
[0035] Generate a local update set, whose expression is as follows:
[0036] ;
[0037] in, and Represents the local difference set The corresponding old file and new file data blocks are identified by hash values. If the contents of the data blocks are different, Just added to In which, Hash(x) represents the hash value obtained by applying the hash function to the data block;
[0038] After completing the window processing at the current position i, the window moves to the right by a preset step size and repeats the calculation of the local difference set Steps to obtain multiple local update sets ;
[0039] Take the multiple local update sets The union of gets the latest minimum update set.
[0040] Optionally, it also includes:
[0041] Use the sliding window to find the longest common sequence between consecutive data blocks to reduce the calculation time. The expression is as follows:
[0042] ;
[0043] Where N is the total number of data blocks, W is the window size, and if W=3, it means that three consecutive data blocks will be viewed as a whole during comparison. The Diff function calculates the difference measure between the contents of two windows, B old [i:i+W] and B new [i:i+W] represents the data blocks from position i to i+W in the old file and the new file respectively.
[0044] In a second aspect, the embodiment of the present application provides a remote upgrade system for an electric vehicle controller, comprising:
[0045] A receiving module, used for receiving an upgrade request and an encrypted upgrade package from a remote server through the vehicle-mounted communication module;
[0046] A determination module, used to determine whether the vehicle has been stationary for more than a predetermined time, and if so, whether the battery power level meets the minimum standard required for upgrading;
[0047] The verification module is used to verify the source and integrity of the upgrade request and upgrade package using a two-way authentication mechanism if the conditions are met;
[0048] The update module is used to decrypt the encrypted upgrade package if the verification is passed, apply a binary difference algorithm to generate a minimum update set containing only the difference parts, and use the minimum update set to update only the changed parts in the controller of the electric vehicle.
[0049] In a third aspect, an embodiment of the present application provides a computing device, comprising a processing component and a storage component; the storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component to implement the remote upgrade method of the electric vehicle controller as described in the first aspect above.
[0050] In a fourth aspect, an embodiment of the present application provides a computer storage medium storing a computer program, which, when executed by a computer, implements the remote upgrade method of the electric vehicle controller as described in the first aspect above.
[0051] In the embodiment of the present application, the upgrade request and the encrypted upgrade package from the remote server are received through the vehicle communication module; it is determined whether the vehicle has been stationary for more than a predetermined time, and if it has been stationary for more than a predetermined time, it is determined whether the battery power level meets the minimum standard required for the upgrade; if it meets, a two-way authentication mechanism is used to verify the source and integrity of the upgrade request and the upgrade package; if the verification is passed, the encrypted upgrade package is decrypted, and a binary difference algorithm is applied to generate a minimum update set containing only the difference part, and the minimum update set is used to update only the changed part in the controller of the electric vehicle, so that only the relevant changed part inside the controller is accurately updated, rather than replacing the entire controller software in full. This method improves the upgrade efficiency, reduces potential risks, and ensures the efficiency and safety of the upgrade process.
[0052] These and other aspects of the present application will become more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0054] Figure 1 A flowchart of a remote upgrade method for an electric vehicle controller provided in an embodiment of the present application;
[0055] Figure 2 A schematic diagram of the structure of a remote upgrade system for an electric vehicle controller provided in an embodiment of the present application;
[0056] Figure 3 A schematic diagram of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with the accompanying drawings. 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 the present application.
[0058] In the existing technology, OTA upgrade faces multiple challenges, including the security of data transmission, the reliability of the upgrade process, and the precise control of the vehicle's operating status to avoid risks such as functional abnormalities or interrupted driving during the upgrade process. Therefore, the development of an efficient, safe, and reliable electric vehicle controller remote upgrade method and system has become the key to promoting the advancement of electric vehicle technology.
[0059] The present application aims to provide an innovative electric vehicle controller remote upgrade method and system, which comprehensively considers data encryption transmission, upgrade package integrity verification, fault-tolerant processing of the upgrade process, and intelligent monitoring of the vehicle status, to ensure that the upgrade operation is completed efficiently while ensuring user safety.
[0060] In the specific embodiment first provided in this application, a remote upgrade method for an electric vehicle controller is provided, such as Figure 1 As shown, the method comprises the following steps:
[0061] Step 1: Receive the upgrade request and encrypted upgrade package from the remote server through the vehicle communication module;
[0062] In the embodiment of the present application, the vehicle's built-in on-board communication module (such as a 4G / 5G module, Wi-Fi module, etc.) continuously monitors the communication channel from a remote server (usually the manufacturer's cloud server). When the server initiates an upgrade request, the communication module receives the signal and downloads an encrypted upgrade package. This upgrade package contains a new version code or configuration changes to the existing controller software. In order to ensure the security of data transmission, the upgrade package will be encrypted before sending.
[0063] For example, if a certain brand of electric vehicle manufacturer discovers a controller software optimization solution that improves battery life, it will send upgrade instructions and corresponding encrypted upgrade file packages to specific models of vehicles through its cloud platform.
[0064] Step 2: Determine whether the vehicle has been stationary for more than a predetermined time. If the vehicle has been stationary for more than a predetermined time, determine whether the battery power level meets the minimum standard required for upgrading.
[0065] In the embodiment of the present application, at the vehicle end, the system first checks whether the vehicle is stationary and whether this stationary state has lasted for more than a preset time threshold (such as 5 minutes). This is done to ensure that the upgrade process will not be interrupted by the vehicle driving, resulting in upgrade failure or system instability. Subsequently, the system detects the current battery power level to ensure that there is at least enough power to complete the entire upgrade process, avoiding the vehicle being unable to start due to power exhaustion during the upgrade.
[0066] For example, the vehicle has been parked in a parking lot for more than 10 minutes, and the dashboard shows that the remaining power is 60%, which exceeds the minimum power standard required for upgrading (assuming it is 30%).
[0067] Step 3: If the conditions are met, a two-way authentication mechanism is used to verify the source and integrity of the upgrade request and upgrade package;
[0068] In the embodiment of the present application, before the upgrade is performed, two-way authentication needs to be performed between the vehicle's control unit and the server. This includes verifying the legitimacy of the upgrade request (confirming that the request is indeed from a trusted server) and the integrity of the upgrade package (ensuring that the upgrade package has not been tampered with). This is usually achieved through an encrypted handshake protocol and a pre-shared secret key to ensure that only authenticated data can be executed.
[0069] For example: The vehicle controller uses the pre-implanted public key to verify the digital signature sent by the server, and the server also verifies the identity information sent by the vehicle. After both parties confirm that they are correct, the authentication is successful.
[0070] Step 4: If the verification is successful, the encrypted upgrade package is decrypted, and a binary difference algorithm is applied to generate a minimum update set containing only the difference parts, and the minimum update set is used to update only the changed parts in the controller of the electric vehicle;
[0071] Detailed explanation: Once the verification is passed, the vehicle controller will use the corresponding private key to decrypt the upgrade package. Then, a binary difference algorithm (such as bsdiff) is applied to analyze the new and old software versions, extracting only the binary differences to generate a minimum update set. This can significantly reduce the amount of data transmission, speed up the upgrade, and reduce network traffic consumption.
[0072] For example: After the upgrade package is decrypted, the algorithm identifies that the new version has only changed in a few key modules compared to the current running version. The generated differential file only contains the updated code of these modules and is only 10% of the size of the complete upgrade package.
[0073] Finally, the vehicle controller uses this minimal update set to accurately update only the relevant changes inside the controller, rather than completely replacing the entire controller software. This approach improves upgrade efficiency, reduces potential risks, and ensures the efficiency and security of the upgrade process.
[0074] For example: The system accurately locates several control logic modules that need to be updated, uses difference sets to replace and update these modules, and automatically restarts the controller after completion, and the new functions or optimizations take effect. The entire process is transparent to the user and does not affect other functions of the vehicle.
[0075] Through the above steps, an efficient and safe remote upgrade process of the electric vehicle controller is realized. The specific beneficial effects are divided into the following five points:
[0076] Security is greatly improved: By adopting a two-way authentication mechanism and encrypted communication technology, the security of upgrade data during transmission is ensured, preventing unauthorized access or tampering, and protecting the security of the vehicle's electronic system and the privacy of user data.
[0077] Efficient upgrade process: The binary difference algorithm is used to generate the minimum update set, and only the changed parts of the software are updated, which greatly reduces the amount of transmission data and upgrade execution time required for the upgrade, improves the upgrade efficiency, and reduces the demand for network resources and user waiting time.
[0078] Intelligent management: The system automatically determines the vehicle status (such as stationary time and battery level) to ensure that the upgrade is performed under the most appropriate conditions, avoiding the risks of upgrading while driving or when the battery is low, improving the user experience and protecting the vehicle hardware.
[0079] Seamless user experience: The entire upgrade process is transparent to users, without manual intervention, reducing the complexity of user operations. After the upgrade is completed, the system can automatically restart and apply new functions, ensuring service continuity and availability.
[0080] Flexible maintenance and iteration: This technology enables manufacturers to quickly respond to market and technological changes, push software updates in a timely manner, fix vulnerabilities, or add new features, extending the service life of the vehicle and enhancing product competitiveness.
[0081] Furthermore, the present application also provides a specific implementation method for using a two-way authentication mechanism to verify the source and integrity of the upgrade instruction and upgrade package:
[0082] Step 31, upon receiving the upgrade request, verifying the validity of the digital certificate carried in the upgrade request;
[0083] In the embodiment of the present application, when the control unit of the electric vehicle receives an upgrade request from a remote server, it first checks whether the request carries a valid digital certificate. A digital certificate is an electronic file containing information such as a public key and a signature of a certification authority, which is used to prove the identity of the sender.
[0084] The system uses built-in trust roots (such as pre-set CA root certificates) to verify whether the issuer of the digital certificate is trustworthy and whether the certificate itself has expired or been revoked. This step ensures that the upgrade request is indeed from an authorized server, not a malicious third party.
[0085] Step 32: If successful, use the public key in the digital certificate to verify the integrity and authenticity of the signature of the upgrade instruction;
[0086] Once the digital certificate is confirmed to be valid, the system will use the public key in the certificate to decrypt and verify the digital signature of the upgrade instruction to ensure that the upgrade instruction has not been tampered with and comes from the certificate holder. Before issuing the upgrade instruction, the sender (server) will sign the instruction with its own private key. The receiver (electric vehicle controller) will verify the signature with the corresponding public key, thereby ensuring the authenticity and integrity of the instruction.
[0087] Step 33: If successful, obtain the initial hash value calculated by the server when packaging the upgrade package;
[0088] The system extracts the initial hash value of the upgrade package calculated by the server from the upgrade request, and independently calculates the hash value of the received upgrade package.
[0089] The hash value is a fixed-length summary, and any small change to the data will result in a huge change in the hash value. When the server encapsulates the upgrade package, it will first calculate its hash value and send it along with the upgrade package. After receiving the upgrade package, the controller will perform the same hash calculation on it.
[0090] Step 34, independently calculating the hash value of the received upgrade package, and comparing the calculation result with the initial hash value provided by the server when packaging the upgrade package;
[0091] Compare the hash value calculated in the electric vehicle controller with the initial hash value provided by the server. If the two are exactly the same, it means that the upgrade package has not been tampered with during the transmission process, and the source and content remain original.
[0092] If the two hash values match, it means that the upgrade package has not been modified accidentally or maliciously during the entire transmission link from the server to the controller, ensuring the integrity and reliability of the upgrade data.
[0093] Step 35: If the two completely match, it indicates that the source and integrity of the upgrade package have not been modified during the transmission process.
[0094] Through the above-mentioned strict identity authentication and data integrity checks, the security of the upgrade process is significantly enhanced, effectively preventing malware injection or man-in-the-middle attacks, and protecting the vehicle's electronic systems from harm; it ensures that each upgrade is based on correct, uncorrupted data, avoiding system instability or functional loss due to upgrade failures, and maintaining user trust and satisfaction with the vehicle; it reduces the need for repeated upgrades or on-site repairs due to data errors, improves upgrade efficiency, thereby saving manufacturers time and costs, and reducing the inconvenience caused to users by upgrade problems.
[0095] This embodiment further provides a method for remotely upgrading an electric vehicle controller, and how to efficiently and safely update only the changed parts of the controller after verification. A differential upgrade algorithm is used to minimize the amount of data transmission, speed up the upgrade, and ensure the security of the upgrade process.
[0096] That is, the process of step 4 "if the verification is passed, after decrypting the encrypted upgrade package, only the changed parts in the controller of the electric vehicle are updated using the differential upgrade algorithm" may include the following steps:
[0097] Step 41, applying a binary difference algorithm to generate a minimum update set containing only the difference parts;
[0098] The server compares the old and new versions of the controller firmware at a binary level to identify the differences between the two. This process usually involves complex algorithms such as bsdiff or xdiff, which can accurately identify new, modified or deleted data blocks.
[0099] In the embodiment of the present application, the algorithm analyzes the binary code of the two versions and generates a "difference patch" that only contains the changed parts, rather than the full image of the entire firmware. This greatly reduces the amount of data that needs to be transmitted and improves the upgrade efficiency.
[0100] Step 42, compressing the update set to obtain compressed difference data to reduce the amount of data transmission;
[0101] In an embodiment of the present application, the generated difference set is then further compressed using an efficient compression algorithm such as gzip or lz4, in order to further reduce the data volume.
[0102] Compression not only reduces the network bandwidth requirements, but also shortens the data transmission time, especially under poor network conditions, which is crucial to improving the upgrade experience. The compressed data can still fully restore the content of the difference set after decompression and can be used losslessly in the upgrade process.
[0103] Step 43, securely writing the compressed difference data into the controller in batches;
[0104] In the embodiment of the present application, in order to ensure the stability and security of the upgrade process, the compressed difference data will be divided into multiple batches and written into the electric vehicle controller one by one safely. Each batch will be checked before and after writing to ensure the correctness and integrity of the data.
[0105] Writing in batches can avoid excessive system burden caused by writing a large amount of data at one time, reducing the risk of upgrade interruption. At the same time, performing checks before and after each batch writing, such as CRC check or MD5 check, can immediately detect and handle errors in data transmission, ensuring the smooth progress of the upgrade process.
[0106] Through the above steps 41 to 43, the amount of data required for the upgrade can be significantly reduced through differential algorithms and data compression, making the upgrade process faster and occupying less network resources, which is particularly suitable for remote upgrades in mobile network environments. The batch safe writing strategy combined with the data verification mechanism ensures the accuracy of data during the upgrade process, effectively prevents the risk of upgrade failure or system damage, and improves the stability and reliability of the overall system. In addition, it can also increase the upgrade speed and reduce network dependence, reduce user waiting time, and increase the success rate of the upgrade, thereby improving user satisfaction and trust in electric vehicles and their brands.
[0107] In another embodiment provided by the present application, the process of step 41 "applying a binary difference algorithm to generate a minimum update set containing only the difference parts" may include:
[0108] Step 411, determining the file version in the controller of the electric vehicle as the old file, and determining the corresponding file version in the upgrade package as the new file;
[0109] In step 411, first, two key entities in the upgrade scenario are clearly defined: the software or firmware version currently installed in the electric vehicle controller is marked as "old file", and the corresponding file version to be replaced in the upgrade package is regarded as "new file". This step is the basis for subsequent difference calculation and ensures the accuracy of the comparison.
[0110] Assume that the controller currently runs firmware version V1.0, and the received upgrade package contains firmware version V1.1. In this scenario, V1.0 is the "old file" and V1.1 is the "new file".
[0111] Step 412, using the following formula group to calculate the minimum update set:
[0112] ;
[0113] ;
[0114] in, Represents the difference set between the old file and the new file, NewVersion represents the new file, OldVersion represents the old file, and UpdateSet is the minimum update set to be updated. Represents a data element in the old file, Represents the data elements in the new file, and the minimum update set is a set obtained by verifying the changes of the data blocks through a hash function.
[0115] In the above formula group, the first part , which means to find the set of all elements that exist in the new file (NewVersion) but not in the old file (OldVersion). Here "x" represents any data block or element in the file, and the ∧ symbol represents the logical "and". Part 2 , is to find all elements that exist in the old file but not in the new file. The combination of these two parts theoretically covers all additions and deletions.
[0116] and , further refined to only include those pairs of elements in the Δ set whose hash values of the corresponding elements in the old and new versions are not equal. This means that only the parts with actual content changes are updated, excluding the cases where the content remains unchanged despite the position change.
[0117] In the embodiment of the present application, it is assumed that the new and old firmware each contain tens of thousands of data blocks (the smallest unit representing code or resource files), and these data blocks are marked as x1, x2, ..., xn. According to the above formula group, first identify:
[0118] Newly added data block set: For example, x1001 exists in the new file but not in the old file, so x1001 belongs to the Δ set.
[0119] A set of deleted data blocks: Assuming x200 exists in the old file but not in the new file, x200 is also marked.
[0120] Modified data block set: If x500 exists in both the old and new files, but its content (by calculating the hash value) is different (Hash(x500_old)≠Hash(x500_new)), then the pair (x500_old, x500_new) will be added to the UpdateSet.
[0121] Through the above steps, the final UpdateSet is the minimum update set, which only contains the data blocks that really need to be updated or replaced, ignoring the unchanged parts, and realizing efficient differential upgrade.
[0122] In summary, through refined operation steps and rigorous formula application, this embodiment effectively realizes the minimization of processing of the electric vehicle controller upgrade package, greatly improving the efficiency and resource utilization of the upgrade process.
[0123] It should be noted that, in the process of executing the above step 41, if the minimum update set exceeds the preset file size, the minimum update set is divided into multiple data blocks, and a sliding window is applied to these blocks to compare the data blocks of the new file one by one, and the data blocks of the old file corresponding to the data blocks of the new file, to obtain the latest minimum update set.
[0124] Optionally, the process of “segmenting the minimum update set into a plurality of data blocks, and applying a sliding window to the blocks to compare the data blocks of the new file and the data blocks of the old file corresponding to the data blocks of the new file one by one” may include:
[0125] Set the sliding window size and determine the starting positions of the data blocks of the new file and the old file;
[0126] Starting from the starting position, for each traversed position i, the sliding window will cover w consecutive data blocks starting from i, and get and ,in, It represents the set of data blocks covered by the window when traversing to position i in the new file. It represents the set of data blocks covered by the window when traversing to position i in the old file;
[0127] Compute local difference sets , which is expressed as follows:
[0128] ;
[0129] in, Represents a unique data block in the new file, Represents data blocks unique to the old file;
[0130] Generate a local update set, whose expression is as follows:
[0131] ;
[0132] in, and Represents the local difference set The corresponding old file and new file data blocks are identified by hash values. If the contents of the data blocks are different, Just added to In which, Hash(x) represents the hash value obtained by applying the hash function to the data block;
[0133] After completing the window processing at the current position i, the window moves to the right by a preset step size and repeats the calculation of the local difference set Steps to obtain multiple local update sets ;
[0134] Take the multiple local update sets The union of gets the latest minimum update set.
[0135] Based on the above process, assume that a software upgrade scenario is being processed. Both the new version file and the old version file are divided into several data blocks, each of which is 1MB in size. The new file has a total of 100 data blocks, and the old file has 98 data blocks. The first 95 data blocks are exactly the same, and the 96th to 98th blocks are updated in the new file, and the new file has the last two blocks added. Our goal is to efficiently identify and construct the minimum update set through the sliding window technology.
[0136] The example steps corresponding to the above process are:
[0137] 1) Set sliding window parameters;
[0138] Window size (w): 5MB (i.e., 5 data blocks) is selected as the window size to balance the accuracy and efficiency of comparison.
[0139] Starting position (i): starts from the first data block, that is, i=0.
[0140] Step size: The number of data blocks crossed each time the window is moved. It is set to w / 2, that is, 2.5MB (or 2-3 data blocks) to ensure overlapping comparisons and no omissions.
[0141] 2) Initialize the local difference set and the local update set;
[0142] Before starting, no local difference sets and local update sets are defined.
[0143] 3) Sliding window traversal;
[0144] Position i=0:
[0145] Window new Covering data blocks 0 to 4, Window old Similarly, blocks 0 to 4 are covered (since the old file has only 98 blocks, the window only covers block 4 in the old file).
[0146] Calculate Δ local , since the first 5 blocks of the new and old files have the same content, at this time Δ local Is an empty set.
[0147] UpdateSet localAlso empty, because there are no pairs of data blocks with different contents.
[0148] Position i = 2.5MB (middle of block 3):
[0149] Move window, Window new Now covering blocks 3 to 7, Window old Covers blocks 3 to 6.
[0150] Assume that block 7 is newly added in the new file, and block 6 has the same content in the new and old files, then Δ local Contains block 7.
[0151] UpdateSet local It is empty because although block 7 is identified as a new block, there is no corresponding old block with different hash values (because block 6 has not changed).
[0152] Position i = 5MB (block 5):
[0153] Keep sliding, Window new Covering blocks 5 to 9, Window old Covers blocks 5 to 8.
[0154] Suppose block 9 has been changed in the new file and has different content from block 8 in the old file, and the hash values do not match.
[0155] At this time, Δ local Block 9 is included because it is unique to new files.
[0156] UpdateSet local Contains {x new_9}, because x old_8 The hash value of x new_9 different.
[0157] Subsequent traversal:
[0158] Repeat the above process until all data blocks of the new file have been covered by the window. In subsequent traversals, more differences may be found, such as updates from blocks 96 to 98, and newly added blocks 99 and 100.
[0159] 4) Merge local update sets;
[0160] After completing the traversal, collect all UpdateSet local , merge them to get the final minimum update set.
[0161] The final minimum update set contains all the data blocks whose contents have indeed changed and are identified during the sliding window comparison process, namely blocks 9, 96 to 100.
[0162] Through the above steps, we use the sliding window technology to dynamically and efficiently identify the differences between the new and old files and construct the minimum update set. This method not only considers the direct differences in data blocks, but also ensures the accuracy of the update through hash value comparison, avoids unnecessary data transmission, and improves the upgrade efficiency.
[0163] It should be noted that, in the above process, optionally, the method further includes: using a sliding window to find the longest common sequence between consecutive data blocks to reduce the calculation time, and its expression is as follows:
[0164] ;
[0165] Where N is the total number of data blocks, W is the window size, and if W=3, it means that three consecutive data blocks will be viewed as a whole during comparison. The Diff function calculates the difference measure between the contents of two windows, B old [i:i+W] and B new [i:i+W] represents the data blocks from position i to i+W in the old file and the new file respectively.
[0166] In this solution, we can continue the previous software upgrade scenario. The new version file and the old version file have been divided into several data blocks. In order to further optimize the comparison process, we will introduce a strategy to find the longest common sequence to reduce the computational burden. Assume that the new file has 100 data blocks and the old file has 98 data blocks. The initial setting window size W=3, the total number of data blocks N=100.
[0167] In the embodiment of the present application, the following process may be included:
[0168] 1) Understand the cost function Cost(W);
[0169] Cost function definition: ;
[0170] In the above cost function, the Diff function measures the difference in the content of the data blocks in the two windows, which can be simply understood as the number of different data blocks. For example, if there are 2 different data blocks between the new and old files in a window, the Diff value is 2. And (N-W+1) determines the number of times the sliding window is traversed to ensure that the window can cover from the beginning to the end.
[0171] For example: When W=3, the first calculation is at position i=1, comparing B old [1:3] and B new The difference of [1:3], then compare B when i=2 old [2:4] and B new [2:4], and so on, to the last possible starting position.
[0172] 2) Find the longest common sequence;
[0173] Each time the window slides, not only the difference measure Diff is recorded, but also the longest common subsequence within the two windows or the high similarity interval identified in some way is recorded, which helps to identify which regions have the least changes or are exactly the same.
[0174] Example: If B is found in a window sliding old [30:32] With B new [30:32]Completely consistent, which indicates that this segment can be used as a common sequence to directly skip the subsequent detailed comparison, reducing unnecessary calculations.
[0175] 3) Optimize the traversal process;
[0176] By accumulating the values of the cost function Cost(W), we can identify intervals with smaller differences, which are theoretically more likely to be continuous common sequences.
[0177] Based on this information, the sliding window strategy can be adjusted, such as increasing the step size for fast skipping in continuous low-difference areas, and reducing the step size for fine comparison in high-difference areas, thereby reducing the overall calculation time.
[0178] 4) Implementation details and examples;
[0179] Calculate the difference: When i=5, assume that Diff(B old [5:7],B new [5:7]) = 1, indicating that only one data block is different in this window.
[0180] Identifying common sequences: Discovering B old [10:12] With B new [10:12] Exactly the same, no further comparison is required for these three pieces of data.
[0181] Strategy adjustment: Based on the previous analysis, if the differences between several consecutive windows are very small, you can selectively skip the detailed comparison of several windows and directly move to the area with higher differences for detailed inspection.
[0182] By introducing the strategy of finding the longest common sequence and combining the cost function Cost(W) to quantify the difference, we can effectively identify and skip a large number of unchanged parts in the comparison process of the new and old file data blocks, significantly improving the efficiency of the upgrade check and reducing unnecessary computing time. This method not only optimizes resource usage, but also speeds up the completion of the entire upgrade process.
[0183] Figure 2A schematic diagram of the structure of a remote upgrade system for an electric vehicle controller provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the system includes:
[0184] A receiving module 51, used for receiving an upgrade request and an encrypted upgrade package from a remote server through the vehicle communication module;
[0185] A determination module 52, for determining whether the vehicle has been stationary for more than a predetermined time, and if the vehicle has been stationary for more than the predetermined time, determining whether the battery power level meets the minimum standard required for upgrading;
[0186] The verification module is used to verify the source and integrity of the upgrade request and upgrade package using a two-way authentication mechanism if the conditions are met;
[0187] The update module 53 is used to decrypt the encrypted upgrade package if the verification is passed, apply the binary difference algorithm to generate a minimum update set containing only the difference parts, and use the minimum update set to update only the changed parts in the controller of the electric vehicle.
[0188] Figure 2 The remote upgrade system of the electric vehicle controller can perform Figure 1 The implementation principle and technical effect of the remote upgrade method of the electric vehicle controller described in the embodiment are not described in detail. The specific way in which each module and unit performs operations in the remote upgrade system of the electric vehicle controller in the above embodiment has been described in detail in the embodiment of the method, and will not be described in detail here.
[0189] In one possible design, Figure 2 The remote upgrade system of the electric vehicle controller of the embodiment shown can be implemented as a computing device, such as Figure 3 As shown, the computing device may include a storage component 61 and a processing component 62;
[0190] The storage component 61 stores one or more computer instructions, wherein the one or more computer instructions are called and executed by the processing component 62 .
[0191] The processing component 62 may include one or more processors to execute computer instructions to complete all or part of the steps in the above method. Of course, the processing component may also be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.
[0192] The storage component 61 is configured to store various types of data to support operations at the terminal. The storage component can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0193] The display component 63 can be an electroluminescent (EL) element, a liquid crystal display or a micro display having a similar structure, or a retinal direct display or a similar laser scanning display.
[0194] Of course, a computing device may also include other components, such as input / output interfaces, communication components, etc.
[0195] The input / output interface provides an interface between the processing component and the peripheral interface module, which may be an output device, an input device, etc.
[0196] The communication component is configured to facilitate, among other things, wired or wireless communications between the computing device and other devices.
[0197] Among them, the computing device can be a physical device or an elastic computing host provided by a cloud computing platform, etc. In this case, the computing device can refer to a cloud server, and the above-mentioned processing components, storage components, etc. can be basic server resources rented or purchased from the cloud computing platform.
[0198] The present application also provides a computer storage medium storing a computer program, wherein the computer program can achieve the above-mentioned Figure 1 The remote upgrade method of the electric vehicle controller of the illustrated embodiment.
[0199] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0200] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0201] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0202] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A remote upgrade method for an electric vehicle controller, characterized in that: include: Receiving an upgrade request and an encrypted upgrade package from a remote server through an on-board communication module; Determine whether the vehicle has been stationary for more than a predetermined time, and if the vehicle has been stationary for more than the predetermined time, determine whether the battery power level meets the minimum standard required for upgrading; If the conditions are met, a two-way authentication mechanism is used to verify the source and integrity of the upgrade request and upgrade package; If the verification is passed, the encrypted upgrade package is decrypted, and a binary difference algorithm is applied to generate a minimum update set containing only the difference parts, and the minimum update set is used to update only the changed parts in the controller of the electric vehicle; If the verification is passed, the encrypted upgrade package is decrypted, and the steps of using a differential upgrade algorithm to update only the changed parts in the controller of the electric vehicle include: Apply a binary difference algorithm to generate a minimal update set containing only the differences; Compress the update set to obtain compressed difference data to reduce the amount of data transmission; The compressed difference data is securely written into the controller in batches; The step of applying a binary difference algorithm to generate a minimum update set containing only the difference parts comprises: Determine the file version in the controller of the electric vehicle as the old file, and determine the corresponding file version in the upgrade package as the new file; The minimum update set is calculated using the following formula group: ; ; in, Represents the difference set between the old file and the new file, NewVersion represents the new file, OldVersion represents the old file, and UpdateSet is the minimum update set to be updated. Represents a data element in the old file, represents the data elements in the new file, wherein the minimum update set is a set obtained by verifying the change of the data block through a hash function; Also includes: If the minimum update set exceeds the preset file size, the minimum update set is divided into a plurality of data blocks, and a sliding window is applied to the blocks to compare the data blocks of the new file and the data blocks of the old file corresponding to the data blocks of the new file one by one, so as to obtain the latest minimum update set; The step of dividing the minimum update set into a plurality of data blocks and applying a sliding window to the blocks to compare the data blocks of the new file and the data blocks of the old file corresponding to the data blocks of the new file one by one comprises: Set the sliding window size and determine the starting positions of the data blocks of the new file and the old file; Starting from the starting position, for each traversed position i, the sliding window will cover w consecutive data blocks starting from i, and get and ,in, It represents the set of data blocks covered by the window when traversing to position i in the new file. It represents the set of data blocks covered by the window when traversing to position i in the old file; Compute local difference sets , which is expressed as follows: ; in, Represents a unique data block in the new file, Represents data blocks unique to the old file; Generate a local update set, whose expression is as follows: ; in, and Represents the local difference set The corresponding old file and new file data blocks are identified by hash values. If the contents of the data blocks are different, Just added to In which, Hash(x) represents the hash value obtained by applying the hash function to the data block; After completing the window processing at the current position i, the window moves to the right by a preset step size and repeats the calculation of the local difference set Steps to obtain multiple local update sets ; Take the multiple local update sets The union of gets the latest minimum update set; Also includes: Use the sliding window to find the longest common sequence between consecutive data blocks to reduce the calculation time. The expression is as follows: ; Where N is the total number of data blocks, W is the window size, and if W=3, it means that three consecutive data blocks will be viewed as a whole during comparison. The Diff function calculates the difference measure between the contents of two windows, B old [i:i+W] and B new [i:i+W] represents the data blocks from position i to i+W in the old file and the new file respectively.
2. The remote upgrade method of the electric vehicle controller according to claim 1, characterized in that: If the conditions are met, the steps to use a two-way authentication mechanism to verify the source and integrity of the upgrade command and upgrade package include: Upon receiving an upgrade request, verifying the validity of the digital certificate carried in the upgrade request; If approved, the integrity and authenticity of the upgrade instruction are verified using the public key in the digital certificate. If successful, obtain the initial hash value calculated by the server when packaging the upgrade package; Independently calculate the hash value of the received upgrade package, and compare the calculation result with the initial hash value provided by the server when packaging the upgrade package; If the two match exactly, it means that the source and integrity of the upgrade package have not been modified during the transmission process.
3. The remote upgrade system of electric vehicle controller is characterized by: include: A receiving module, used for receiving an upgrade request and an encrypted upgrade package from a remote server through the vehicle-mounted communication module; A determination module, used to determine whether the vehicle has been stationary for more than a predetermined time, and if so, whether the battery power level meets the minimum standard required for upgrading; The verification module is used to verify the source and integrity of the upgrade request and upgrade package using a two-way authentication mechanism if the conditions are met; An update module, for decrypting the encrypted upgrade package if the verification is passed, applying a binary difference algorithm to generate a minimum update set containing only the difference parts, and using the minimum update set to update only the changed parts in the controller of the electric vehicle; If the verification is passed, the encrypted upgrade package is decrypted, and the steps of using a differential upgrade algorithm to update only the changed parts in the controller of the electric vehicle include: Apply a binary difference algorithm to generate a minimal update set containing only the differences; Compress the update set to obtain compressed difference data to reduce the amount of data transmission; The compressed difference data is securely written into the controller in batches; The step of applying a binary difference algorithm to generate a minimum update set containing only the difference parts comprises: Determine the file version in the controller of the electric vehicle as the old file, and determine the corresponding file version in the upgrade package as the new file; The minimum update set is calculated using the following formula group: ; ; in, Represents the difference set between the old file and the new file, NewVersion represents the new file, OldVersion represents the old file, and UpdateSet is the minimum update set to be updated. Represents a data element in the old file, represents the data elements in the new file, wherein the minimum update set is a set obtained by verifying the change of the data block through a hash function; Also includes: If the minimum update set exceeds the preset file size, the minimum update set is divided into a plurality of data blocks, and a sliding window is applied to the blocks to compare the data blocks of the new file and the data blocks of the old file corresponding to the data blocks of the new file one by one, so as to obtain the latest minimum update set; The step of dividing the minimum update set into a plurality of data blocks and applying a sliding window to the blocks to compare the data blocks of the new file and the data blocks of the old file corresponding to the data blocks of the new file one by one comprises: Set the sliding window size and determine the starting positions of the data blocks of the new file and the old file; Starting from the starting position, for each traversed position i, the sliding window will cover w consecutive data blocks starting from i, and get and ,in, It represents the set of data blocks covered by the window when traversing to position i in the new file. It represents the set of data blocks covered by the window when traversing to position i in the old file; Compute local difference sets , which is expressed as follows: ; in, Represents a unique data block in the new file, Represents data blocks unique to the old file; Generate a local update set, whose expression is as follows: ; in, and Represents the local difference set The corresponding old file and new file data blocks are identified by hash values. If the contents of the data blocks are different, Just added to In which, Hash(x) represents the hash value obtained by applying the hash function to the data block; After completing the window processing at the current position i, the window moves to the right by a preset step size and repeats the calculation of the local difference set Steps to obtain multiple local update sets ; Take the multiple local update sets The union of gets the latest minimum update set; Also includes: Use the sliding window to find the longest common sequence between consecutive data blocks to reduce the calculation time. The expression is as follows: ; Where N is the total number of data blocks, W is the window size, and if W=3, it means that three consecutive data blocks will be viewed as a whole during comparison. The Diff function calculates the difference measure between the contents of two windows, B old [i:i+W] and B new [i:i+W] represents the data blocks from position i to i+W in the old file and the new file respectively.
4. A computing device, characterized in that It comprises a processing component and a storage component; the storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component to implement the remote upgrade method of the electric vehicle controller as described in claim 1 or 2.
5. A computer storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a computer, the remote upgrade method of the electric vehicle controller as claimed in claim 1 or 2 is implemented.
