Data processing method, controller, battery management system and vehicle

By storing and retrieving data from the battery management system in the order of writing, the problems of wasted storage space and low efficiency in existing technologies are solved, achieving efficient and simplified data management and extending memory life.

CN119917026BActive Publication Date: 2026-03-20BYD CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-16
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing battery management systems use FLASH to simulate EEPROM storage when storing and retrieving critical data, which leads to wasted storage space, low efficiency, and the need for complex specific algorithms, affecting system operating efficiency and memory lifespan.

Method used

By using a method of storing data in the order of writing, new data and historical data arranged in chronological order in memory are used to sequentially read data groups in response to data read commands, simplifying the reading process, reducing the need for specific algorithms, and improving memory utilization and system efficiency.

Benefits of technology

It enables efficient reading and storage of key data from the battery management system, extends memory life, simplifies data management processes, ensures data integrity and consistency, and improves system operating efficiency and data processing capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119917026B_ABST
    Figure CN119917026B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a data processing method, a controller, a battery management system and a vehicle, relates to the technical field of data processing, can read new data and historical data at the same time, does not need to add specific algorithm, shortens the time required for data reading and data writing, and improves the efficiency of the battery management system. The method comprises: in response to a data reading instruction, sequentially reading a plurality of data from a memory to obtain a data group, wherein the data group comprises new data and historical data, the new data is the latest data written into the memory, the historical data is the data written into the memory before the new data, and the data in the memory is arranged according to the order of data writing.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of data processing, in particular to a data processing method, a controller, a battery management system and a vehicle. BACKGROUND

[0002] When the battery management system is running, it is necessary to frequently save the key data for judging whether the battery management system is faulty, that is, freeze frames.

[0003] At present, FLASH memory is generally used to simulate EEPROM storage to realize flexible storage. Specifically, multiple key data when the system fails are stored as a group of data, which occupies a large storage space and shortens the service life of the FLASH. In addition, a specific algorithm needs to be developed to realize data reading and writing, which reduces the operation efficiency of the battery management system. SUMMARY

[0004] In order to solve the problems in the prior art, the present disclosure provides a data processing method, a controller, a battery management system and a vehicle.

[0005] In order to achieve the above-mentioned purpose, in a first aspect, the present disclosure provides a data processing method, which comprises:

[0006] In response to a data reading instruction, sequentially read multiple data from the storage to obtain a data group, wherein the data group comprises new data and historical data, the new data is the latest data written into the storage, the historical data is the data written into the storage before the new data, and the data in the storage is arranged according to the order of data writing.

[0007] In a second aspect, the present disclosure provides a controller, which comprises:

[0008] A storage having a computer program stored thereon;

[0009] A processor for executing the computer program in the storage to realize the method of the first aspect.

[0010] In a third aspect, the present disclosure provides a battery management system comprising the controller of the second aspect.

[0011] In a fourth aspect, the present disclosure provides a vehicle comprising the battery management system of the third aspect.

[0012] In a fifth aspect, the present disclosure provides a computer readable storage medium, having stored thereon a computer program, which, when executed by a processor, implements the method of the first aspect.

[0013] In a sixth aspect, the present disclosure provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method of the first aspect.

[0014] By the above technical solution, the multiple data are sequentially read from the memory in response to the data reading instruction to obtain the data group, the data group comprises the new data written in the memory in the latest time and the historical data written before the new data. The new data and the historical data can be read at the same time, the reading process does not need to formulate a specific algorithm, the time required for reading data is shortened, and the operation efficiency of the battery management system is improved. The data in the memory is stored in the writing order, the new data and the historical data are arranged in the time order, when the data is read, complex sorting or searching processing is not needed, the data is read in the writing order, the integrity and consistency of the data can be ensured, the logical relationship and the business continuity of the data can be maintained, when a large amount of data needs to be processed, the processing efficiency of the data can be significantly improved by the sequential reading mode, when the data is backed up, restored or migrated, the data can be processed more easily and efficiently, and the data management process is simplified. The storage space occupied by each data in the memory is small, and the service life of the memory is prolonged.

[0015] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF DRAWINGS

[0016] The accompanying drawings are included to provide a further understanding of the present disclosure and constitute a part of the specification, and are used together with the following detailed description to explain the present disclosure, but do not constitute a limitation of the present disclosure. In the drawings:

[0017] Figure 1 is a read-write schematic diagram of an existing data processing method.

[0018] Figure 2a is another read-write schematic diagram of an existing data processing method.

[0019] Figure 2b is still another read-write schematic diagram of an existing data processing method.

[0020] Figure 3 is a flowchart of a data processing method according to an exemplary embodiment of the present disclosure.

[0021] Figure 4 is a read-write schematic diagram of a data processing method according to an exemplary embodiment of the present disclosure.

[0022] Figure 5 is a schematic diagram of a storage partition shown according to an example embodiment of the present disclosure.

