Data recording method and apparatus

By dividing the data buffer of volatile memory in the vehicle controller for rolling storage and event-triggered periodic disk write-to-disk, the efficiency and real-time issues of the vehicle controller data recording system are solved, achieving efficient data storage and extending the lifespan of non-volatile memory.

CN122308745APending Publication Date: 2026-06-30JINGWEI HIRAIN (TIANJIN) RES&DEV CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
JINGWEI HIRAIN (TIANJIN) RES&DEV CO LTD
Filing Date
2026-04-13
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In the existing technology, the data recording system of the vehicle controller is inefficient, lacks real-time performance and accuracy during remote transmission, and is easily affected by network transmission quality, resulting in data delay or loss.

Method used

By dividing the volatile memory into multiple data buffers, periodically rolling the storage of critical data, and writing the data to non-volatile memory when a specific event is triggered, and combining the event trigger signal to divide the post-event data interval, the rolling storage and periodic disk write of critical data can be realized.

Benefits of technology

Effective storage of critical data within limited storage space reduces storage requirements, slows down the aging of non-volatile memory, extends its lifespan, and improves the real-time performance and accuracy of data recording.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122308745A_ABST
    Figure CN122308745A_ABST
Patent Text Reader

Abstract

The application discloses a data recording method and device. The method comprises the following steps: determining a target data buffer from a plurality of data buffers when the system is powered on; periodically acquiring key data of a process task corresponding to each task data group of the target data buffer from a starting data interval of the task data group, and respectively rolling and storing the key data of each period to a corresponding data interval; the key data is parameter information representing a system running state; in response to an event trigger signal, dividing part of the data interval in the task data group as an after-the-event data interval, and respectively storing the key data of part of the period after the event trigger signal to the corresponding after-the-event data interval; and writing the stored data in the target data buffer to a nonvolatile memory when at least part of the task data groups meet a data recording condition. The application can realize a black box data recording function in a limited storage space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data management technology, and in particular to a data recording method and apparatus. Background Technology

[0002] With the continuous development of technology, various electronic devices and equipment have become an indispensable part of daily life. However, during the operation of electronic devices, various events such as malfunctions and alarms may occur. In order to trace these events, electronic devices need to retain relevant operational data within the time range in which the events occurred.

[0003] For example, with the rapid development of intelligent and electrification technologies, new energy vehicles are gradually becoming the mainstream in the market. Taking the on-board controller of a new energy vehicle as another example, to ensure the normal operation of the vehicle, the on-board controller needs to collect and process a large amount of data in real time. When a vehicle malfunctions or is involved in an accident, valuable information can be obtained by reading the data recorded by the vehicle's black box system. This helps technicians analyze the root cause of the problem, enabling accident reconstruction, fault analysis, and other operations. Based on this data, effective solutions can be implemented to improve the vehicle's safety and reliability.

[0004] In related technologies, taking the vehicle's onboard controller as an example, the black box system of the vehicle controller can be a data recording system. This system can connect to various sensors and control units, collect and store vehicle operating data in real time, and upload the data to a cloud platform or server via remote network transmission. However, this remote transmission method is limited by transmission bandwidth and network latency, resulting in low actual transmission efficiency. Furthermore, the data transmission process is affected by network transmission quality, which may lead to data delays or data loss, affecting the real-time performance and accuracy of data recording. Summary of the Invention

[0005] This application provides a data recording method and apparatus, which can improve the technical problems of insufficient efficiency, real-time performance and accuracy in the implementation of data recording in related technologies.

[0006] In a first aspect, embodiments of this application provide a data recording method, the method comprising: When the system is powered on, the target data buffer is determined from multiple data buffers; the data buffer is a storage area in volatile memory, and the data buffer includes multiple task data groups, and the task data group contains multiple data ranges; For each task data group in the target data buffer, starting from the initial data range of the task data group, the key data of the process task corresponding to the task data group is periodically obtained, and the key data of each period is rolled and stored into the corresponding data range; the key data is parameter information representing the system running status. In response to the event trigger signal, a portion of the data range is divided from the task data group as the post-event data range, and the key data of the period after the event trigger signal is stored one by one into the corresponding post-event data range. If at least some task data groups meet the data recording conditions, the stored data in the target data buffer is written to the non-volatile memory.

[0007] According to an embodiment of the first aspect of this application, when the system is powered on, determining a target data buffer from a plurality of data buffers includes: When the system is powered on, the stored data in the non-volatile memory is read into the respective data buffers; The first data buffer for the most recent rolling storage of key data is determined based on the identification information of each data buffer; The target data buffer is determined based on the first data buffer.

[0008] According to the implementation of the first aspect of this application, starting from the initial data interval of the task data group, key data of the process task corresponding to the task data group is periodically acquired, and the key data of each period is rolled and stored into the corresponding data interval, including: When the data recording status of the task data group is enabled, the data recording value and its corresponding starting data range are determined based on the data stop recording value; the data stop recording value is used to indicate the data range of the last stored key data in the previous rolling storage process of the corresponding task data group; Starting from the initial data range, the key data for each period is sequentially stored in each data range according to the range order of the multiple data ranges.

[0009] According to the first aspect of this application, in response to an event trigger signal, a portion of the data range from the task data group is divided as a post-event data range, and key data from a period following the event trigger signal are stored one by one into the corresponding post-event data range, including: In response to an event trigger signal, the first quantity of the post-event data interval for each task data group is determined based on the data allocation ratio corresponding to each task data group. Based on the data interval corresponding to the key data of the most recent period for each task data group and the first quantity, multiple subsequent data intervals corresponding to the first quantity are determined from multiple data intervals. The key data for the first number of cycles following the event trigger signal are sequentially stored in each subsequent data interval.

