Data storage method, device, equipment and storage medium

By storing multiple data packets into a single data block based on preset rules in the vehicle's electronic control unit and configuring a CRC value, the problem of excessively long polling time in the prior art is solved, and data storage efficiency and accuracy are improved.

CN115309323BActive Publication Date: 2026-01-02NEUSOFT REACH AUTOMOBILE TECH (SHENYANG) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210803299.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-07
Publication Date
2026-01-02
Estimated Expiration
2042-07-07

AI Technical Summary

Technical Problem

In vehicle electronic control units, the existing storage method that stores one data block for each software component requires multiple polling of the NVM main function, resulting in excessively long queue polling time and affecting data storage efficiency.

Method used

By storing multiple data packets into a single data block based on preset rules, determining the target data block by matching the category and attributes of the data block, and configuring a CRC value for each data packet, the data storage process is optimized.

Benefits of technology

It reduces the number of data blocks in the data storage unit, shortens the queue polling time, improves data packet storage efficiency, and increases the accuracy of data packets while saving computing power.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115309323B_ABST
    Figure CN115309323B_ABST
Patent Text Reader

Abstract

The application discloses a data storage method, device, equipment and storage medium. The method comprises the following steps: obtaining a plurality of data packets of an SWC; determining a data block matched with each data packet based on a preset rule; wherein each data block is used for storing a plurality of data packets; storing each data packet into the data block matched with the data packet; determining a to-be-stored data block based on a plurality of data blocks; and storing the to-be-stored data block into an NVM module. The technical scheme of the application stores several data packets into one data block, reduces the number of data blocks in the data storage unit, shortens the length of the to-be-stored queue, and then greatly shortens the queue polling time when the NVM main function is polled to process the to-be-stored queue, thereby improving the efficiency of storing the data packets in the SWC into the NVM module.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of basic software, and particularly relates to a data storage method and device, equipment and a storage medium. BACKGROUND

[0002] There are a large amount of data to be stored in the electronic control unit (ECU) of a vehicle. The ECU equipped with a classic platform (CP)-automotive open system architecture (AUTOSAR) uses a non-volatile memory (NVM) standard module to achieve the storage function, so as to achieve the function of non-volatile storage after the ECU is powered off.

[0003] The NVM module is configured in the form of a software component (SWC) as the minimum unit. When there is a storage requirement, a dedicated interface is called to transmit the data to be stored to a random access memory (Ram) and queue, and then the data in the queue is processed by the CP-AUTOSAR NVM periodically and asynchronously, and then the data is stored in the NVM.

[0004] However, in actual application, each SWC corresponds to a data block, and when the queue is processed, the NVM main function needs to be polled multiple times to process the queue asynchronously, which consumes a large amount of queue polling time. SUMMARY

[0005] The present application aims to at least solve one of the technical problems in the related art. To this end, one object of the present application is to provide a data storage method, device, equipment and storage medium.

[0006] To solve the above technical problems, the embodiments of the present application provide the following technical solutions:

[0007] A data storage method comprises the following steps:

[0008] Obtaining a plurality of data packets of a SWC;

[0009] Based on a preset rule, determining a data block matched with each data packet; wherein each data block is used to store a plurality of data packets;

[0010] Storing each data packet in the data block matched with the data packet;

[0011] Determining a data block to be stored based on a plurality of data blocks;

[0012] storing the data block matching each of the data packets into the NVM module.

[0013] Optionally, the determining of the data block matching each of the data packets based on the preset rule comprises:

[0014] acquiring a category of each of the data packets; wherein the category of the data packets comprises any one of an immediate storage data packet, a periodic storage data packet and a power-off storage data packet;

[0015] determining a category of the data block matching each of the data packets based on a first sub-pre-set rule of the preset rule and according to the category of each of the data packets, and determining the data block of the category as an initial data block; wherein the category of the data block comprises any one of an immediate storage data block, a periodic storage data block and a power-off storage data block; each of the data blocks comprises a plurality of storage areas, and each of the storage areas is used for storing one of the data packets;

[0016] acquiring an attribute of each of the data packets; wherein the attribute of each of the data packets comprises at least one of a function category and a security level;

[0017] determining a target attribute based on a second sub-pre-set rule of the preset rule and according to the attribute of each of the data packets;

[0018] selecting the initial data block according to the target attribute of each of the data packets to determine a target data block matching each of the data packets.

[0019] Optionally, each of the data blocks comprises a plurality of storage areas, and each of the storage areas is used for storing one of the data packets, which comprises:

[0020] the target attribute corresponding to each of the storage areas is the same; or

[0021] the target attribute corresponding to each of the storage areas is different; or

[0022] the target attribute corresponding to at least two of the storage areas is different; or

[0023] acquiring a total storage space value of each of the data blocks, and determining a storage space value of each of the storage areas of each of the data packets according to the total storage space value.

[0024] Optionally, the storing of each of the data packets into the data block matching the data packet comprises:

[0025] acquiring a numerical value of the target attribute of each of the data packets;

[0026] According to the value of the target attribute of each data packet, the data packet is stored in a target storage area of the target data block; wherein the data packet is used to cover and update original data of the target storage area.

[0027] Optionally, the determining of the data block to be stored based on the plurality of data blocks comprises:

[0028] The category of each data block is obtained.

[0029] If the data block is an immediate storage data block, when data of the data packet in any one of the storage areas of the immediate storage data block is updated, the immediate storage data block is determined as the data block to be stored; or

[0030] If the data block is a periodic storage data block, when an interval time reaches an interval threshold, the periodic storage data block is determined as the data block to be stored; or

[0031] If the data block is a power-off storage data block, when the ECU is about to be powered off, the power-off storage data block is determined as the data block to be stored.

[0032] Optionally, the storing of the data block to be stored to the NVM module comprises:

[0033] The data block to be stored is added to a to-be-stored queue.

[0034] According to the order of each data block to be stored in the to-be-stored queue, each data block to be stored is stored to the NVM module.

[0035] Optionally, after the obtaining of the plurality of data packets of the SWC, the method further comprises:

[0036] The start address and the data length of each data packet are obtained.

[0037] According to the start address and the data length of each data packet, a CRC value of each data packet is calculated and added to the end of the data packet.

[0038] The CRC value of each data packet is stored in the target storage area matched with the data packet, for CRC checking of each data packet in read-back data of the NVM module; wherein if a calculated check CRC value of the data packet is consistent with the CRC value of the data packet, the data packet is received; or if the check CRC value of the data packet is inconsistent with the CRC value of the data packet, the data packet is recovered to a default value and then received.

[0039] Embodiments of the present application also provide a data storage device, comprising:

[0040] an obtaining module, configured to obtain a plurality of data packets of a SWC;

[0041] a first determining module, configured to determine a data block matched with each of the data packets based on a preset rule; wherein each of the data blocks is used to store a plurality of the data packets;

[0042] a first storing module, configured to store each of the data packets into the data block matched with the data packet;

[0043] a second determining module, configured to determine a to-be-stored data block based on a plurality of the data blocks;

[0044] a second storing module, configured to store the to-be-stored data block into an NVM module.

[0045] Embodiments of the present application also provide an electronic device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the method as described above when executing the computer program.

[0046] Embodiments of the present application also provide a computer readable storage medium, comprising a stored computer program, wherein the computer readable storage medium controls a device where the computer readable storage medium is located to execute the method as described above when the computer program runs.

[0047] Embodiments of the present application have the following technical effects:

[0048] The above technical solutions of the present application have the following effects: 1) based on the preset rule, several data packets are stored into one data block, which reduces the number of data blocks in the data storage unit, shortens the length of the to-be-stored queue, and further greatly shortens the queue polling time when the NVM main function is polled to process the to-be-stored queue, thereby improving the efficiency of storing the data packets in the SWC into the NVM module.

[0049] 2) a CRC value is configured for each data packet, and after a plurality of data packets are stored into one data block, when the data of one data packet is inconsistent, the data of other data packets in the data block will not be affected, which improves the accuracy of the data packets and reduces the waste of data and saves computing power.

[0050] Additional aspects and advantages of the present application will be in part apparent and in part pointed out hereinafter. BRIEF DESCRIPTION OF DRAWINGS

[0051] Figure 1 is a structural schematic diagram of a data storage unit provided by an embodiment of the present application;

[0052] Figure 2 is a structural schematic diagram of a data block provided by an embodiment of the present application;

[0053] Figure 3 is a working principle schematic diagram of a data storage unit provided by an embodiment of the present application;

[0054] Figure 4 is a flow schematic diagram of a data storage method provided by an embodiment of the present application;

[0055] Figure 5 is a structural schematic diagram of a data storage device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0056] The embodiments of the present application are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar notations represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the accompanying drawings are exemplary and are intended to explain the present application, and cannot be understood as a limitation of the present application.

[0057] In order to facilitate the understanding of the embodiments by those skilled in the art, some terms are explained:

[0058] (1) RTE: Run-Time Environment, runtime environment.

[0059] (2) cache: cache memory.

[0060] (3) CRC: Cyclic Redundancy Check, cyclic redundancy check.

[0061] As shown in Figure 1 , an embodiment of the present application provides a data storage unit, wherein the data storage unit serves as middleware of the SWC and the NVM module, performs the function of the middleware, and is specifically used for receiving data packets from the SWC, matching data blocks for each data packet, and then storing the data blocks to be stored to the NVM module. After the ECU is powered on again, the read-back data in the NVM module can also be recovered to the data blocks of the SWC.

[0062] According to actual needs, the data storage unit can be arranged inside the SWC or independently arranged outside the SWC.

[0063] Specifically, the data storage unit includes a receiving interface, a sending interface, a matching element, a verification element, and a plurality of data blocks.

[0064] The receiving interface is used to receive data streams from SWC over the network, and each data stream includes multiple data packets;

[0065] The sending interface is used to send the data packet to be stored to the NVM module, and to receive the readback data from the NVM module after power-on, and then send the readback data to SWC;

[0066] The verification element is used to generate a CRC value for each data packet based on the start address and data length of each data packet, and add the CRC value of each data packet to the end of the corresponding data packet; that is, when a data packet is subsequently stored in the NVM module, the data part of the data packet is stored, and the CRC value of the end of the data packet is stored in the NVM module.

[0067] In addition, when the ECU is powered on again, the verification element is also used to calculate the CRC value of each data packet in the readback data of the NVM module, and compare the CRC value carried by the readback data itself with the calculated CRC value. If they match, the data storage unit receives the readback data; if they do not match, the readback data is restored to the default value, and then the data storage unit receives the readback data.

[0068] The matching element is used to match the target data block for each data packet and to store the CRC value of each data packet and its tail sequentially into the target data block corresponding to each data packet.

[0069] like Figure 2 As shown in the embodiments of this application, since each data block is used to store multiple data packets, each data block is divided into multiple storage areas, and each storage area is used to store only a certain data packet with a certain attribute; wherein, the number of storage areas included in each data block can be the same or different, for example: one data block includes 5 storage areas, another data block includes 4 storage areas, etc.

[0070] To enable the storage of data packets with a certain attribute to the corresponding target storage area, each storage area is equipped with a corresponding input interface and output interface; the input interface is used to receive data packets, and the output interface is used to send data to the NVM module and send the readback data to the SWC.

[0071] For example, a data block may include a first storage area, a second storage area, a third storage area, a fourth storage area, ..., an Nth storage area, where N ≥ 3 and N is an integer.

[0072] An optional embodiment of this application, such as... Figure 3 As shown, the data storage unit is located outside the SWC;

[0073] Specifically, the SWC obtains M data packets simultaneously; wherein M is greater than or equal to 1 and M is an integer;

[0074] Under the condition of the RTE, each data packet is converted into an rte-packet based on the rte-write interface, and then the rte-packet is stored into the data storage unit (the data storage unit in the RTE is implemented based on the cache) through the rte-read interface. Figure 2