[0023] Figure 6a is another read-write schematic diagram of a data processing method shown according to an example embodiment of the present disclosure.

[0024] Figure 6b is still another read-write schematic diagram of a data processing method shown according to an example embodiment of the present disclosure.

[0025] Figure 6c is a data write schematic diagram of a data processing method shown according to an example embodiment of the present disclosure.

[0026] Figure 7 is another flowchart of a data processing method shown according to an example embodiment of the present disclosure.

[0027] Figure 8a is a data read schematic diagram of a data processing method shown according to an example embodiment of the present disclosure.

[0028] Figure 8b is another data read schematic diagram of a data processing method shown according to an example embodiment of the present disclosure.

[0029] Figure 9 is still another data write schematic diagram of a data processing method shown according to an example embodiment of the present disclosure.

[0030] Figure 10 is a block diagram of a controller shown according to an example embodiment of the present disclosure. DETAILED DESCRIPTION

[0031] The specific embodiments of the present disclosure will be described below in detail with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely intended to illustrate and explain the present disclosure, and are not intended to limit the present disclosure.

[0032] It is worth mentioning that the storage media capable of realizing power-off saving mainly includes two types: EEPROM and FLASH. EEPROM supports byte-level read and write, and has long erasing life, but is expensive; FLASH only supports page-level (usually several bytes) writing and sector-level (several hundred or several thousand bytes) erasing, and has short erasing life, but is much cheaper than EEPROM.

[0033] EEPROM and FLASH, currently, the FLASH is generally used to store the data saved in power failure, and through the technical means to simulate the EEPROM storage, to realize flexible storage. For example, a FLASH memory chip (its page size is 8 bytes, sector size is 1024 bytes). Referring to Figure 1 , the FLASH storage area is divided into multiple blocks, each block is an integer multiple of 8 bytes; each time the data needs to be recorded, the new data is directly written into the FLASH free block; each time the data needs to be read, the latest data written, that is, the new data, is found; the entire storage area is erased after being full, and the above steps are restarted. But this method can only read new data each time, cannot read historical data, if you want to read new data and historical data at the same time, you need to store the new data and historical data to be read as a group of data, which requires a large storage space, shortening the life of the FLASH.

[0034] For the battery management system needs to save the freeze frame in power failure, the need to save the information on the spot when the battery management system fails, at the same time, in order to prevent the fault from occurring multiple times, it needs to be able to store and read multiple fault information at the same time, and the storage freeze frame can be the data stored when the latest fault of the battery management system occurs. Referring to Figure 2a , according to the number of fault information groups to be saved, define multiple data packets, and whenever the freeze frame data needs to be updated, find the packet position of the data to be stored this time through a specific algorithm. When the data needs to be read, the latest data of each data packet is found.

[0035] The inventors found Figure 2a that the storage method has the following technical problems:

[0036] 1. Multiple data packets need to be defined, increasing the complexity of the data structure in the memory;

[0037] 2. The data reading order and the data writing order cannot be consistent, and when the data is read and written, a specific algorithm needs to be added to determine the position of the data packet storing the data for data reading or writing, which reduces the efficiency of the battery management system and increases the processing code;

[0038] 3. When the number of read data needs to be increased or decreased, the code modification amount is large, which does not conform to the program design principle. Referring to Figure 2b , when the number of read data is changed from 3 groups to 4 groups, the data packet needs to be redefined, and the specific algorithm for determining the position of the data packet storing the data needs to be adjusted.

[0039] Therefore, the present disclosure provides a data processing method, a controller, a battery management system and a vehicle, which can read new data and historical data at the same time, without adding specific algorithms, shortens the time required for data reading and data writing, and improves the efficiency of the battery management system.

[0040] Figure 3 is a flowchart of a data processing method according to an exemplary embodiment of the present disclosure, which can be applied to a controller, such as Figure 3 The data processing method can include the following steps:

[0041] In step S11, in response to a data reading instruction, a plurality of data in the memory are read in sequence to obtain a data group, wherein the data group includes new data and historical data, the new data is the latest data written into the memory, the historical data is the data written into the memory before the new data, and the data in the memory is arranged according to the order of data writing.

[0042] For example, as shown in Figure 4 In the case where one new data and two historical data are stored in the memory, the arrangement order of the data in the memory is new data, historical data 1 and historical data 2, at this time, the new data, the historical data 1 and the historical data 2 are read in sequence from the memory to obtain a data group; continue to write new data into the memory, the latest data written into the memory as new data, and the data written before the new data as historical data, at this time, there is one new data and three historical data in the memory, and the arrangement order of the data in the memory is new data, historical data 1, historical data 2 and historical data 3, the new data, the historical data 1, the historical data 2 and the historical data 3 are read in sequence from the memory.

