Fault diagnosis library file updating method and system
By comparing the fault code differences between the diagnostic template files and the fault diagnosis configuration header files, generating replacement files, and automatically updating the fault diagnosis library, the problem of high error rate caused by human identification of fault data is solved, and development efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202411302294.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-01-07
AI Technical Summary
In the prior art, the fault diagnosis library is constructed by artificially identifying fault data and is prone to errors, resulting in complex data matching and high error rate.
By obtaining the diagnostic template file and the fault diagnosis configuration header file, comparing the fault code differences, generating replacement files, and automatically updating the fault diagnosis library files of the target system to reduce manual comparison and errors.
Reduces the R&D burden, improves development efficiency, reduces error rates, and automates the update process of the fault diagnosis library.
Smart Images

Figure CN119271237A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of fault diagnosis library update, and specifically relates to a method and system for updating a fault diagnosis library file. Background Art
[0002] DTC (Digital Trouble Code) is an ISO standard code used to indicate a fault in a vehicle system. Different projects and systems use different DTC codes, which require manual identification, comparison, and judgment of the fault codes and fault information in the source files of diagnostic templates and diagnostic fault codes to construct different fault diagnosis libraries. However, there are a large amount of repeated fault data in the source files of diagnostic templates and diagnostic fault codes, and manual identification is prone to errors. Summary of the invention
[0003] Purpose of the invention: This application develops a method and system for updating fault diagnosis library files, aiming to solve the technical problem in the prior art that the fault diagnosis library is constructed by manually identifying fault data, which leads to the fault data being very prone to errors.
[0004] Technical solution: In a first aspect, an embodiment of the present application provides a method for updating a fault diagnosis library file, comprising:
[0005] Acquire a diagnosis template file and a fault diagnosis configuration header file, wherein the diagnosis template file is configured as a reference file for defining and describing a fault code, and the fault diagnosis configuration header file includes a fault code of a target system;
[0006] In response to a difference between the fault codes in the diagnosis template file and the fault diagnosis configuration header file, acquiring a fault code to be updated and fault information to be updated corresponding to the fault code to be updated;
[0007] generating a replacement file based on the fault code to be updated and the fault information to be updated;
[0008] The fault diagnosis library file of the target system is updated based on the replacement file.
[0009] In some embodiments, the step of determining whether there is a difference between the fault codes in the diagnosis template file and the fault diagnosis configuration header file includes:
[0010] Obtaining the fault codes in the diagnosis template file to generate a first set;
[0011] Obtaining the fault codes in the fault diagnosis configuration header file to generate a second set;
[0012] In response to a difference between the first set and the second set, it is determined that a difference exists between the fault codes in the diagnosis template file and the fault diagnosis configuration header file.
[0013] In some embodiments, the step of generating a replacement file based on the fault code to be updated and the fault information to be updated includes:
[0014] generating a first file based on the fault code to be updated and the fault information to be updated;
[0015] sorting the first file based on the fault code to generate a first dictionary;
[0016] The first dictionary is traversed to generate the replacement file.
[0017] In some embodiments, the step of generating a first file based on the fault code to be updated and the fault information to be updated includes:
[0018] Configuring the fault code to be updated as a first-category key;
[0019] Configuring the fault information to be updated as a first type value;
[0020] Based on the correspondence between the fault codes to be updated and the fault information to be updated, the first type of keys and the first type of values are configured to generate a first file of a key-value data structure.
[0021] In some embodiments, the method for updating the fault diagnosis library file further includes:
[0022] Acquire a fault diagnosis code source file, wherein the fault diagnosis code source file includes fault information of a target system and a fault code state index of the fault information;
[0023] Configuring the fault information as a second type key;
[0024] Configuring the fault code status index to be a second type value;
[0025] Based on the fault information and the fault code status index, configure the second type of key and the second type of value to generate a second file of a key-value data structure;
[0026] A second dictionary is generated based on the second file.
[0027] In some embodiments, the replacement file includes a fault code configuration code and a fault information configuration code.
[0028] In some embodiments, the step of generating the fault code configuration code includes:
[0029] Traversing the first dictionary to generate first data, the first data including a fault code, a total number of accumulated fault information, a number of fault information corresponding to the fault code in the current first data, an index of the current first data, and a cumulative ranking number of the fault code in the current first data;
[0030] Based on the first data, the fault code configuration code is generated.
[0031] In some embodiments, the step of generating the fault information configuration code includes:
[0032] Traverse the first dictionary to obtain the fault code;
[0033] In the first dictionary, traverse the fault information corresponding to the fault code, the fault information corresponding to the fault code includes the fault code state index of the fault interface name in the second dictionary, the bit of the fault interface name, the value of the fault code number column of the fault information in the target system, the name of the fault interface, the index of the current second data, the fault comment and the cumulative ranking number of the fault information;
[0034] generating second data based on the fault code and the fault information;
[0035] Based on the second data, the fault information configuration code is generated.
[0036] In some embodiments, the step of updating the fault diagnosis library file of the target system based on the replacement file includes:
[0037] Determining the index of the starting position of the fault code configuration and the index of the ending position of the fault code configuration in the source file of the fault diagnosis library file, and replacing the data between the index of the starting position of the fault code configuration and the index of the ending position of the fault code configuration by the fault code configuration code;
[0038] Determine the index of the starting position of the fault information configuration and the index of the ending position of the fault information configuration in the source file of the fault diagnosis library file, and replace the data between the index of the starting position of the fault information configuration and the index of the ending position of the fault information configuration by the fault information configuration code;
[0039] In the header file of the fault diagnosis library file, modify the value of the maximum number of diagnostic events to the final value of the cumulative ranking number of the fault codes in the first data;
[0040] In the header file of the fault diagnosis library file, the value of the maximum fault quantity is modified to the final value of the cumulative ranking number of the fault information in the second data.
[0041] In a second aspect, an embodiment of the present application further provides a system for updating a fault diagnosis library file, comprising:
[0042] A file acquisition module, the file acquisition module is used to acquire a diagnosis template file and a fault diagnosis configuration header file, the diagnosis template file is configured as a reference file for defining and describing a fault code, and the fault diagnosis configuration header file includes a fault code of a target system;
[0043] An update determination module, the update determination module being used for acquiring a fault code to be updated and fault information to be updated corresponding to the fault code to be updated in response to a difference between the fault codes in the diagnosis template file and the fault diagnosis configuration header file;
[0044] A replacement file generation module, the replacement file generation module is used to generate a replacement file based on the fault code to be updated and the fault information to be updated;
[0045] A fault diagnosis library update module is used to update the fault diagnosis library file of the target system based on the replacement file.
[0046] Beneficial effect: Compared with the prior art, the method for updating a fault diagnosis library file provided by the embodiment of the present application includes obtaining a diagnosis template file as a reference file and a fault diagnosis configuration header file of the corresponding system, and when there is a difference in the fault code in the diagnosis template file and the fault diagnosis configuration header file, obtaining the fault code to be updated and the fault information corresponding to the fault code to be updated, and then generating a replacement file based on the fault code to be updated and the fault information to be updated, and updating the fault diagnosis library file of the target system based on the replacement file. The present application compares the reference file with the configuration header file of the specific system, and when it is determined that there is a difference in the fault code, determines the replacement file using the fault code to be updated and the corresponding fault information to be updated, and updates the fault diagnosis library file of the target system through the replacement file, without the need to manually compare the fault data, thereby reducing the burden of research and development, improving development efficiency, and reducing the error rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0048] Figure 1 A flowchart of the steps of the method for updating the fault diagnosis library file provided in the embodiment of the present application;
[0049] Figure 2 A specific flow chart of step 200 in the method for updating the fault diagnosis library file provided in an embodiment of the present application;
[0050] Figure 3 A specific flow chart of step 300 in the method for updating the fault diagnosis library file provided in an embodiment of the present application;
[0051] Figure 4 A specific flow chart of step 310 in the method for updating the fault diagnosis library file provided in an embodiment of the present application;
[0052] Figure 5 A specific flow chart of generating fault code configuration codes in the method for updating the fault diagnosis library file provided in the embodiment of the present application;
[0053] Figure 6 A specific flow chart of generating a fault information configuration code in a method for updating a fault diagnosis library file provided in an embodiment of the present application;
[0054] Figure 7 A flowchart of the specific steps of obtaining a second dictionary in the method for updating a fault diagnosis library file provided in an embodiment of the present application;
[0055] Figure 8 A specific flow chart of step 400 in the method for updating the fault diagnosis library file provided in an embodiment of the present application;
[0056] Fig. 9 A schematic diagram of module connections of a system for updating a fault diagnosis library file provided in an embodiment of the present application;
[0057] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0058] Figure numerals: 10, file acquisition module; 20, update determination module; 30, replacement file generation module; 40, fault diagnosis library update module; 100, memory; 200, processor. DETAILED DESCRIPTION
[0059] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0060] At present, the BMS (Battery Management System) platform identifies the fault list table Sheet:Fau ltli st of the diagnostic template, matches the fault data Faul lt in the diagnostic fault code source file DTC.c file, and manually generates the code of the corresponding logic fault diagnosis library source file DTCLi bc and the fault diagnosis library header file DTCLi bh according to the identified information, and verifies the difference between the DTC (Di agnost ic Trouble Code) code in the diagnostic list file and the DTC code in the fault diagnosis configuration header file Dem_Lcfg.h file.
[0061] However, since there are a large amount of repeated fault data in the source files of diagnostic templates and diagnostic fault codes, matching these data is complex and error-prone, which will consume a lot of effort of developers.
[0062] In view of this, an embodiment of the present application provides a method for updating a fault diagnosis library file, including obtaining a diagnostic template file as a reference file and a fault diagnosis configuration header file of a corresponding system, and when there is a difference in the fault code in the diagnostic template file and the fault diagnosis configuration header file, obtaining the fault code to be updated and the fault information corresponding to the fault code to be updated, and then generating a replacement file based on the fault code to be updated and the fault information to be updated, and updating the fault diagnosis library file of the target system based on the replacement file. The present application compares the reference file with the configuration header file of the specific system, and when it is determined that there is a difference in the fault code, determines the replacement file using the fault code to be updated and the corresponding fault information to be updated, and updates the fault diagnosis library file of the target system through the replacement file, without the need to manually compare the fault data, thereby reducing the burden of research and development, improving development efficiency, and reducing the error rate.
[0063] In some embodiments, see Figure 1 , Figure 1 This is a flowchart of the method for updating the fault diagnosis library file provided in the embodiment of the present application. The method for updating the fault diagnosis library file provided in the embodiment of the present application is specifically implemented through steps 100 to 400:
[0064] Step 100: Obtain a diagnosis template file and a fault diagnosis configuration header file.
[0065] In some embodiments, the diagnosis template file is configured as a reference file that defines and describes the fault code, and the fault diagnosis configuration header file includes the fault code of the target system.
[0066] Step 200: In response to the difference between the fault codes in the diagnosis template file and the fault diagnosis configuration header file, the fault code to be updated and the fault information to be updated corresponding to the fault code to be updated are obtained.
[0067] In some embodiments, see Figure 2 , Figure 2 The specific flow chart of step 200 in the method for updating the fault diagnosis library file provided in the embodiment of the present application, the specific method for determining that there is a difference between the fault codes in the diagnosis template file and the fault diagnosis configuration header file is implemented through steps 210 to 230:
[0068] Step 210: Obtain the fault codes in the diagnosis template file and generate a first set.
[0069] Specifically, the diagnostic list file Sheet:Fau lt li st of the diagnostic template is loaded, and the data in the fault code DTC column is calculated according to certain rules and stored in the diagnostic fault code set di ag_dtc set, that is, the first set. For example, the fault code DTC column has a set of data UEB0E1 C, which is divided into three parts: the first part - U, the second part - E, and the third part - B0E1 C. The codes of the first part include P, C, B, and U, and the corresponding conversion rules are: P-0, C-1, B-2, and U-3. Its calculation rules include: first, multiply the data of the first part converted based on its conversion rule by 4, then add it to the decimal number corresponding to the second part, and then convert the number obtained after the addition into a hexadecimal number, and finally add the converted hexadecimal number to the third part, and convert all letters into lowercase letters. Specifically, the conversion process of UEB0E1 C is as follows: first, U is converted to 3, then (3*4)+(E is converted to decimal as 14) to get 26, then 26 is converted to hexadecimal as 0x1A, and finally B0E1 C is added and all converted to lowercase letters to get 0x1ab0e1c, and 0x1ab0e1c is stored in the diagnostic trouble code set di ag_dtc set.
[0070] Step 220: Obtain the fault codes in the fault diagnosis configuration header file and generate a second set.
[0071] Specifically, the fault diagnosis configuration header file Dem_Lcfg.h is loaded, all the DTC codes in the file are matched by regular expressions, and stored in the fault terminal file set h_dtc set, that is, the second set.
[0072] Step 230: In response to the difference between the first set and the second set, determining that there is a difference between the fault codes in the diagnosis template file and the fault diagnosis configuration header file.
[0073] It can be understood that the present application selects the set method for fault code comparison. Since the set has its own deduplication operation, the difference items in the two sets can be compared through a simple difference set, and the difference set will be written to the log file when there is a difference set to remind the user to update the fault diagnosis library file.
[0074] Step 300: Generate a replacement file based on the fault code to be updated and the fault information to be updated.
[0075] In some embodiments, see Figure 3 , Figure 3 The specific flow chart of step 300 in the method for updating the fault diagnosis library file provided in the embodiment of the present application, the specific method for generating the replacement file based on the fault code to be updated and the fault information to be updated is implemented through steps 310 to 330:
[0076] Step 310: Generate a first file based on the fault code to be updated and the fault information to be updated.
[0077] In some embodiments, see Figure 4 , Figure 4 The specific flow chart of step 310 in the method for updating the fault diagnosis library file provided in the embodiment of the present application, the specific method for generating the first file based on the fault code to be updated and the fault information to be updated is implemented through steps 311 to 313:
[0078] Step 311: Configure the fault code to be updated as a first-class key.
[0079] Step 312: Configure the fault information to be updated as the first type of value.
[0080] Step 313: Based on the correspondence between the fault code to be updated and the fault information to be updated, configure the first type of key and the first type of value to generate a first file of the key-value data structure.
[0081] Specifically, in the key-value data structure, the key is the DTC column fault code, that is, the first-class key, and the value is the list of diagnostic information in the Fault column cut by '|', that is, the first-class value. For example, each element in the current list is concatenated as: fault interface name + fault name FaultName column + battery management system fault ID number column BMS_DTCnumber column + current row.
[0082] Step 320: Sort the first file based on the fault code to generate a first dictionary.
[0083] Step 330: traverse the first dictionary and generate a replacement file.
[0084] Specifically, an ordered dictionary, namely the first dictionary, is generated by sorting the DTC codes of the key values. At this time, the ordered dictionary is traversed to generate a replacement file.
[0085] In some embodiments, the replacement file includes a fault code configuration code DTC_CFG_code and a fault information configuration code F lt_CFG_code.
[0086] In some embodiments, see Figure 5 , Figure 5 This is a specific flow chart of generating a fault code configuration code in the method for updating the fault diagnosis library file provided in the embodiment of the present application. The specific method for generating the fault code configuration code DTC_CFG_code is implemented through steps 331 to 332:
[0087] Step 331: traverse the first dictionary to generate first data.
[0088] In some embodiments, the first data includes a fault code, a total number of accumulated fault messages, a number of fault messages corresponding to the fault code in the current first data, an index of the current first data, and a cumulative ranking number of the fault code in the current first data.
[0089] Step 332: Generate a fault code configuration code based on the first data.
[0090] Specifically, a line of spliced code is generated in one traversal loop, namely, the first data, including the fault code, the total number of accumulated fault information, the number of fault information corresponding to the fault code in the current first data, the index of the current first data and the accumulated sorting number of the fault code in the current first data; after multiple traversals, multiple first data are generated, and the multiple first data are combined to obtain the fault code configuration code DTC_CFG_code.
[0091] In some embodiments, see Figure 6 , Figure 6 This is a specific flow chart of generating a fault information configuration code in the method for updating a fault diagnosis library file provided in an embodiment of the present application. The method for generating a fault information configuration code is specifically implemented through steps 333 to 336:
[0092] Step 333: traverse the first dictionary to obtain the fault code.
[0093] Step 334: In the first dictionary, traverse the fault information corresponding to the fault code.
[0094] In some embodiments, the fault information corresponding to the fault code includes the fault code status index of the fault interface name in the second dictionary, the bits of the fault interface name, the value of the fault code number column of the fault information in the target system, the name of the fault interface, the index of the current second data, the fault annotation and the cumulative sort number of the fault information.
[0095] Step 335: Generate second data based on the fault code and the fault information.
[0096] Step 336: Generate a fault information configuration code based on the second data.
[0097] Specifically, firstly, a row of corresponding DTC codes is traversed and then a list of values of corresponding DTC codes is traversed. In the second traversal loop, each specific Fau lt diagnostic information is obtained, and a row of code is correspondingly generated, which includes the fault code state index of the fault interface name in the second dictionary, the bit of the fault interface name, the value of the fault code number column of the fault information in the target system, the name of the fault interface, the index of the current second data, the fault annotation and the cumulative ranking number of the fault information; the above two traversal steps are repeated to obtain multiple second data, and the multiple second data are combined to obtain the fault information configuration code.
[0098] In some embodiments, see Figure 7 , Figure 7 A flowchart of specific steps for obtaining a second dictionary in the method for updating a fault diagnosis library file provided in an embodiment of the present application. Before executing step 400 to update the fault diagnosis library file of the target system, the method for updating the fault diagnosis library file provided in an embodiment of the present application further includes:
[0099] Step 340: Obtain a fault diagnosis code source file, where the fault diagnosis code source file includes fault information of the target system and a fault code status index of the fault information.
[0100] Step 350: Configure the fault information as a second type key.
[0101] Step 360: Configure the fault code status index to be a second type value.
[0102] Step 370: Based on the fault information and the fault code status index, configure the second type of keys and the second type of values to generate a second file of the key-value data structure.
[0103] Step 380: Generate a second dictionary based on the second file.
[0104] Step 400: Update the fault diagnosis library file of the target system based on the replacement file.
[0105] Specifically, load the diagnostic fault code source file DTC.c, parse each line of code, and use regular expressions to extract the fault information Faul lt data and fault code status index DTCFal utSts array index of the current line in the diagnostic fault code source file DTC.c.
[0106] It can be understood that the dictionary is stored in the form of a key-value data structure, where the name of the Fault data is the key, that is, the second-class key, and the DTCFa l utSts array index is the value, that is, the second-class value, so that when the fault diagnosis library file DTCLi b code is rewritten later, the corresponding DTCFa l utSts array index can be directly obtained through the name of the Fault data, reducing traversal operations and time complexity. For example, there is a line of code in the diagnostic fault code source file DTC.c file:
[0107] (voi d)Rte_Read_I SO_x_F l tSts_SR_V_u8_I SO_x_F l tSts_SR_V_u8(&G_u32_DTCFa l utSts_Arr[7]);
[0108] Among them, the key is the extracted I SO_x_F l tSts_SR_V_u8, and the value is the index 7 of the last array extracted.
[0109] In some embodiments, see Figure 8 , Figure 8 The specific flow chart of step 400 in the method for updating the fault diagnosis library file provided in the embodiment of the present application, the method for updating the fault diagnosis library file of the target system based on the replacement file is specifically implemented through steps 410 to 440:
[0110] Step 410: Determine the index of the starting position of the fault code configuration and the index of the ending position of the fault code configuration in the source file of the fault diagnosis library file, and replace the data between the index of the starting position of the fault code configuration and the index of the ending position of the fault code configuration with the fault code configuration code.
[0111] Step 420: Determine the index of the fault information configuration start position and the index of the fault information configuration end position in the source file of the fault diagnosis library file, and replace the data between the index of the fault information configuration start position and the index of the fault information configuration end position with the fault information configuration code.
[0112] Specifically, load the source file DTCLi bc file of the fault diagnosis library file, and search for the indexes corresponding to the four codes "index DTC CFG START of the starting position of the fault code configuration", "index DTC CFG END of the ending position of the fault code configuration", "index FAULT CFG START of the starting position of the fault information configuration", and "index FAULT CFG END of the ending position of the fault information configuration". Then rewrite the source file DTCLi bc file of the fault diagnosis library file. Replace the fault code configuration code DTC_CFG_code code after the index "index DTC CFG START of the starting position of the fault code configuration" and before the index "index DTC CFG END of the ending position of the fault code configuration". Replace the fault information configuration code F l t_CFG_code code after the index "index FAULT CFG START of the starting position of the fault information configuration" and before the index "index FAULT CFG END of the ending position of the fault information configuration".
[0113] Step 430: In the header file of the fault diagnosis library file, modify the value of the maximum number of diagnostic events to the final value of the cumulative ranking number of the fault codes in the first data.
[0114] Step 440: In the header file of the fault diagnosis library file, modify the value of the maximum fault quantity to the final value of the cumulative ranking number of the fault information in the second data.
[0115] Specifically, the fault diagnosis library file DTCLi bh is loaded, and the "maximum number of diagnostic events DTC_MAX_EVENT_NUM" is found through regular matching, and the value is changed to the final value of the cumulative ranking number of the fault code in the first data. The "maximum number of faults DTC_MAX_FAULT_NUM" is found through regular matching, and the value is changed to the final value of the cumulative ranking number of the fault information in the second data.
[0116] It can be understood that the method for updating the fault diagnosis library file provided in the embodiment of the present application includes obtaining a diagnostic template file as a reference file and a fault diagnosis configuration header file of the corresponding system, and when there is a difference in the fault code in the diagnostic template file and the fault diagnosis configuration header file, obtaining the fault code to be updated and the fault information corresponding to the fault code to be updated, and then generating a replacement file based on the fault code to be updated and the fault information to be updated, and updating the fault diagnosis library file of the target system based on the replacement file. The present application compares the reference file with the configuration header file of the specific system, and when it is determined that there is a difference in the fault code, determines the replacement file using the fault code to be updated and the corresponding fault information to be updated, and updates the fault diagnosis library file of the target system through the replacement file, without the need to manually compare the fault data, thereby reducing the burden of research and development, improving development efficiency, and reducing the error rate.
[0117] Accordingly, the embodiment of the present application also provides a system for updating a fault diagnosis library file, see Fig. 9 , Fig. 9 A schematic diagram of module connections of a system for updating a fault diagnosis library file provided in an embodiment of the present application. The system for updating a fault diagnosis library file provided in an embodiment of the present application includes:
[0118] The file acquisition module 10 is used to acquire a diagnosis template file and a fault diagnosis configuration header file. The diagnosis template file is configured as a reference file for defining and describing fault codes. The fault diagnosis configuration header file includes the fault codes of the target system.
[0119] The update determination module 20 is used for obtaining the fault code to be updated and the fault information to be updated corresponding to the fault code to be updated in response to the difference between the fault codes in the diagnosis template file and the fault diagnosis configuration header file.
[0120] The replacement file generating module 30 is used to generate a replacement file based on the fault code to be updated and the fault information to be updated.
[0121] The fault diagnosis library update module 40 is used to update the fault diagnosis library file of the target system based on the replacement file.
[0122] In some embodiments, the update determination module 20 is specifically used to:
[0123] Obtain the fault codes in the diagnosis template file and generate a first set.
[0124] The fault codes in the fault diagnosis configuration header file are obtained to generate a second set.
[0125] In response to a difference between the first set and the second set, it is determined that a difference exists between the fault codes in the diagnosis template file and the fault diagnosis configuration header file.
[0126] In some embodiments, the replacement file generation module 30 is specifically used to:
[0127] A first file is generated based on the fault code to be updated and the fault information to be updated.
[0128] The first file is sorted based on the fault code to generate a first dictionary.
[0129] Traverse the first dictionary and generate replacement files.
[0130] In some embodiments, the replacement file generation module 30 is specifically used to:
[0131] Configure the fault code to be updated as the first type key.
[0132] Configure the fault information to be updated as the first type value.
[0133] Based on the correspondence between the fault codes to be updated and the fault information to be updated, a first type of key and a first type of value are configured to generate a first file of a key-value data structure.
[0134] In some embodiments, the updating system of the fault diagnosis library file is specifically used for:
[0135] A fault diagnosis code source file is obtained, wherein the fault diagnosis code source file includes fault information of a target system and a fault code status index of the fault information.
[0136] Configure fault information as the second type of key.
[0137] Configure the fault code status index as the second type value.
[0138] Based on the fault information and the fault code status index, the second type of keys and the second type of values are configured to generate a second file of the key-value data structure.
[0139] A second dictionary is generated based on the second file.
[0140] In some embodiments, the replacement file generation module 30 is specifically used to:
[0141] The first dictionary is traversed to generate first data, where the first data includes a fault code, a total number of accumulated fault information, a number of fault information corresponding to the fault code in the current first data, an index of the current first data, and a cumulative ranking number of the fault code in the current first data.
[0142] Based on the first data, a fault code configuration code is generated.
[0143] In some embodiments, the replacement file generation module 30 is specifically used to:
[0144] Traverse the first dictionary and get the fault code.
[0145] In the first dictionary, the fault information corresponding to the fault code is traversed, and the fault information corresponding to the fault code includes the fault code status index of the fault interface name in the second dictionary, the bit of the fault interface name, the value of the fault code number column of the fault information in the target system, the name of the fault interface, the index of the current second data, the fault comment and the cumulative sort number of the fault information.
[0146] Second data is generated based on the fault code and the fault information.
[0147] Based on the second data, a fault information configuration code is generated.
[0148] In some embodiments, the fault diagnosis library update module 40 is specifically used to:
[0149] The index of the starting position of the fault code configuration and the index of the ending position of the fault code configuration are determined in the source file of the fault diagnosis library file, and the data between the index of the starting position of the fault code configuration and the index of the ending position of the fault code configuration are replaced by the fault code configuration code.
[0150] The index of the starting position of the fault information configuration and the index of the ending position of the fault information configuration are determined in the source file of the fault diagnosis library file, and the data between the index of the starting position of the fault information configuration and the index of the ending position of the fault information configuration are replaced by the fault information configuration code.
[0151] In the header file of the fault diagnosis library file, the value of the maximum number of diagnostic events is modified to the final value of the cumulative ranking number of the fault codes in the first data.
[0152] In the header file of the fault diagnosis library file, the value of the maximum fault quantity is modified to the final value of the cumulative ranking number of the fault information in the second data.
[0153] Accordingly, an embodiment of the present application further provides an electronic device, see Fig.10 , Fig.10 The structural diagram of the electronic device provided in the embodiment of the present application includes a memory 100 and a processor 200, the memory 100 and the processor 200 are connected to each other in communication, the memory 100 stores computer instructions, and the processor 200 executes the computer instructions to execute the method for updating the fault diagnosis library file provided in the embodiment of the present application. Specifically, the memory 100 and the processor 200 are connected via a communication bus.
[0154] In some embodiments, the processor 200 may be a central processing unit (CPU). The processor 200 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0155] In some embodiments, the memory 100 is a non-transitory computer-readable storage medium that can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the methods in the method embodiments of the present application. The processor 200 executes various functional applications and data processing of the processor 200 by running the non-transitory software programs, instructions and modules stored in the memory 100, that is, implementing the methods in the above method embodiments.
[0156] In some embodiments, the memory 100 may include a program storage area and a data storage area, wherein the program storage area may store an application required for operating the device or at least one function; the data storage area may store data created by the processor 200, etc. In addition, the memory 100 may include a high-speed random access memory 100, and may also include a non-volatile memory 100, such as at least one disk memory 100, a flash memory device, or other non-volatile solid-state memory 100. In some embodiments, the memory 100 may optionally include a memory 100 remotely arranged relative to the processor 200, and these remote memories 100 may be connected to the processor 200 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0157] In some embodiments, one or more modules are stored in the memory 100 and when executed by the processor 200, the methods in the above method embodiments are performed.
[0158] In some embodiments, the specific details of the above-mentioned electronic device can be understood by referring to the corresponding related descriptions and effects in the above-mentioned method embodiments, and will not be repeated here.
[0159] The present application has introduced in detail a method and system for updating a fault diagnosis library file provided in an embodiment of the present application. Specific examples are used herein to illustrate the principle and implementation mode of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for updating a fault diagnosis library file, characterized in that: include: Acquire a diagnosis template file and a fault diagnosis configuration header file, wherein the diagnosis template file is configured as a reference file for defining and describing a fault code, and the fault diagnosis configuration header file includes a fault code of a target system; In response to a difference between the fault codes in the diagnosis template file and the fault diagnosis configuration header file, acquiring a fault code to be updated and fault information to be updated corresponding to the fault code to be updated; generating a replacement file based on the fault code to be updated and the fault information to be updated; The fault diagnosis library file of the target system is updated based on the replacement file.
2. The method for updating the fault diagnosis library file according to claim 1, characterized in that: The step of determining whether there is a difference between the fault codes in the diagnosis template file and the fault diagnosis configuration header file comprises: Obtaining the fault codes in the diagnosis template file to generate a first set; Obtaining the fault codes in the fault diagnosis configuration header file to generate a second set; In response to a difference between the first set and the second set, it is determined that a difference exists between the fault codes in the diagnosis template file and the fault diagnosis configuration header file.
3. The method for updating the fault diagnosis library file according to claim 1, characterized in that: The step of generating a replacement file based on the fault code to be updated and the fault information to be updated includes: generating a first file based on the fault code to be updated and the fault information to be updated; sorting the first file based on the fault code to generate a first dictionary; The first dictionary is traversed to generate the replacement file.
4. The method for updating the fault diagnosis library file according to claim 3, characterized in that: The step of generating a first file based on the fault code to be updated and the fault information to be updated includes: Configuring the fault code to be updated as a first-category key; Configuring the fault information to be updated as a first type value; Based on the correspondence between the fault codes to be updated and the fault information to be updated, the first type of keys and the first type of values are configured to generate a first file of a key-value data structure.
5. The method for updating the fault diagnosis library file according to claim 4, characterized in that: The method for updating the fault diagnosis library file also includes: Acquire a fault diagnosis code source file, wherein the fault diagnosis code source file includes fault information of a target system and a fault code state index of the fault information; Configuring the fault information as a second type key; Configuring the fault code status index to be a second type value; Based on the fault information and the fault code status index, configure the second type of key and the second type of value to generate a second file of a key-value data structure; A second dictionary is generated based on the second file.
6. The method for updating the fault diagnosis library file according to claim 5, characterized in that: The replacement file includes a fault code configuration code and a fault information configuration code.
7. The method for updating the fault diagnosis library file according to claim 6, characterized in that: The steps of generating the fault code configuration code include: Traversing the first dictionary to generate first data, the first data including a fault code, a total number of accumulated fault information, a number of fault information corresponding to the fault code in the current first data, an index of the current first data, and a cumulative ranking number of the fault code in the current first data; Based on the first data, the fault code configuration code is generated.
8. The method for updating the fault diagnosis library file according to claim 7, characterized in that: The steps of generating the fault information configuration code include: Traverse the first dictionary to obtain the fault code; In the first dictionary, traverse the fault information corresponding to the fault code, the fault information corresponding to the fault code includes the fault code state index of the fault interface name in the second dictionary, the bit of the fault interface name, the value of the fault code number column of the fault information in the target system, the name of the fault interface, the index of the current second data, the fault comment and the cumulative ranking number of the fault information; generating second data based on the fault code and the fault information; Based on the second data, the fault information configuration code is generated.
9. The method for updating the fault diagnosis library file according to claim 8, characterized in that: The step of updating the fault diagnosis library file of the target system based on the replacement file comprises: Determining the index of the starting position of the fault code configuration and the index of the ending position of the fault code configuration in the source file of the fault diagnosis library file, and replacing the data between the index of the starting position of the fault code configuration and the index of the ending position of the fault code configuration by the fault code configuration code; Determine the index of the starting position of the fault information configuration and the index of the ending position of the fault information configuration in the source file of the fault diagnosis library file, and replace the data between the index of the starting position of the fault information configuration and the index of the ending position of the fault information configuration by the fault information configuration code; In the header file of the fault diagnosis library file, modify the value of the maximum number of diagnostic events to the final value of the cumulative ranking number of the fault codes in the first data; In the header file of the fault diagnosis library file, the value of the maximum fault quantity is modified to the final value of the cumulative ranking number of the fault information in the second data.
10. A system for updating a fault diagnosis library file, characterized in that: include: A file acquisition module, the file acquisition module is used to acquire a diagnosis template file and a fault diagnosis configuration header file, the diagnosis template file is configured as a reference file for defining and describing a fault code, and the fault diagnosis configuration header file includes a fault code of a target system; An update determination module, the update determination module being used for acquiring a fault code to be updated and fault information to be updated corresponding to the fault code to be updated in response to a difference between the fault codes in the diagnosis template file and the fault diagnosis configuration header file; A replacement file generation module, the replacement file generation module is used to generate a replacement file based on the fault code to be updated and the fault information to be updated; A fault diagnosis library update module is used to update the fault diagnosis library file of the target system based on the replacement file.