[0075] After the cache obtains a plurality of data packets (for example, a first data packet, a second data packet, a third data packet, a fourth data packet, a fifth data packet, and an Mth data packet), the CRC value of each data packet is obtained through the inspection element calculation, and a target data block is matched for each data packet from a first data block, a second data block, and an Lth data block, and then each data packet and the CRC value thereof are stored into the target storage area through the interface of the target storage area; wherein L is greater than or equal to 1 and L is an integer.

[0076] When a data block is determined to be a to-be-stored data block, the to-be-stored data block is added to a to-be-stored queue, and the to-be-stored data block is stored into the RAM element of the NVM module according to the storage order.

[0077] For example, the first data packet, the fourth data packet, and the like are stored into the first data block.

[0078] The third data packet and the like are stored into the second data block.

[0079]

[0080] The third data packet, the fifth data packet, and the Mth data packet are stored into the Lth data block.

[0081] As shown in FIG. 1, the embodiments of the present application also provide a data storage method applied to the data storage unit as shown in FIG. 1, and the data storage method comprises the following steps. Figure 4 Figure 1 The data storage method comprises the following steps.

[0082] Step S41: obtaining a plurality of data packets of the SWC.

[0083] In the process of automatic driving of the target vehicle, the ECU obtains a plurality of data packets in real time or at a certain frequency, and each data packet can comprise any one of the following data: vehicle lamp information data, seat information data, air conditioner information data, and the like.

[0084] ​​The normal operation of the ECU requires positioning, obstacle avoidance or control according to the collected real-time operation data of the target vehicle, and thus the collected real-time operation data of the target vehicle needs to be stored. In order to prevent the loss of the collected data, the embodiments of the present application store the data packets into the NVM module.

[0085] Step S42: determining a data block matched with each data packet based on a preset rule; each data block is used for storing a plurality of data packets;

[0086] In order to reduce the running time of the main loop and the total number of data blocks, the embodiments of the present application improve that one data block corresponds to one data packet in the related art to one data block corresponding to a plurality of data packets, and the specific technical solutions are as follows:

[0087] Specifically, the determination of the data block matched with each data packet based on the preset rule comprises:

[0088] obtaining the category of each data packet; the category of the data packet comprises any one of an immediate storage data packet, a periodic storage data packet and a power-off storage data packet;

[0089] determining the category of the data block matched with each data packet based on a first sub-preset rule of the preset rule and according to the category of each data packet, and determining the data block of the category as an initial data block; the category of the data block comprises any one of an immediate storage data block, a periodic storage data block and a power-off storage data block; each data block comprises a plurality of storage areas, and each storage area is used for storing one data packet;

[0090] obtaining the attribute of each data packet; the attribute of each data packet comprises at least one of a function category and a security level;

[0091] determining a target attribute based on a second sub-preset rule of the preset rule and according to the attribute of each data packet;

[0092] selecting the initial data block according to the target attribute of each data packet to determine a target data block matched with each data packet.

[0093] In the embodiments of the present application, the data of each data packet comprises the category of the data packet, and the first sub-preset rule matches the target data block according to the recognized category of each data packet.

[0094] Specifically, the first sub-preset rule can comprise:

[0095] When the category of the data packet is the immediate storage data packet, the data block matched with the data packet is the immediate storage data block;

[0096] When the category of the data packet is the periodic storage data packet, the data block matched with the data packet is the periodic storage data block; and the period of the data block matched with the data packet is less than or equal to the period of the data packet.

[0097] When the category of the data packet is the power-off storage data packet, the data block matched with the data packet is the power-off storage data block.

[0098] The first sub-preset rule can be extended according to actual needs in the embodiments of the present application.

[0099] Further, since the attributes of each data packet can include multiple attributes at the same time, in order to prevent conflicts when storing a certain data packet into a data block, the embodiments of the present application determine a target attribute according to the attributes of each data packet based on a second sub-preset rule.

[0100] Specifically, the second sub-preset rule can include:

[0101] When the attributes of a certain data packet include the function category, the security level and the update frequency, the priority of each attribute is determined, and then the target attribute is determined according to the priority of each attribute.

[0102] The priority of the function category is less than the priority of the security level, and the priority of the update frequency is greater than the priority of the security level; or

[0103] The priority of the function category is greater than the priority of the security level, and the priority of the update frequency is less than the priority of the security level, and the like.

[0104] For example, 1) when the attributes of a certain data packet include the function category, the security level and the update frequency, the update frequency is determined as the first target attribute;

[0105] When the attributes of a certain data packet include the function category and the update frequency, the update frequency is determined as the target attribute; and then the target data block matched with the data packet is determined according to the update frequency.

[0106] When the attributes of a certain data packet include the function category and the security level, the security level is determined as the target attribute.

[0107] Then the target data block matched with the data packet is determined according to the security level.

[0108] Step S43: storing each data packet into the data block matched with the data packet;

[0109] Specifically, each of the data blocks comprises a plurality of storage areas, each of the storage areas being configured to store one of the data packets, comprising:

[0110] The target attribute corresponding to each of the storage areas is the same; or

[0111] The target attribute corresponding to each of the storage areas is different; or

[0112] The target attribute corresponding to at least two of the storage areas is different; or

[0113] The total storage space value of each of the data blocks is obtained, and the storage space value of each of the storage areas of each of the data packets is determined according to the total storage space value.

[0114] In an optional embodiment of the present application, for example, a certain data block is provided with five storage areas, and the target attribute corresponding to each of the storage areas is the same, specifically:

[0115] Each of the storage areas is configured to store a data packet related to vehicle lamp information, that is, the function types are the same.

[0116] In an optional embodiment of the present application, for example, a certain data block is provided with three storage areas, and the target attribute corresponding to each of the storage areas is different, specifically:

[0117] The first storage area is configured to store a data packet related to vehicle lamp information;

[0118] The second storage area is configured to store a data packet according to the security level of the data;

[0119] The third storage area is configured to store a data packet according to the update frequency of the data;

[0120] In an optional embodiment of the present application, for example, a certain data block is provided with five storage areas, and the target attribute corresponding to at least two of the storage areas is different, specifically:

[0121] The first storage area is configured to store a data packet related to vehicle lamp information;

[0122] The second storage area is configured to store a data packet according to the security level of the data;

[0123] The third storage area is configured to store a data packet according to the update frequency of the data;

[0124] The fourth storage area is configured to store a data packet according to the update frequency of the data;

[0125] The fifth storage area is configured to store a data packet according to the update frequency of the data.

[0126] In an optional embodiment of the present application, the size of a data block is preset, for example, the size of a data block is preset as 2000 bits, wherein the storage space of the first storage area of the data block is 1000 bits, the storage space of the second storage area is 500 bits, the storage space of the third storage area is 200 bits, and the storage space of the fourth storage area is 300 bits.

[0127] The first storage area can be used to store a data packet related to battery cell information, the second storage area can be used to store a data packet related to steering wheel information, and the third storage area, the fourth storage area and the fourth storage area can be used to store a data packet related to switch information.

[0128] In an embodiment of the present application, the type or target attribute of the data packet of each data block is determined based on the total storage space of the entire data block and the storage space of each storage area of the data block.

[0129] Further, the storing of each data packet into the data block matched with the data packet comprises:

[0130] obtaining the value of the target attribute of each data packet;

[0131] storing the data packet into the target storage area of the target data block according to the value of the target attribute of each data packet, wherein the data packet is used to cover and update the original data of the target storage area.

[0132] In an embodiment of the present application, in the data storage unit, there can be multiple data blocks of the same category, and the data blocks of the same category can further include storage areas with the same target attribute, so that the initial data block needs to be determined first, then the target data block is determined, and finally the target storage area is determined.

[0133] Specifically, after determining the initial data block according to the category of each data packet, the initial data block is screened according to the target attribute of each data packet to determine the target data block.

[0134] And the target storage area of the data block is determined according to the value of the target attribute, for example, the specific value of the update frequency (once every 2 minutes, etc.), the specific level of the security level (level 1, etc.) or the specific function in the function category (car light, etc.).

[0135] An optional embodiment of the present application, in the data storage unit, includes a first data block, a second data block, a third data block, a fourth data block, a fifth data block and a sixth data block; wherein the first data block and the second data block are immediate storage data blocks, that is, as long as any one of the data in the storage area is updated, the entire data block is immediately stored; the third data block and the fourth data block are periodic storage data blocks, that is, as long as the un-stored interval time of any one of the data in the storage area reaches the period, the data block is stored; the fifth data block and the sixth data block are power-down storage data blocks; that is, when the ECU is about to power down (for example, the ECU has 3s to power down), all the data packets included in the entire data block are immediately stored in the NVM module.

[0136] The data storage unit obtains 8 data packets based on the SWC, including a first data packet, a second data packet, a third data packet, a fourth data packet, a fifth data packet, a sixth data packet, a seventh data packet and an eighth data packet;

[0137] Among them, the categories of the first data packet and the second data packet are immediate storage data packets;

[0138] The categories of the third data packet, the fourth data packet and the fifth data packet are periodic storage data packets;

[0139] The categories of the sixth data packet, the seventh data packet and the eighth data packet are power-down storage data packets;

[0140] Then, after obtaining the 8 data packets, the data storage unit respectively determines that the initial data block matched with the first data packet and the second data packet is an immediate storage data block; the initial data block matched with the third data packet, the fourth data packet and the fifth data packet is a periodic storage data block; and the initial data block corresponding to the sixth data packet, the seventh data packet and the eighth data packet is a power-down storage data block;

[0141] For example, the attributes of the first data packet and the second data packet include: function category, security level and update frequency;

[0142] The attributes of the third data packet, the fourth data packet, and the fifth data packet, the sixth data packet, the seventh data packet and the eighth data packet include: function category and security level.

[0143] Then, according to the attributes of the first data packet and the second data packet, the initial attribute is determined to be the update frequency;

[0144] The attributes of the third data packet, the fourth data packet, and the fifth data packet, the sixth data packet, the seventh data packet and the eighth data packet determine the initial attribute to be the security level;

[0145] If the update frequency of the data of the first data packet is 1 minute once;

[0146] The update frequency of the data of the second data packet is 10 minutes once;

[0147] The storage period of the data of the third data packet is 5s, and the security level is level one;

[0148] The storage period of the data of the fourth data packet is 10s, and the security level is level two;

[0149] The storage period of the data of the fifth data packet is 60s, and the security level is level three;

[0150] The security level of the data of the sixth data packet is level one;

[0151] The security level of the data of the seventh data packet is level two;

[0152] The security level of the data of the eighth data packet is level three;

[0153] The first data packet is stored into an immediate storage data block including a storage area according to the update frequency of 1 minute once, for example, the first data block;

[0154] The second data packet is stored into an immediate storage data block including a storage area according to the update frequency of 10 minutes once, for example, the second data block;

[0155] The third data packet is stored into a period storage data block including a storage area according to the security level of level one, for example, the third data block, and the period of the third data block is ≤5s;

[0156] The fourth data packet is stored into a period storage data block including a storage area according to the security level of level two, for example, the fourth data block, and the period of the fourth data block is ≤10s;

[0157] The fifth data packet is stored into a period storage data block including a storage area according to the security level of level three, for example, the fourth data block, and the period of the fourth data block is ≤10s;

[0158] The sixth data packet is stored into a power-off storage data block including a storage area according to the security level of level one, and the storage is performed immediately when power-off, for example, the fifth data block;

[0159] The seventh data packet is stored into a power-off storage data block including a storage area according to the security level of level two, and the storage is performed immediately when power-off, for example, the sixth data block;

[0160] The eighth data packet is stored in a storage area according to a security level of three, and when power-off, the data is immediately stored in a power-off storage data block, for example, the sixth data block;

[0161] An optional embodiment of the application includes a first data block, a second data block, a third data block, a fourth data block, a fifth data block, a sixth data block, a seventh data block, and an eighth data block in the data storage unit. The first data block and the second data block are immediate storage data blocks, that is, as soon as data in a certain storage area is updated, the data block is immediately stored. The third data block and the fourth data block are periodic storage data blocks, that is, as soon as the interval time of data in a certain storage area reaches a period, the data block is stored. The fifth data block and the sixth data block are power-off storage data blocks, that is, when the ECU is about to power off, all data packets included in the entire data block are immediately stored in the NVM module.