[0043] The present disclosure reads a plurality of data in the memory in sequence in response to a data reading instruction to obtain a data group, which includes new data written into the memory at the latest time and historical data written before the new data. The new data and the plurality of historical data can be read at the same time, and the reading process does not need to develop specific algorithms, which shortens the time required for reading data, thereby improving the operation efficiency of the battery management system. Moreover, the data in the memory is stored according to the writing order, the new data and the historical data are arranged according to the writing time order, and when reading data, no complex sorting or searching processing is needed, the data is read according to the writing order, which can ensure the integrity and consistency of the data, help to maintain the logical relationship and business continuity of the data, and significantly improve the data processing efficiency when a large amount of data needs to be processed, such as when data backup, recovery or migration is performed, the data can be processed more easily and efficiently, thereby simplifying the data management process.

[0044] For the convenience of those skilled in the art to better understand the data processing method provided by the present disclosure, the steps of the data processing method are described in detail below.

[0045] In a feasible implementation, the data stored in the memory is a frozen frame for the battery management system to run.

[0046] It is worth noting that one of the key data that the battery management system needs to save is a type of data called frozen frame. The frozen frame refers to the vehicle operating state data recorded at a specific time in the vehicle electronic control unit (ECU). For example, when the data stream of the sensor appears abnormal, the ECU will capture the moment when the fault occurs and record the relevant data to form a frozen frame. The frozen frame includes but is not limited to the operating state of the vehicle, sensor readings, system parameters, etc., and can be used for subsequent fault diagnosis and maintenance.

[0047] In a feasible implementation, the data processing method can further include:

[0048] According to the data size of the preset write requirement, the storage addresses in the memory are divided into a second number of data blocks according to the order of data writing, and the size of each data block is equal to the preset write requirement data size;

[0049] According to the number of data required for preset reading, the second number of data blocks is divided into at least two storage partitions, the number of data required for preset reading is the first number carried in the data reading instruction, each storage partition includes a third number of data blocks, and the third number is less than or equal to the first number.

[0050] Among them, the size of the data block is the same as the size of the preset write requirement data. The number of historical data in the number of data required for preset reading is greater than or equal to the number of data blocks in a storage partition, such as the number of historical data in the preset reading requirement is 10, then the number of data blocks in each storage partition is less than or equal to 10; or the number of historical data is an integer multiple of the number of data blocks in a storage partition, such as the number of historical data in the preset reading requirement is 10, and the number of data blocks in each storage partition is 2 or 5. By limiting the number of historical data to be read and the number of data blocks in each storage partition, it is avoided that the data in the memory overflows, resulting in that the new data and the historical data cannot be determined.

[0051] It's worth noting that the memory can be FLASH, and the number of times FLASH can be used is related to its lifespan. In existing technology, one FLASH address stores only one piece of data. If the FLASH lifespan is 500 times, one FLASH address can only store data 500 times. However, the disclosed embodiment divides one FLASH address into multiple data blocks, and then divides these data blocks into multiple storage partitions. With the FLASH address capable of storing data 500 times, each data block can store data 500 times. If the FLASH storage space is large enough, dividing the FLASH address into multiple data blocks increases the total number of times the FLASH can be used, thereby extending the FLASH lifespan. For example, if the FLASH lifespan is 500 times, dividing the FLASH address into ten data blocks, each capable of storing data 500 times, means one FLASH address can store data 5000 times, thus extending the FLASH lifespan.

[0052] It should be understood that a data block refers to a specific data area used for storing and managing data. This could be a contiguous space on a physical storage medium, or a logically defined area for ease of management and operation. In this embodiment, the memory address can also be divided into multiple data blocks according to the data writing order, based on the memory's lifespan requirements.

[0053] For example, such as Figure 5 As shown, based on the preset data size required for writing, the FLASH address is divided into n data blocks according to the data writing order. Each data block corresponds to a storage address, namely storage address 1, storage address 2, ..., storage address n. Using 6 data blocks as a storage partition, the n data blocks are divided into M storage partitions, and partition mapping is performed to obtain storage partitions A, ..., M. The storage addresses of the 6 data blocks in storage partition A are storage address 1, ..., storage address 6, ..., and the storage addresses of the 6 data blocks in storage partition M are storage address n-5, ..., storage address n.

[0054] In this embodiment of the present disclosure, the size of the storage space (i.e., data block) occupied by each piece of data in the memory can be preset according to the size of the data to be written. The lifespan of the memory can be extended by adjusting the size of the storage space used to store each piece of data, i.e., trading storage space for lifespan.

[0055] In one feasible implementation, the data processing method may further include:

[0056] In response to a data write command, the system traverses the memory to determine the second storage state of each memory partition.

[0057] Based on the second storage state, the data carried by the data write instruction is written into the memory.

[0058] In the embodiment of the present disclosure, in response to the data write instruction, the second storage state of each storage partition in the memory is determined by traversing the memory, so that the storage space can be managed more effectively, the generation of storage fragmentation can be avoided, the existing data will not be overwritten, the risk of data write conflict and data loss can be reduced, and the data can be written into the target position in the memory quickly and accurately, and the response speed of the battery management system can be improved.