[0010] According to an embodiment of the first aspect of this application, multiple task data groups correspond one-to-one with multiple process tasks; when at least some task data groups meet the data recording conditions, the stored data in the target data buffer is written to a non-volatile memory, including: Based on preset selection criteria, one of multiple process tasks is selected as the storage trigger task; If the data recording signal of the task data group corresponding to the storage trigger task is a prohibited signal, the data recording signals of the remaining task data groups are traversed; wherein, if the task data group has completed the storage of key data in the subsequent data interval, the data recording signal of the task data group is set to a prohibited signal; preset selection conditions are used to reduce the number of traversals; If the data recording signal of at least some task data groups is disabled, a storage write task is triggered to write the storage data in the target data buffer to non-volatile memory.

[0011] According to the implementation of the first aspect of this application, the storage write-to-disk task is independent of each process task.

[0012] According to the first aspect of this application, after writing the stored data in the target data buffer to the non-volatile memory when at least a portion of the task data group meets the data recording conditions, the method further includes: Update the target data buffer to the first data buffer; Based on the updated first data buffer, determine the new target data buffer and return to the following steps: For each task data group in the target data buffer, starting from the initial data range of the task data group, periodically obtain the key data of the process task corresponding to the task data group, and roll and store the key data of each period to the corresponding data range.

[0013] According to an embodiment of the first aspect of this application, the storage area in the volatile memory further includes a backup buffer; for each task data group in the target data buffer, starting from the initial data interval of the task data group, the key data of the process task corresponding to the task data group is periodically acquired, and the key data of each period is rolled and stored to the corresponding data interval respectively, further comprising: Copy the stored data from the target data buffer to the backup buffer.

[0014] According to the first aspect of this application, after writing the stored data in the target data buffer to the non-volatile memory when at least a portion of the task data group meets the data recording conditions, the method further includes: When external communication devices are connected, stored data is read from multiple data buffers other than the target data buffer and the backup buffer, and the stored data is parsed.

[0015] Secondly, embodiments of this application provide a data recording device, including: The determination module is used to determine the target data buffer from multiple data buffers when the system is powered on; the data buffer is a storage area in volatile memory, and the data buffer includes multiple task data groups, and the task data group contains multiple data ranges; The rolling storage module is used to periodically retrieve the key data of the process task corresponding to each task data group in the target data buffer, starting from the initial data range of the task data group, and roll and store the key data of each period to the corresponding data range; the key data is parameter information representing the system running status. The event triggering module is used to respond to the event triggering signal, divide a portion of the data range from the task data group as a portion of the post-event data range, and store the key data of the period after the event triggering signal into the corresponding post-event data range one by one. The recording and storage module is used to write the stored data in the target data buffer to the non-volatile memory when at least a portion of the task data group meets the data recording conditions.

[0016] Thirdly, embodiments of this application provide an electronic device, including: a processor and a memory storing computer program instructions; The steps of implementing the data recording method of the first aspect when the processor executes computer program instructions.

[0017] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the steps of the data recording method described in the first aspect.

[0018] Fifthly, embodiments of this application provide a computer program product, which includes a computer program. When the instructions in the computer program product are executed by a processor, they implement the steps of the data recording method described in the first aspect.

[0019] The data recording method and apparatus of this application embodiment can determine a target data buffer from multiple data buffers when the system is powered on. For each task data group in the target data buffer, starting from the initial data interval, key data corresponding to the task data group can be periodically acquired and rolled into the corresponding data interval. The key data may include parameter information representing the system's operating status. After a specific event occurs and an event trigger signal is generated, a portion of the data interval can be allocated from the task data group as a post-event data interval, and the key data periodically acquired after the specific event occurs can be stored in the post-event data interval, so that the task data group stores key data before and after the event. When at least some task data groups meet the data recording conditions, the stored data in the target data buffer can be written to non-volatile memory. The above implementation can function as a black box data recording function when a specific event occurs. Through the rolling storage method, key data can be effectively stored in a limited storage space, reducing the storage space requirements during function implementation. Furthermore, by only writing key data to non-volatile memory when a specific event occurs, the number of erase and write cycles of the storage medium can be greatly reduced, slowing down the aging of the non-volatile memory and extending its service life. Attached Figure Description

[0020] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is a schematic flowchart of a data recording method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the data structure of a data buffer provided in an embodiment of this application; Figure 3 This is a schematic diagram of the layout of the storage area of ​​a volatile memory provided in an embodiment of this application; Figure 4 This is a flowchart illustrating a data recording method provided in another embodiment of this application; Figure 5 This is a flowchart illustrating a data recording method provided in another embodiment of this application; Figure 6 This is a flowchart illustrating a data recording method provided in another embodiment of this application; Figure 7 This is a flowchart illustrating a data recording method provided in another embodiment of this application; Figure 8 This is a schematic diagram illustrating an application scenario of the data recording method provided in an embodiment of this application; Figure 9 This is a schematic diagram of the structure of a data recording device provided in an embodiment of this application; Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0022] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0023] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0024] To address at least one of the aforementioned technical problems, embodiments of this application provide a data recording method and apparatus. The data recording method provided by these embodiments will be described first.

[0025] Figure 1 A flowchart illustrating a data recording method according to an embodiment of this application is shown. The method may include the following steps: S110, when the system is powered on, determine the target data buffer from multiple data buffers; the data buffer is a storage area in volatile memory, and the data buffer includes multiple task data groups, and the task data groups contain multiple data ranges; S120: For each task data group in the target data buffer, starting from the initial data range of the task data group, periodically obtain the key data of the process task corresponding to the task data group, and roll and store the key data of each period into the corresponding data range; the key data is parameter information representing the system running status. S130, in response to the event trigger signal, divide a portion of the data interval from the task data group as the post-event data interval, and store the key data of the period after the event trigger signal into the corresponding post-event data interval one by one. S140: If at least some task data groups meet the data recording conditions, write the stored data in the target data buffer to the non-volatile memory.