[0162] The data storage unit obtains eight data packets, including a first data packet, a second data packet, a third data packet, a fourth data packet, a fifth data packet, a sixth data packet, a seventh data packet, and an eighth data packet based on the SWC.

[0163] The first data packet and the second data packet are immediate storage data packets.

[0164] The third data packet, the fourth data packet, and the fifth data packet are periodic storage data packets.

[0165] The sixth data packet, the seventh data packet, and the eighth data packet are power-off storage data packets.

[0166] After obtaining the eight data packets, the data storage unit determines that the initial data block matched with the first data packet and the second data packet is an immediate storage data block, the initial data block matched with the third data packet, the fourth data packet, and the fifth data packet is a periodic storage data block, and the initial data block corresponding to the sixth data packet, the seventh data packet, and the eighth data packet is a power-off storage data block.

[0167] For example, the attributes of the first data packet and the second data packet include a function type, a security level, and an update frequency.

[0168] The attributes of the third data packet, the fourth data packet, and the fifth data packet include a function type and a security level.

[0169] The attributes of the sixth data packet, the seventh data packet, and the eighth data packet include a function type and a security level.

[0170] According to the attributes of the first data packet and the second data packet, the initial attribute is determined to be the update frequency.

[0171] The attribute of the third data packet, the fourth data packet, the fifth data packet, the sixth data packet, the seventh data packet and the eighth data packet determines the initial attribute as a security level;

[0172] If the update frequency of the data of the first data packet is 1 minute 1 time;

[0173] The update frequency of the data of the second data packet is 10 minutes 1 time;

[0174] The security level of the data of the third data packet is level 1, and the period is 1 hour;

[0175] The security level of the data of the fourth data packet is level 2, and the period is 1 hour;

[0176] The security level of the data of the fifth data packet is level 3, and the period is 1 hour;

[0177] The security level of the data of the sixth data packet is level 1;

[0178] The security level of the data of the seventh data packet is level 2;

[0179] The security level of the data of the eighth data packet is level 3;

[0180] The first data packet is stored into an immediate storage data block including a storage area according to the update frequency of the data being 1 minute 1 time, for example, the first data block;

[0181] The second data packet is stored into an immediate storage data block including a storage area according to the security level of the data being level 1, for example, the second data block;

[0182] The third data packet is stored into a period storage data block including a storage area according to the security level of the data being level 2, for example, the third data block, and the period of the third data block is ≤1 hour;

[0183] The fourth data packet is stored into a period storage data block including a storage area according to the security level of the data being level 3, for example, the third data block, and the period of the third data block is ≤1 hour;

[0184] The fifth data packet is stored into a period storage data block including a storage area according to the update frequency of the data being 1 day 1 time, for example, the fourth data block, and the period of the fourth data block is ≤1 hour;

[0185] The sixth data packet is stored into a power-off storage data block including a storage area according to the security level of the data being level 1, and is immediately stored at power-off, for example, the fifth data block;

[0186] The seventh data packet is stored in a storage area according to a security level of two, and when power-off, the data is immediately stored in a power-off storage data block, for example, the sixth data block;

[0187] The eighth data packet is stored in a storage area according to a security level of three, and when power-off, the data is immediately stored in a power-off storage data block, for example, the sixth data block.

[0188] An optional embodiment of the present application includes a first data block, a second data block, a third data block, a fourth data block, a fifth data block, a sixth data block, a seventh data block, and an eighth data block in the data storage unit; wherein the first data block and the second data block are immediate storage data blocks, that is, as soon as there is an update of data in a certain storage area, the data block is immediately stored; the third data block and the fourth data block are periodic storage data blocks, that is, as soon as the interval time of data in a certain storage area reaches a period, the data block is stored; the fifth data block and the sixth data block are power-off storage data blocks, that is, when the ECU is about to power off, all data packets included in the entire data block are immediately stored in the NVM module.

[0189] The data storage unit obtains eight data packets, including a first data packet, a second data packet, a third data packet, a fourth data packet, a fifth data packet, a sixth data packet, a seventh data packet, and an eighth data packet based on the SWC.

[0190] The first data packet, the second data packet, the third data packet, the fourth data packet, the fifth data packet, the sixth data packet, the seventh data packet, and the eighth data packet are immediate storage data packets.

[0191] The data storage unit determines that the data blocks matched with the first data packet, the second data packet, the third data packet, the fourth data packet, the fifth data packet, the sixth data packet, the seventh data packet, and the eighth data packet are immediate storage data blocks after obtaining the eight data packets.

[0192] For example, the attributes of the first data packet, the second data packet, the third data packet, the fourth data packet, the fifth data packet, the sixth data packet, the seventh data packet, and the eighth data packet include a function category, a security level, and an update frequency.

[0193] The initial attribute is determined to be the update frequency according to the attributes of the first data packet, the second data packet, the third data packet, the fourth data packet, the fifth data packet, the sixth data packet, the seventh data packet, and the eighth data packet.

[0194] If the update frequency of the data of the first data packet is once per minute;

[0195] The update frequency of the data of the second data packet is 10 minutes once;

[0196] The update frequency of the data of the third data packet is 15 minutes once;

[0197] The update frequency of the data of the fourth data packet is 30 minutes once;

[0198] The update frequency of the data of the fifth data packet is 1 hour once;

[0199] The update frequency of the data of the sixth data packet is 2 hours once;

[0200] The update frequency of the data of the seventh data packet is 5 hours once;

[0201] The update frequency of the data of the eighth data packet is 10 hours once;

[0202] The first data packet is stored into the immediate storage data block including the storage area according to the update frequency of the data of 1 minute once, for example, the first data block;

[0203] The second data packet is stored into the immediate storage data block including the storage area according to the update frequency of the data of 10 minutes once, for example, the first data block;