[0059] In a possible implementation, the data carried by the data write instruction is written into the memory according to the second storage state, which can include:

[0060] In the case that the second storage state represents that there is a free data block in the storage partition where the data is written last time, the data carried by the data write instruction is written into the storage partition where the data is written last time.

[0061] In the case that the second storage state represents that there is no free data block in the storage partition where the data is written last time, the data carried by the data write instruction is written into the next storage partition adjacent to the storage partition where the data is written last time.

[0062] For example, the FLASH address is divided into 18 data blocks according to the data write order, 6 data blocks are taken as a storage partition, and the 18 data blocks are divided into 3 storage partitions, which are A storage partition, B storage partition and C storage partition in turn. In response to the data write instruction, the second storage state of each storage partition in the memory is determined. As shown in FIG. 1, in the case that the second storage state represents that there is a free data block in the A storage partition where the data is written last time, the data carried by the data write instruction is written into the next free data block in the A storage partition. As shown in FIG. 2, in the case that the second storage state represents that there is no free data block in the A storage partition where the data is written last time, the data carried by the data write instruction is written into the first free data block in the B storage partition. Figure 6a Figure 6b

[0063] In the embodiment of the present disclosure, when there is still a free data block in the storage partition where the data is written last time, the data is preferentially written into the storage partition, so that the storage fragmentation is reduced, the utilization rate of the storage space is improved, and the addressing time is reduced without repositioning to other storage areas in the memory. When there is no free data block in the storage partition where the data is written last time, the next storage partition adjacent to the storage partition is selected for writing, so that the continuity of data writing is maintained, the movement of the read-write head is reduced, and the writing efficiency is improved. Through the above two ordered writing strategies, the data retrieval and recovery process can be simplified.

[0064] ​​In a possible implementation, the writing of the data carried by the data write instruction into the memory according to the second storage state can include:

[0065] In a case where the second storage state represents that all the storage partitions in the memory are full, the first storage partition in the memory is erased, and the data carried by the data write instruction is written into the first storage partition.

[0066] For example, as shown in Figure 6c In a case where the second storage state represents that all the storage partitions in the memory are full, all the data in the A storage partition is erased, and the data carried by the data write instruction is written into the first free data block in the A storage partition.

[0067] In a case where all the storage partitions in the embodiment of the present disclosure are full, the first storage partition is erased, and the data is written into the first storage partition, and the historical data in the other storage partitions is retained on the basis of the storable new data, and the new data and the plurality of historical data can be read at the same time in subsequent data reading.

[0068] The foregoing three data writing processes are described below in a complete implementation:

[0069] The FLASH address is divided into 12 data blocks according to the data writing sequence, 6 data blocks are taken as one storage partition, and the 12 data blocks are divided into two storage partitions, which are the A storage partition and the B storage partition in turn. In response to the data write instruction, data is written into the blank data blocks in the A storage partition in turn; after all the data blocks in the A storage partition are full, data is written into the blank data blocks in the B storage partition in turn; after all the data blocks in the B storage partition are full, all the data in the A storage partition is erased, and data is written into the blank data blocks in the A storage partition in turn; after all the data blocks in the A storage partition are full again, all the data in the B storage partition is erased, and data is written into the blank data blocks in the B storage partition in turn. The foregoing data writing process is repeated until the life of the memory reaches the upper limit.

[0070] In a possible implementation, as shown in Figure 7 In step S11, in response to the data read instruction, a plurality of data is read from the memory in turn to obtain a data group, which can include:

[0071] In step S111, in response to the data read instruction, a first storage address of new data newly written into the memory is determined, and a second storage address of historical data written into the memory before the new data is determined according to the first storage address, a first quantity of data to be read corresponding to the read instruction, and a write number of the memory.

[0072] In step S112, the data group is obtained by sequentially reading the plurality of data from the memory according to the first storage address and the second storage address.

[0073] It is worth mentioning that the number of times of writing the memory can be counted by a counter, and the count of the counter is increased by one each time the memory is written, and is not affected by power failure.

[0074] For example, after determining the first storage address of the new data newly written in the memory, the storage address of the first historical data adjacent to the new data can be determined according to the first storage address and the count of the counter, and the storage addresses of the remaining historical data can be determined according to the first quantity of data corresponding to the read instruction and the storage address of the first historical data, and the storage addresses of the first historical data and the remaining historical data are taken as the second storage address. Correspondingly, the new data is read according to the first storage address, and the plurality of historical data is read according to the second storage address.