[0026] In this embodiment, when the system powers on, a target data buffer can be determined from multiple data buffers. For each task data group within the target data buffer, starting from the initial data interval, key data corresponding to that task data group can be periodically acquired and rolled over to the corresponding data interval. This key data may include parameter information representing the system's operating status. After a specific event occurs and an event trigger signal is generated, a portion of the data interval can be designated as a post-event data interval, and the key data periodically acquired after the specific event is stored in the post-event data interval. This ensures that the task data group stores both pre-event and post-event key data. When at least some task data groups meet the data recording conditions, the stored data in the target data buffer can be written to non-volatile memory. The above implementation can function as a black box for recording data when a specific event occurs. By using a rolling storage method, key data can be effectively stored within a limited storage space, reducing the storage space requirements during function implementation. Furthermore, writing key data to non-volatile memory only when a specific event occurs significantly reduces the number of erase / write cycles on the storage medium, slows down the aging of the non-volatile memory, and extends its lifespan.

[0027] The specific implementation methods for each of the above steps are described below.

[0028] In S110, the storage modules in the system may include non-volatile memory (NVM) and volatile memory (RAM). Data stored in non-volatile memory will not disappear after the system is powered off or disconnected, while data stored in volatile memory will be lost after the system is powered off or disconnected.

[0029] The aforementioned non-volatile memory can be Flash Memory, ROM (Read-Only Memory), PROM (Programmable read-only memory), EAROM (Electrically alterable read-only memory), EPROM (Erasable programmable read-only memory), EEPROM (Electrically erasable programmable read-only memory), etc., while volatile memory can be DRAM (Dynamic Random Access Memory), SRAM (Static Random-Access Memory), etc.

[0030] To implement the data recording method described in the following embodiments of this application, data structure planning can be performed on a portion of the storage area allocated in the volatile memory. For example... Figure 2 As shown, a portion of the volatile memory is divided into N data buffers, namely Record1, Record2, ..., RecordN. Each data buffer can store multiple sets of key data corresponding to process tasks.

[0031] Taking data buffer N, i.e. RecordN, as an example, RecordN can include multiple task data groups, namely RecordN-Task1Data, RecordN-Task2Data, ..., RecordN-TaskNData. Each task data group can include multiple data ranges, namely Counter data0, Counter data1, ..., Counter dataN.

[0032] Taking a single data buffer as an example, a data buffer (Record-Buffer) can contain multiple task data groups and a record counter. The record counter records the current RecordId to determine the target data buffer corresponding to the rolling storage process. Each task data group can contain multiple data ranges (Counter data) and a task counter (Task-Counter). Task data groups can store key data for multiple cycles, and different task data groups are used to store key data corresponding to different process tasks. Based on the above data structure design, a data structure suitable for storage and parsing can be obtained. Combined with the event-driven storage mechanism and rolling storage technology, the orderliness and efficiency of data in the storage process can be ensured.

[0033] When the system is powered on, the target data buffer can be determined from multiple data buffers.

[0034] To ensure data reading can be achieved via external communication buses (such as CAN bus, ETH industrial Ethernet bus, etc.). Figure 3 As shown, within the storage area of ​​a non-volatile memory, not only the specific content of each record needs to be stored, but also the cache address and cache size of each data buffer (Record-Buffer) also need to be recorded. Figure 2 The Did7001 shown represents the size of the data buffer in bytes, while Did7002-Did700N represent the size of the cache addresses in bytes for each data buffer. Record0, corresponding to Block Record0, contains the data stored in the first data buffer, and so on. Each time a storage operation is triggered, the record data in the current data buffer, along with its corresponding cache address and size, can be written to different areas of the volatile memory.

[0035] Please refer to Figure 4 In some embodiments, the above-described S110 may include: S210, when the system is powered on, reads the stored data in the non-volatile memory into each data buffer; S220, determine the first data buffer for the most recent rolling storage of key data based on the identification information of each data buffer; S230, determine the target data buffer based on the first data buffer.

[0036] In this embodiment, since the data buffer is the storage area of ​​the volatile memory, when the power is on, the data in the non-volatile memory needs to be read into each data buffer, and the target data buffer is determined according to the identification information of each data buffer, so that the critical data is stored in a rolling manner starting from the target data buffer.

[0037] In S210, the method for determining the target data buffer from multiple data buffers can be as follows: upon initial system power-on, the stored data in the non-volatile memory is read into the corresponding RAM segment (denoted as Nv-Ram) of each data buffer in the volatile memory. Since the data buffer is a storage area in the volatile memory, the data in the data buffer is empty before system power-on, at which point the stored data in the non-volatile memory needs to be reread into each data buffer.

[0038] Understandably, before the system was powered down previously, the stored data in each data buffer was stored in non-volatile memory so that the stored data could be read from the non-volatile memory and stored in each data buffer when the system was powered up again.

[0039] In S220, when the system is powered on, the stored data read from the non-volatile memory by each data buffer may include identification information, based on which the first data buffer that most recently stored key data can be determined.

[0040] As an example, this identification information could be the Recordcounter value in the Record-Counter. If the Recordcounter value is 4, it means that the first data buffer for storing key data in the previous rolling storage was data buffer number 5 out of multiple data buffers. It can be understood that a Recordcounter value of 0 corresponds to data buffer number 1, and so on.

[0041] In S230, after determining the first data buffer of the most recent rolling storage of key data, the next data buffer can be selected as the target data buffer. For example, when the Record counter value is 4, the first data buffer can be determined to be data buffer numbered 5, i.e., Record-Buffer 5. At this time, Record-Buffer 6 can be selected as the target data buffer. Accordingly, the Record counter value can be updated to 5.

[0042] The formula for updating the Record counter value is: Record counter = (Record counter + 1) % N, where "%" represents the modulo operation.

[0043] In S120, after determining the target data buffer from multiple data buffers, the following steps can be performed for each task data group in the target data buffer.