[0204] The third data packet is stored into the immediate storage data block including the storage area according to the update frequency of the data of 15 minutes once, for example, the first data block;

[0205] The fourth data packet is stored into the immediate storage data block including the storage area according to the update frequency of the data of 30 minutes once, for example, the first data block;

[0206] The fifth data packet is stored into the immediate storage data block including the storage area according to the update frequency of the data of 1 hour once, for example, the first data block;

[0207] The sixth data packet is stored into the immediate storage data block including the storage area according to the update frequency of the data of 2 hours once, for example, the second data block;

[0208] The seventh data packet is stored into the immediate storage data block including the storage area according to the update frequency of the data of 5 hours once, for example, the second data block;

[0209] The eighth data packet is stored into the immediate storage data block including the storage area according to the update frequency of the data of 10 hours once, for example, the second data block.

[0210] The other data blocks, temporarily, no data coverage and update occurs.

[0211] determining a data block to be stored based on the plurality of data blocks;

[0212] Specifically, the determining a data block to be stored based on the plurality of data blocks comprises:

[0213] obtaining the category of each data block;

[0214] if the data block is an immediate storage data block, determining the immediate storage data block as the data block to be stored when data of the data packet of any one of the storage areas in the immediate storage data block is updated; or

[0215] if the data block is a periodic storage data block, determining the periodic storage data block as the data block to be stored when an interval time reaches an interval threshold; or

[0216] if the data block is a power-off storage data block, determining the power-off storage data block as the data block to be stored when the ECU is about to be powered off.

[0217] In an embodiment of the present application, for example, if the first data block is an immediate storage data block, when data of any one of the storage areas of the first data block is updated, the data storage unit stores data of the entire data block to the NVM module;

[0218] if the second data block is a periodic storage data block, when an interval time during which data of any one of the storage areas of the second data block is not stored reaches an interval threshold, for example, the interval threshold is 1 minute, the data storage unit stores data of the entire data block to the NVM module;

[0219] if the third data block is a power-off storage data block, when the ECU is about to be powered off, the data storage unit stores data of the entire data block to the NVM module.

[0220] The method further comprises:

[0221] Specifically, the storing the data block to be stored to the NVM module comprises:

[0222] adding the data block to be stored to a to-be-stored queue;

[0223] storing each data block to be stored to the NVM module according to an order of each data block to be stored in the to-be-stored queue.

[0224] In an embodiment of the present application, whenever a data block to be stored appears, it is added to the to-be-stored queue, and is stored to the NVM module according to the order of its entering the to-be-stored queue.

[0225] An optional embodiment of the present application, because the size of the corresponding storage space of each data block may not be consistent, for example, a data block includes a first storage area, a second storage area, a third storage area, a fourth storage area and a fifth storage area;

[0226] Among them, the storage space of the first storage area and the second storage area is larger, which is used to store battery cell data; the storage space of the third storage area, the fourth storage area and the fifth storage area is smaller, which is used to store switch data;

[0227] If the data storage unit receives a data packet for storing battery cell data and a data packet for storing switch data at the same time, and needs to store both the data packet for storing battery cell data and the data packet for storing switch data to the immediate storage data block, it will appear that after the data update of the target storage area corresponding to the switch data is completed, the entire immediate storage data block is determined as a to-be-stored data block and is added to the to-be-stored queue. However, the target storage area for storing the battery cell data packet has not completed data update. In order to prevent data loss, after all the data of the immediate storage data block is stored to the NVM module, the storage of the uncompleted battery cell data packet is continued, and the above process is repeated until the battery cell data packet is completely stored to the corresponding target storage area.

[0228] Embodiments of the present application store several data packets in one data block based on a preset rule, which reduces the number of data blocks in the data storage unit, shortens the length of the to-be-stored queue, and further greatly shortens the queue polling time when the NVM main function is polled to process the to-be-stored queue, thereby improving the efficiency of storing data packets in the SWC to the NVM module.

[0229] An embodiment of the present application, after obtaining a plurality of data packets of the SWC, further comprises:

[0230] Obtaining the starting address and data length of each data packet;

[0231] According to the starting address and data length of each data packet, the CRC value of each data packet is calculated and added to the end of the data packet;

[0232] The CRC value of each data packet is stored in the target storage area that matches the data packet, for CRC verification of each data packet in the readback data of the NVM module; wherein, if the calculated CRC value of the data packet matches the CRC value of the data packet, the data packet is received; or if the calculated CRC value of the data packet does not match the CRC value of the data packet, the data packet is restored to its default value before the data packet is received.

[0233] In embodiments of this application, the CRC value can occupy a maximum of 4 bytes;

[0234] When storing a data packet, for example, if the original data length of a data packet is 100 bytes, after storing the data packet in the target storage area, the CRC value of the data packet is stored starting from the 101st byte of the storage space in the target storage area, until all bytes of data corresponding to the CRC value of the data packet are also stored in the target storage area, then the storage of the data packet is completed.

[0235] In an optional embodiment of this application, when the ECU is powered off and then powered on again, the data from the NVM module is read back and stored in the corresponding data block of the data unit, such as a periodically stored data block or an immediately stored data block. When the data unit receives the read-back data from the NVM module, it calculates the checksum CRC value of each data packet and compares the calculated checksum CRC value with the CRC value carried by the corresponding data packet. If the checksum CRC value and the CRC value are consistent, the data storage unit receives the data packet. If the checksum CRC value and the CRC value are inconsistent, the data storage unit restores the default value settings of the data packet and then receives it. For each type of data packet, the data storage unit should preset a corresponding default value.

[0236] In the embodiments of this application, a CRC value is configured for each data packet. After storing multiple data packets into a data block, if the data of one data packet is inconsistent, it will not affect the use of the data in other data packets in the data block. This improves the accuracy of data packet data, reduces data waste, and saves computing power.

[0237] like Figure 5 As shown, embodiments of this application also provide a data storage device 50, comprising:

[0238] Module 51 is used to acquire multiple data packets of SWC;

[0239] The first determining module 52 is configured to determine a data block matched with each data packet based on a preset rule, wherein each data block is configured to store a plurality of data packets;