[0075] In the embodiment of the present disclosure, by directly positioning to the first storage address of the newly written data, the data reading process can be quickly started, and the need to scan the memory from the beginning is reduced, thereby improving the efficiency of data access. And according to the first quantity of data to be read and the number of times of writing the memory, the second storage address of the historical data is accurately obtained, ensuring that only the required data is read, avoiding unnecessary data transmission and processing, quickly positioning and reading the required data, thereby improving the response speed of the battery management system, and suitable for scenarios that require processing of a large amount of data and frequent data updates.

[0076] In a possible implementation, the memory includes a second quantity of data blocks and at least two storage partitions, each of which includes a third quantity of continuous data blocks;

[0077] In step S111, the second storage address of the historical data written in the memory before the new data is determined according to the first storage address, the first quantity of data corresponding to the read instruction, and the number of times of writing the memory, which can include:

[0078] According to the number of times of writing the memory and the second quantity, the first storage state of the memory is determined, and the first storage state represents whether the memory is full;

[0079] The second storage address of the historical data written in the memory before the new data is determined according to the first storage state, the first quantity and the first storage address, or the first storage state and the third quantity.

[0080] It is worth mentioning that the first storage state representing whether the memory is full can be determined by comparing the number of times of writing the memory with the second quantity, and then the second address of the historical data is further determined according to the first storage state.

[0081] In a possible implementation, the second storage address of the historical data written into the memory before the new data is determined according to the first storage state and the first storage address, or the first storage state and the third quantity, which can include:

[0082] In a case where the first storage state represents that the write-in times of the memory are greater than the second quantity, the second storage address of the historical data written into the memory before the new data is determined according to the first difference between the write-in times and the second quantity, the first quantity and the first storage address;

[0083] In a case where the first storage state represents that the write-in times of the memory are less than the second quantity, the second storage address of the historical data written into the memory before the new data is determined according to the first quantity and the third quantity.

[0084] It is worth noting that the write-in times of the memory are greater than the second quantity, which represents that all data blocks in the memory have stored data, at this time, the second storage address of the historical data needs to be determined according to the first difference between the write-in times and the second quantity, in combination with the first storage address. In a case where the write-in times of the memory are less than the second quantity, which represents that there are data blocks in the memory that have never stored data, at this time, the second storage address of the historical data needs to be determined according to the first quantity and the third quantity.

[0085] For example, the FLASH address is divided into 18 data blocks according to the data write-in order, and 6 data blocks are taken as a storage partition, and the 18 data blocks are divided into 3 storage partitions, which are A storage partition, B storage partition and C storage partition in turn. As shown in Figure 8a When there is one data stored in the A storage partition and the count of the counter is 19, the count 19 of the counter is greater than the total number 18 of data blocks in the memory, at this time, all data blocks in the memory have stored data, and the second storage address of the historical data is determined to be in the B storage partition and / or the C storage partition according to the difference between the count 19 of the counter and the total number 18 of data blocks in the memory, and the first storage address of the new data.

[0086] Correspondingly, as shown in Figure 6a When there are 4 data stored in the A storage partition and the count of the counter is 4, the count 4 of the counter is less than the total number 18 of data blocks in the memory, at this time, there are data blocks in the memory that have never stored data, and the second storage address of the historical data is determined to be in the A storage partition according to the count 4 of the counter and the number 6 of data blocks in the A storage partition, and the first storage address of the new data.

[0087] In the embodiment of the present disclosure, the storage state of the memory is determined by comparing the number of write times of the memory with the total number of data blocks in the memory, and then the second storage address is determined in combination with the first storage address, so that the repeated storage and invalid storage of data can be avoided, the utilization of the storage space is improved, the addressing time during data access is reduced, the required data can be quickly located in a large data set or a complex data structure, and the performance of the battery management system is improved.

[0088] In a feasible embodiment, determining the second storage address of the historical data written into the memory before the new data according to the first difference, the first number and the first storage address can include:

[0089] comparing the first difference with the third number to obtain a comparison result;

[0090] determining the second storage address of the historical data written into the memory before the new data according to the comparison result, the first number and the first storage address.

[0091] In the embodiment of the present disclosure, when all data blocks in the memory store data, the second storage address of the historical data is determined by comparing the first difference with the number of data blocks in the storage partition and in combination with the first storage address, so that the accuracy and reliability of the second storage address are improved.

[0092] In a feasible embodiment, determining the second storage address of the historical data written into the memory before the new data according to the comparison result, the first number and the first storage address can include:

[0093] In the case where the comparison result represents that the first difference is less than or equal to the third number, it is determined that the first storage address is located in the first storage partition in the memory, the fourth number is obtained by subtracting the first difference from the first number, and all storage addresses before the first storage address in the first storage partition and the storage addresses of the last fourth number in the last storage partition in the memory are determined as the second storage addresses of the historical data.

