Method and system for storing and analyzing fault occurrence time data of electric vehicle
By constructing a two-dimensional array and a dual-FLASH alternating storage strategy, the problems of limited storage capacity and latency in electric vehicle fault data storage were solved, achieving real-time and continuous data storage and improving the effectiveness and accuracy of fault analysis.
Patent Information
- Application Number
- CN202511560254.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-29
- Publication Date
- 2026-03-03
AI Technical Summary
In existing technologies, the data storage capacity at the moment of electric vehicle failure is limited, and there is a time delay in the data acquisition and storage process, resulting in limited data volume and correlation bias, which affects the effectiveness and accuracy of failure analysis.
A two-dimensional array is used to store the electric vehicle operation data in real time. A combination of RAM and dual FLASH alternating storage strategy ensures the continuity and integrity of the data. The host computer then parses and generates multi-parameter time-series variation curves.
It improves the real-time and continuous nature of data storage at the moment of failure, provides reliable data support, and improves the efficiency and accuracy of failure analysis.
Smart Images

Figure CN121597496A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data storage technology for new energy electric vehicles, and in particular to a method and system for storing and parsing data on the moment of an electric vehicle malfunction. Background Technology
[0002] In the existing AUTOSAR architecture design, the DEM module, as the core component of the diagnostic function, performs the important functions of fault diagnosis and related data recording. Its operating mechanism is closely matched with the overall system architecture, providing basic support for the detection and analysis of vehicle faults.
[0003] When a fault occurs, the freeze frame function is activated to capture and save key parameters such as ambient temperature and ECU power supply voltage. Since these parameters are closely related to the vehicle's operating status and fault triggering conditions, their recording is of irreplaceable value for subsequent in-depth analysis of the fault's cause, reproduction of the fault scenario, and development of targeted solutions, forming a key link in the vehicle fault diagnosis system.
[0004] However, existing frame freeze mechanisms have the following two limitations: 1. Limited data storage capacity, which can only save a set of data at the moment the fault occurs, resulting in a limited amount of data available for analysis. It is difficult to fully reflect the complete state change trajectory when the fault occurs, and the support efficiency for the analysis of complex fault scenarios is insufficient. 2. The data acquisition and storage process has an inherent time delay, and the stored data may not accurately match the critical moment of the fault occurrence, causing a deviation in the correlation between the data and the actual fault moment. This affects the reliability of fault root cause tracing based on the data and the accuracy of diagnostic conclusions, reducing the effectiveness and practicality of the freeze frame function in actual fault troubleshooting.
[0005] Therefore, through beneficial exploration and research, the applicant has found a solution to the above problems, and the technical solution to be introduced below is the result of this research. Summary of the Invention
[0006] One of the technical problems to be solved by the present invention is to provide a method for storing and parsing data at the moment of electric vehicle failure, which addresses the shortcomings of the prior art. This method increases the data storage volume and data continuity, and solves the current drawback that electric vehicles can only use a set of data recorded within a frozen frame for troubleshooting after a failure.
[0007] The second technical problem to be solved by the present invention is to provide a system for storing and parsing data on the time of occurrence of electric vehicle faults.
[0008] As a first aspect of the present invention, a method for storing and parsing data on the time of occurrence of an electric vehicle fault includes: A two-dimensional array is constructed to store the operating data of electric vehicles, and the operating data of electric vehicles is stored in real time using the two-dimensional array. The first dimension represents the data sampling time series, and the second dimension represents the parameters related to different types of faults. Define a structure array in RAM memory to record relevant fault data during program execution; the structure array supports concurrent recording of multiple faults. When a fault signal is detected, a fault confirmation mechanism is activated. The validity of the fault is confirmed by detecting the fault status in multiple consecutive cycles. Once the fault status is confirmed, continuous data within a preset time window before and after the fault occurs is extracted based on the index position of the current two-dimensional data storage array, and the continuous data is copied into the structure array of the RAM memory. During the power-off process of an electric vehicle, a dual FLASH alternating storage strategy is adopted to store the relevant fault data stored in the structure array of the RAM memory into the designated FLASH address, and to achieve data version control through status bit management. The host computer reads relevant fault data from the specified FLASH address based on the UDS diagnostic protocol, and after ensuring data integrity through CRC verification, it parses and processes the read relevant fault data to generate multi-parameter time-series change curves at the time of the fault.
[0009] In a preferred embodiment of the present invention, the real-time storage of electric vehicle operating data using the two-dimensional array includes: The storage address in the two-dimensional array is marked using an index number to confirm that the current electric vehicle operation data is updated to the specified storage address of the two-dimensional array, and the index number of the two-dimensional array is initialized. Electric vehicle operation data is collected at regular intervals, and the collected electric vehicle operation data is updated to the position of the two-dimensional array corresponding to the current index number. Increment the index of the two-dimensional array by one, and determine whether the current index exceeds the length of the two-dimensional array; If the current index number exceeds the length of the two-dimensional array, the current index number is reset, and it is determined whether there is a need to update the array. If there is a need to update, the process of collecting electric vehicle operation data at regular intervals is returned; otherwise, the process ends. If the current index number does not exceed the length of the two-dimensional array, the process of collecting electric vehicle operation data at regular intervals is returned.
[0010] In a preferred embodiment of the present invention, the structure array is composed of several fault structures. Each fault structure is used to record the current state of the fault, the fault ID corresponding to the fault, the index of the structure in the structure array, the number of consecutive occurrences of the fault, the fault-related data, and the CRC check bit.
[0011] In a preferred embodiment of the present invention, the step of extracting continuous data within a preset time window before and after the fault occurrence time according to the index position of the current two-dimensional data storage array after the fault status is confirmed, and copying the continuous data into the structure array of the RAM memory, includes: The fault occurrence flags in the two-dimensional array are iterated over in one loop cycle; Iterate through the structure array to find if there is a fault structure that can be written. If there is a fault structure that can be written, write the fault ID into the fault structure, change the fault status of the fault structure to Fail, and increment the number of consecutive fault occurrences. If the fault still exists in the next cycle, the number of consecutive fault occurrences in the fault structure will be incremented by one; otherwise, the fault ID, fault status, and number of consecutive fault occurrences in the fault structure will be cleared. When the number of consecutive fault occurrences reaches a set number, the fault status in the fault structure is changed to Confirm. At the same time, based on the cyclic index position at the fault confirmation time, continuous data containing M sampling points before the fault and N sampling points after the fault occurs is extracted from the two-dimensional data storage array, where M and N are preset time window parameters. The extracted continuous data is then copied to the fault-related data storage area of the fault structure, and the CRC check value is calculated for all data in the fault structure and written to the CRC check field.
[0012] In a preferred embodiment of the present invention, the step of using a dual-FLASH alternating storage strategy to store the relevant fault data stored in the structure array of the RAM memory into a designated FLASH address includes: By modifying the link file that the software memory addresses depend on, the specified RAM memory and FLASH addresses are used to store data stored during software operation and the addresses where data is written when the software is powered off, respectively. Iterate through the first FLASH block and determine if there is available space within it; If there is available space in the first FLASH, the relevant fault data stored in the structure array of RAM memory is written to the available FLASH address in the first FLASH; if there is no available space in the first FLASH, the second FLASH is traversed to determine if there is available space in the second FLASH. If the second FLASH has available space, the data in the first FLASH is copied to the second FLASH, the first FLASH is formatted, and the relevant fault data stored in the structure array of RAM memory is written to the available FLASH address in the first FLASH. If the second FLASH has no available space, the second FLASH is formatted, the data in the first FLASH is copied to the second FLASH, the first FLASH is formatted, and the relevant fault data stored in the structure array of RAM memory is written to the available FLASH address in the first FLASH.
[0013] In a preferred embodiment of the present invention, the host computer reads relevant fault data from a specified FLASH address based on the UDS diagnostic protocol, and after ensuring data integrity through CRC verification, parses and processes the read relevant fault data to generate a multi-parameter time-series change curve at the time of the fault, including: The starting address of each FLASH block used to store fault data is used as the status bit of the FLASH. After the fault data is stored in the FLASH, the status bits of the FLASH are updated. The host computer reads the memory address through the UDS 0x23 service and sends a read command to the ECU to read the status identifier area data of each FLASH storage block; The current valid FLASH storage blocks are determined based on the contents of the status identifier area, and the storage area containing the latest fault data is identified. The host computer calculates the starting address and data length of the target data in the FLASH based on the fault DTC selected by the user. The target fault data is read in segments through the UDS 0x23 service, with one or more complete fault structure data read each time. Perform CRC check on each faulty structure data read to verify the integrity of the data during storage and transmission; If the CRC check passes, the fields in the fault structure are parsed, and the fault diagnosis identification code (DTC), fault status, and multiple sets of continuous fault-related data are extracted; and The extracted continuous data sets are arranged in time series to generate multi-parameter change curves before and after the fault occurrence time, which intuitively shows the dynamic change trend of each parameter during the fault occurrence process. It also supports comparative analysis of data from multiple faults to identify the correlation and common characteristics between different faults.
[0014] As a second aspect of the present invention, a system for storing and parsing data on the time of occurrence of electric vehicle malfunctions includes: A data acquisition module is used to collect multiple operating parameters of an electric vehicle at preset intervals. A two-dimensional data storage module is used to construct a two-dimensional array for storing electric vehicle operation data, and to use the two-dimensional array to store the electric vehicle operation data in real time. The first dimension of the two-dimensional array represents the data sampling time series, and the second dimension represents the fault-related parameters of different types. The structure array module is used to define a structure array in RAM memory for recording relevant fault data during program execution. The structure array supports concurrent recording of multiple faults. The fault detection and confirmation module is used to activate the fault confirmation mechanism when a fault signal is detected. The validity of the fault is confirmed by detecting the fault status for multiple consecutive cycles. After the fault status is confirmed, the module extracts continuous data within a preset time window before and after the fault occurrence time according to the index position of the current two-dimensional data storage array, and copies the continuous data into the structure array of the RAM memory. The FLASH storage module is used during the power-off process of an electric vehicle to store relevant fault data stored in the structure array of the RAM memory into a designated FLASH address using a dual-FLASH alternating storage strategy, and to achieve data version control through status bit management; and The host computer data analysis module is used to read relevant fault data in a specified FLASH address by the host computer based on the UDS diagnostic protocol, and after ensuring data integrity through CRC verification, it parses and processes the read relevant fault data to generate a multi-parameter time-series change curve at the time of the fault.
[0015] The beneficial effects of this invention, achieved through the adoption of the above technical solution, are as follows: This invention upgrades the data stored in the freeze frame from one-dimensional to two-dimensional and updates the stored data in real time, ensuring the validity and continuity of the data stored at the moment of failure. After a failure occurs, the data is fixed in RAM memory, and upon power-down, the data in RAM is written to a designated address in FLASH. The host computer can read and parse the data at the designated address in FLASH. Because the stored data is continuous, plotting the parsed data allows for a direct visualization of the data change curve. This invention increases the real-time nature and continuity of the data stored at the moment of failure, providing reliable data support for locating the cause of the failure. Furthermore, in conjunction with a host computer, it enables data visualization, improving the efficiency of data analysis. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating the present invention.
[0018] Figure 2 This is a schematic diagram of existing frozen frame storage data.
[0019] Figure 3 This is a schematic diagram of the extended two-dimensional array for storing data according to the present invention.
[0020] Figure 4 This is a logical diagram illustrating the update of storage-related data according to the present invention.
[0021] Figure 5 This is a schematic diagram of the data distribution captured after a fault occurs according to the present invention.
[0022] Figure 6 This is a logical diagram illustrating the data writing to the array according to the present invention.
[0023] Figure 7 This is a schematic diagram of the fault structure of the present invention.
[0024] Figure 8 This is a schematic diagram of the fault confirmation and storage process of the present invention.
[0025] Figure 9 This is a schematic diagram of the data storage process of the present invention.
[0026] Figure 10 This is a schematic diagram of the data writing process to FLASH according to the present invention.
[0027] Figure 11 This is a logical diagram illustrating the segmentation within the FLASH memory and the data reading process by the host computer in this invention.
[0028] Figure 12 This is a schematic diagram of the system structure of the present invention. Detailed Implementation
[0029] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below with reference to specific illustrations.
[0030] See Figure 1 The figure illustrates a method for storing and parsing data on the time of an electric vehicle malfunction, including the following steps: Step S10: Construct a two-dimensional array for storing electric vehicle operation data, and use the two-dimensional array to store the electric vehicle operation data in real time. The first dimension represents the data sampling time series, and the second dimension represents the parameters related to different types of faults. Step S20: Define a structure array in RAM memory for recording relevant fault data during program execution. The structure array supports concurrent recording of multiple faults. Step S30: When a fault signal is detected, a fault confirmation mechanism is started. The validity of the fault is confirmed by detecting the fault status in multiple consecutive cycles. After the fault status is confirmed, the continuous data within a preset time window before and after the fault occurs is extracted according to the index position of the current two-dimensional data storage array, and the continuous data is copied to the structure array in RAM memory. Step S40: During the power-off process of the electric vehicle, a dual FLASH alternating storage strategy is adopted to store the relevant fault data stored in the structure array of RAM memory into the specified FLASH address, and the data version control is realized through status bit management. Step S50: The host computer reads the relevant fault data in the specified FLASH address based on the UDS diagnostic protocol, and after ensuring the data integrity through CRC verification, it parses and processes the read relevant fault data to generate a multi-parameter time-series change curve at the time of the fault.
[0031] In step S10, since the current frozen frame design stores only one set of data, such as Figure 2 As shown. Therefore, the first consideration is to expand the amount of stored data. For this requirement, consider using a two-dimensional array to expand the previously stored one-dimensional data. Store a set of data from the previously frozen frame as an element of the new array, i.e., a two-dimensional array, to meet the requirement of increasing the effective data volume, such as... Figure 3As shown, this invention uses a two-dimensional array structure to replace the traditional one-dimensional storage method. Based on the original one-dimensional array, each array element is expanded to the length of the original one-dimensional array, thereby increasing the amount of data stored.
[0032] Meanwhile, because the sampling periods of different data within the freeze frame are inconsistent, the stored data may deviate from the time of the fault. Therefore, it is considered to update the stored data within the same period to ensure data real-time performance. Figure 4 As shown.
[0033] Because there is a delay between data update and stop update signals, the array can store data before and after the fault, ensuring a complete record of data before and after the fault. Figure 5 As shown. Specifically, see [link to relevant documentation]. Figure 6 In step S10, the electric vehicle operation data is stored in real time using a two-dimensional array, including the following steps: Step S11: Use the index number to mark the storage address in the two-dimensional array to confirm that the current electric vehicle operation data is updated to the specified storage address of the two-dimensional array, and initialize the index number of the two-dimensional array. Step S12: Collect electric vehicle operation data at regular intervals (e.g., 100µs); Step S13: Update the collected electric vehicle operation data to the position of the two-dimensional array corresponding to the current index number; Step S14: Increment the index number of the two-dimensional group by one; Step S15: Determine whether the current index number exceeds the length of the two-dimensional array. If yes, proceed to step S16; otherwise, return to step S12. Step S16: Reset the current index number; Step S17: Determine if there is still a need to update the array. If yes, return to step S12; otherwise, end.
[0034] In a 100µs cycle task, the relevant data for updating the frozen frame is stored in a two-dimensional array. For this two-dimensional array, an index number is designed during the update process to confirm the current data address within the array. Starting from the beginning of the array, the electric vehicle's operating data is updated to the corresponding position every 100µs. When the last position of the array is reached, the index number is reset after the data update. The data from the next cycle will overwrite the data at the beginning of the array, and the overwritten data is the oldest data in the entire array, ensuring real-time data accuracy. Simultaneously, due to the delay between data updates and the data stop signal, the data in the entire two-dimensional array simultaneously records both the data before and after the fault, ensuring that data before and after the fault can be captured.
[0035] In step S20, a structure array is defined in RAM memory to record relevant fault data during program execution, enabling the storage of multiple faults and their related data during program operation. The structure array consists of several fault structures, each recording the current state of the fault, the corresponding fault ID, the index of the structure within the structure array, the number of consecutive occurrences of the fault, fault-related data, and CRC checksums. Figure 7 As shown.
[0036] In step S30, see Figure 8 and combined Figure 9 Once the fault status is confirmed, based on the index position of the current two-dimensional data storage array, continuous data within a preset time window before and after the fault occurrence is extracted, and the continuous data is copied into the structure array of the RAM memory, including the following steps: Step S31: Traverse all fault occurrence flags in the two-dimensional array within one loop cycle; Step S32: Traverse the structure array to find if there is a writable fault structure. If there is a fault structure that can be written, write the fault ID into the fault structure, change the fault status in the fault structure to Fail, and increment the number of consecutive fault occurrences by one. Step S33: In the next cycle, if the fault still exists, the number of consecutive fault occurrences in the fault structure is incremented by one; otherwise, the fault ID, fault status, and number of consecutive fault occurrences in the fault structure are cleared. Step S34: When the number of consecutive fault occurrences reaches a set number, the fault status in the fault structure is modified to Confirm. At the same time, based on the cyclic index position at the fault confirmation time, continuous data containing M sampling points before the fault and N sampling points after the fault occurs is extracted from the two-dimensional data storage array, where M and N are preset time window parameters. The extracted continuous data is then copied to the fault-related data storage area of the fault structure, and the CRC check value is calculated for all data in the fault structure and written into the CRC check field.
[0037] See Figure 8 The diagram illustrates a more detailed fault confirmation and storage process, which includes the following steps: Step 1: Iterate through all fault occurrence flags in the two-dimensional array within one loop cycle (e.g., 1ms); Step 2: Determine if there is a fault setting. If no fault is detected, proceed to Step 3; otherwise, proceed to Step 4. Step 3: Traverse all fault structures in the structure array and clear the data in all fault structures with a fault status of Fail, then return to Step 1; Step 4: Traverse all fault structures in the structure array and determine if there is a fault that is currently set. If yes, proceed to step 5; otherwise, proceed to step 7. Step 5: Increment the number of consecutive fault occurrences by one, and determine whether the number of consecutive fault occurrences is greater than or equal to three. If the determination is yes, proceed to step 6; otherwise, return to step 1. Step 6: Change the fault status to Confirm, write the relevant fault data into the corresponding fault structure, calculate the corresponding CRC check bit and write it into the corresponding fault structure, and then end. Step 7: Traverse all fault structures in the structure array and determine if there is a writable fault structure. If yes, write the fault ID into the fault structure and change the fault status to Fail, then end the process. Otherwise, end the process directly.
[0038] In step S40, see Figure 10 and combined Figure 9 The method employs a dual-FLASH alternating storage strategy to store relevant fault data stored in the structure array of the RAM memory into a specified FLASH address, including the following steps: Step S41: Modify the link file that the software memory address depends on so that the specified RAM memory and FLASH address are used to store the data stored during software operation and the address for data written when power is off, respectively. Step S42: Traverse the first FLASH block and determine whether there is available space in the first FLASH block. If the determination is yes, write the relevant fault data stored in the structure array of RAM memory into the available FLASH address in the first FLASH block; otherwise, proceed to step S43. Step S43: Traverse the second FLASH block and determine whether there is available space in the second FLASH block. If the determination is yes, proceed to step S44; otherwise, proceed to step S45. Step S44: Copy the data in the first FLASH to the second FLASH, format the first FLASH, and then write the relevant fault data stored in the structure array of RAM memory to the available FLASH address in the first FLASH. Step S45: Format the second FLASH and copy the data from the first FLASH to the second FLASH. At the same time, format the first FLASH and write the relevant fault data stored in the structure array of RAM memory to the available FLASH address in the first FLASH.
[0039] In step S50, see Figure 11 The host computer reads relevant fault data from the specified FLASH address based on the UDS diagnostic protocol, and after ensuring data integrity through CRC verification, it parses and processes the read fault data to generate a multi-parameter time-series change curve at the time of the fault. This includes the following steps: Step S51: Use the starting address of each FLASH block used to store fault data as the status bit of the FLASH. Step S52: After the fault data is stored in the FLASH, the status bits of the FLASH are updated. In step S53, the host computer reads the memory address through the UDS 0x23 service and sends a read command to the ECU to read the status identifier data of each FLASH storage block; Step S54: Determine the currently valid FLASH storage block based on the content of the status identifier area, and identify the storage area containing the latest fault data; Step S55: The host computer calculates the starting address and data length of the target data in the FLASH based on the fault DTC selected by the user. Step S56: Read the target fault data in segments through the UDS 0x23 service, reading one or more complete fault structure data each time; Step S57: Perform CRC check on each fault structure data read to verify the integrity of the data during storage and transmission. Step S58: If the CRC check passes, parse each field in the fault structure and extract the fault diagnosis identification code (DTC), fault status, and multiple sets of continuous data related to the fault. Step S59: Arrange the parsed continuous data sets according to time series to generate multi-parameter change curves before and after the fault occurrence time. This visually displays the dynamic change trend of each parameter during the fault occurrence process and supports comparative analysis of data from multiple faults to identify the correlation and common characteristics between different faults. See Figure 12 The figure shows a system for storing and parsing data on the time of electric vehicle fault occurrence, including a data acquisition module 100, a two-dimensional data storage module 200, a structure array module 300, a fault detection and confirmation module 400, a FLASH storage module 500, and a host computer data analysis module 600.
[0040] The data acquisition module 100 is used to collect multiple operating parameters of the electric vehicle at preset cycles.
[0041] The two-dimensional data storage module 200 is used to construct a two-dimensional array for storing electric vehicle operation data, and to use the two-dimensional array to store the electric vehicle operation data in real time. The first dimension of the two-dimensional array represents the data sampling time series, and the second dimension represents the parameters related to different types of faults.
[0042] The structure array module 300 is used to define a structure array in RAM memory for recording relevant fault data during program execution. The structure array supports concurrent recording of multiple faults.
[0043] The fault detection and confirmation module 400 is used to activate the fault confirmation mechanism when a fault signal is detected. It confirms the validity of the fault by detecting the fault status in multiple consecutive cycles. After the fault status is confirmed, it extracts continuous data within a preset time window before and after the fault occurred based on the index position of the current two-dimensional data storage array, and copies the continuous data to the structure array in RAM memory.
[0044] The FLASH storage module 500 is used to store relevant fault data stored in the structure array of RAM memory into a specified FLASH address during the power-off process of an electric vehicle by adopting a dual FLASH alternating storage strategy, and to achieve data version control through status bit management.
[0045] The host computer data analysis module 600 is used to read relevant fault data in the specified FLASH address through the host computer based on the UDS diagnostic protocol, and after ensuring the integrity of the data through CRC verification, it parses and processes the read relevant fault data to generate multi-parameter time-series change curves at the time of the fault.
[0046] The various modules in the system for storing and parsing data on the time of electric vehicle fault occurrence of the present invention can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0047] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.
Claims
1. A method for storing and parsing data on the time of occurrence of electric vehicle faults, characterized in that, include: A two-dimensional array is constructed to store the operating data of electric vehicles, and the operating data of electric vehicles is stored in real time using the two-dimensional array. The first dimension represents the data sampling time series, and the second dimension represents the parameters related to different types of faults. Define a structure array in RAM memory to record relevant fault data during program execution; the structure array supports concurrent recording of multiple faults. When a fault signal is detected, a fault confirmation mechanism is activated. The validity of the fault is confirmed by detecting the fault status in multiple consecutive cycles. Once the fault status is confirmed, continuous data within a preset time window before and after the fault occurs is extracted based on the index position of the current two-dimensional data storage array, and the continuous data is copied into the structure array of the RAM memory. During the power-off process of an electric vehicle, a dual FLASH alternating storage strategy is adopted to store the relevant fault data stored in the structure array of the RAM memory into the designated FLASH address, and to achieve data version control through status bit management. The host computer reads relevant fault data from the specified FLASH address based on the UDS diagnostic protocol, and after ensuring data integrity through CRC verification, it parses and processes the read relevant fault data to generate multi-parameter time-series change curves at the time of the fault.
2. The method for storing and parsing data on the time of occurrence of electric vehicle faults as described in claim 1, characterized in that, The real-time storage of electric vehicle operation data using the two-dimensional array includes: The storage address in the two-dimensional array is marked using an index number to confirm that the current electric vehicle operation data is updated to the specified storage address of the two-dimensional array, and the index number of the two-dimensional array is initialized. Electric vehicle operation data is collected at regular intervals, and the collected electric vehicle operation data is updated to the position of the two-dimensional array corresponding to the current index number. Increment the index of the two-dimensional array by one, and determine whether the current index exceeds the length of the two-dimensional array; If the current index number exceeds the length of the two-dimensional array, the current index number is reset, and it is determined whether there is a need to update the array. If there is a need to update, the process of collecting electric vehicle operation data at regular intervals is returned; otherwise, the process ends. If the current index number does not exceed the length of the two-dimensional array, the process of collecting electric vehicle operation data at regular intervals is returned.
3. The method for storing and parsing data on the time of occurrence of electric vehicle faults as described in claim 1, characterized in that, The structure array consists of several fault structures. Each fault structure records the current state of the fault, the fault ID corresponding to the fault, the index of the structure in the structure array, the number of consecutive occurrences of the fault, the fault-related data, and the CRC check bit.
4. The method for storing and parsing data on the time of occurrence of electric vehicle faults as described in claim 3, characterized in that, Once the fault state is confirmed, the following steps are performed: Based on the index position of the current two-dimensional data storage array, continuous data within a preset time window before and after the fault occurrence is extracted, and this continuous data is copied into the structure array of the RAM memory. The fault occurrence flags in the two-dimensional array are iterated over in one loop cycle; Iterate through the structure array to find if there is a fault structure that can be written. If there is a fault structure that can be written, write the fault ID into the fault structure, change the fault status of the fault structure to Fail, and increment the number of consecutive fault occurrences. If the fault still exists in the next cycle, the number of consecutive fault occurrences in the fault structure will be incremented by one; otherwise, the fault ID, fault status, and number of consecutive fault occurrences in the fault structure will be cleared. When the number of consecutive fault occurrences reaches a set number, the fault status in the fault structure is changed to Confirm. At the same time, based on the cyclic index position at the fault confirmation time, continuous data containing M sampling points before the fault and N sampling points after the fault occurs is extracted from the two-dimensional data storage array, where M and N are preset time window parameters. The extracted continuous data is copied to the fault-related data storage area of the fault structure, and the CRC check value is calculated for all data in the fault structure and written to the CRC check field.
5. The method for storing and parsing data on the time of occurrence of electric vehicle faults as described in claim 1, characterized in that, The step of using a dual-FLASH alternating storage strategy to store relevant fault data stored in the structure array of the RAM memory into a specified FLASH address includes: By modifying the link file that the software memory addresses depend on, the specified RAM memory and FLASH addresses are used to store data stored during software operation and the addresses where data is written when the software is powered off, respectively. Iterate through the first FLASH block and determine if there is available space within it; If there is available space in the first FLASH, the relevant fault data stored in the structure array of RAM memory is written to the available FLASH address in the first FLASH; if there is no available space in the first FLASH, the second FLASH is traversed to determine if there is available space in the second FLASH. If the second FLASH has available space, the data in the first FLASH is copied to the second FLASH, the first FLASH is formatted, and the relevant fault data stored in the structure array of RAM memory is written to the available FLASH address in the first FLASH. If the second FLASH has no available space, the second FLASH is formatted, the data in the first FLASH is copied to the second FLASH, the first FLASH is formatted, and the relevant fault data stored in the structure array of RAM memory is written to the available FLASH address in the first FLASH.
6. The method for storing and parsing data on the time of occurrence of electric vehicle faults as described in claim 1, characterized in that, The host computer reads relevant fault data from the specified FLASH address based on the UDS diagnostic protocol. After ensuring data integrity through CRC verification, the read fault data is parsed and processed to generate multi-parameter time-series change curves at the time of the fault, including: The starting address of each FLASH block used to store fault data is used as the status bit of the FLASH. After the fault data is stored in the FLASH, the status bits of the FLASH are updated. The host computer reads the memory address through the UDS 0x23 service and sends a read command to the ECU to read the status identifier area data of each FLASH storage block; The current valid FLASH storage blocks are determined based on the contents of the status identifier area, and the storage area containing the latest fault data is identified. The host computer calculates the starting address and data length of the target data in the FLASH based on the fault DTC selected by the user. The target fault data is read in segments through the UDS 0x23 service, with one or more complete fault structure data read each time. Perform CRC check on each faulty structure data read to verify the integrity of the data during storage and transmission; If the CRC check passes, the fields in the fault structure are parsed, and the Diagnostic Troubleshooting Code (DTC), fault status, and multiple sets of continuous fault-related data are extracted; and The extracted continuous data sets are arranged in time series to generate multi-parameter change curves before and after the fault occurrence time, which intuitively shows the dynamic change trend of each parameter during the fault occurrence process. It also supports comparative analysis of data from multiple faults to identify the correlation and common characteristics between different faults.
7. A system for storing and parsing data on the time of occurrence of electric vehicle faults, characterized in that, include: A data acquisition module is used to collect multiple operating parameters of the electric vehicle at a preset cycle; A two-dimensional data storage module is used to construct a two-dimensional array for storing electric vehicle operation data, and to use the two-dimensional array to store the electric vehicle operation data in real time. The first dimension of the two-dimensional array represents the data sampling time series, and the second dimension represents the fault-related parameters of different types. The structure array module is used to define a structure array in RAM memory for recording relevant fault data during program execution. The structure array supports concurrent recording of multiple faults. The fault detection and confirmation module is used to activate the fault confirmation mechanism when a fault signal is detected. The validity of the fault is confirmed by detecting the fault status for multiple consecutive cycles. After the fault status is confirmed, the module extracts continuous data within a preset time window before and after the fault occurrence time according to the index position of the current two-dimensional data storage array, and copies the continuous data into the structure array of the RAM memory. The FLASH storage module is used during the power-off process of an electric vehicle to store relevant fault data stored in the structure array of the RAM memory into a designated FLASH address using a dual-FLASH alternating storage strategy, and to achieve data version control through status bit management; and The host computer data analysis module is used to read relevant fault data in a specified FLASH address by the host computer based on the UDS diagnostic protocol, and after ensuring data integrity through CRC verification, it parses and processes the read relevant fault data to generate a multi-parameter time-series change curve at the time of the fault.