[0240] The first storage module 53 is configured to store each data packet into the data block matched with the data packet;

[0241] The second determining module 54 is configured to determine a to-be-stored data block based on a plurality of data blocks;

[0242] The second storage module 55 is configured to store the to-be-stored data block into an NVM module.

[0243] Optionally, the determining of the data block matched with each data packet based on the preset rule comprises:

[0244] acquiring a category of each data packet, wherein the category of the data packet comprises any one of an immediate storage data packet, a periodic storage data packet and a power-off storage data packet;

[0245] determining a category of the data block matched with each data packet based on a first sub-precondition of the preset rule and according to the category of each data packet, and determining the data block of the category as an initial data block, wherein the category of the data block comprises any one of an immediate storage data block, a periodic storage data block and a power-off storage data block, and each data block comprises a plurality of storage areas, and each storage area is configured to store one data packet;

[0246] acquiring an attribute of each data packet, wherein the attribute of each data packet comprises at least one of a function category and a security level;

[0247] determining a target attribute based on a second sub-precondition of the preset rule and according to the attribute of each data packet;

[0248] selecting the initial data block according to the target attribute of each data packet to determine a target data block matched with each data packet.

[0249] Optionally, the each data block comprises a plurality of storage areas, and each storage area is configured to store one data packet, which comprises:

[0250] the target attribute corresponding to each storage area is the same; or

[0251] the target attribute corresponding to each storage area is different; or

[0252] the target attribute corresponding to at least two storage areas is different; or

[0253] obtaining a total storage space value of each of the data blocks, and determining a storage space value of each of the storage areas of each of the data packets according to the total storage space value.

[0254] Optionally, the storing each of the data packets into the data block matched with the data packet comprises:

[0255] obtaining a value of the target attribute of each of the data packets;

[0256] storing the data packet into a target storage area of the target data block according to the value of the target attribute of each of the data packets; wherein the data packet is used to cover and update original data of the target storage area.

[0257] Optionally, the determining the data block to be stored based on the plurality of data blocks comprises:

[0258] obtaining the category of each of the data blocks;

[0259] if the data block is an immediate storage data block, then when data of the data packet in any one of the storage areas of the immediate storage data block is updated, the immediate storage data block is determined as the data block to be stored; or

[0260] if the data block is a periodic storage data block, then when an interval time reaches an interval threshold value, the periodic storage data block is determined as the data block to be stored; or

[0261] if the data block is a power-off storage data block, then when the ECU is about to be powered off, the power-off storage data block is determined as the data block to be stored.

[0262] Optionally, the storing the data block to be stored into the NVM module comprises:

[0263] adding the data block to be stored into a to-be-stored queue;

[0264] storing each of the data blocks to be stored into the NVM module according to an order of each of the data blocks to be stored in the to-be-stored queue.

[0265] Optionally, after the obtaining the plurality of data packets of the SWC, the method further comprises:

[0266] obtaining a start address and a data length of each of the data packets;

[0267] calculating a CRC value of each of the data packets according to the start address and the data length of each of the data packets, and adding the CRC value to an end of the data packet;

[0268] The CRC value of each data packet is stored into the target storage area matched with the data packet, for CRC check of each data packet in the read data of the NVM module; wherein, if the check CRC value of the data packet obtained by calculation is consistent with the CRC value of the data packet, the data packet is received; or if the check CRC value of the data packet obtained by calculation is not consistent with the CRC value of the data packet, the data packet is recovered to a default value and then received.

[0269] Embodiments of the present application also provide an electronic device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the method as described above when executing the computer program.

[0270] Embodiments of the present application also provide a computer readable storage medium comprising a stored computer program, wherein the computer readable storage medium controls the device where the computer readable storage medium is located to execute the method as described above when the computer program runs.

[0271] In addition, other configurations and functions of the device of the embodiments of the present application are known to those skilled in the art, and to reduce redundancy, they are not described here.

[0272] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a list of executable instructions for implementing logic functions, and can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus or device, such as a computer-based system, a system including a processor or other system that can fetch the instructions from the instruction execution system, apparatus or device and execute the instructions, or in conjunction with these instruction execution systems, apparatus or devices. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transport a program for use by or in connection with an instruction execution system, apparatus or device, or in conjunction with these instruction execution systems, apparatus or devices. More specific examples (non-exhaustive list) of computer-readable medium include the following: electrical connections having one or more wires (electronic devices), portable computer diskette (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), fiber optic devices, and portable compact disc read-only memory (CDROM). In addition, the computer-readable medium can even be paper or other suitable medium on which the program can be printed, as the program can be electronically obtained, for example, by optical scanning of the paper or other medium, followed by electronic conversion, interpretation or processing, if necessary, in other suitable manner, and then stored in a computer memory.

[0273] It should be understood that aspects of the application can be implemented in hardware, software, firmware or combinations thereof. In the embodiments described above, various steps or methods can be implemented, for example, through software or firmware in storage media which are executable by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any of the following technologies, known in the art, or their combinations, can be used: discrete logic circuitry having logic gates for implementing logic functions upon an application of data signals, application-specific integrated circuits having appropriate combinational logic gates, programmable gate arrays (PGA), field-programmable gate arrays (FPGA), and the like.

[0274] In the description of the present specification, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example", or "some examples" and the like means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Also, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in an appropriate manner.

[0275] In the description of the present application, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the purpose of facilitating the description of the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as limiting the present application.

[0276] In addition, the terms "first", "second" are only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "a plurality of" is at least two, for example, two, three, etc., unless otherwise explicitly specified.

[0277] In this application, unless otherwise explicitly specified and limited, the terms "mounting", "connection", "connecting", "fixing" and the like should be understood in a broad sense, for example, can be fixed connection, can also be detachable connection, or integral; can be mechanical connection, can also be electrical connection; can be directly connected, can also be indirectly connected through an intermediate medium, can be internal communication of two elements or interaction relationship of two elements, unless otherwise explicitly limited. For those skilled in the art, the specific meaning of the above terms in this application can be understood according to the specific circumstances.

