DBC file generation method, electronic equipment and storage medium
By deduplication of messages, signals and configuration data of different DBC files, new DBC files are constructed, and the problem of DBC file merging in the existing technology is solved, and compatibility of CAN controllers across models and projects is achieved.
Patent Information
- Application Number
- CN202311062234.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-22
- Publication Date
- 2025-02-25
AI Technical Summary
It is difficult for the prior art to effectively merge DBC files of different vehicle models or projects, resulting in the CAN controller being unable to find the corresponding CAN frames in different vehicles or projects, which in turn affects the implementation of control functions.
By obtaining data from different DBC files, deduplication of packets and signals, and deduplication of configuration data, a new DBC file is built to enable it to be compatible with CAN communication networks of different models or projects.
The compatibility design of DBC files is realized to ensure that the CAN controllers of different vehicles or projects can find the corresponding CAN frames in the synthetic DBC files, thereby realizing the corresponding control functions.
Smart Images

Figure CN119520188A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to vehicle-related technologies, and more specifically, to DBC file generation technology. Background Art
[0002] The interpretation of vehicle CAN communication frames is mostly based on DBC files. In short, most of the communications in vehicles are based on the CAN communication network, which can ensure universality and reduce the time and cost of developing new networks. In order to achieve the universality of the CAN communication network, it is necessary to design the compatibility of the DBC file, merge the DBC files of different models or different projects together to form a total DBC file, so that the CAN controllers of different vehicles or different projects can find the corresponding CAN frames in the synthesized DBC files, and then obtain the content of the received message according to the corresponding CAN frame to achieve the corresponding control function. Summary of the invention
[0003] According to one aspect of the present application, a method for generating a DBC file is provided. The method includes acquiring data of different DBC files; taking data including a message and a signal in the acquired data as a first part, performing a first processing on the data, wherein the first processing is based on the message and the signal corresponding to the message; taking configuration data in the acquired data as a second part, performing a second processing on the data; and constructing a new DBC file based on the first part after the first processing and the second part after the second processing.
[0004] The DBC file generation method, optionally, takes the data including messages and signals in the acquired data as the first part and performs a first processing on it, including: a) taking the first part of one of the acquired different DBC files as the first basic data; b) comparing the messages and signals in one of the remaining DBC files with the messages and signals in the basic data to form new first basic data with deduplication; c) repeating step b) until all DBC files have undergone step b), thereby forming the processed first part.
[0005] The DBC file generation method, optionally, step b) further includes: comparing each message of a DBC file in the remaining DBC files and the corresponding signal of the message with the message in the first basic data and the corresponding signal of the message; for repeated messages that appear in both the one DBC file and the first basic data, further determining whether the corresponding signals of the repeated messages in the one DBC file all appear in the corresponding signals of the repeated messages in the first basic data; if the determination result is that they do not appear, writing the signals that do not appear in the corresponding signals of the repeated messages in the first basic data into the first basic data; for messages that appear in the one DBC file but do not appear in the first basic data, writing the messages and their corresponding signals into the first basic data.
[0006] The DBC file generation method, optionally, the configuration data in the acquired data is used as the second part and subjected to the second processing, including: e) using the configuration data of one of the acquired different DBC files as the second basic file; f) comparing the configuration data in one of the remaining DBC files with the configuration data in the second basic data to form new second basic data without duplication; g) repeating step f) until all the remaining files have undergone step f) to form the processed second part. The configuration data may include configuration parameters, signal name interpretation, and signal value interpretation.
[0007] In the DBC file generation method, optionally, the DBC file obtains data from different DBC files using a Python function.
[0008] An electronic device is also provided, which includes: an input / output interface for receiving input data and output data; a memory for storing program instructions; a processor for executing the program instructions in the memory to: obtain data from different CAN data sources from the data received by the input / output interface; take the data including messages and signals in the acquired data as a first part, and perform a first processing on the data, the first processing being based on the message and the signal corresponding to the message; take the configuration data in the acquired data as a second part, and perform a second processing on the data; and construct a DBC file based on the first part after the first processing and the second part after the second processing.
[0009] Also by a computer storage medium, characterized in that the storage medium stores program instructions, and the program instructions can be executed to implement any one of the DBC file generation methods described above. As an example, the computer storage medium is a non-transitory storage medium. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The following will describe the embodiments of the present application in detail with reference to the accompanying drawings so that the present application can be more fully understood, wherein:
[0011] Figure 1 is a flow chart of a DBC file generation method according to some examples of the present application;
[0012] Figure 2 A specific example process for implementing step S102 is illustrated;
[0013] Figure 3 is a process diagram of a specific example for implementing step S204;
[0014] Figure 4 is a flowchart of an example of implementing step S204;
[0015] Figure 5 It is a schematic diagram of the structure of an electronic device according to an example of the present application. DETAILED DESCRIPTION
[0016] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the following will be combined with the accompanying drawings to clearly and completely describe the implementation methods of the present application. It should be noted that the described implementation methods are only part of the implementation methods of the technical solution of the present application, not all. All other implementation methods obtained by ordinary technicians in this field based on the implementation methods recorded in the application documents without paying creative work are covered by the protection scope of the present application.
[0017] The terms "first", "second", etc. in the specification, claims, and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that the terms are interchangeable where appropriate, so that the embodiments of the present application can be implemented in a sequence other than the embodiments illustrated or described herein. In addition, "first" and "second" are used for descriptive purposes only and are not to be understood as expressly or implicitly indicating relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first" and "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more.
[0018] As used hereinafter, the words “example” or “exemplarily” or “exemplarily” mean “serving as an example, embodiment, or illustration.” Any embodiment described as “example” or “exemplarily” or “exemplarily” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0019] DBC (Database CAN) file refers to the CAN database file.
[0020] Figure 1 Flowchart of the DBC file generation method according to some examples of the present application. Figure 1 As shown, in step S100, data of different DBC files are obtained. Different DBC files may be files formed based on CAN data sources of different electronic components or systems of the vehicle. In step S102, the data including messages and signals in the acquired data is taken as the first part, and a first processing is performed on it, wherein the first processing is based on both the message and the signal corresponding to the message. In other words, the first processing takes into account both each message and the signal corresponding to each message. According to the example of the present application, the first processing can remove the repeated parts in the first part. In step S104, the configuration data in the acquired data is taken as the second part, and a second processing is performed on it. Similarly, the second processing can remove the repeated parts in the second part. In step S106, a new DBC file is constructed based on the first part processed by the first processing and the second part processed by the second processing, for example, the first part processed by the first processing and the second part processed by the second processing are combined to form a new DBC file.
[0021] Figure 2 FIG. 2 shows a specific example of a process for implementing step S102. Figure 2 As shown, in step S200, the messages and signals from a certain DBC file in the data obtained in step S100 are used as the first basic data, and the remaining part of the DBC file, that is, the configuration data, is used as the second basic data for the second processing, which will be described below. In step S202, the messages and signals in one of the remaining DBC files are compared with the messages and signals in the first basic data to form new first basic data with deduplication. Continuing with the previous example, the messages and signals of DBC file A are the first basic data, and the messages and signals of the remaining DBC file B in the multiple DBC files are compared with the first basic data, including comparison of the messages and comparison of the signals corresponding to the messages. For the same message name that appears in both the first basic data and DBC file B, if the signal corresponding to the message in DBC file B is consistent with the signal under the message in the first basic data, there is no need to write the message and its signal in DBC file B into the first basic data. On the contrary, if the signal corresponding to the message in DBC file B is different from the signal under the message in the first basic data, these different signals are written into the signal corresponding to the message name in the first basic data. For the message name and its corresponding signal that only appear in DBC file B, DBC file B and the corresponding signal are written into the first basic data. Thus, a new first basic data with deduplication is formed, which is the data that merges the messages and signals of DBC file A and DBC file B but removes the overlapping parts.
[0022] Furthermore, in the process of performing step S202, not only the repeated parts are removed, but also the order of the message and its corresponding signal is maintained in an appropriate manner. For example, when the message to be written into the first basic data (the message name does not appear in the first basic data during comparison) and its corresponding signal are written into the first basic data, they are written after the existing message in the first basic data; the signal to be written into the message (the message name corresponding to the signal already exists in the first basic data during comparison) is written after the existing signal under its corresponding message name.
[0023] In step S204, it is determined whether all the remaining DBC files in the DBC file have gone through step S202. If so, the process proceeds to step S206. Otherwise, the process continues until all the remaining DBC files have gone through step S202.
[0024] For example, in the case where there are three BDC files (files A, B, and C), file A is used as the first basic data and the second basic data as mentioned above. In step S204, it is determined whether both file B and file C have undergone step S202. In the case that both have undergone step S202, the process proceeds to step S206. The new first basic data of DBC file B after undergoing step S202 includes the messages and signals of both DBC file A and DBC file B, but the data has been deduplicated. When BDC file C subsequently undergoes step S202, its messages and signals will be compared with the new first basic data, including comparison of messages and comparison of signals corresponding to the messages, thereby forming the final first basic data, which includes the messages and signals of DBC file A, DBC file B, and DBC file C, but the data has been deduplicated.
[0025] In step S206, the final first basic data is used to form the first part for constructing a new DAB file.
[0026] Figure 3It is a process diagram of a specific example for implementing step S204. In step S300, each message of a DBC file in the remaining DBC files and the corresponding signal of the message are compared with the message in the first basic data and the corresponding signal of the message. In step S302, for repeated messages that appear in both the one DBC file and the first basic data, it is further determined whether the corresponding signals of the repeated messages in the one CAN data source all appear in the corresponding signals of the repeated messages in the first basic data. If the result of the determination is that they do not appear, the signals that do not appear in the corresponding signals of the repeated messages in the first basic data are written into the first basic data. In step S304, for messages that appear in the one CAN data source but do not appear in the first basic data, the messages and their corresponding signals are all written into the first basic data.
[0027] The DBC file formed by the CAN data of the radar set at the front of the vehicle body is taken as DBC file A, the DBC file formed by the CAN data of the radar set at the rear of the vehicle body is taken as DBC file B, and the DBC file formed by the CAN data of the radar set at the side of the vehicle body is taken as file C. Assume that DBC file A includes 3 messages, wherein the first message corresponds to two signals, namely signal 11F and signal 12F, the second message corresponds to one signal, namely signal 21F, and the third message corresponds to one signal 31F. DBC file B includes 3 messages, wherein the first message corresponds to four signals, namely signals 11B, 12B, 13B and 14B, the second message corresponds to one signal 21B, and the third message corresponds to one signal 31B. DBC file C includes 1 message, wherein the first message includes two signals, namely signals 11S and 12S.
[0028] The message and signal of DBC file A are the first basic data. According to some examples of the present application, firstly one of DBC file B and DBC file C is compared with the first basic data, and here DBC file B is compared with the first basic data first.
[0029] Compare the three messages of DBC file B with the messages of the first basic data. For example, the comparison is that the names of the three messages of DBC file B are exactly the same as those of the three messages of the first basic data. Further, compare the signals under each message. Signal 11F and signal 12F of the first message of the first basic data are consistent with signal 11B and signal 12B of the first message of DBC file B, but because the first message of the first basic data does not include signals 13B and 14B, signals 12B and 14B of the first message of the DBC file are added to signals 11F and signal 12F of the first message of the first basic data as the third and fourth signals. Signal 21B of the second message of DBC file B is the same as signal 21F of the second message of the first basic data, so signal 21F of the second message of the first basic data can be retained. Signal 31B of the third message of the DBC file is the same as the signal of the third message of the first basic data, so signal 31F of the third message of the first basic data can be retained. Thus, new first basic data is formed, which includes three messages. The first message includes signals 11F, 12F, 13B and 14B, the second message includes 21F, and the third message includes signal 31F.
[0030] Subsequently, DBC file C is compared with the new first basic data. The only message of DBC file C has the same name as the third message in the first basic data, but its signals 11S and 12S are different from signal 31F of the third message in the new first basic data. Therefore, signals 11S and 12S are added to the signal of the third message of the first basic data and can be written after signal 31F. Thus, the two remaining DBC files have been compared with the basic data to form the final first basic data. It includes 3 messages, the first message includes signals 11F, 12F, 13B and 14B, the second message includes 21F, and the third message includes signals 31F, 11S and 12S. According to the example of the present application, the first part of the new DBC file, i.e., the message and signal part, can be formed based on the final basic data, and each message corresponds to one or more signals.
[0031] When the above method is executed in an electronic device, operations such as reading and updating the first basic data can be implemented by placing the first basic data into a cache for comparison, or placing the addresses of each message of the first basic data and the corresponding signal into a cache.
[0032] Back to Figure 2 , step S204 can be implemented through some specific examples. Figure 4: is a flowchart of an example of implementing step S204. In step S400, the configuration data of one of the different DBC files obtained, such as configuration parameters, signal name interpretation, and signal value interpretation, is used as a second basic file. In step S402, the configuration data of one of the remaining DBC files, such as configuration parameters, signal name interpretation, and signal value interpretation, is compared with the configuration data in the second basic data to form a new second basic data with deduplication. In step S404, step S402 is repeated until all the remaining files have undergone step S402 to form a processed second part.
[0033] Take the DBC file A, file B and file C as an example. The configuration data of DBC file A is used as the second basic data. The configuration data of file B is compared with the second basic data. For the configuration data of file B that is already included in the second basic data, the second basic data will not be written repeatedly, but only the configuration data included in file B but not included in the second basic data will be written into the second basic data. Thus, new second basic data is formed. The configuration data of file C is compared with the new second basic data, so as to form the final second basic data. The second part of the DBC file is formed with the final second basic data.
[0034] For different DBC files, according to the method of merging based only on the message name that the inventors have learned, different signals under the same message may be ignored. In addition, according to the inventors' understanding, in the process of forming a DBC file, the later data usually overwrites the earlier data, which makes the corresponding signal under the same message in the final DBC file only include the signal corresponding to the message in the last received data. According to the DBC file generation method of the example of the present application, a new DBC file is constructed based on the message and the signal corresponding to the message at the same time. Therefore, as described above in conjunction with the embodiment, a DBC file that does not repeat but completely records all the same messages and the signals corresponding to the messages can be formed.
[0035] In the DBC file generation method described above, the data of different DBC files can be obtained through Python functions. For example, the DBC file generation method according to the example of the present application can be implemented by an electronic device such as a computer. The input interface of the electronic device, such as a USB interface, a communication interface or other wired or wireless communication interface that can receive data, can be used to receive different data. If the electronic device is provided with a Python function, the data of different DBC files can be obtained from the received data, and then the processor of the electronic device executes the above combined Figures 1 to 4 Any one of the processes described in the above to form a DBC file. In this process, the storage components of the electronic device, such as memory, cache, etc., can store data related to each example of the present application as needed.
[0036] In each example of the present application, steps are represented by numbers, but this does not limit their execution order. For example, Figure 1 Although step S102 and step S104 are described first herein, they may actually be performed simultaneously or step S104 may be performed first and then step S102.
[0037] Figure 5 1 is a schematic diagram of the structure of an electronic device according to an example of the present application. The electronic device includes an input / output interface 50, a memory 52, and a processor 54. The input / output interface 50 is used to receive input data and output data. The memory 52 is used to store program instructions. The processor 54 is used to process the program instructions stored in the memory 52 to implement the various examples of the DBC file generation method described above.
[0038] For example, in the process of executing the program instructions, the processor 54 obtains (step S100) data of different DBC files from the data received by the input / output interface 50. The processor 54 takes the data including the message and the signal in the obtained data as the first part and performs the first processing on it (step S102). The processor 54 takes the configuration data in the obtained data as the second part and performs the second processing on it (step S104), and constructs a new DBC file based on the first part after the first processing and the second part after the second processing (step S106).
[0039] According to some examples of the present application, the processor 54 further implements the above combination when executing the program instruction Figure 2 In some examples, the processor 54 further implements the above combined Figure 3 In some examples, the processor 54 further implements the above combined Figure 4 Describe the process.
[0040] The electronic device is, for example, one or more of a laptop computer, a desktop computer, a smart phone, a tablet computer, and a server.
[0041] The present application also provides a computer storage medium, on which program instructions are stored, and the program instructions can be executed to implement any one of the DBC file generation methods according to the examples of the present application. The storage medium is a non-transitory storage medium. The non-transitory storage medium can be included by an electronic device, and when the processor of the electronic device executes the program instructions, the DBC file is generated according to the examples of the present application.
[0042] Although specific embodiments of the present application have been shown and described in detail to illustrate the principles of the present application, it should be understood that the present application may be implemented in other ways without departing from such principles, for example, the technical features of the various embodiments / examples / examples of the present application may be combined with each other to form new implementation methods.
Claims
1. A DBC file generation method, characterized in that: The method comprises: Get data from different DBC files; Taking the acquired data including the message and the signal as the first part, and performing a first processing on the data, wherein the first processing is based on the message and the signal corresponding to the message; Taking the configuration data in the acquired data as the second part, and performing a second processing on it; A new DBC file is constructed based on the first processed first portion and the second processed second portion.
2. The method according to claim 1, characterized in that: The first processing of the acquired data including the message and the signal as the first part includes: a) using a first part of one of the obtained different DBC files as first basic data; b) comparing the message and signal in one of the remaining DBC files with the message and signal in the basic data to form new first basic data with deduplication; c) Repeat step b) until all DBC files have undergone step b), thereby forming the processed first part.
3. The method according to claim 2, characterized in that The step b) further comprises: Comparing each message and a corresponding signal of the message in a DBC file of the remaining DBC files with the message and the corresponding signal of the message in the first basic data; For a duplicate message that appears in both the one DBC file and the first basic data, further determining whether the corresponding signals of the duplicate message in the one DBC file all appear in the corresponding signals of the duplicate message in the first basic data, and if the determination result is that they do not appear, writing the signals that do not appear in the corresponding signals of the duplicate message in the first basic data into the first basic data; For a message that appears in the one DBC file but does not appear in the first basic data, the message and its corresponding signal are written into the first basic data.
4. The method according to claim 2, characterized in that: The step of taking the configuration data in the acquired data as the second part and performing a second processing on the configuration data includes: e) using the configuration data of one of the obtained different DBC files as second basic data; f) comparing the configuration data of one of the remaining DBC files with the second basic data to form new second basic data with deduplication; g) repeating step f) until all remaining files have undergone step f) to form a processed second part; The configuration data includes configuration parameters, signal name explanations, and signal value explanations.
5. The method according to any one of claims 1 to 4, characterized in that The DBC file uses Python functions to obtain data from different DBC files.
6. An electronic device, comprising: Input / output interface, used to receive input data and output data; A memory for storing program instructions; A processor, configured to execute program instructions in the memory to: Acquire data from different DBC files from the data received by the input / output interface; Taking the acquired data including the message and the signal as the first part, and performing a first processing on the data, wherein the first processing is based on the message and the signal corresponding to the message; Taking the configuration data in the acquired data as the second part, and performing a second processing on it; A new DBC file is constructed based on the first processed first portion and the second processed second portion.
7. The electronic device according to claim 6, characterized in that: The processor is configured to execute the instructions to further implement the first processing by: a) using a first part of one of the obtained different DBC files as first basic data; b) comparing the message and signal in one of the remaining DBC files with the message and signal in the basic data to form new first basic data with deduplication; c) Repeat step b) until all DBC files have undergone step b), thereby forming the processed first part.
8. The electronic device according to claim 7, characterized in that: The processor is configured to execute the instructions to further implement step b) by: comparing each message of a DBC file in the remaining DBC files and a corresponding signal of the message with the messages in the first basic data and the corresponding signals of the messages; For a duplicate message that appears in both the one DBC file and the first basic data, further determining whether the corresponding signals of the duplicate message in the one DBC file all appear in the corresponding signals of the duplicate message in the first basic data, and if the determination result is that they do not appear, writing the signals that do not appear in the corresponding signals of the duplicate message in the first basic data into the first basic data; For a message that appears in the one DBC file but does not appear in the first basic data, the message and its corresponding signal are written into the first basic data.
9. The electronic device according to claim 7, characterized in that: The processor is configured to execute the instructions to further implement the second processing by: e) using the configuration data of one of the obtained different DBC files as a second basic file; f) comparing the configuration data of one of the remaining DBC files with the second basic data to form new second basic data with deduplication; g) repeating step f) until all remaining files have undergone step f) to form a processed second part; The configuration data includes configuration parameters, signal name explanations, and signal value explanations.
10. A computer storage medium, characterized in that: The storage medium stores program instructions, and the program instructions can be executed to implement the method according to any one of claims 1 to 5.