[0044] A single Task-Data set can store key data from multiple periods. In the data structure planning of volatile memory, a single Task-Data set can include a Task-Counter and multiple counter data storage areas. Each counter data area can be used to store the key data that the process task corresponding to that Task-Data set needs to collect within a single period. This key data can be parameter information representing the system's operating status. Taking an onboard controller as an example, this key data can be the power battery status, motor operating status, braking system information, driving behavior data, etc. For example, if the process task corresponding to a certain Task-Data set is power battery status detection, then the multiple counter data areas within that Task-Data set can respectively store the power battery status parameters corresponding to multiple sampling periods.

[0045] Since the task data group contains multiple data ranges, and the critical data from the last rolling cycle storage during the previous power-on process has already been read from non-volatile memory into each task data group, when reading the critical data from the last rolling cycle storage during the previous power-on process, the data range where the last critical data was stored can be determined based on the relevant parameter information read at the same time, and the next data range can be determined as the starting data range for this process. For example, if the last data range where the critical data was stored in the previous rolling cycle storage process was data range number 5 out of multiple data ranges, then the current rolling cycle storage process can start from data range number 6. That is, the starting data range is determined to be data range number 6.

[0046] After determining the starting data range within the task data group, key data for the corresponding process tasks can be periodically acquired, and the key data from each period can be rolled over and stored into the corresponding data range. This key data can be a subset of parameter information selected by the user from all collectable parameters representing the system's operating status.

[0047] Understandably, taking the data recording of the vehicle controller as an example, users can ensure that the recorded data effectively reflects the vehicle's operating status based on system requirements and safety criteria, which should be of significant value for subsequent system analysis and diagnosis. Furthermore, considering that the ECU program of the vehicle controller is generally task-driven and the operating cycles of different tasks vary, to ensure data real-time performance and simplify the subsequent data integration process, the characteristics of each task can be fully considered during the data filtering process to ensure that the collected data meets the real-time needs of vehicle operation monitoring and fault diagnosis.

[0048] As an alternative implementation, since the running cycles of each process task are not consistent, the quantity and type of key data stored in each task data group may differ, and the sampling period for collecting key data can also be adjusted according to the running cycle of the corresponding process task. Therefore, the period for storing key data in each task data group may also differ.

[0049] Please refer to Figure 5 In some embodiments, the above-described S120 may include: S310, when the data recording status of the task data group is enabled, determine the data recording value and its corresponding starting data range based on the data stop recording value; the data stop recording value is used to indicate the data range of the last stored key data in the previous rolling storage process of the corresponding task data group. S320 starts from the initial data range and, according to the range order of multiple data ranges, sequentially stores the key data of each period into each data range.

[0050] In this embodiment, when the data recording status of the task data group is enabled, the starting data interval of the current rolling storage process can be determined based on the data stop recording value recorded in the previous rolling storage process, and the key data of each cycle can be rolled and stored into each data interval starting from the starting data interval.

[0051] In S310, before performing rolling storage of critical data based on each task data group in the target data buffer, it is necessary to first determine the data recording status of the task data group. The data recording status indicates whether the task data group can perform rolling storage of critical data. For example, the data recording status can be enabled or stopped. In the enabled state, it means that the critical data stored in the task data group has not yet been written to the non-volatile memory after power-on. Therefore, the task data group can perform rolling storage of critical data.

[0052] Each task data group also has a corresponding data stop recording value. During the previous rolling storage process, after completing the last data interval storing key data, the identifier or number of that data interval can be used as the data stop recording value. For example, taking a single task data group containing 20 data intervals as an example, if the rolling storage process stops when it reaches data interval number 10 during the previous power-on process, then the 20 data intervals will each store key data corresponding to 20 cycles, with the key data stored in data interval number 11 being the oldest key data and the key data stored in data interval number 10 being the newest key data.

[0053] After stopping the rolling storage and writing the key data of 20 data intervals to non-volatile memory, the data stop recording value of this task data group can be recorded as 9, which corresponds to the data interval numbered 10.

[0054] If the data stop record value is read as 9 during this power-on, it means that the last data range storing key data in the previous rolling storage process was the data range numbered 10. Therefore, the starting data range this time can be the data range numbered 11.

[0055] In S320, after determining the initial data interval, key data from each cycle can be sequentially stored in the respective data intervals according to their order. For example, for this task data set, in the first cycle after power-on, the collected key data can be stored in data interval numbered 11. Key data collected in the next cycle is then stored in data interval numbered 11. After being stored in data interval numbered 20, key data collected in the next cycle is re-stored in data interval numbered 1, overwriting the existing data. By storing key data in real-time, effective management of key data can be achieved within limited RAM space, significantly reducing the storage space requirements.

[0056] It should be noted that in the above embodiments, the number of data intervals contained in each task data group within the target data buffer may be different, and the collection period for key data in each task data group may also be different. That is, the two task data groups in the target data buffer may contain 20 data intervals and 40 data intervals respectively. When one task data group is storing key data into data interval numbered 11, the other task data group may not have reached the next sampling period for key data, or it may be storing key data into data interval numbered 31.

[0057] In S130, when performing real-time rolling storage of key data for each task data group in the target data buffer, real-time rolling storage can continue without an event trigger signal being generated, and the key data of each task data group in the target data buffer will not be written to non-volatile memory. Only after a specific event triggers an event trigger signal will a portion of the data from the task data group be divided as a subsequent data range in response to the event trigger signal.

[0058] Upon receiving an event trigger signal, a single task data group in the target data buffer can, based on the currently stored key data interval, reserve a portion of the data interval for key data after the specific event occurs, starting from the next data interval, as a post-event data interval. Key data for the subsequent periods following the event trigger signal will then be stored one by one into the corresponding post-event data intervals. For example, if a task data group containing 20 data intervals happens to store the key data for that sampling period in data interval numbered 8 when a specific event occurs, then starting from data interval numbered 9, a certain number of data intervals can be selected to store the key data for each period after the specific event occurs. Alternatively, a certain number of data intervals can be randomly selected as post-event data intervals; this is not strictly limited.