[0094] For example, the FLASH addresses are divided into 18 data blocks according to the data write order, 6 data blocks are taken as a storage partition, and the 18 data blocks are divided into 3 storage partitions, which are A storage partition, B storage partition and C storage partition in sequence. Figure 8aAs shown, in the case that the first difference value between the count of the counter and the total number of data blocks in the memory is 1, the first difference value 1 is less than the number of data blocks in the storage partition 6, indicating that the A storage partition in the memory is erased and there are free data blocks in the A storage partition, at this time, it can be determined that the first storage address is located in the A storage partition, the first number 7 of the data to be read corresponding to the read instruction is reduced by the first difference value 1 to obtain 6, it can be determined that the number of historical data stored in the C storage partition is 6, and the last 6 storage addresses in the C storage partition are determined as the second storage addresses of the historical data. At this time, one new data and 6 historical data are read out from the A storage partition and the C storage partition, in sequence, the new data, the historical data 1, the historical data 2, …, and the historical data 6.

[0095] In an implementable embodiment, according to the comparison result, the first number and the first storage address, determining the second storage addresses of the historical data written into the memory before the new data can comprise:

[0096] In the case that the comparison result indicates that the first difference value is greater than the third number, it is determined that the first storage address is located in the second storage partition outside the first storage partition in the memory, a second difference value between the first difference value and the third number is determined, the first number is reduced by the second difference value to obtain a fifth number, and all storage addresses before the first storage address in the second storage partition and the first fifth number of storage addresses in the storage partition adjacent to the second storage partition are determined as the second storage addresses of the historical data.

[0097] For example, the FLASH addresses are divided into 18 data blocks according to the data writing sequence, 6 data blocks are taken as one storage partition, and the 18 data blocks are divided into 3 storage partitions, in sequence, the A storage partition, the B storage partition and the C storage partition. As shown, Figure 8b As shown, in the case that the first difference value between the count 25 of the counter and the total number 18 of data blocks in the memory is 7, the first difference value 7 is greater than the number of data blocks in the storage partition 6, indicating that the A storage partition and the B storage partition in the memory are both erased and the A storage partition is full again, at this time, it can be determined that the first storage address is located in the B storage partition, the first difference value 7 is reduced by the number of data blocks in the storage partition 6 to obtain a second difference value 1, the first number 7 of the data to be read corresponding to the read instruction is reduced by the second difference value 1 to obtain 6, it can be determined that the number of historical data stored in the A storage partition is 6, and the last 6 storage addresses in the A storage partition are determined as the second storage addresses of the historical data. At this time, one new data and 6 historical data are read out from the A storage partition and the B storage partition, in sequence, the new data, the historical data 1, the historical data 2, …, and the historical data 6.

[0098] In an implementable embodiment, according to the third number, determining the second storage addresses of the historical data written into the memory before the new data can comprise:

[0099] In a case that the write-in times of the memory is less than or equal to the third quantity, the first storage address is determined to be located in the first storage partition in the memory, and all storage addresses before the first storage address in the first storage partition are determined to be the second storage addresses of the historical data.

[0100] For example, the FLASH addresses are divided into 18 data blocks according to the data write-in order, 6 data blocks are taken as one storage partition, and the 18 data blocks are divided into 3 storage partitions, which are A storage partition, B storage partition and C storage partition in sequence. Figure 6a As shown in the figure, in a case that the count 4 of the counter is less than the total number 6 of the data blocks in the storage partition, the first storage address of the new data is determined to be located in the A storage partition, the first 3 storage addresses in the A storage partition are determined to be the second storage addresses of the historical data, at this time, one new data and 3 historical data are read out from the A storage partition in sequence, which are new data, historical data 1, historical data 2 and historical data 3.

[0101] In a feasible implementation, the second storage addresses of the data written into the memory before the new data can include:

[0102] In a case that the write-in times of the memory is greater than the third quantity, the first storage address is determined to be located in a target third storage partition outside the first storage partition in the memory, a third difference value is obtained by subtracting the third quantity from the write-in times, a sixth quantity is obtained by subtracting the third difference value from the first quantity, and all storage addresses before the first storage address in the third storage partition and the first sixth quantity of storage addresses in a storage partition adjacent to the third storage partition in the memory are determined to be the second storage addresses of the data written into the memory before the new data.

[0103] For example, the FLASH addresses are divided into 18 data blocks according to the data write-in order, 6 data blocks are taken as one storage partition, and the 18 data blocks are divided into 3 storage partitions, which are A storage partition, B storage partition and C storage partition in sequence. Figure 6b As shown in the figure, in a case that the count 7 of the counter is greater than the total number 6 of the data blocks in the storage partition, the first storage address of the new data is determined to be located in the B storage partition, a third difference value 1 is obtained by subtracting the total number 6 of the data blocks in the storage partition from the count 7 of the counter, the first quantity 6 of the data to be read corresponding to the read instruction is subtracted by the third difference value 1 to obtain 5, and the quantity of the historical data stored in the A storage partition is determined to be 5, the last 6 storage addresses in the A storage partition are determined to be the second storage addresses of the historical data. At this time, one new data and 5 historical data are read out from the A storage partition and the B storage partition in sequence, which are new data, historical data 1, historical data 2, …, historical data 5.