[0278] In this application, unless otherwise explicitly specified and limited, the first feature is "on" or "under" the second feature, which can be direct contact between the first and second features, or indirect contact between the first and second features through an intermediate medium. Moreover, the first feature "above", "above" and "above" the second feature can be directly above or obliquely above the first feature, or only indicate that the horizontal height of the first feature is higher than that of the second feature. The first feature "below", "below" and "below" the second feature can be directly below or obliquely below the first feature, or only indicate that the horizontal height of the first feature is less than that of the second feature.

[0279] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application, and those skilled in the art can make changes, modifications, replacements and variations to the above embodiments within the scope of the present application.

Claims

1. A data storage method, characterized by, The method comprises: acquiring a plurality of data packets of a software component; determining a data block matched with each of the data packets based on a preset rule, wherein each of the data blocks is used for storing a plurality of the data packets; storing each of the data packets into the data block matched with the data packet; determining a data block to be stored based on a plurality of the data blocks; storing the data block to be stored into an NVM module; and acquiring a category of each of the data packets, wherein the category of the data packet comprises any one of an immediate storage data packet, a periodic storage data packet and a power-off storage data packet; determining a category of the data block matched with each of the data packets based on a first sub-preset rule of the preset rule and according to the category of each of the data packets, and determining the data block of the category as an initial data block, wherein the category of the data block comprises any one of an immediate storage data block, a periodic storage data block and a power-off storage data block, and each of the data blocks comprises a plurality of storage areas, each of the storage areas being used for storing one of the data packets; acquiring an attribute of each of the data packets, wherein the attribute of each of the data packets comprises at least one of a function category and a security level; determining a target attribute based on a second sub-preset rule of the preset rule and according to the attribute of each of the data packets; selecting the initial data block according to the target attribute of each of the data packets to determine a target data block matched with each of the data packets; acquiring the category of each of the data blocks; if the data block is an immediate storage data block, determining the immediate storage data block as the data block to be stored when data of the data packet in any one of the storage areas of the immediate storage data block is updated; or if the data block is a periodic storage data block, determining the periodic storage data block as the data block to be stored when an interval time reaches an interval threshold; or if the data block is a power-off storage data block, determining the power-off storage data block as the data block to be stored when an ECU is about to be powered off. each of the data blocks comprises a plurality of storage areas, each of the storage areas being used for storing one of the data packets, and the target attribute corresponding to each of the storage areas is the same, or the target attribute corresponding to each of the storage areas is not the same, or the target attribute corresponding to at least two of the storage areas is not the same, or a total storage space value of each of the data blocks is acquired and a storage space value of each of the storage areas of each of the data packets is determined according to the total storage space value.

2. The method of claim 1, wherein, storing each of the data packets into the target data block of the target storage area according to the numerical value of the target attribute of each of the data packets, wherein the data packet is used for covering and updating original data of the target storage area. ​ ​ ​ ​ 3. The method of claim 2, wherein, ​ ​ ​ 4. The method of claim 1, wherein, The storing the to-be-stored data block to the NVM module comprises: adding the to-be-stored data block to a to-be-stored queue; storing each of the to-be-stored data blocks to the NVM module according to the order of each of the to-be-stored data blocks in the to-be-stored queue.

5. The method of claim 4, wherein, After the obtaining of the plurality of data packets of the software component, further comprising: obtaining a starting address and a data length of each of the data packets; calculating a CRC value of each of the data packets according to the starting address and the data length of each of the data packets, and adding the CRC value to the end of the data packet; storing the CRC value of each of the data packets to the target storage area matched with the data packet, for CRC checking of each of the data packets in the read data of the NVM module; wherein, if the calculated check CRC value of the data packet is consistent with the CRC value of the data packet, the data packet is received; or if the calculated check CRC value of the data packet is inconsistent with the CRC value of the data packet, the data packet is recovered to a default value and then received.

6. A data storage device, characterized by comprising: an obtaining module, configured to obtain a plurality of data packets of a software component; a first determining module, configured to determine a data block matched with each of the data packets based on a preset rule; wherein each of the data blocks is used for storing a plurality of the data packets; a first storing module, configured to store each of the data packets to the data block matched with the data packet; a second determining module, configured to determine a to-be-stored data block based on a plurality of the data blocks; a second storing module, configured to store the to-be-stored data block to an NVM module; the determining of the data block matched with each of the data packets based on the preset rule comprises: obtaining a category of each of the data packets; wherein the category of the data packet comprises any one of an immediate storage data packet, a periodic storage data packet and a power-off storage data packet; determining a category of the data block matched with each of the data packets according to the category of each of the data packets based on a first sub-preset rule of the preset rule, and determining the data block of the category as an initial data block; wherein the category of the data block comprises any one of an immediate storage data block, a periodic storage data block and a power-off storage data block; each of the data blocks comprises a plurality of storage areas, and each of the storage areas is used for storing one of the data packets; obtaining an attribute of each of the data packets; wherein the attribute of each of the data packets comprises at least one of a function category and a security level; determining a target attribute according to the attribute of each of the data packets based on a second sub-preset rule of the preset rule; selecting the initial data block according to the target attribute of each of the data packets to determine a target data block matched with each of the data packets; the determining of the to-be-stored data block based on a plurality of the data blocks comprises: obtaining the category of each of the data blocks; If the data block is an immediate storage data block, the immediate storage data block is determined as the data block to be stored when data of the data packet of any one of the storage areas in the immediate storage data block is updated; or If the data block is a periodic storage data block, the periodic storage data block is determined as the data block to be stored when an interval time reaches an interval threshold; or If the data block is a power-off storage data block, the power-off storage data block is determined as the data block to be stored when the ECU is about to be powered off.

7. An electronic device, comprising: A computer program product comprising a computer readable storage medium having stored thereon computer program instructions that, when executed at a processor, cause the processor to carry out the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, A computer readable storage medium comprising a stored computer program, wherein the computer program, when run, controls a device in which the computer readable storage medium is located to carry out the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Data storage method and device

    CN110096451A