[0059] Please refer to Figure 6 In some embodiments, the above-described S130 may include: S410, in response to an event trigger signal, determines the first quantity of the post-event data interval for each task data group based on the data allocation ratio corresponding to each task data group; S420, based on the data interval corresponding to the key data of the most recent period of each task data group and the first quantity, determine multiple subsequent data intervals corresponding to the first quantity from multiple data intervals; S430 sequentially stores the key data of the first number of cycles after the event trigger signal into each subsequent data interval.

[0060] In this embodiment, an event trigger signal generated based on a specific event can divide each task data group into a first number of post-event data intervals, and the key data in each period after the specific event occurs can be rolled and stored in the post-event data intervals, so that the task data group stores key data before and after the event.

[0061] In S410, when a specific event occurs, an event trigger signal can be generated. Based on this event trigger signal, a corresponding data allocation ratio can be pre-set according to the process task corresponding to each task data group, and the first number of subsequent data intervals for each task data group can be determined according to the actual number of data intervals in each task data group. For example, taking the vehicle controller as an example, the specific event could be an emergency braking event or a fault signal indication event during manual or automatic driving. If a data allocation ratio of 1:1 is set for a certain process task, then when the task data group contains 20 data intervals, the first number of subsequent data intervals can be determined to be 10. That is, 10 data intervals are used to store key data for 10 cycles before the specific event occurs, and another 10 data intervals are used to store key data for 10 cycles after the specific event occurs.

[0062] If the data allocation ratio is set to 1:3, then the first number of post-event data intervals can be determined to be 15. That is, 5 data intervals are used to store key data for 5 periods before the specific event occurs, and the other 15 data intervals are used to store key data for 15 periods after the specific event occurs.

[0063] It is understandable that the number of data ranges contained in each task data group in the target data buffer may not be the same, and users can set different data allocation ratios for each task data group.

[0064] In S420, after determining the first quantity corresponding to each task data group, for a single task data group, multiple subsequent data intervals corresponding to the first quantity can be determined from multiple data intervals based on the data interval where the key data of the most recent period of the task data group is stored and the first quantity of the task data group. For example, if the task data group contains 20 data intervals, and the first quantity is 10, and the key data collected in the most recent period is stored in the data interval numbered 7, then the 10 data intervals numbered 8-17 can be determined as subsequent data intervals.

[0065] In S430, after determining multiple post-event data intervals, key data collected in each period can be sequentially stored in the corresponding post-event data intervals within the first number of cycles following the trigger signal generated by the specific event. For example, after determining 10 data intervals numbered 8-17 as post-event data intervals, key data collected within 10 cycles following the specific event can be stored in the 10 data intervals numbered 8-17 respectively.

[0066] It is understood that, in the above embodiment, after the key data is stored in the data interval numbered 17, the key data stored in this task data group can be fixed. In the next cycle, the key data will not be stored in the data interval of this task data group again.

[0067] As an optional implementation, for a single task data group, a data stop record value (StopCounter) and a data record value (SaveCounter) can be set.

[0068] During the initial scrolling process, the data record value SaveCounter can be updated based on the read data stop record value StopCounter. The SaveCounter adjustment formula is as follows: SaveCounter = (StopCounter + 1) % N, where "%" represents modulo operation.

[0069] That is, when there are 20 data intervals, if the data stop record value StopCounter is 9, then SaveCounter is 10, thus indicating that the starting data interval for this time can be the data interval numbered 11.

[0070] After storing the key data for the current period into the data range numbered 11, SaveCounter can be incremented, i.e.: SaveCounter = (SaveCounter + 1)% N; After the auto-increment is completed, the key data for the next period can be stored in the data interval numbered 12, and so on. After being stored in the last data interval, the key data for the next period can overwrite the data interval numbered 1.

[0071] When a specific event occurs, based on the event trigger signal and after determining a first quantity according to the above implementation method, a data stop recording value (StopCounter) can be set based on the first quantity. For example, when the corresponding data allocation ratio is set to 1:1 and the task data group contains 20 data intervals, if the last key data before the specific event is stored in data interval numbered 3, then the corresponding SaveCounter value is 2. After determining the first quantity to be 10, the StopCounter value can be set to 12 based on the current SaveCounter value.

[0072] Over the next 10 cycles, the SaveCounter value increases from 3 to 12, thereby storing the key data for the 10 cycles following that specific event sequentially into the post-event data intervals numbered 4-13. When the SaveCounter value increases to match the StopCounter value, it indicates that the first quantity of key data following the specific event has been stored in the post-event data intervals, and the task data group can stop the rolling storage process.

[0073] The StopCounter adjustment formula is as follows: StopCounter = (SaveCounter + X)% N; Where X is the first quantity, and "%" represents the modulo operation.

[0074] As an optional implementation, in the above embodiments, the state of each process task can also be adjusted based on the data recording signal during the rolling storage process. For example, it can be determined whether the data recording signal corresponding to a certain process task has changed according to a predetermined rule (e.g., the data recording signal changes from 0 to 1). If the change satisfies the predetermined rule, the data recording state of that process task is adjusted to the enabled state.

[0075] After a specific event triggers an event signal, the data recording state of the process task can be adjusted to a pre-stop recording state.

[0076] When the SaveCounter value increases to match the StopCounter value and the task data group stops rolling the stored procedure, the data recording status of the process task can be adjusted to the stopped recording state, and the latest SaveCounter value can be recorded in the Task Counter data bit of the task data group.

[0077] After storing critical data into the corresponding data range each time, the data recording status of the process task can be judged. When the data recording status is enabled or pre-stop recording, the SaveCounter value can be updated, and critical data can continue to be written into the next data range in the next cycle. When the data recording status is stopped recording, the rolling storage process of the task data group can be stopped.