[0104] In a feasible implementation, when the requirement of changing is to increase the number of data read each time, the program code does not need to be modified, and data can be directly read.

[0105] As shown in Figure 9 FIG. 1, the FLASH address is divided into 18 data blocks according to the data writing order, 6 data blocks are taken as one storage partition, and the 18 data blocks are divided into 3 storage partitions, which are A storage partition, B storage partition and C storage partition in sequence, and the storage state in the memory is that the A storage partition is full, 4 data are stored in the B storage partition, and no data is stored in the C storage partition. After responding to the data writing instruction, new data is written into the B storage partition, at this time, 5 data are stored in the B storage partition, if the data reading instruction is received at this time, and the first number carried in the data reading instruction is 7, then a new data and 6 historical data are read out from the A storage partition and the B storage partition to obtain a data group in response to the data reading instruction. After responding to the data writing instruction again, new data is written into the B storage partition, at this time, the B storage partition is full, if the data reading instruction is received at this time, and the first number carried in the data reading instruction is changed from 7 to 8, then a new data and 7 historical data are read out from the A storage partition and the B storage partition to obtain a data group in response to the data reading instruction.

[0106] In the embodiment of the disclosure, when the requirement of reading out data changes, such as increasing or decreasing the number of reading data, only the first number carried in the data reading instruction needs to be adjusted, so that the number of historical data read is increased or decreased, the code does not need to be modified, and the data can be quickly and accurately read.

[0107] Based on the same inventive concept, the disclosure further provides a controller, as shown in Figure 10 comprises:

[0108] a memory 1001, in which a computer program is stored;

[0109] a processor 1002, configured to execute the computer program in the memory to implement the data processing method described above.

[0110] The present disclosure sequentially reads multiple data from the memory in response to a data reading instruction to obtain a data group, the data group including new data written in the memory last time and historical data written before the new data. The new data and the multiple historical data can be read simultaneously, and the reading process does not need to develop a specific algorithm, thereby shortening the time required for reading data and improving the operation efficiency of the battery management system. Moreover, the data in the memory is stored in the order of writing, and the new data and the historical data are arranged in the order of writing time, so that when the data is read, no complex sorting or searching process is needed, and the data can be read in the order of writing, which can ensure the integrity and consistency of the data, help maintain the logical relationship and business continuity of the data, and significantly improve the processing efficiency of the data when a large amount of data needs to be processed. For example, when data backup, recovery or migration is performed, the data can be processed more easily and efficiently, thereby simplifying the data management process.

[0111] Based on the same inventive concept, the present disclosure also provides a battery management system comprising the controller described above.

[0112] Based on the same inventive concept, the present disclosure also provides a vehicle comprising the battery management system described above.

[0113] In another exemplary embodiment, a computer readable storage medium comprising program instructions is also provided, the program instructions being executed by a processor to implement the steps of the data processing method described above.

[0114] In another exemplary embodiment, a computer program product is also provided, the computer program product containing a computer program capable of being executed by a processor, the computer program being executed by the processor to implement the steps of the data processing method described above.

[0115] The preferred embodiments of the present disclosure are described in detail above with reference to the accompanying drawings, but the present disclosure is not limited to the specific details in the above-described embodiments. Within the scope of the technical concept of the present disclosure, various simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.

[0116] In addition, it should be noted that each specific technical feature described in the above specific embodiments can be combined in any appropriate manner without contradiction. In order to avoid unnecessary repetition, various possible combinations are not described again in the present disclosure.

[0117] Furthermore, any combination of the various different embodiments of the present disclosure can also be made, as long as it does not deviate from the idea of the present disclosure, and it should also be considered as disclosed by the present disclosure.

Claims

1. A data processing method, characterized in that, The method includes: In response to a data read command, the system determines the first storage address of the newly written data in the memory, and determines the second storage address of the historical data written to the memory before the new data based on the first storage address, the first quantity of data to be read corresponding to the read command, and the number of writes to the memory. Based on the first storage address and the second storage address, multiple data are sequentially read from the memory to obtain a data group, wherein the data group includes new data and historical data, the new data is the data most recently written to the memory, and the historical data is the data written to the memory before the new data, and the data in the memory is arranged according to the order in which the data was written; Based on the preset data size required for writing, the memory address is divided into a second number of data blocks according to the order of data writing, and the size of each data block is equal to the preset data size required for writing. Based on the preset number of data to be read, the second number of data blocks are divided into at least two storage partitions. The preset number of data to be read is the first number carried in the data read instruction. Each storage partition includes a third number of data blocks, and the third number is less than or equal to the first number.

