Battery pack data analysis method and device
By correcting the battery pack data frames received by the serial port, the frame header position corresponds to the target byte position and data integrity, the problem of easy disorder during the reception process of the serial port data frame is solved, and the accurate analysis of the battery pack data is achieved.
Patent Information
- Application Number
- CN202411782009.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-03-28
AI Technical Summary
During the reception process, serial data frames are susceptible to factors such as electromagnetic interference, resulting in disordered transmission frequency and transmission time, which in turn causes partial loss or disordered data in the data frame, affecting the accuracy of data analysis.
By correcting the battery pack data in each frame, it is ensured that the position of the frame header corresponds to the target byte position and the data is in a complete state, thereby achieving accurate analysis of the battery pack data.
It effectively alleviates the problem that the received battery pack data is prone to confusion and difficult to accurately analyze, and ensures the integrity and accuracy of the battery pack data analysis results for each frame.
Smart Images

Figure CN119718769A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of battery pack data analysis and application, and in particular to a battery pack data analysis method and device. Background Art
[0002] Serial port is a common peripheral in the development of automotive electronics. The general definition of serial port data frame is: frame header + data. Among them, the frame header indicates the beginning of a frame of data and can be called head.
[0003] The inventors have discovered that current serial port data frames are generally transmitted via wired transmission. When the serial port receives a data frame of a preset length within a preset period, the counterpart of the serial port (such as a high-voltage acquisition module) is susceptible to factors such as electromagnetic interference, resulting in confusion in the sending frequency and timing of the counterpart, making it likely that the data in the data frame will be partially lost, and the data in the data frame received by the serial port will be confused, resulting in large errors in the analysis results of the data at the data receiving end (such as a charging management module). Summary of the invention
[0004] In view of this, an object of the present invention is to provide a method and device for parsing battery pack data, by correcting each frame of battery pack data so that each frame of parsed battery pack data is complete, so as to alleviate the technical problem that the received battery pack data is easily confused and difficult to parse accurately.
[0005] In a first aspect, an embodiment provides a method for parsing battery pack data, the method comprising:
[0006] Acquire the battery pack data of the current frame sent by the high voltage acquisition module through the serial port; wherein the battery pack data of the current frame includes a frame header and data; the frame header has a matching target byte position; the target byte position is used to locate the battery pack data of each frame;
[0007] Identify the battery pack data of the current frame, and if it is identified that the position of the frame header does not correspond to the target byte position, perform correction processing on the battery pack data of the current frame, so that the position of the frame header in the battery pack data of the current frame after the correction processing corresponds to the target byte position, and the data in the battery pack data of the current frame after the correction processing is complete;
[0008] Verifying and analyzing the charging status of the current battery pack according to the battery pack data of the current frame after the correction processing;
[0009] The battery pack data of the next frame is used as the battery pack data of the new current frame, and the step of obtaining the battery pack data of the current frame sent by the high-voltage acquisition module through the serial port is repeated until all the battery pack data sent by the high-voltage acquisition module have been verified and analyzed.
[0010] In an optional implementation manner, the battery pack data of the current frame has a preset length; and the step of correcting the battery pack data of the current frame includes:
[0011] Determine, according to the position of the frame header and the preset length, a target length of the next frame of battery pack data acquired from the high voltage acquisition module through the serial port;
[0012] Acquire the target battery pack data of the next frame from the high voltage acquisition module based on the target length;
[0013] The battery pack data of the current frame after correction processing is determined according to the frame header of the battery pack data of the current frame and the data after the frame header, and the target battery pack data of the next frame.
[0014] In an optional embodiment, the method further comprises:
[0015] When each frame of battery pack data after the target battery pack data sent by the high-voltage acquisition module is acquired through the serial port, the position of the frame header of each frame of the battery pack data identified corresponds to the target byte position.
[0016] In an optional implementation manner, the battery pack data of the current frame has a preset length; and the step of correcting the battery pack data of the current frame includes:
[0017] Acquire the battery pack data of the next frame from the high voltage acquisition module through the serial port;
[0018] splicing the battery pack data of the current frame and the battery pack data of the next frame;
[0019] Based on the frame header of the battery pack data of the current frame, a preset length is determined from the spliced battery pack data to generate the battery pack data of the current frame after correction processing.
[0020] In an optional embodiment, the method further comprises:
[0021] The minimum measurement unit of the amount of information is used as the frame header, and the data in the battery pack data of each frame is controlled not to be the minimum measurement unit of the amount of information.
[0022] In an optional embodiment, the method further comprises:
[0023] The format and preset length of each frame of battery pack data are agreed upon in advance with the high voltage acquisition module.
[0024] In an optional implementation, the step of acquiring the battery pack data of the current frame sent by the high voltage acquisition module through the serial port includes:
[0025] If the battery pack data of the current frame has been received, reading the battery pack data of the current frame from the buffer area;
[0026] If the battery pack data of the current frame is not received, sending a request for obtaining the battery pack data of the current frame to the high-voltage acquisition module according to a preset period, and receiving the battery pack data of the current frame sent by the high-voltage acquisition module through the serial port;
[0027] or,
[0028] If the battery pack data of the current frame is not received, in response to the interrupt signal sent by the high-voltage acquisition module, the battery pack data of the current frame is obtained from the high-voltage acquisition module through the serial port.
[0029] In a second aspect, an embodiment provides a battery pack data parsing device, the device comprising:
[0030] An acquisition module is used to acquire the battery pack data of the current frame sent by the high-voltage acquisition module through the serial port; wherein the battery pack data of the current frame includes a frame header and data; the frame header has a matching target byte position; the target byte position is used to locate the battery pack data of each frame;
[0031] a correction module, which identifies the battery pack data of the current frame, and if it is identified that the position of the frame header does not correspond to the target byte position, performs correction processing on the battery pack data of the current frame, so that the position of the frame header in the battery pack data of the current frame after the correction processing corresponds to the target byte position, and the data in the battery pack data of the current frame after the correction processing is in a complete state;
[0032] An analysis module verifies and analyzes the charging status of the current battery pack according to the battery pack data of the current frame after the correction processing;
[0033] The repeating module uses the battery pack data of the next frame as the battery pack data of the new current frame, and repeatedly executes the step of obtaining the battery pack data of the current frame sent by the high-voltage acquisition module through the serial port, until all the battery pack data sent by the high-voltage acquisition module have been verified and analyzed.
[0034] In a third aspect, an embodiment provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the steps of the method described in any of the aforementioned implementation methods are implemented.
[0035] In a fourth aspect, an embodiment provides a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the steps of the method described in any one of the aforementioned implementations.
[0036] A method and device for parsing battery pack data provided by an embodiment of the present invention obtains the battery pack data of the current frame sent by the high-voltage acquisition module through a serial port; identifies whether the frame header of the battery pack data of the current frame is at the target byte position, and if not, then the data in the battery pack data of the current frame is misaligned, and performs correction processing on the battery pack data of the current frame, so that after the frame header corresponds to the target byte position and the battery pack data of the current frame is complete, the battery pack data of the current frame is parsed, and the battery pack data of the next frame is used as the new battery pack data of the current frame. Repeat the above process until the battery pack data sent by the high-voltage acquisition module are all verified and parsed, thereby terminating a relatively accurate parsing result of the battery pack data.
[0037] Other features and advantages of the present disclosure will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present disclosure.
[0038] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 A schematic diagram of a data frame under an ideal state provided by an embodiment of the present invention;
[0041] Figure 2 A schematic diagram of a data frame actually subjected to external interference provided by an embodiment of the present invention;
[0042] Figure 3 A flow chart of a battery pack data analysis method provided by an embodiment of the present invention;
[0043] Figure 4 A schematic diagram of an application scenario of data frame correction processing provided by an embodiment of the present invention;
[0044] Figure 5 A schematic diagram of another application scenario of data frame correction processing provided by an embodiment of the present invention;
[0045] Figure 6 A functional module diagram of a battery pack data analysis device provided by an embodiment of the present invention;
[0046] Figure 7 A schematic diagram of the hardware architecture of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention 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 invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] The serial port data frame is generally defined as: frame header + data. The frame header indicates the beginning of a frame of data and can be called head. Figure 1 The black filled part of each received data frame. In an ideal state, the head of the serial port data frame expected to be received corresponds to the position of byte 0, so that the data in the serial port data frame can be directly verified and the protocol parsed without special processing.
[0049] However, in actual applications, for the serial port data frames transmitted by wire, the counterpart of the serial port is susceptible to external interference. At this time, the data frames received by the serial port may have some data loss, and if data loss occurs once, it will cause all subsequent received data to be disordered; Figure 2 As shown, some data is lost in the data frame received for the first time. The received data includes data2, data3, data4 in the previous data frame, and head, data0, data1 in the next data frame, so that the data header and each data of the data frame received for the second time are still misaligned with the corresponding byte position, which is not conducive to the subsequent reading, verification and analysis of the data frame.
[0050] Based on this, an embodiment of the present invention provides a method and device for parsing battery pack data, which performs correction processing when there is a mismatch between the frame header and the target byte position in each frame of battery pack data, so as to improve the accuracy of verification and parsing of each received data frame.
[0051] To facilitate understanding of this embodiment, a method for parsing battery pack data disclosed in an embodiment of the present invention is first introduced in detail. The method is applied to the data receiving end, that is, the charging management module; the charging management module is used to receive the battery pack data sent by the opponent end / data sending end (high-voltage acquisition module) to ensure that the data frame received each time will not be disordered and cause low parsing accuracy. Among them, the charging management module and the high-voltage acquisition module can be understood as devices in practical applications of vehicles involving power supply, such as electric vehicles, hybrid vehicles, new energy vehicles, etc.
[0052] Figure 3 A flow chart of a battery pack data parsing method provided in an embodiment of the present invention.
[0053] like Figure 3 As shown, the method comprises the following steps:
[0054] Step S102, obtaining the battery pack data of the current frame sent by the high voltage acquisition module through the serial port.
[0055] Among them, the high-voltage acquisition module is a component device used for vehicle high-voltage acquisition, which can safely measure voltages up to 1000V; the data receiving end can receive the battery pack data sent by the high-voltage acquisition module through the serial port, and the battery pack data may include voltage, current and other parameter values involved in the current battery pack charging process.
[0056] The battery pack data of the current frame or even each frame includes a frame header and at least one data. It can be understood that the frame header is set before the at least one data; the frame header has a target byte position that matches it; the target byte position is used to locate the battery pack data of each frame, that is, the battery pack data of each frame can be located by the frame header located at the target byte position; the target byte position can be as follows Figure 1 and Figure 2 As shown in byte0, the frame header should ideally be located at the position shown by the black fill.
[0057] Step S104, the battery pack data of the current frame is identified. If it is identified that the position of the frame header does not correspond to the target byte position, the battery pack data of the current frame is corrected so that the position of the frame header in the battery pack data of the current frame after correction corresponds to the target byte position, and the data in the battery pack data of the current frame after correction is complete.
[0058] It should be noted that if the frame header does not correspond to the target byte position, the battery pack data frame received, read, and obtained each time is incomplete. Figure 2 As shown, each frame of battery pack data received at this time is incomplete and in a disordered state, and cannot be presented as Figure 1The inventor has found that after correcting such disordered data frames, the frame header corresponds to the target byte position, which can ensure the integrity of each frame of battery pack data. After the correction, each frame of battery pack data can be Figure 1 As shown, each time a battery pack data frame is received, read, and acquired, the data is in a complete state.
[0059] Step S106 , verifying and analyzing the charging status of the current battery pack according to the battery pack data of the current frame after correction.
[0060] Here, the battery pack data that has been corrected has complete data, and data verification operations and protocol analysis operations can be directly performed, thereby obtaining more accurate analysis results to improve the reliability of the current battery pack charging status analysis.
[0061] Step S108, taking the battery pack data of the next frame as the battery pack data of the new current frame, and repeating step S102 until all the battery pack data sent by the high voltage acquisition module have been verified and analyzed.
[0062] It should be noted that the battery pack data used to characterize the current battery pack charging status may include more than one data frame. When the battery pack data of the current frame has been verified and parsed, the battery pack data of the next frame will continue to be parsed through the above-mentioned steps S102-S106 until the verification and parsing of each frame of battery pack data is completed.
[0063] In a preferred embodiment of actual application, the battery pack data of the current frame sent by the high-voltage acquisition module is obtained through the serial port; it is identified whether the frame header of the battery pack data of the current frame is at the target byte position. If not, the data in the battery pack data of the current frame is misaligned, and the battery pack data of the current frame is corrected so that the frame header corresponds to the target byte position and the battery pack data of the current frame is complete. Then, the battery pack data of the current frame is parsed, and the battery pack data of the next frame is used as the new battery pack data of the current frame. Repeat the above process until the battery pack data sent by the high-voltage acquisition module are all verified and parsed, thereby terminating a relatively accurate analysis result of the battery pack data.
[0064] In some embodiments, different acquisition methods may be used according to different battery pack data situations; illustratively, the step S102 may acquire the battery pack data of the current frame through the following steps, including:
[0065] Step 2.1), if the battery pack data of the current frame has been received, the battery pack data of the current frame is read from the buffer area.
[0066] At this time, if the current frame battery pack data has been received by the charging management module before, the current frame battery pack data needs to be obtained from the buffer area of the charging management module.
[0067] Step 2.2), if the battery pack data of the current frame is not received, a request for obtaining the battery pack data of the current frame is sent to the high-voltage acquisition module according to a preset period, and the battery pack data of the current frame sent by the high-voltage acquisition module through the serial port is received.
[0068] At this time, the current frame battery pack data has not been received by the charging management module before. At this time, the charging management module can query the status of the high-voltage acquisition module regularly (preset period) through polling mode and request the latest current frame battery pack data.
[0069] or,
[0070] Step 2.3), if the battery pack data of the current frame is not received, in response to the interrupt signal sent by the high-voltage acquisition module, the battery pack data of the current frame is obtained from the high-voltage acquisition module through the serial port.
[0071] At this moment, when the current frame battery pack data has not been received by the charging management module before, the charging management module can obtain the current frame battery pack data through the interrupt driving mode; specifically, when the high-voltage acquisition module detects that the preset conditions are met, it can actively generate a hardware interrupt signal to notify the charging management module, so that the charging management module can obtain the current frame battery pack data after receiving the interrupt signal; wherein, the preset condition can be understood as the target parameter collected by the battery pack during the charging process exceeds the preset threshold value corresponding to the target parameter; for example, the voltage exceeds the preset voltage threshold value.
[0072] In some embodiments, the battery pack data of the current frame is of a preset length, that is, the length of the battery pack data of each frame is fixed, such as Figure 4 and Figure 5 As shown, the preset length is 6 at this time; the solution of correcting the battery pack data of the current frame in step S104, as an optional embodiment, can be implemented by the following steps, including:
[0073] Step 3.1), according to the position of the frame header and the preset length, determine the target length of the next frame of battery pack data obtained from the high-voltage acquisition module through the serial port.
[0074] Here, the target length of the next frame to obtain the data frame can be determined by calculating the difference between the preset length and the position of the frame header and then adding a value of one; Figure 5 As shown in the figure, when it is found that the frame header is not at the target byte position byte 0, the receiving length of the next frame is determined to be "preset length - the position of the head + 1". Figure 5 The preset length shown in is the length of byte0-byte5, which is 6. The position of the head is byte3, which is located at position 4. Then the target length of the received data frame of the next frame is "6-4+1=3".
[0075] Step 3.2), based on the target length, obtain the target battery pack data of the next frame from the high voltage acquisition module.
[0076] The length of the target battery pack data of the next frame is the target length, and the target battery pack data of the next frame is a part of the battery pack data of the next frame. Figure 5 As shown, the target battery pack data of the next frame received by the second receiver is data2, data3, data4 with a target length of 3, that is, three bytes of data.
[0077] Step 3.3), according to the frame header and the data after the frame header of the battery pack data of the current frame, and the target battery pack data of the next frame, determine the battery pack data of the current frame after correction processing.
[0078] Here, if Figure 5 As shown, based on the frame header head located in byte3 of the battery pack data of the current frame received for the first time and the data data0, data1 located after the frame header head, and the target battery pack data data2, data3, data4 of the next frame received for the second time, the battery pack data of the current frame after correction processing are constituted. The battery pack data of the current frame after correction processing is complete and can directly participate in the analysis of the subsequent step S106.
[0079] On the basis of the above-mentioned embodiment, the battery pack data correction scheme of the current frame is implemented through steps 3.1) to 3.3), and the battery pack data of each frame received each time can be adjusted once to be in an ideal state, that is, except for steps 3.1) to 3.3), no subsequent processing is required to ensure that the frame header head is always at the target byte position byte0, and the data in the battery pack data of each frame received each time is complete; specifically, the scheme provided by the embodiment of the present invention also includes:
[0080] Step 4.1), when acquiring each frame of battery pack data after the target battery pack data sent by the high-voltage acquisition module through the serial port, the position of the frame header of each frame of the battery pack data identified corresponds to the target byte position.
[0081] Here, if Figure 5As shown, after receiving the target battery pack data for the second time, the position of the frame header head of each frame of the battery pack data received for the third, fourth, etc. times is restored to a state corresponding to the target byte position byte0, and the battery pack data received for the third, fourth, etc. times is complete, meeting the requirement of the preset length of 6.
[0082] It should be noted that Figure 5 Only a case of receiving four battery pack data frames is shown, but the present invention is not limited thereto. The actual number of battery pack data frames depends on the actual situation.
[0083] The correction processing scheme provided in step 3.1) to step 3.3) of the embodiment of the present invention only requires one adjustment after the frame header is found to be misaligned. Subsequent data frames can be restored to complete battery pack data with the frame header located at the 0th byte, and can be used directly without any correction processing, thereby improving the efficiency of the correction processing, avoiding the MCU resource overhead of rearranging the data each time it is received, and reducing the complexity of the encoding logic.
[0084] Exemplarily, in actual applications, if the charging management module detects that an interrupt signal is generated, it identifies whether the frame header head is at the target byte position byte0; if so, it directly performs data verification and protocol parsing operations on the battery pack data of the current frame; if not, it calculates the data offset between the frame header head and the target byte position byte0, and calls a preset function to read the target battery pack data of the next frame based on the data offset. The combination of the data after the frame header in the battery pack data of the current frame and the target battery pack data of the next frame, as well as each frame after the target battery pack data, can be directly subjected to data verification and protocol parsing processing.
[0085] In some embodiments, the solution of correcting the battery pack data of the current frame in step S104, as another optional embodiment, can be implemented by the following steps, including:
[0086] Step 4.1), obtain the next frame of battery pack data from the high voltage acquisition module through the serial port.
[0087] Step 4.2), concatenate the battery pack data of the current frame and the battery pack data of the next frame.
[0088] Step 4.3), based on the mid-frame header of the battery pack data of the current frame, determine the preset length from the spliced battery pack data, and generate the battery pack data of the current frame after correction processing.
[0089] like Figure 5As shown, the battery pack data of the current frame received for the first time and the battery pack data of the next frame received for the second time can be spliced, and then the frame header can be identified from the battery pack data of the current frame and the data length can be selected backward, so that the length of the frame header head + data data0, data1, data2, data3, data4 is a preset length of 6. At this time, the battery pack data of the current frame after correction processing is obtained, and the battery pack data of the current frame after correction processing can be directly used for subsequent parsing processing.
[0090] Exemplarily, if the charging management module detects the generation of an interrupt signal, it identifies whether the frame header is at the target byte position byte0; if it is, the battery pack data of the current frame is directly checked and the protocol parsing operation is performed; if not, the battery pack data of the current frame received this time is spliced with the battery pack data of the next frame received next time, and the frame header and the data following it in the battery pack of the current frame are taken out to reach the preset length, and the battery pack data after correction is obtained, and the data verification and protocol parsing operation are directly performed. It can be understood that if the correction processing scheme provided by steps 4.1)-step 4.3) is adopted, the correction processing operation needs to be performed on each frame of battery pack data, and this correction processing can ensure that each frame of battery pack data after correction processing has higher reliability.
[0091] It should be noted that in actual applications, if it is necessary to ensure the correction efficiency, avoid the MCU resource overhead of rearranging the data each time it is received, and reduce the complexity of the encoding logic, the correction method provided in steps 3.1) to 3.3) can be adopted. Only one correction process is required, and no subsequent correction is required; if the actual requirements for the correction reliability are high, in order to ensure the accuracy of the subsequent analysis results, the correction method provided in steps 4.1) to 4.3) can be selected.
[0092] In some embodiments, the high voltage acquisition module and the charging management module can maintain the definition consistency of each frame of battery pack data in advance, and the format of the battery pack data can be expanded or modified; the battery pack data parsing method provided by the embodiment of the present invention also includes:
[0093] Step 5.1), agree with the high voltage acquisition module in advance on the format and preset length of each frame of battery pack data.
[0094] For example, the high-voltage acquisition module and the charging management module can pre-define the format of each frame of battery pack data, including HEX hexadecimal, DEC decimal, OCT octal, BIN binary, etc.
[0095] Step 5.2), the minimum measurement unit of the amount of information is used as the frame header, and the minimum measurement unit of the non-information amount of the data in each frame of the battery pack data is controlled.
[0096] It should be noted that, as the frame header of a frame of data, "head" should be avoided from appearing as data in a position other than the frame header when designing the protocol, so as not to interfere with the receiving party receiving data; in the embodiment of the present invention, the frame header of the battery pack data can be defined as the minimum unit of measurement of information amount, that is, data with the highest bit being 1, so that the frame header of the battery pack data is unique and will not interfere with the receiving party receiving data;
[0097] Here, if the battery pack data of each frame is in hexadecimal format, 0x90 is used as the data header of each frame; if the battery pack data of each frame is in binary format, 1 0 0 1 0 0 0 0 is used as the data header of each frame;
[0098] In the pre-definition of the high-voltage acquisition module and the charging management module in actual applications, avoid using data with the highest bit as 1, so that 0x90 can only appear as a frame header in a frame of data. The maximum value that a byte can represent is 127. If you want to represent larger values, you need to customize a private protocol. The sender and receiver splice and parse multiple bytes that meet the above requirements in the same format, so that data can be transmitted flexibly.
[0099] In some embodiments, the battery pack data of the current frame or even each frame includes a check bit in addition to the frame header and at least one data; the check bit is located at the end of the last data;
[0100] The high-voltage acquisition module adds up the byte data after removing the first bit of data in the data frame and puts it in the check bit; the charging management module adds up the bit data of each bit in the battery pack data of the current frame received, and determines whether the sum is equal to the check bit to verify the reliability of the battery pack data of the current frame received.
[0101] In practical applications, if a cyclic redundancy check (CRC) is used, the check values of the high-voltage acquisition module and the charging management module are unified to &0x7f to ensure the uniqueness of the frame header.
[0102] The battery pack data parsing method provided in the embodiment of the present invention can alleviate the disorder of battery pack data transmitted due to external interference in the serial port protocol. The method ensures the accuracy of the battery pack data verification and parsing results by quickly adjusting the disorder problem of the battery pack data.
[0103] In some embodiments, Figure 6 As shown, the embodiment of the present invention further provides a battery pack data analysis device 200, the device comprising:
[0104] The acquisition module 201 acquires the battery pack data of the current frame sent by the high voltage acquisition module through the serial port; wherein the battery pack data of the current frame includes a frame header and data; the frame header has a matching target byte position; the target byte position is used to locate the battery pack data of each frame;
[0105] The correction module 202 identifies the battery pack data of the current frame, and if it is identified that the position of the frame header does not correspond to the target byte position, performs correction processing on the battery pack data of the current frame, so that the position of the frame header in the battery pack data of the current frame after the correction processing corresponds to the target byte position, and the data in the battery pack data of the current frame after the correction processing is complete;
[0106] The analysis module 203 verifies and analyzes the charging status of the current battery pack according to the battery pack data of the current frame after the correction processing;
[0107] Repeat module 204, use the battery pack data of the next frame as the battery pack data of the new current frame, and repeat the step of obtaining the battery pack data of the current frame sent by the high-voltage acquisition module through the serial port until all the battery pack data sent by the high-voltage acquisition module have been verified and analyzed.
[0108] Furthermore, the battery pack data of the current frame is of a preset length; the correction module 202 is specifically used to determine the target length of the battery pack data of the next frame obtained from the high-voltage acquisition module through the serial port according to the position of the frame header and the preset length; obtain the target battery pack data of the next frame from the high-voltage acquisition module based on the target length; determine the battery pack data of the current frame after correction processing according to the frame header of the battery pack data of the current frame and the data after the frame header, as well as the target battery pack data of the next frame.
[0109] Furthermore, the device is also used to, when acquiring each frame of battery pack data after the target battery pack data sent by the high-voltage acquisition module through the serial port, identify that the position of the frame header of each frame of the battery pack data corresponds to the target byte position.
[0110] Furthermore, the battery pack data of the current frame is of a preset length; the correction module 202 is specifically used to obtain the battery pack data of the next frame from the high-voltage acquisition module through the serial port; splice the battery pack data of the current frame and the battery pack data of the next frame; determine the preset length from the spliced battery pack data based on the mid-frame header of the battery pack data of the current frame, and generate the battery pack data of the current frame after correction.
[0111] Furthermore, the device is also used to use the minimum measurement unit of the amount of information as the frame header, and control the data in each frame of battery pack data to be not the minimum measurement unit of the amount of information.
[0112] Furthermore, the device is also used to pre-agreed with the high-voltage acquisition module on the format and preset length of each frame of battery pack data.
[0113] Furthermore, the acquisition module 201 is specifically used to, if the battery pack data of the current frame has been received, read the battery pack data of the current frame from the cache area; if the battery pack data of the current frame has not been received, send an acquisition request for the battery pack data of the current frame to the high-voltage acquisition module according to a preset period, and receive the battery pack data of the current frame sent by the high-voltage acquisition module through the serial port; or, if the battery pack data of the current frame has not been received, obtain the battery pack data of the current frame from the high-voltage acquisition module through the serial port in response to an interrupt signal sent by the high-voltage acquisition module.
[0114] Figure 7 Schematic diagram of the hardware architecture of the electronic device 300 provided in an embodiment of the present invention. Figure 7 As shown, the electronic device 300 includes: a machine-readable storage medium 301 and a processor 302, and may also include a non-volatile storage medium 303, a communication interface 304 and a bus 305; wherein the machine-readable storage medium 301, the processor 302, the non-volatile storage medium 303 and the communication interface 304 communicate with each other through the bus 305. The processor 302 can execute the battery pack data parsing method described in the above embodiment by reading and executing the machine-executable instructions for parsing the battery pack data in the machine-readable storage medium 301.
[0115] The machine-readable storage medium mentioned in this article can be any electronic, magnetic, optical or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), any type of storage disk (such as CD, DVD, etc.), or similar storage medium, or a combination thereof.
[0116] The non-volatile medium may be a non-volatile memory, a flash memory, a storage drive (such as a hard drive), any type of storage disk (such as a CD, DVD, etc.), or a similar non-volatile storage medium, or a combination thereof.
[0117] It can be understood that the specific operation methods of each functional module in this embodiment can refer to the detailed description of the corresponding steps in the above method embodiment, and will not be repeated here.
[0118] The computer-readable storage medium provided in the embodiment of the present invention stores a computer program. When the computer program code is executed, the battery pack data parsing method described in any of the above embodiments can be implemented. For specific implementation, please refer to the method embodiment, which will not be repeated here.
[0119] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0120] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0121] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0122] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the aforementioned embodiments, those of ordinary skill in the art should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the aforementioned embodiments within the technical scope disclosed by the present invention, or can easily conceive of changes, or make equivalent replacements for some of the technical features therein. Such modifications, changes 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 invention, and should all be covered within the protection scope of the present invention.
Claims
1. A method for analyzing battery pack data, characterized in that: The method comprises: Acquire the battery pack data of the current frame sent by the high voltage acquisition module through the serial port; wherein the battery pack data of the current frame includes a frame header and data; the frame header has a matching target byte position; the target byte position is used to locate the battery pack data of each frame; Identify the battery pack data of the current frame, and if it is identified that the position of the frame header does not correspond to the target byte position, perform correction processing on the battery pack data of the current frame, so that the position of the frame header in the battery pack data of the current frame after the correction processing corresponds to the target byte position, and the data in the battery pack data of the current frame after the correction processing is complete; Verifying and analyzing the charging status of the current battery pack according to the battery pack data of the current frame after the correction processing; The battery pack data of the next frame is used as the battery pack data of the new current frame, and the step of obtaining the battery pack data of the current frame sent by the high-voltage acquisition module through the serial port is repeated until all the battery pack data sent by the high-voltage acquisition module have been verified and analyzed.
2. The method according to claim 1, characterized in that The battery pack data of the current frame is of a preset length; and the step of correcting the battery pack data of the current frame comprises: Determine, according to the position of the frame header and the preset length, a target length of the next frame of battery pack data acquired from the high voltage acquisition module through the serial port; Acquire the target battery pack data of the next frame from the high voltage acquisition module based on the target length; The battery pack data of the current frame after correction processing is determined according to the frame header of the battery pack data of the current frame and the data after the frame header, and the target battery pack data of the next frame.
3. The method according to claim 2, characterized in that The method further comprises: When each frame of battery pack data after the target battery pack data sent by the high-voltage acquisition module is acquired through the serial port, the position of the frame header of each frame of the battery pack data identified corresponds to the target byte position.
4. The method according to claim 1, characterized in that: The battery pack data of the current frame is of a preset length; and the step of correcting the battery pack data of the current frame comprises: Acquire the battery pack data of the next frame from the high voltage acquisition module through the serial port; splicing the battery pack data of the current frame and the battery pack data of the next frame; Based on the frame header of the battery pack data of the current frame, a preset length is determined from the spliced battery pack data to generate the battery pack data of the current frame after correction processing.
5. The method according to claim 1, 3 or 4, characterized in that: The method further comprises: The minimum measurement unit of the amount of information is used as the frame header, and the data in the battery pack data of each frame is controlled not to be the minimum measurement unit of the amount of information.
6. The method according to claim 5, characterized in that The method further comprises: The format and preset length of each frame of battery pack data are agreed upon in advance with the high voltage acquisition module.
7. The method according to claim 1, characterized in that The steps of obtaining the battery pack data of the current frame sent by the high voltage acquisition module through the serial port include: If the battery pack data of the current frame has been received, reading the battery pack data of the current frame from the buffer area; If the battery pack data of the current frame is not received, sending a request for obtaining the battery pack data of the current frame to the high-voltage acquisition module according to a preset period, and receiving the battery pack data of the current frame sent by the high-voltage acquisition module through the serial port; or, If the battery pack data of the current frame is not received, in response to the interrupt signal sent by the high-voltage acquisition module, the battery pack data of the current frame is obtained from the high-voltage acquisition module through the serial port.
8. A battery pack data analysis device, characterized in that: The device comprises: An acquisition module is used to acquire the battery pack data of the current frame sent by the high-voltage acquisition module through the serial port; wherein the battery pack data of the current frame includes a frame header and data; the frame header has a matching target byte position; the target byte position is used to locate the battery pack data of each frame; a correction module, which identifies the battery pack data of the current frame, and if it is identified that the position of the frame header does not correspond to the target byte position, performs correction processing on the battery pack data of the current frame, so that the position of the frame header in the battery pack data of the current frame after the correction processing corresponds to the target byte position, and the data in the battery pack data of the current frame after the correction processing is in a complete state; An analysis module verifies and analyzes the charging status of the current battery pack according to the battery pack data of the current frame after the correction processing; The repeating module uses the battery pack data of the next frame as the battery pack data of the new current frame, and repeatedly executes the step of obtaining the battery pack data of the current frame sent by the high-voltage acquisition module through the serial port, until all the battery pack data sent by the high-voltage acquisition module have been verified and analyzed.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the steps of the method described in any one of claims 1 to 7.