Data processing method and system, electronic equipment and storage medium
By adopting a data processing method based on preset sampling logic in the battery management system, the problem of no reusability of test software code is solved, high reusability and portability of the code is achieved, development time is saved, and the sampling cycle is improved Stable and controllable, it is suitable for stable collection and verification of multi-node data.
Patent Information
- Application Number
- CN202410567696.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-09
- Publication Date
- 2024-08-23
AI Technical Summary
The test software code of the existing battery management system lacks reusability and needs to change the sampling logic according to the number of nodes, resulting in a large development time consumption.
A data processing method based on preset sampling logic is adopted. The number of nodes is called in the function as a formal parameter variable. Fixed-format messages are forwarded to the host computer, where they are parsed and verified. Multi-dimensional arrays are used to store and forward node data. , supports stable collection and verification of multi-node data.
It achieves high code reusability and portability, saves development time, and the sampling period increases linearly with the number of nodes. It is stable and controllable, has strong maintainability, and is compatible with development from high to low node numbers.
Smart Images

Figure CN118535152A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of testing software development technology processing, and in particular to a data processing method, system, electronic equipment and storage medium. Background Art
[0002] Battery Management System (BMS) refers to the software and hardware platform used to monitor, manage and control the battery system. The current BMS platform uses a one-to-many mode, that is, one master node (BQ79600) mounts multiple slave nodes (BQ7961x). Different numbers of nodes will be designed to meet different customer needs, and multi-node battery cell voltage sampling will be performed. In related technologies, the test software for this module is point-to-point project development.
[0003] like Figure 1 As shown, the software development logic in the related technology is: the sampling logic is determined according to the number of nodes each time, and the collected data is forwarded to the host computer in real time using the Controller Area Network (CAN) message. The upper limit of the data volume sampled each time is determined by the maximum number of bytes supported by the CAN message. Then, C# is used to develop the host computer software with the corresponding logic to perform data analysis, cyclic redundancy check (CRC) and visual display.
[0004] The inventors have found through research that the data processing method in the related art has at least the following defects:
[0005] The data sampling logic needs to be changed according to the number of nodes. The test software code of projects with different numbers of nodes is not reusable. Summary of the invention
[0006] The present application provides a data processing method, system, electronic device and storage medium, which can solve the problem of non-reusability of test software codes provided in related technologies. In this method, the data sampling logic is fixed, and the number of nodes is called in the function as a formal parameter variable. There is no need to change the logic according to the number of nodes. The code is highly portable and saves a lot of development time.
[0007] One of the embodiments of the present application provides a data processing method, which includes: obtaining sampling data based on a preset sampling logic, wherein the number of nodes is a variable of a sampling function corresponding to the preset sampling logic; forwarding the sampling data to a host computer based on a message in a fixed format; and parsing and verifying the message based on the host computer.
[0008] Further, a read instruction is obtained, wherein the read instruction is used to trigger a request read function; when the request read function triggered by the read instruction is started, the node data of the variable corresponding to each node is read; wherein the number of cycles of data reading is the same as the number of variables corresponding to any node; based on the number of nodes and the number of cycles, the node data is stored in a cache to obtain sampled data.
[0009] Furthermore, the step of storing the node data in the cache includes: when the total number of nodes is less than or equal to the storage threshold of the memory, directly storing the node data in the cache; when the total number of nodes is greater than the storage threshold, storing part of the node data that does not exceed the cache storage threshold, and then storing the remaining node data after clearing the cache until the node data storage is completed.
[0010] Furthermore, according to the number of nodes and the number of loops, the node data is stored in a cache to obtain the step of sampling data, including: creating a multidimensional array based on the number of loops, the number of nodes and the node data; wherein the number of loops is associated with the number of columns of the multidimensional array; the number of nodes is associated with the number of rows of the multidimensional array; and the node data is the basic data unit of the multidimensional array.
[0011] Furthermore, according to the sampled data, a message based on a fixed format is forwarded to the host computer, including: sequentially retrieving the node data to be forwarded with the number of rows associated with the number of nodes in the multidimensional array; according to the node data to be forwarded, a message based on a fixed frame number is forwarded to the host computer.
[0012] Furthermore, the message with a fixed number of frames includes four CAN FD message frames, wherein each CAN FD message frame corresponds to the node data of the variable corresponding to a single node.
[0013] Furthermore, parsing and verifying the message based on the host computer includes: the parsing method includes: using VectorCANalyzer to make a DBC file for data parsing; and / or using CANoe to make a DBC file for data parsing.
[0014] Furthermore, parsing and verifying the message based on the host computer includes: the verification method includes at least one of CRC verification, parity verification, Gray code verification, LRC verification and MD5 verification.
[0015] Furthermore, when CRC verification is used, it also includes: using Visual Studio tools to compile verification data into a DLL file; importing the DLL file into a script automation test system for verification; wherein the maximum number of nodes for CRC verification is the total number of nodes.
[0016] One of the embodiments of the present application also provides a data processing system, including: an acquisition module, used to obtain sampling data based on a preset sampling logic, wherein the number of nodes is a variable of a sampling function corresponding to the preset sampling logic; a forwarding module, used to forward the sampling data to a host computer based on a message in a fixed format; and a processing module, used to parse and verify the message based on the host computer.
[0017] One of the embodiments of the present application also provides an electronic device, the electronic device includes a processor and a memory, the memory stores at least one instruction or program, the instruction or program is loaded and executed by the processor to implement the data processing method as described above.
[0018] One of the embodiments of the present application also provides a computer-readable storage medium, in which at least one instruction or program is stored. The instruction or program is loaded and executed by a processor to implement the data processing method as described above.
[0019] Compared with the related art, this application has the following beneficial effects, including but not limited to:
[0020] 1) In this data processing method, the data sampling logic is fixed, and the number of nodes is used as a parameter variable to call the sampling function corresponding to the sampling logic. There is no need to change the sampling logic according to the number of nodes. The data processing method has strong code portability during application and can save a lot of development time.
[0021] 2) In this data processing method, since the sampling logic is fixed, the sampling period increases linearly directly according to the increase in the number of nodes, and the sampling period is stable and controllable.
[0022] 3) In this data processing method, the host computer software adopts standard software and uses its internal plug-in tool for secondary development, which has strong maintainability. The parsing logic of the host computer software can be compatible from a high number of nodes to a low number of nodes, which can be maximized and eliminates the complicated host computer software development work. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] This specification will be further described in the form of exemplary embodiments, which will be described in detail by the accompanying drawings. These embodiments are not restrictive, and in these embodiments, the same number represents the same structure, wherein:
[0024] Figure 1 It is a sampling chip sampling architecture diagram provided in the related art;
[0025] Figure 2 is a flowchart of a data processing method according to some embodiments of the present application;
[0026] Figure 3is a schematic diagram of a preset sampling logic according to some embodiments of the present application;
[0027] Figure 4 is a schematic diagram of a data sampling process according to some embodiments of the present application;
[0028] Figure 5 It is a message frame forwarding logic diagram shown in some embodiments of the present application;
[0029] Figure 6 is a structural block diagram of an electronic device according to some embodiments of the present application;
[0030] Figure 7 It is a structural block diagram of a data processing system according to some embodiments of the present application. DETAILED DESCRIPTION
[0031] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following is a brief introduction to the drawings required for the description of the embodiments. Obviously, the drawings described below are only some examples or embodiments of this specification. For ordinary technicians in this field, this specification can also be applied to other similar scenarios based on these drawings without creative work. Unless it is obvious from the language environment or otherwise explained, the same reference numerals in the figures represent the same structure or operation.
[0032] It should be understood that the "system", "device", "unit" and / or "module" used herein are a method for distinguishing different components, elements, parts, portions or assemblies at different levels. However, if other words can achieve the same purpose, the words can be replaced by other expressions.
[0033] As shown in this specification and claims, unless the context clearly indicates an exception, the words "a", "an", "an" and / or "the" do not refer to the singular and may also include the plural. Generally speaking, the terms "comprise" and "include" only indicate the inclusion of the steps and elements that have been clearly identified, and these steps and elements do not constitute an exclusive list. The method or device may also include other steps or elements.
[0034] Flowcharts are used in this specification to illustrate the operations performed by the system according to the embodiments of this specification. It should be understood that the preceding or following operations are not necessarily performed precisely in order. Instead, the steps may be processed in reverse order or simultaneously. At the same time, other operations may also be added to these processes, or one or more operations may be removed from these processes.
[0035] like Figure 2 As shown, this embodiment provides a data processing method, which includes the following steps.
[0036] Step S110, based on the preset sampling logic, obtain sampling data, wherein the number of nodes is the variable of the sampling function corresponding to the preset sampling logic. It can be understood that the number of nodes is the variable of the sampling function corresponding to the preset sampling logic, and there is no need to change the sampling logic according to the number of nodes. The data processing method has strong code portability during the application process and can save a lot of development time. It can be understood that the number of nodes in this embodiment represents the serial number of the node, such as 1 node, 2 nodes, etc., which correspond to different master nodes (BQ79600) or slave nodes (BQ7961x), respectively, and the total number of nodes refers to the total number of nodes.
[0037] like Figure 3 and Figure 4 As shown, step S110 may include steps S111 to S113.
[0038] Step S111, obtain a read instruction, wherein the read instruction is used to trigger a request read function. It is understandable that the read instruction obtained can be an instruction in the form of a serial peripheral interface (Serial Peripheral Interface, SPI) issued by a microcontroller (Microcontroller Unit, MCU). The read instruction is an instruction in the form of SPI, that is, the SPI protocol is used to perform a data read operation. The master device sends a read instruction to the slave device, and according to the clock signal and the communication protocol, the slave device sends the corresponding data back to the master device in a serial form. Through the instruction in the form of SPI, reliable and high-speed data communication with external devices can be achieved, which is suitable for high-performance and high-bandwidth application scenarios required for the data acquisition. Depending on the specific implementation environment, an instruction in the form of a serial peripheral interface (Inter-Integrated Circuit, I2C) can also be used as a read instruction. This embodiment does not constitute a limitation on the instruction type of the read instruction.
[0039] Step S112, when the request read function triggered by the read instruction is started, the node data of the variable corresponding to each node is read; wherein the number of cycles of data reading is the same as the number of variables corresponding to any node.
[0040] It is worth noting that if Figure 3As shown in the figure, for the value reading of 26 variables, including 16 cell+8 GPIO+Busbar+VBAT, each SPI instruction sent by the MCU is to read the voltage value of the variable corresponding to each node, and a total of 16+8+1+1=26 cycles are read (that is, the number of cycles of data reading is the same as the number of variables corresponding to any node). Each reading instruction is called as a configuration parameter at a different number of cycles. If you need to read parameters other than the 26 parameters, you can increase or decrease the number of cycles and the corresponding configuration parameters.
[0041] It should also be noted that the "16-way cell" mentioned in this embodiment refers to the number of battery cells that the battery management system can monitor and manage simultaneously, that is, 16 battery cells, each of which can be a lithium battery cell or other type of battery cell. "8-way GPIO" means that the system has 8 programmable input / output ports (General Purpose Input / Output, GPIO), which can be used to connect external devices or perform specific control functions. The bus bar is a conductive bar used to connect the individual battery cells in a battery pack, and is typically used to balance the voltage and current between battery cells. VBAT refers to the backup power supply or battery voltage of the battery system. Depending on the specific implementation environment, the sampling method can also sample other types of battery management systems.
[0042] Step S113, storing the node data in a buffer according to the number of nodes and the number of cycles to obtain sampling data.
[0043] Specifically, step S113 includes:
[0044] A multidimensional array is created based on the number of loops, the number of nodes and the node data; wherein the number of loops is associated with the number of columns of the multidimensional array; the number of nodes is associated with the number of rows of the multidimensional array; and the node data is the basic data unit of the multidimensional array.
[0045] like Figure 3 As shown, that is to say, for data storage and forwarding of different numbers of nodes, a multidimensional array of x rows (i.e., the corresponding number of nodes is x nodes) and 26 columns (i.e., corresponding to the above-mentioned 16-way cell+8-way GPIO+Busbar+VBAT, a total of 26 variables) can be created. Each loop is repeated once. For example, in the first loop, the data read is the data of the first variable of x nodes, and the data is stored in the first column array of rows 1-x in sequence. After 26 loops, all the data can be stored in the multidimensional array at the corresponding position to complete the data collection.
[0046] In addition, when the total number of nodes is less than or equal to the storage threshold of the memory, the node data is directly stored in the cache; when the total number of nodes is greater than the storage threshold, the part of the node data that does not exceed the storage threshold of the cache is stored, and then the cache is cleared and the remaining node data is stored until the node data is completed. It can be understood that in the case of Figure 3 In the implementation environment shown, for the problem of the limited buffer of 128 bytes on the mainboard, since the message read and replied by each node is 4 bytes (Head) + 2 bytes (data) + 2 bytes (CRC) = 8 bytes, 128 bytes can accommodate data of 16 nodes at most (that is, the storage threshold is 16 nodes), so conditional judgment can be added during or before the data storage process. Before 16 nodes, data is directly stored. After 16 nodes, the buffer clearing function is called and then data is stored. If the number of nodes needs to be increased multiple times, the conditional judgment can be added and cleared again.
[0047] Step S120: forwarding the sampled data to the host computer based on a message in a fixed format.
[0048] Specifically, step S120 may include the following steps:
[0049] Step S121, sequentially retrieve the to-be-forwarded node data of the row number associated with the node number in the multi-dimensional array.
[0050] like Figure 5 As shown, in this implementation, when forwarding data, it is forwarded in sequence according to the number of nodes. For example, starting from the first node, all the data in the first row of the array are forwarded in sequence. The first row contains a total of 26 data (i.e., the basic data units in the multidimensional array corresponding to the number of nodes).
[0051] Step S122: forwarding the message based on the fixed frame number to the host computer according to the node data to be forwarded.
[0052] In this embodiment, the fixed number of frames of the message includes four frames of CANFD messages, wherein each frame of the CANFD message corresponds to the node data of the variable corresponding to a single node. Figure 5In the implementation shown, each basic data unit is 8 bytes, a total of 208 bytes, divided into four frames of CANFD message forwarding, each frame contains 64 bytes (1-8 cell) + 64 bytes (9-16 cell) + 64 bytes (1-8 GPIO) + 16 bytes (Busbar + VBAT). The CANID and Txbuffer of the forwarded message are defined according to the node, and the relevant parameters of different node numbers are placed in the configuration function, which can be called as a variable according to the number of nodes when sending.
[0053] It is worth noting that in this data processing method, due to the fixed sampling logic, the sampling period increases linearly directly according to the increase in the number of nodes, and the sampling period is stable and controllable.
[0054] Step S130, parsing and verifying the message based on the host computer.
[0055] Specifically, the analysis method for the upper computer to perform data analysis includes: using Vector CANalyzer to create a DBC file for data analysis; and / or using CANoe to create a DBC file for data analysis.
[0056] The verification method for data verification performed by the host computer includes: the verification method includes at least one of CRC verification, parity verification, Gray code verification, LRC verification and MD5 verification.
[0057] In this embodiment, when CRC verification is used, it also includes: using Visual Studio tools to compile verification data into a DLL file; importing the DLL file into a script automation test system for verification; wherein the maximum number of nodes for CRC verification is the total number of nodes.
[0058] It is worth mentioning that in this data processing method, the host computer software adopts standard software and uses its internal plug-in tool for secondary development, which has strong maintainability. The parsing logic of the host computer software can be compatible from a high number of nodes to a low number of nodes, and can be developed to the maximum extent, eliminating the complicated host computer software development work.
[0059] Figure 7 is a structural block diagram of a data processing system according to some embodiments of the present application. Figure 3 As shown, the data processing system may include: an acquisition module, used to obtain sampling data based on a preset sampling logic, wherein the number of nodes is a variable of a sampling function corresponding to the preset sampling logic; a forwarding module, used to forward the sampling data to a host computer based on a message in a fixed format; and a processing module, used to parse and verify the message based on the host computer.
[0060] Figure 66 is a structural block diagram of an electronic device according to some embodiments of the present application. The electronic device may include: a processor 610 and a memory 620.
[0061] The processor 610 may be a central processing unit (CPU), a network processor (NP) or a combination of a CPU and a NP. The processor 610 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0062] The memory 620 is connected to the processor 610 via a bus or other means, and at least one instruction, at least one program, code set or instruction set is stored in the memory 620. The at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor 610 to implement the data processing method provided in any of the above embodiments. The memory 620 can be a volatile memory (volatile memory), a non-volatile memory (non-volatile memory) or a combination thereof. The volatile memory can be a random access memory (random-access memory, RAM), such as a static random access memory (static random access memory, SRAM), a dynamic random access memory (dynamic random access memory, DRAM). The non-volatile memory can be a read-only memory (read only memory image, ROM), such as a programmable read only memory (programmable read only memory, PROM), an erasable programmable read only memory (erasable programmable read only memory, EPROM), and an electrically erasable programmable read-only memory (electrically erasable programmable read-only memory, EEPROM). The non-volatile memory may also be a flash memory, a magnetic memory such as a magnetic tape, a floppy disk, or a hard disk. The non-volatile memory may also be an optical disk.
[0063] The present application also provides a computer-readable storage medium, which stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement a data processing method as described in any of the above embodiments.
[0064] The basic concepts have been described above. Obviously, for those skilled in the art, the above detailed disclosure is only for example and does not constitute a limitation of this specification. Although not explicitly stated here, those skilled in the art may make various modifications, improvements and corrections to this specification. Such modifications, improvements and corrections are suggested in this specification, so such modifications, improvements and corrections still belong to the spirit and scope of the exemplary embodiments of this specification.
[0065] At the same time, this specification uses specific words to describe the embodiments of this specification. For example, "one embodiment", "an embodiment", and / or "some embodiments" refer to a certain feature, structure or characteristic related to at least one embodiment of this specification. Therefore, it should be emphasized and noted that "one embodiment" or "an embodiment" or "an alternative embodiment" mentioned twice or more in different positions in this specification does not necessarily refer to the same embodiment. In addition, certain features, structures or characteristics in one or more embodiments of this specification can be appropriately combined.
[0066] In addition, unless explicitly stated in the claims, the order of processing elements and sequences, the use of alphanumeric characters, or the use of other names in this specification are not intended to limit the order of the processes and methods of this specification. Although the above disclosure discusses some invention embodiments that are currently considered useful through various examples, it should be understood that such details are only for illustrative purposes, and the attached claims are not limited to the disclosed embodiments. On the contrary, the claims are intended to cover all modifications and equivalent combinations that are consistent with the essence and scope of the embodiments of this specification. For example, although the system components described above can be implemented by hardware devices, they can also be implemented only by software solutions, such as installing the described system on an existing server or mobile device.
[0067] Similarly, it should be noted that in order to simplify the description disclosed in this specification and thus help understand one or more embodiments of the invention, in the above description of the embodiments of this specification, multiple features are sometimes combined into one embodiment, figure or description thereof. However, this disclosure method does not mean that the features required by the subject matter of this specification are more than the features mentioned in the claims. In fact, the features of the embodiments are less than all the features of the single embodiment disclosed above.
[0068] Finally, it should be understood that the embodiments in this specification are only used to illustrate the principles of the embodiments of this specification. Other variations may also fall within the scope of this specification. Therefore, as an example and not a limitation, alternative configurations of the embodiments of this specification may be considered consistent with the teachings of this specification. Accordingly, the embodiments of this specification are not limited to the embodiments explicitly introduced and described in this specification.
Claims
1. A data processing method, characterized in that: The steps include: Based on a preset sampling logic, sampling data is obtained, wherein the number of nodes is a variable of a sampling function corresponding to the preset sampling logic; According to the sampled data, forwarding the message based on a fixed format to the host computer; The message is parsed and verified based on the host computer.
2. The data processing method according to claim 1, characterized in that: The acquiring of sampling data based on the preset sampling logic includes: Obtaining a read instruction, wherein the read instruction is used to trigger a request read function; When the request read function triggered by the read instruction is started, the node data of the variable corresponding to each node is read; wherein the number of cycles of data reading is the same as the number of variables corresponding to any of the nodes; According to the number of nodes and the number of cycles, the node data is stored in a buffer to obtain the sampling data.
3. The data processing method according to claim 2, characterized in that: The step of storing the node data in a buffer comprises: When the total number of nodes is less than or equal to a storage threshold of the memory, directly storing the node data in the buffer; When the total number of nodes is greater than the storage threshold, part of the node data that does not exceed the buffer storage threshold is stored, and then the buffer is cleared and the remaining node data is stored until the node data storage is completed.
4. The data processing method according to claim 2, characterized in that: The step of storing the node data in a buffer according to the number of nodes and the number of cycles to obtain the sampled data comprises: Creating a multidimensional array based on the number of loops, the number of nodes, and the node data; Wherein, the number of loops is associated with the number of columns of the multidimensional array; The number of nodes is associated with the number of rows of the multidimensional array; The node data is the basic data unit of the multi-dimensional array.
5. The data processing method according to claim 4, characterized in that: The forwarding of the sampled data to the host computer based on a fixed format message includes: Sequentially retrieve the node data to be forwarded of the number of rows associated with the number of nodes in the multidimensional array; According to the node data to be forwarded, messages based on a fixed number of frames are forwarded to the host computer.
6. The data processing method according to claim 5, characterized in that: The fixed-frame message includes four CANFD message frames, wherein each frame of the CANFD message corresponds to the node data of the variable corresponding to a single node.
7. The data processing method according to claim 1, characterized in that: The parsing and verifying the message based on the host computer includes: The analysis method includes: using Vector CANalyzer to make a DBC file for data analysis; and / or using CANoe to make a DBC file for data analysis.
8. The data processing method according to claim 1, characterized in that: The parsing and verifying the message based on the host computer includes: The verification method includes at least one of CRC verification, parity verification, Gray code verification, LRC verification and MD5 verification.
9. The data processing method according to claim 8, characterized in that: When CRC check is used, it also includes: Use Visual Studio tools to compile the verification data into a DLL file; Import the DLL file into the script automation test system for verification; The maximum number of nodes for the CRC check is the total number of nodes.
10. A data processing system, characterized in that: include: A collection module, used to obtain sampled data based on a preset sampling logic, wherein the number of nodes is a variable of a sampling function corresponding to the preset sampling logic; A forwarding module, used for forwarding the sampled data to a host computer based on a message in a fixed format; A processing module is used to parse and verify the message based on the host computer.
11. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one instruction or program, and the instruction or program is loaded and executed by the processor to implement the data processing method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction or program, and the instruction or program is loaded and executed by the processor to implement the data processing method according to any one of claims 1 to 9.