2. The data processing method according to claim 1, characterized in that, The memory includes a second number of data blocks and at least two storage partitions, each of the storage partitions including a third number of consecutive data blocks; Determining the second storage address of historical data written to the memory before the new data, based on the first storage address, the first quantity of data to be read corresponding to the read instruction, and the number of writes to the memory, includes: Based on the number of writes to the memory and the second quantity, a first storage state of the memory is determined, wherein the first storage state indicates whether the memory is full; Based on the first storage state, the first quantity, and the first storage address, or the first storage state and the third quantity, determine a second storage address for historical data written to the memory before the new data.

3. The data processing method according to claim 2, characterized in that, Determining the second storage address of historical data written to the memory before the new data, based on the first storage state, the first quantity, and the first storage address, or the first storage state and the third quantity, includes: When the first storage state indicates that the number of writes to the memory is greater than the second quantity, the second storage address of the historical data written to the memory before the new data is determined based on the first difference between the number of writes and the second quantity, the first quantity, and the first storage address. If the first storage state indicates that the number of writes to the memory is less than the second number, then based on the third number, a second storage address for historical data written to the memory before the new data is determined.

4. The data processing method according to claim 3, characterized in that, The step of determining the second storage address of historical data written to the memory before the new data, based on the first difference between the number of writes and the second quantity, the first quantity, and the first storage address, includes: Compare the first difference with the third quantity to obtain the comparison result; Based on the comparison result, the first quantity, and the first storage address, a second storage address is determined for the historical data written to the memory before the new data.

5. The data processing method according to claim 4, characterized in that, The step of determining the second storage address of historical data written to the memory before the new data, based on the comparison result, the first quantity, and the first storage address, includes: If the comparison result indicates that the first difference is less than or equal to the third quantity, it is determined that the first storage address is located in the first storage partition of the memory. The first quantity is subtracted from the first difference to obtain the fourth quantity. All storage addresses in the first storage partition before the first storage address, and the storage addresses in the last storage partition of the memory after the fourth quantity, are determined as the second storage address of the historical data.

6. The data processing method according to claim 4, characterized in that, The step of determining the second storage address of historical data written to the memory before the new data, based on the comparison result, the first quantity, and the first storage address, includes: If the comparison result indicates that the first difference is greater than the three quantities, it is determined that the first storage address is located in a second storage partition outside the first storage partition in the memory, the second difference between the first difference and the third quantity is determined, the first quantity is subtracted from the second difference to obtain the fifth quantity, and all storage addresses in the second storage partition before the first storage address, and the storage addresses in the previous storage partition adjacent to the second storage partition in the memory before the fifth quantity are determined as the second storage address of the historical data.

7. The data processing method according to claim 3, characterized in that, Determining the second storage address of historical data written to the memory before the new data, based on the third quantity, includes: If the number of writes to the memory is less than or equal to the third number, the first memory address is determined to be located in the first memory partition, and all memory addresses preceding the first memory address in the first memory partition are determined to be the second memory address.

8. The data processing method according to claim 3, characterized in that, Determining the second storage address of the data written to the memory before the new data, based on the third quantity, includes: If the number of writes to the memory is greater than the third quantity, the first memory address is determined to be located in a target third memory partition outside the first memory partition. The number of writes is subtracted from the third quantity to obtain a third difference. The first quantity is subtracted from the third difference to obtain a sixth quantity. All memory addresses in the third memory partition before the first memory address, and the memory addresses in the memory preceding the sixth quantity in the memory adjacent to the third memory partition, are determined as the second memory address of the data written to the memory before the new data.

9. The data processing method according to claim 1, characterized in that, The method further includes: In response to a data write command, the memory is traversed to determine the second storage state of each of the memory partitions. According to the second storage state, the data carried by the data writing instruction is written into the memory.

10. The data processing method according to claim 9, characterized in that, The step of writing the data carried by the data writing instruction into the memory according to the second storage state includes: If there is a free data block in the storage partition of the memory where the second storage state indicates that the last data was written, the data carried by the data write instruction is written into the storage partition where the last data was written. If, in the second storage state, there is no free data block in the storage partition where the last data was written, the data carried by the data write instruction is written to the next storage partition in the memory adjacent to the storage partition where the last data was written.

11. The data processing method according to claim 9, characterized in that, The step of writing the data carried by the data writing instruction into the memory according to the second storage state includes: When the second storage state indicates that all storage partitions in the memory are full, the first storage partition in the memory is erased, and the data carried by the data write instruction is written into the first storage partition.

12. The data processing method according to claim 1, characterized in that, The data stored in the memory is the freeze frame during the operation of the battery management system.

13. A controller, characterized in that, include: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the method of any one of claims 1-12.

14. A battery management system, characterized in that, Includes the controller as described in claim 13.

15. A vehicle, characterized in that, Includes the battery management system as described in claim 14.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1-12.

17. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-12.

Citation Information

Patent Citations

  • Recording device, recording method, recording medium

    CN107615386A

  • Data processing method, multi-input multi-output queue circuit and storage medium

    CN116431099A