[0078] In S140, for multiple task data groups in the target data buffer, the period duration of acquiring key signals may differ, and the number of data intervals in each task data group may also vary, resulting in different ending times for the rolling storage process of each task data group. The data is written to the non-volatile memory after at least some task data groups have stopped their rolling storage process. Therefore, for example, the data stored in the target data buffer can be written to the non-volatile memory after at least some task data groups, such as all task data groups, meet the data recording condition, i.e., after all task data groups have stopped their rolling storage process. Alternatively, the data stored in the target data buffer can be written to the non-volatile memory after more than a preset number of task data groups have stopped their rolling storage process; this is not strictly limited.

[0079] Please refer to Figure 7 In some embodiments, multiple task data groups correspond one-to-one with multiple process tasks; the above-mentioned S140 may include: S510 selects one of multiple process tasks as the storage trigger task based on preset selection conditions; S520, when the data recording signal of the task data group corresponding to the storage trigger task is a prohibited signal, the data recording signals of the remaining task data groups are traversed; wherein, when the task data group has completed the key data storage of the post-event data interval, the data recording signal of the task data group is set to a prohibited signal; a preset selection condition is used to reduce the number of traversals; S530, when the data recording signal of at least some task data groups is a prohibited signal, triggers a storage disk task to write the storage data in the target data buffer to non-volatile memory.

[0080] In this embodiment, based on preset selection criteria, one of multiple process tasks can be selected as the storage trigger task. After triggering, it is determined whether the data recording signals of each task data group are all prohibited signals. When at least some task data groups, such as all task data groups, have prohibited signals, it indicates that all task data groups have stopped the rolling storage process. At this time, the stored data in the target data buffer can be written to the non-volatile memory. Alternatively, the stored data in the target data buffer can be written to the non-volatile memory only when the data recording signals of more than a preset number of task data groups are prohibited signals. This is not strictly limited here.

[0081] In S510, multiple task data groups within the target data buffer correspond one-to-one with multiple process tasks. Users can pre-set selection criteria so that, after a specific event occurs, the target data buffer can select one of the multiple process tasks as the storage trigger task based on the preset selection criteria.

[0082] In S520, after determining the storage trigger task, the corresponding task data group can be identified, and the data recording signal corresponding to the task data group can be monitored. After each task data group completes the critical data storage of the subsequent data interval, i.e., after stopping the rolling storage process, the corresponding data recording signal can be set to an inhibit signal.

[0083] If the data recording signal of a task data group changes from an enable signal to an inhibit signal, it means that the task data group can no longer record data, which means that the task data group stops the rolling storage process.

[0084] After the data record signal of the task data group corresponding to the stored trigger task becomes a prohibition signal, the data record signals of other task data groups can be traversed to determine whether they are prohibition signals.

[0085] After one traversal, if at least one task data group's data recording signal is not a prohibited signal, it means that the task data group has not stopped the rolling storage process, and traversal can continue until all task data groups' data recording signals or more than a preset number of task data groups' data recording signals are prohibited signals.

[0086] As an example implementation, the enable signal of the data recording signal can be 1, and the disable signal can be 0. During the traversal, the data recording signals of all task data groups can be accumulated. If the accumulated result after the traversal is 0, it means that the data recording signal of each task data group is a disable signal; otherwise, it means that the data recording signal of at least one task data group is not a disable signal.

[0087] In the above embodiments, users can set preset selection conditions based on the need to reduce the number of traversals. For example, users can select a process task with a larger sampling period as the storage trigger task. Because the sampling period is larger, the time interval for rolling storage of key data in the task data group corresponding to this process task is longer. That is, the time node when the rolling storage process of this task data group usually stops is later. When this task data group stops rolling storage, most other task data groups have basically stopped rolling storage long ago. By using this process task as the storage trigger task, it can be determined that at least some task data groups have stopped rolling storage shortly after triggering, thereby reducing the computational load of the processing module and reducing the CPU computational load.

[0088] In another implementation, the storage trigger task can be selected based on the number of post-process data intervals in the task data group corresponding to each process task. For example, if the number of post-process data intervals in the task data group corresponding to process task A is B1, and the number of post-process data intervals in the task data group corresponding to process task B is B2, then the process task corresponding to the larger value between B1 and B2 can be selected as the storage trigger task. Furthermore, other selection methods are also possible. For example, if the period of process task A is P1 and the number of post-process data intervals is B1, and the period of process task B is P2 and the number of post-process data intervals is B2, then comparing the size of P1*B1 and P2*B2 can also be used to select the storage trigger task; this is not limited here.

[0089] In S530, when the data recording signal of at least some task data groups is a prohibited signal, it indicates that at least some task data groups in the target data buffer have stopped the rolling storage process. At this time, a storage write task can be triggered to write the stored data of each task data group in the target data buffer to the non-volatile memory. At least some task data groups can be all task data groups or more than a preset number of task data groups, which is not strictly limited here.

[0090] In some embodiments, the disk write task is independent of the individual process tasks. When the disk write task is independent of the individual process tasks, the disk write task can run in parallel with the process tasks, and multiple process tasks may alternately execute within the disk write task to ensure system efficiency and responsiveness.

[0091] Based on the principle of mutual independence, the storage write task can be set as a low-priority task.

[0092] As an optional implementation, after the above-mentioned storage and disk writing task is completed, the disk writing completion flag can be set to valid. Based on the valid flag bit of the disk writing completion flag, the data recording signals in each task data group in the data buffer can be set to enable signals, and the disk writing completion flag can be cleared after setting the enable signals. When the data buffer is rotated again after rotating through other data buffers, the rolling storage of critical data can continue.

[0093] In some embodiments, after S140 above, the following may also be included: S610, update the target data buffer to the first data buffer; S620, based on the updated first data buffer, determines the new target data buffer and returns to S120.

