A data measurement storage method and system
By judging and linearly predicting the working state of lithium batteries, combined with XOR difference encoding, the problem of low data compression rate of BMS is solved, achieving more efficient data storage and transmission and reducing costs.
Patent Information
- Application Number
- CN202511483736.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-17
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2045-10-17
AI Technical Summary
Existing general compression algorithms cannot effectively utilize the multi-state and strongly correlated characteristics of lithium battery management system (BMS) data, resulting in low data compression rates, especially in environments with limited storage capacity and communication bandwidth, leading to high storage and transmission costs.
By determining the working state of the lithium battery, calculating the prediction coefficient and performing linear prediction, and combining the XOR difference encoding of the timestamp and voltage value, only the core bits and location information are encoded to generate data value encoding, and the timestamp and data value encoding are associated and stored.
It improves data compression rate, reduces storage and transmission costs, alleviates hardware pressure on BMS, and enables more efficient data management.
Smart Images

Figure CN120979462B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of measuring storage, and particularly relates to a data measurement storage method and system. BACKGROUND
[0002] In order to ensure safe and reliable operation of a lithium ion battery and prolong the service life of the battery, a battery management system (BMS) needs to perform real-time monitoring on key state parameters such as voltage and current of the lithium battery at a high frequency. With the improvement of monitoring accuracy and the increase of sampling frequency, the BMS will generate a large amount of time series data during operation. These data are crucial for battery state estimation, fault diagnosis and life prediction, but the huge volume also brings great pressure to data storage and long-distance wireless transmission, especially in a vehicle-mounted or Internet of Things environment with limited storage capacity and communication bandwidth, and the storage and transmission cost becomes a key factor restricting further expansion of the BMS.
[0003] A general compression algorithm (such as the Gorilla algorithm) utilizes the continuity and similarity of time series data in time stamp and value, and achieves compression by difference calculation of the difference of time stamps and linear prediction and XOR operation of data values. However, this is the compression of general data, and unlike general time series data, BMS data has its unique physical and chemical characteristics. For example, the change law of battery parameters under different working states (such as charging, standing and discharging) is completely different, and the parameters are highly correlated and strictly physically constrained. The single prediction model in the general compression algorithm cannot fully utilize the characteristics of multi-state and strong correlation of BMS data. Therefore, there is no optimized data compression method for BMS characteristics, and the compression rate needs to be further improved. SUMMARY
[0004] The application provides a data measurement storage method and system to solve the technical problem of low compression rate of BMS time series data in the prior art.
[0005] In a first aspect, the application provides a data measurement storage method, comprising the following steps:
[0006] S1, obtaining a time stamp, a voltage value and a current value of a lithium battery at a current time; judging a working state of the lithium battery based on the positive and negative and size of the current time current value, the working state including charging, standing and discharging; calculating a difference value of the time stamp at the current time and the time stamp at a previous time, and encoding a change amount of the current time corresponding difference value and the previous time corresponding difference value to obtain a time stamp code;
[0007] S2, calculating a prediction coefficient according to the working state of the lithium battery and a current change amount of the current time current value and the previous time current value; and utilizing the prediction coefficient and voltage values V1 and V2 of the previous two times to calculate a predicted voltage value V3 of the current time, and encoding the predicted voltage value V3 to obtain a voltage code. S3, obtaining a time series data code by combining the time stamp code and the voltage code.n-1 and V n-2 linearly predict the predicted voltage value V p at the current moment n ; convert the measured voltage value V p at the current moment into binary and calculate the XOR difference value of the two;
[0008] S3, encode the XOR difference value to generate data value encoding: when the sum of the number of consecutive zero bits at the head and the number of consecutive zero bits at the tail of the XOR difference value meets the preset compression condition, only encode the core bits and position information in the XOR difference value, wherein the core bits are located between the consecutive zero bits at the head and the consecutive zero bits at the tail; when the sum of the number of consecutive zero bits at the head and the number of consecutive zero bits at the tail of the XOR difference value does not meet the preset compression condition, directly encode the complete XOR difference value;
[0009] S4, store the timestamp encoding and the data value encoding in association.
[0010] Further, in S1, a quiescent current threshold I th is set, the charging judgment threshold is I th , and the discharging judgment threshold is -I th :
[0011] If the current moment current value is greater than the charging judgment threshold I th , the working state of the lithium battery is judged to be charging;
[0012] If the current moment current value is less than the discharging judgment threshold -I th , the working state of the lithium battery is judged to be discharging;
[0013] If the current moment current value is between the discharging judgment threshold -I th and the charging judgment threshold I th , the working state of the lithium battery is judged to be quiescent.
[0014] Further, in S1, the difference D n between the current moment timestamp t n-1 and the last moment timestamp t n , the difference D n-1 between the last moment timestamp t n-2 and the last but one moment timestamp t n-1 are calculated; the difference between D n and D n-1 is calculated and recorded as D of , and D of is encoded according to the value of D of :
[0015] If D of≤63 and D of If -256 ≤ D, it is encoded using control code 10 plus 7 bits; of ≤255 and D of [-63, 63], encoded using control code 110 plus 9 bits; if -2047 ≤ D of ≤2048 and D of [-256, 256], encoded using control code 1110 plus 12 bits; if D of <-2047 or D of >2047, encoded using control code 1111 plus 32 bits.
[0016] Furthermore, in S2, reference coefficients are pre-set for the three working states of charging, resting, and discharging;
[0017] Calculate the current value I at the current moment. n The current value I at the previous moment n-1 The change in current ΔI;
[0018] The prediction coefficient k is the product of the baseline coefficient, the weighting factor, and the change in current ΔI.
[0019] Furthermore, using the prediction coefficients and the voltage values V from the previous two time points... n-1 and V n-2 Linear prediction of the predicted voltage value V at the current moment. p The calculation formula is:
[0020] V p =V n-1 +k×(V n-1 -V n-2 );
[0021] Where V p V is the predicted voltage value at the current moment. n-1 The voltage value at the previous moment, V n-2 is the voltage value at the time two moments ago, and k is the prediction coefficient.
[0022] Furthermore, the current measured voltage value V n and predicted voltage value V p Both are converted into binary sequences. The two binary sequences are then XORed bitwise to obtain the XOR difference between them.
[0023] Furthermore, in S3, the preset compression condition is the compression threshold.
[0024] Further, in S3, if the sum of the number of consecutive zero bits in the header and the number of consecutive zero bits in the tail is greater than or equal to the compression threshold, the compression condition is met, at this time, the control code, the value of the number of consecutive zero bits in the header, the length of the core bits and the core bits themselves are stored by the encoding mode; if the compression condition is not met, the encoding mode is to write the control code and follow the XOR difference value of the complete binary sequence. z
[0025] Further, in S4, the data value generated in S3 is encoded immediately after the timestamp encoding generated in S1, and is concatenated into a continuous bit stream.
[0026] In a second aspect, the present application provides a data measurement storage system, comprising a memory and a processor, wherein the memory stores computer program instructions which, when executed by the processor, implement the above-mentioned data measurement storage method.
[0027] The beneficial effects are: by introducing the judgment of the working state of the lithium battery, the prediction coefficient of the voltage change trend consistent with the actual situation can be calculated for different working conditions of charging, discharging and standing; and when the error value is small and the bit position presents the characteristic of zero at the beginning and end, only the middle core effective bits and position information are encoded, thereby reducing the storage space of the data value. In processing the lithium battery data, the compression ratio is higher than that of the prior art Gorilla, the cost of data storage and transmission is reduced, and the hardware pressure of the battery management system is relieved. BRIEF DESCRIPTION OF DRAWINGS
[0028] Figure 1 is a flowchart of the data measurement storage method;
[0029] Figure 2 is a schematic diagram of lithium battery data acquisition;
[0030] Figure 3 is a schematic diagram of working state judgment;
[0031] Figure 4 is a voltage prediction schematic diagram;
[0032] Figure 5 is a first schematic diagram of data value encoding;
[0033] Figure 6 is a second schematic diagram of data value encoding;
[0034] Figure 7 is a timestamp and data value association schematic diagram;
[0035] Figure 8 is a structural block diagram of the data measurement storage system. DETAILED DESCRIPTION
[0036] An embodiment of the data measurement and storage method provided by the present invention:
[0037] like Figure 1 The data measurement and storage method includes the following steps:
[0038] S1. Obtain the current timestamp, voltage value, and current value of the lithium battery. Based on the sign and magnitude of the current value at the current moment, determine the working state of the lithium battery, which includes charging, resting, and discharging. Calculate the difference between the current timestamp and the previous timestamp, and encode the timestamp code based on the change in the difference between the current and previous timestamps.
[0039] The implementation details of step S1 are as follows:
[0040] Key parameters of lithium batteries include voltage and current, which need to be monitored in real time to ensure battery safety. The battery management system (BMS) uses sensors to collect analog signals from the lithium battery at a preset sampling frequency. An analog-to-digital converter (ADC) then converts these analog signals into digital timestamps, voltage values, and current values, such as... Figure 2 As shown.
[0041] Set a resting current threshold I th , static current threshold I th This is also the charging threshold; the discharging threshold is -I. th When the current current value I is collected... n Greater than I th When I is in a charging state, it is determined that the lithium battery is in a charging state; when I n The absolute value is less than or equal to I th When I is in a static state, it is determined that the lithium battery is in a quiescent state; when I n Less than -I th At this time, it is determined that the lithium battery is in a discharging state.
[0042] Among them, the static current threshold I th The following steps are usually used to obtain the current: (1) Conduct a static test: After the lithium battery is fully charged or fully discharged, let the lithium battery remain static for a sufficient period of time under no load or slight load. During the entire static test, continuously and frequently collect and record the current value of the lithium battery; (2) Calculate the maximum absolute value of the collected static current data and use the maximum absolute value as the static current threshold I. th .
[0043] In an optional embodiment, a resting current threshold I is set. th If the value is 0.1A, then the charging threshold is 0.1A and the discharging threshold is -0.1A.
[0044] When the current current value obtained is greater than 0.1A, the working state of the lithium battery is charging;
[0045] When the current current value obtained is less than 0.1A, the working state of the lithium battery is discharging;
[0046] When the current current value obtained is between -0.1A and 0.1A, the working state of the lithium battery is standing by, as shown in Figure 3
[0047] When the lithium battery is in different states, the current is different, and by setting the standing current threshold, the discharging judgment threshold and the charging current threshold, the battery working state can be distinguished. For example, when the current value is detected to be 2A, since the current value is greater than the preset charging judgment threshold 0.1A, it is determined that the battery is charging. If the current value is detected to be -5A, since the current value is less than the discharging judgment threshold -0.1A, it is determined to be in a discharging state; and when the current value is 0.05A, since the current value is between -0.1A and 0.1A, the battery state is determined to be standing by.
[0048] Calculate the difference D n between the current time stamp t n-1 and the time stamp t n of the last moment; n-1 Calculate the difference D n-2 between the time stamp t n-1 of the last moment and the time stamp t n of the moment before the last moment; n-1 and record it as D of .
[0049] According to the value of D of , encoding is performed:
[0050] If D of =0, a single bit 0 is used for encoding;
[0051] If -63≤D of ≤63 and D of ≠0, control code 10 plus 7 bits are used for encoding;
[0052] If -256≤D of ≤255 and D of ≠0, control code 110 plus 9 bits are used for encoding; If -2047≤D of ≤2048 and D of ≠0, control code 1110 plus 12 bits are used for encoding; If D of >2048, control code 1111 plus 16 bits are used for encoding.
[0054] If D of <-2047 or D of >2047, encode with control code 1111 plus 32 bits.
[0055] The embodiment of the timestamp difference value D of is encoded by hierarchical encoding to improve compression efficiency. If the sampling interval is the same for three consecutive times, D of is 0, only 1-bit control code 0 is used to represent. If D of is 50, falling within the range of -64 to 63, it is encoded as control code 10 plus 7-bit data value; if D of is 200, it is encoded as control code 110 and 9-bit data value.
[0056] S2, according to the working state of the lithium battery and the current value of the current value and the current change value of the current value at the last time, the prediction coefficient is calculated; the prediction coefficient and the voltage value V n-1 and V n-2 at the previous two times are used to linearly predict the predicted voltage value V p at the current time; the measured voltage value V n at the current time and the predicted voltage value V p are converted into binary and the XOR difference value is calculated.
[0057] The implementation details of step S2 are as follows:
[0058] The reference coefficients are set in advance for the three working states of charging, standing and discharging. At the same time, the current change value ΔI of the current value I n at the current time and the current value I n-1 at the last time is calculated. The prediction coefficient k is determined by the reference coefficient and the current change value ΔI, specifically, k is the reference coefficient plus the product of the weight factor and the current change value ΔI.
[0059] Wherein, the reference coefficient represents the average or typical trend of voltage change of the battery under each working state, and the obtaining steps are as follows:
[0060] (1) Let the lithium battery perform long-time charging, standing and discharging under controlled conditions respectively. During the whole process, high-precision voltage, current and timestamp data are continuously recorded.
[0061] (2) According to the recorded current value, the data is divided into three groups, respectively corresponding to the charging, standing and discharging states.
[0062] (3) In each group of data, the average relationship between voltage change and time is analyzed; for example, the average voltage change per second can be calculated.
[0063] (4) The average voltage change rate of each state is calculated and used as the reference coefficient for that state.
[0064] The weighting factor is used to modify the baseline coefficient to accommodate the impact of current fluctuations on voltage prediction. The steps to obtain it are as follows:
[0065] (1) Construct a linear mathematical model to model the deviation of voltage change as a linear function of current change (ΔI).
[0066] (2) Solve the slope in the linear mathematical model by the least squares method. This slope is the weight factor.
[0067] In an optional embodiment, the prediction coefficients and the voltage values V at the previous two time points are used. n-1 and V n-2 Linear prediction of the predicted voltage value V at the current moment. p The calculation formula is:
[0068] V p =V n-1 +k×(V n-1 -V n-2 );
[0069] Where V p V is the predicted voltage value at the current moment. n-1 The voltage value at the previous moment, V n-2 is the voltage value at the time two moments ago, and k is the prediction coefficient.
[0070] Assume the voltage V at the time two moments ago n-2 It is 3.70V, and the voltage V at the previous moment is... n-1 The voltage is 3.71V, and the prediction coefficient k calculated based on the current operating conditions is 1.1. Therefore, the predicted voltage V... p It is 3.721V, such as Figure 4 As shown, the predicted voltage value represents a dynamic acceleration of the voltage based on the recent trend. The current measured voltage value V... n and predicted voltage value V p Both are converted to 32-bit floating-point binary representations according to the IEEE 754 standard. The two binary sequences are then XORed bitwise to obtain the XOR difference between the binary sequences.
[0071] S3, Encode the XOR difference to generate data value encoding: When the sum of the number of consecutive zero bits at the beginning and the number of consecutive zero bits at the end of the XOR difference meets the preset compression conditions, only the core bit and position information in the XOR difference are encoded, where the core bit is located between the consecutive zero bits at the beginning and the consecutive zero bits at the end; when the sum of the number of consecutive zero bits at the beginning and the number of consecutive zero bits at the end of the XOR difference does not meet the preset compression conditions, the complete XOR difference is directly encoded.
[0072] The preset compression condition is the compression threshold, and the number of consecutive zero bits in the first part of the XOR difference, starting from the most significant bit, is calculated as l. z and the number of consecutive zero bits at the tail starting from the least significant bit t z If l z With t z If the sum is greater than or equal to the compression threshold, the compression condition is met. In this case, the control code and l are encoded. z The value, the length of the core bit, and the core bit itself are stored. If the compression conditions are not met, the encoding method is to write the control code followed by the XOR difference of the complete binary sequence.
[0073] The steps for obtaining the compression threshold are as follows:
[0074] (1) Collect a large amount of voltage data, perform prediction and XOR operation on these data to obtain a large amount of XOR difference values.
[0075] (2) Perform statistics on all binary sequences of XOR differences. For each binary sequence, calculate the number of consecutive zero bits at the beginning. z and the number of consecutive zero bits at the tail t z ; will l z +t z A histogram is plotted with the sum of the values on the x-axis and the frequency of that sum on the y-axis. Most XOR differences are represented by l. z +t z The sum will be concentrated in a relatively small range.
[0076] (3) If you want to achieve the highest compression ratio, you can increase the compression threshold, such as 80%. z +t z If the sum is greater than 15, the compression threshold can be set to 15; if you want more stable performance, you can set the threshold slightly lower, such as to 12.
[0077] In an optional embodiment, the XOR difference is set to a 32-bit binary sequence, and the number of consecutive zero bits at the beginning of the XOR difference is calculated. z and the number of consecutive zero bits at the tail t z ;
[0078] Set the compression threshold to 12, if l z With t z If the sum is greater than or equal to 12, it is determined that the compression condition is met. The encoding method is: write 1 bit of control code 1, followed by 6 bits of l. z The value consists of a core bit length represented by 6 bits, and the core bit itself, where the core bit is the bit located between consecutive zero bits at the beginning and end, and the core bit length is equal to 32-1.z -t z As Figure 5 shown;
[0079] If the sum of l z and t z is less than 12, it is determined that the compression condition is not met, and the encoding mode is: write 1 bit control code 0, followed by 32 bits of complete XOR difference value, as shown in Figure 6 .
[0080] S4, the time stamp encoding is stored in association with the data value encoding.
[0081] The data value encoding generated by S3 is immediately concatenated after the time stamp encoding generated by S1 to form a continuous bit stream, and the bit stream is written into the flash memory or sent through the network to complete the compressed storage of the data point, as shown in Figure 7 .
[0082] Embodiments of the data measurement storage system provided by the present application:
[0083] As Figure 8 shown, the data measurement storage system includes a processor and a memory, and the memory stores computer program instructions, which, when executed by the processor, implement the above-mentioned data measurement storage method.
[0084] The data measurement storage system also includes a communication interface and other components well known to those skilled in the art, the settings and functions of which are known in the art, and therefore will not be described here.
[0085] In addition, in the description of the present specification, the meaning of "a plurality of" is at least two, for example, two, three or more, etc., unless otherwise explicitly and specifically limited.
Claims
1. A data measurement storage method, characterized by, The method comprises the following steps: S1, obtaining a time stamp, a voltage value and a current value of the lithium battery at a current time; determining a working state of the lithium battery based on the sign and size of the current value at the current time, the working state including charging, standing and discharging; calculating a difference between the time stamp at the current time and the time stamp at a previous time, and encoding a change amount of the difference at the current time and the difference at the previous time to obtain a time stamp code; S2, calculating a prediction coefficient according to the working state of the lithium battery and the current change amount of the current value at the current moment and the current value at the previous moment; using the prediction coefficient and the voltage values V n-1 and V n-2 linearly predicting the prediction voltage value V p, satisfying: V p =V n-1 +k×(V n-1 -V n-2 ); V n-1 Vn-1is the voltage value of the previous time, V n-2 Vn-2is the voltage value of the time before the previous time, k is a prediction coefficient; setting a reference coefficient for the three working states of charging, standing and discharging in advance; calculating a current value I at the present time n a current change amount ΔI from the current value I at the previous time n-1 a current change amount ΔI from the current value I at the previous time the prediction coefficient k is the reference coefficient plus the product of the weight factor and the current change amount ΔI; The measured voltage value V n and the predicted voltage value V p are converted into binary and the XOR difference value is calculated. S3, encoding the XOR difference to generate a data value code: when the sum of the number of continuous zero bits at the head and the number of continuous zero bits at the tail of the XOR difference satisfies a preset compression condition, only the core bits and the position information in the XOR difference are encoded, wherein the core bits are located between the continuous zero bits at the head and the continuous zero bits at the tail; when the sum of the number of continuous zero bits at the head and the number of continuous zero bits at the tail of the XOR difference does not satisfy the preset compression condition, the complete XOR difference is directly encoded; S4, storing the time stamp code and the data value code in association.
2. The data measurement storage method of claim 1, wherein, In S1, a static current threshold I is set th The charging judgment threshold is I th The discharging judgment threshold is -I th : If the current value at the current time is greater than the charging judgment threshold I th , the working state of the lithium battery is judged as charging. If the current value at the current time is less than the discharge judgment threshold -I th then the working state of the lithium battery is judged as discharging. If the current value at the current time is between the discharge determination threshold value -I th and the charge determination threshold value I th , it is determined that the working state of the lithium battery is stationary.
3. The data measurement storage method of claim 1, wherein, In S1, the time stamp t of the current time is calculated n the difference D between the time stamp t of the previous time n-1 n the time stamp t of the previous time n-1 the time stamp t of the time before the previous time n-2 n-1 the difference D between D and D n n-1 the difference D between D and D of is calculated and is noted D of is encoded according to the value of D If D of =0, encoded using a single bit 0; if -63≤D of ≤63 and D of If -256 ≤ D, it is encoded using control code 10 plus 7 bits; of ≤255 and D of [-63, 63], encoded using control code 110 plus 9 bits; if -2047 ≤ D of ≤2048 and D of [-256, 256], encoded using control code 1110 plus 12 bits; if D of <-2047 or D of >2047, encoded using control code 1111 plus 32 bits.
4. The data measurement storage method of claim 1, wherein, The current measured voltage value V n and the predicted voltage value V p are both converted into binary sequences, and the two binary sequences are subjected to XOR operation bit by bit to obtain an XOR difference value of the binary sequences.
5. The data measurement storage method of claim 1, wherein, In S3, the preset compression condition is a compression threshold.
6. The data measurement storage method of claim 5, wherein, In S3, if the sum of the number of consecutive zero bits at the beginning and the number of consecutive zero bits at the end is greater than or equal to the compression threshold, then the compression condition is met. In this case, the control code and the number of consecutive zero bits at the beginning are encoded. z The value, the length of the core bit, and the core bit itself are stored; if the compression conditions are not met, the encoding method is to write the control code and follow it with the XOR difference of the complete binary sequence.
7. The data measurement storage method of any one of claims 1-6, wherein, In S4, the data value code generated in S3 is stored immediately after the time stamp code generated in S1, and is concatenated into a continuous bit stream.
8. A data measurement storage system, characterized by, The data measurement storage method comprises a memory and a processor, and computer program instructions are stored in the memory, and when the computer program instructions are executed by the processor, the data measurement storage method of any one of claims 1-7 is realized.
Citation Information
Patent Citations
Multi-dimensional optimization of electrical parameters for memory training
CN109643577A
Method, apparatus and computer program product for determining residual value of battery energy store
CN115684969A