[0094] In this embodiment, after the data in the target data buffer is written to the non-volatile memory, the next data buffer can be used as the new target data buffer, and the rolling storage process can be restarted in the new target data buffer.

[0095] In S610, at least some task data groups (e.g., all task data groups) in the target data buffer stop the rolling storage process, indicating that the data stored in at least some task data groups in the target data buffer no longer changes during this power-on process. At this time, the target data buffer can be updated to the first data buffer.

[0096] In S620, based on the updated first data buffer, a new target data buffer can be determined, and key data can be rolled and stored in the new target data buffer.

[0097] As an optional implementation, if a specific event occurs at a certain moment when the system powers on, and the target data buffer at that moment is data buffer number 3, then after at least some task data groups have stopped the rolling storage process and the critical data in the data buffer has been stored in non-volatile memory, data buffer number 3 can be updated to the first data buffer, and data buffer number 4 is determined as the new target data buffer. Thereafter, the rolling storage of critical data continues by the various task data groups in data buffer number 4.

[0098] Understandably, since each data buffer needs to be polled and switched after a specific event occurs, the memory space of each data buffer can be set to be consistent.

[0099] Based on this, task data groups with the same number in different data buffers can be set with the same configuration parameters. For example, they can correspond to the same process task, have the same number of data ranges, and the same size of memory space, etc. There are no restrictions here.

[0100] In some embodiments, the storage area in the volatile memory further includes a backup buffer; prior to S120 above, it may also include: S710 copies the stored data in the target data buffer to the backup buffer.

[0101] In this embodiment, the storage area in the volatile memory also includes a backup buffer, the memory space of which can be set to be consistent with the memory space of each data buffer. Before writing the first key data of a new cycle to the task data group in the target data buffer, the stored data in the target data buffer can also be copied to the backup buffer.

[0102] Understandably, the data read from the non-volatile memory by the target data buffer after power-on is the oldest record data. To ensure the readability of the oldest record data, it can be copied to the backup buffer so that when the oldest record data in the target data buffer is overwritten by new data during the rolling storage process, the oldest record data can still be read through the backup buffer.

[0103] like Figure 2 As shown, the volatile memory also includes a backup buffer, Record Shadow.

[0104] In some embodiments, after S140 above, the following may also be included: When an external communication device is connected, the S720 reads stored data from multiple data buffers other than the target data buffer and a backup buffer, and parses the stored data.

[0105] In this embodiment, when an external communication device is connected, key data in each data buffer can be read using a common transmission protocol. Users or maintenance personnel can access and extract the key data through the external communication device, and then further analyze the key data as needed.

[0106] Understandably, within the multiple data buffers, the task data groups in the target data buffer are undergoing a rolling storage process, making it unsuitable for reading stored data. Meanwhile, the critical data stored in the other data buffers remains unchanged. Therefore, if a user wants to read stored data from any data buffer other than the target data buffer, they can directly read it from the corresponding data buffer. When reading stored data from the target data buffer, since the stored data in that target data buffer has already been backed up to a backup buffer before the rolling storage process, the user can read the stored data from the backup buffer.

[0107] Based on the above implementation methods, such as Figure 8 As shown, users or maintenance personnel can connect to the vehicle controller via a device with external communication capabilities. When the black box system is powered on, they can read the memory data rolled over from various data buffers in the random access memory (volatile memory), such as TASK 1:(signal 1, signal 2, signal n...), TASK 2:(signal 1, signal 2, signal n...), or TASK N:(signal 1, signal 2, signal n...), thereby conveniently obtaining key data recorded for each specific event. After the data is read, it can be further parsed, displayed, and analyzed, providing efficient data support for subsequent fault diagnosis, status monitoring, and anomaly analysis.

[0108] Based on the same inventive concept, this application also provides a data recording device. (Specifically combined with...) Figure 9 Please provide a detailed explanation.

[0109] Figure 9 This is a schematic diagram of the structure of a data recording device 900 provided in an embodiment of this application.

[0110] like Figure 9 As shown, the data recording device 900 may include: The determination module 901 is used to determine the target data buffer from multiple data buffers when the system is powered on; the data buffer is a storage area in volatile memory, and the data buffer includes multiple task data groups, and the task data groups contain multiple data ranges; The rolling storage module 902 is used to periodically acquire the key data of the process task corresponding to each task data group in the target data buffer, starting from the initial data range of the task data group, and roll and store the key data of each period to the corresponding data range; the key data is parameter information representing the system running status. The event triggering module 903 is used to respond to the event triggering signal, divide a portion of the data range from the task data group as the post-event data range, and store the key data of the period after the event triggering signal into the corresponding post-event data range one by one. The recording storage module 904 is used to write the stored data in the target data buffer to the non-volatile memory when at least some of the task data groups meet the data recording conditions.

[0111] Figure 10 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application is shown. The electronic device can be at least one of a computer, a server, and a dedicated document generation device. The electronic device includes a processor 1001 and a memory 1002 storing computer program instructions.

[0112] Specifically, the processor 1001 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0113] Memory 1002 may include mass storage for data or instructions. For example, and not limitingly, memory 1002 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 1002 may include removable or non-removable (or fixed) media. Where appropriate, memory 1002 may be internal or external to an electronic device. In a particular embodiment, memory 1002 is a non-volatile solid-state memory.

[0114] Memory 1002 may include read-only memory (ROM), flash memory device, random access memory (RAM), disk storage medium device, optical storage medium device, electrical, optical or other physical / tangible memory storage device. Therefore, typically, memory 1002 includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory device) of software that may be encoded with computer-executable instructions and, when executed (e.g., by one or more processors), is operable to perform the operations described with reference to the methods of the foregoing aspects of this disclosure.

[0115] The processor 1001 implements any of the data recording methods described in the above embodiments by reading and executing computer program instructions stored in the memory 1002.

[0116] In one example, the electronic device may also include a communication interface 1003 and a bus 1010. For example, Figure 10 As shown, the processor 1001, memory 1002, and communication interface 1003 are connected through bus 1010 and complete communication with each other.

[0117] The communication interface 1003 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0118] Bus 1010 includes hardware, software, or both, that couples components of an electronic device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 1010 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.

[0119] This electronic device can achieve integration based on data recording methods. Figures 1 to 8 The described data recording method and apparatus.

[0120] Furthermore, in conjunction with the data recording methods in the above embodiments, this application embodiment can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the data recording methods in the above embodiments.

[0121] In addition, this application also provides a computer program product, including a computer program, which, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments.

[0122] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0123] It should be understood that in the embodiments of this application, "B corresponding to A" means that B is associated with A, and B can be determined based on A. However, it should also be understood that determining B based on A does not mean that B is determined solely based on A; B can also be determined based on A and / or other information.

[0124] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A data recording method, characterized in that, include: When the system is powered on, a target data buffer is determined from multiple data buffers; the data buffer is a storage area in volatile memory, and the data buffer includes multiple task data groups, and the task data groups contain multiple data ranges. For each task data group in the target data buffer, starting from the initial data range of the task data group, the key data of the process task corresponding to the task data group is periodically obtained, and the key data of each period is rolled and stored into the corresponding data range; the key data is parameter information representing the system running status. In response to an event trigger signal, a portion of the data intervals in the task data group is divided as a post-event data interval, and key data of a portion of the period following the event trigger signal are stored one by one into the corresponding post-event data intervals. If at least a portion of the task data groups meet the data recording conditions, the stored data in the target data buffer is written to the non-volatile memory.

2. The data recording method according to claim 1, characterized in that, The step of determining the target data buffer from multiple data buffers when the system is powered on includes: When the system is powered on, the stored data in the non-volatile memory is read into each data buffer; The first data buffer for the most recent rolling storage of key data is determined based on the identification information of each data buffer; The target data buffer is determined based on the first data buffer.

3. The data recording method according to claim 1, characterized in that, Starting from the initial data range of the task data group, the key data of the process task corresponding to the task data group is periodically acquired, and the key data of each period is rolled and stored into the corresponding data range, including: When the data recording status of the task data group is enabled, the data recording value and its corresponding starting data range are determined based on the data stop recording value; the data stop recording value is used to indicate the data range of the last stored key data in the previous rolling storage process of the corresponding task data group. Starting from the initial data interval, the key data of each period are sequentially stored in each data interval according to the interval order of the multiple data intervals.

4. The data recording method according to claim 3, characterized in that, In response to an event trigger signal, the process of dividing a data interval from the task data group as a post-event data interval, and storing key data from a period following the event trigger signal into the corresponding post-event data interval, includes: In response to an event trigger signal, the first quantity of the post-event data interval for each task data group is determined based on the data allocation ratio corresponding to each task data group. Based on the data interval corresponding to the key data of the most recent period of each task data group and the first quantity, multiple post-event data intervals corresponding to the first quantity are determined from multiple data intervals. The key data for the first number of cycles following the event trigger signal are sequentially stored in each subsequent data interval.

5. The data recording method according to claim 4, characterized in that, The plurality of task data groups correspond one-to-one with the plurality of process tasks; the step of writing the stored data in the target data buffer to non-volatile memory when at least some of the task data groups meet the data recording conditions includes: Based on preset selection criteria, one of the multiple process tasks is selected as the storage trigger task. When the data recording signal of the task data group corresponding to the storage trigger task is a prohibited signal, the data recording signals of the remaining task data groups are traversed; wherein, when the task data group has completed the key data storage of the post-event data interval, the data recording signal of the task data group is set to a prohibited signal; the preset selection condition is used to reduce the number of traversals; When at least some of the data recording signals of the task data group are prohibited, a storage write task is triggered to write the stored data in the target data buffer to the non-volatile memory.

6. The data recording method according to claim 5, characterized in that, The storage write-to-disk task is independent of each process task.

7. The data recording method according to claim 1, characterized in that, After writing the stored data in the target data buffer to the non-volatile memory when at least a portion of the task data groups meet the data recording conditions, the method further includes: Update the target data buffer to the first data buffer; Based on the updated first data buffer, a new target data buffer is determined, and the following steps are returned: For each task data group in the target data buffer, starting from the initial data range of the task data group, the key data of the process task corresponding to the task data group is periodically obtained, and the key data of each period is rolled and stored to the corresponding data range.

8. The data recording method according to claim 1, characterized in that, The storage area in the volatile memory also includes a backup buffer; the step of periodically acquiring key data of the process task corresponding to each task data group in the target data buffer, starting from the initial data interval of the task data group, and rolling the key data of each period to the corresponding data interval, further includes: Copy the stored data in the target data buffer to the backup buffer.

9. The data recording method according to claim 8, characterized in that, After writing the stored data in the target data buffer to the non-volatile memory when at least a portion of the task data groups meet the data recording conditions, the method further includes: When an external communication device is connected, stored data is read from multiple data buffers other than the target data buffer and the backup buffer, and the stored data is parsed.

10. A data recording device, characterized in that, include: A determination module is used to determine a target data buffer from multiple data buffers when the system is powered on; the data buffer is a storage area in a volatile memory, the data buffer includes multiple task data groups, and the task data groups contain multiple data ranges. The rolling storage module is used to periodically acquire key data of the process task corresponding to each task data group in the target data buffer, starting from the initial data range of the task data group, and roll and store the key data of each period to the corresponding data range; the key data is parameter information representing the system running status. The event triggering module is used to respond to an event triggering signal, divide a portion of the data interval from the task data group as a post-event data interval, and store the key data of a portion of the period after the event triggering signal into the corresponding post-event data interval. A recording and storage module is used to write stored data in the target data buffer to a non-volatile memory when at least a portion of the task data groups meet the data recording conditions.