DBC file generation method, device, equipment and medium based on CAN communication

By analyzing the CAN database file and communication matrix, and verifying its integrity through the CAN software, the problem of low applicability and reliability of DBC files in the existing technology is solved, and efficient and reliable DBC file generation is achieved.

CN114780519BActive Publication Date: 2025-03-18DONGFENG OFF ROAD VEHICLE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210478013.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-27
Publication Date
2025-03-18
Estimated Expiration
2042-04-27

AI Technical Summary

Technical Problem

The DBC files generated in the prior art have low applicability and reliability, and cannot effectively support the preparation and parsing of J1939 protocol multi-packet transmission, and the generated files are unreliable.

Method used

By obtaining the CAN database file and analyzing its key elements, obtaining the communication matrix to generate a communication data table, analyzing the communication data one by one into a DBC file, and verifying the file integrity through the preset CAN software to generate the target DBC file.

Benefits of technology

It improves the applicability of the DBC file generation method, supports the analysis of extended frame and standard frame database structures, ensures the reliability of the generated target DBC file, and thus improves the efficiency of the vehicle network development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114780519B_ABST
    Figure CN114780519B_ABST
Patent Text Reader

Abstract

The present invention provides a DBC file generation method, device, equipment and medium based on CAN communication, the method comprising: obtaining a CAN database file, parsing the CAN database file to obtain multiple key elements; obtaining a communication matrix, and generating a communication data table according to the communication matrix, wherein the communication data table includes multiple communication data; parsing the communication data one by one according to the key elements to obtain multiple communication strings; merging the multiple communication strings to obtain a DBC file; verifying the integrity of the DBC file based on a preset CAN software, and obtaining a target DBC file. The present invention can improve the applicability of the DBC file generation method based on CAN communication and the reliability of the generated target DBC file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of vehicle-mounted controller development software, and in particular to a DBC file generation method, device, equipment and medium based on CAN communication. Background Art

[0002] As the number of CAN nodes in the automobile network continues to increase, the data in the network is also becoming more and more massive. Therefore, in order to facilitate the design and maintenance of the whole vehicle, the prior art proposes a technical solution for parsing and managing automobile CAN data using DBC files. The traditional implementation methods for forming DBC files include the following three methods: 1. Create a new DBC through system modeling software, and form a DBC file that is exclusive to the current vehicle or parts according to the communication design document and DBC format requirements. 2. Purchase a device that can parse the DBC database file of the car to read the CAN file. The prior art has the following technical problems: Technical Solution 1 uses the CAN communication protocol to perform detailed message parsing one by one in the upper computer software. As the amount of communication data increases, a lot of repetitive work needs to be done in system modeling, resulting in low development efficiency and increased error rate. Technical Solution 2 purchases a device that can parse the DBC database file of the car to compile the DBC database file of the car. The price is high and the configuration requirements are relatively general. If customized development is to be achieved, a lot of expenses will still be incurred.

[0003] In order to solve the above technical problems, independent software development and design have been proposed in the prior art, for example: the Chinese invention patent application with publication number CN107132832A, "A DBC file parsing and program based on CAN communication", proposes to set CAN communication parameter configuration, create DBC file messages, write DBC file parsing programs, dynamically create DBC information (such as: frame name, ID, signal name, signal value definition, etc.), and realize the sending and receiving functions of each frame message. However, it only supports standard frames and <8-byte extended frame definitions, and cannot realize the compilation and parsing of J1939 protocol multi-packet transmission, resulting in its low applicability. And the generated DBC file is not verified, resulting in the generated DBC file being unreliable.

[0004] Therefore, there is an urgent need for a DBC file generation method, device, equipment and medium based on CAN communication to solve the technical problems of low applicability and reliability of the generated DBC files in the prior art. Summary of the invention

[0005] In view of this, it is necessary to provide a DBC file generation method, device, equipment and medium based on CAN communication to solve the technical problems of low applicability and reliability of the generated DBC file in the prior art.

[0006] On the one hand, the present invention provides a DBC file generation method based on CAN communication, comprising:

[0007] Obtaining a CAN database file, and parsing the CAN database file to obtain multiple key elements;

[0008] Acquire a communication matrix, and generate a communication data table according to the communication matrix, wherein the communication data table includes a plurality of communication data;

[0009] Parsing the communication data one by one according to the key elements to obtain multiple communication character strings;

[0010] Merging the multiple communication character strings to obtain a DBC file;

[0011] The integrity of the DBC file is verified based on the preset CAN software, and the target DBC file is obtained.

[0012] In some possible implementations, the CAN database file includes a standard frame database file and an extended frame J1939 database file.

[0013] In some possible implementations, the multiple key elements include version and new character definition, baud rate definition, network node definition, message frame definition, signal definition, annotation definition, attribute definition, value table definition, and J1939 protocol-specific definition.

[0014] In some possible implementations, parsing the communication data one by one according to the key elements to obtain multiple communication character strings includes:

[0015] Create an initial variable-length string;

[0016] Parsing the communication data according to the key elements, obtaining version and new character definitions, baud rate definitions, network node definitions, message frame definitions, signal definitions, annotation definitions, attribute definitions, value table definitions, and J1939 protocol-specific definitions in the communication data;

[0017] The version and new character definition, baud rate definition, network node definition, message frame definition, signal definition, annotation definition, attribute definition, value table definition and J1939 protocol-specific definition in the communication data are written into the initial character string to obtain the communication character string.

[0018] In some possible implementations, the merging the multiple communication character strings to obtain a DBC file includes:

[0019] Construct DBC empty file;

[0020] The multiple communication character strings are written into the DBC empty file and merged to obtain the DBC file.

[0021] In some possible implementations, the verifying the integrity of the DBC file based on the preset CAN software and obtaining the target DBC file includes:

[0022] Loading the DBC file based on the preset CAN software, and determining whether the loading is successful;

[0023] If the loading is successful, the DBC file is complete and the DBC file is the target DBC file;

[0024] If the loading is unsuccessful, the communication matrix is ​​corrected to obtain a corrected communication matrix, and the target DBC file is obtained based on the corrected communication matrix.

[0025] In some possible implementations, the DBC file generation method based on CAN communication further includes:

[0026] Establishing a CAN network simulation interface, and loading the target DBC file based on the CAN network simulation interface, performing network simulation, and generating network simulation results and / or simulation messages;

[0027] Determine the integrity of the target DBC file according to the simulation message and the communication matrix;

[0028] The network performance of the CAN network is verified according to the network simulation results.

[0029] On the other hand, the present invention also provides a DBC file generation device based on CAN communication, comprising:

[0030] A database file parsing unit, used for acquiring a CAN database file and parsing the CAN database file to obtain a plurality of key elements;

[0031] A communication matrix processing unit, used to obtain a communication matrix and generate a communication data table according to the communication matrix, wherein the communication data table includes a plurality of communication data;

[0032] A communication data parsing unit, configured to parse the communication data one by one according to the key elements to obtain a plurality of communication character strings;

[0033] A DBC file generating unit, used for merging the plurality of communication character strings to obtain a DBC file;

[0034] The integrity verification unit is used to verify the integrity of the DBC file based on the preset CAN software and obtain the target DBC file.

[0035] On the other hand, the present invention also provides an electronic device, including a memory and a processor, wherein:

[0036] The memory is used to store programs;

[0037] The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps in the DBC file generation method based on CAN communication described in any one of the above implementations.

[0038] On the other hand, the present invention also provides a computer-readable storage medium for storing a computer-readable program or instruction, which, when executed by a processor, can implement the steps in the DBC file generation method based on CAN communication described in any of the above-mentioned implementations.

[0039] The beneficial effect of adopting the above embodiment is that the DBC file generation method based on CAN communication provided by the present invention obtains a CAN database file and parses the CAN database file to obtain multiple key elements, then parses the communication data generated by the communication matrix one by one according to the key elements to obtain multiple communication strings, and then merges the multiple communication strings to obtain the DBC file. Since the CAN database file is parsed to obtain multiple key elements, it is possible to parse CAN databases of different template formats, thereby establishing DBC files for extended frame and standard frame database structures, thereby improving the applicability of the DBC file generation method based on CAN communication.

[0040] Furthermore, the present invention can ensure the reliability of the target DBC file by setting up a preset CAN software to verify the integrity of the DBC file and obtain the target DBC file, thereby improving the subsequent development efficiency of the entire vehicle network. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, 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 invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0042] Figure 1 A schematic flow chart of an embodiment of a method for generating a DBC file based on CAN communication provided by the present invention;

[0043] Figure 2 For the present invention Figure 1 A schematic flow chart of an embodiment of S103;

[0044] Figure 3 For the present invention Figure 1 A schematic flow chart of an embodiment of S104;

[0045] Figure 4 For the present invention Figure 1 A schematic flow chart of an embodiment of S105;

[0046] Figure 5 A schematic diagram of an embodiment of the present invention for performing simulation verification on a target DBC file;

[0047] Figure 6 A schematic diagram of the structure of an embodiment of a DBC file generating device based on CAN communication provided by the present invention;

[0048] Figure 7 A schematic structural diagram of an embodiment of an electronic device provided by the present invention. DETAILED DESCRIPTION

[0049] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0050] It should be understood that the schematic drawings are not drawn to scale. The flow chart used in the present invention shows the operations implemented according to some embodiments of the present invention. It should be understood that the operations of the flow chart can be implemented out of order, and the steps without logical context can be reversed or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flow chart under the guidance of the content of the present invention, and can also remove one or more operations from the flow chart.

[0051] In the description of the embodiments of the present invention, "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone.

[0052] Some of the block diagrams shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor systems and / or microcontroller systems.

[0053] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0054] The embodiments of the present invention provide a method, device, equipment and medium for generating a DBC file based on CAN communication. Before describing the embodiments, CAN communication and DBC files are explained first.

[0055] CAN communication refers to the technology of communication based on the Controller Area Network (CAN). CAN is an ISO internationally standardized serial communication protocol. Due to its excellent anti-interference ability, strong error detection and processing capabilities, it has been increasingly widely used in automotive electronics and other fields.

[0056] DBC (Database CAN) file refers to the CAN database file.

[0057] Figure 1 A flow chart of an embodiment of a method for generating a DBC file based on CAN communication provided by the present invention is shown in FIG. Figure 1 As shown, the DBC file generation method based on CAN communication includes:

[0058] S101, obtaining a CAN database file, and parsing the CAN database file to obtain multiple key elements;

[0059] S102, obtaining a communication matrix, and generating a communication data table (DataTable) according to the communication matrix, wherein the communication data table includes a plurality of communication data;

[0060] S103, parsing the communication data one by one according to the key elements to obtain multiple communication character strings;

[0061] S104, merging multiple communication character strings to obtain a DBC file;

[0062] S105 . Verify the integrity of the DBC file based on the preset CAN software, and obtain the target DBC file.

[0063] Compared with the prior art, the DBC file generation method based on CAN communication provided by the embodiment of the present invention obtains a CAN database file and parses the CAN database file to obtain multiple key elements, then parses the communication data generated by the communication matrix one by one according to the key elements to obtain multiple communication strings, and then merges the multiple communication strings to obtain the DBC file. Since the CAN database file is parsed to obtain multiple key elements, it is possible to parse CAN databases of different template formats, thereby establishing DBC files for extended frame and standard frame database structures, thereby improving the applicability of the DBC file generation method based on CAN communication.

[0064] Furthermore, the embodiment of the present invention can ensure the reliability of the target DBC file by setting up a preset CAN software to verify the integrity of the DBC file and obtain the target DBC file, thereby improving the subsequent development efficiency of the entire vehicle network.

[0065] In a specific embodiment of the present invention, the CAN database file in step S101 includes but is not limited to a standard frame database file and an extended frame J1939 database file.

[0066] The embodiment of the present invention can generate a DBC file corresponding to the J1939 database file of a commercial vehicle by setting the CAN database file to include a standard frame database file and an extended frame J1939 database file, thereby improving the applicability of the DBC file generation method based on CAN communication.

[0067] The J1939 database file refers to a database file that complies with the J1939 multi-packet communication protocol.

[0068] It should be understood that: the CAN database file may also include other database files in addition to the standard frame database file and the extended frame J1939 database file, for example: a database file custom-generated by the DBediter of the CANoe software, etc.

[0069] In a specific embodiment of the present invention, the various key elements in step S101 include version and new character definition, baud rate definition, network node definition, message frame definition, signal definition, annotation definition, attribute definition, value table definition and J1939 protocol proprietary definition. Specifically:

[0070] 1. Version and new character definition

[0071] The format of the version is as follows: version "", version "" can be empty or defined by the user;

[0072] The format of the new character is as follows: NS_. This information is automatically generated when the DBC file is generated and the default is acceptable.

[0073] 2. Baud rate definition

[0074] The format is as follows: BS_:[baudrate: BTR1, BTR2];

[0075] BS_ is a keyword used to define the baud rate of the CAN network; the [] content indicates an optional part and can be omitted.

[0076] 3. Network node definition

[0077] The format is as follows: BU_:Nodename1 Nodename2 Nodename3…;

[0078] BU_ is a keyword indicating a network node. Nodename1 and Nodename2 in the format indicate the names of defined network nodes, which are defined by the user.

[0079] 4. Message frame definition

[0080] The format is as follows: BO_MessageId (decimal) MessageName: MessageSizeTransmitter;

[0081] They respectively represent: keyword_message ID, message name, number of bytes in the message data field, number of bytes in the message data field, and network node of the message.

[0082] 5. Signal definition

[0083] The format is as follows: SG_SignalName: StartBit|SignalSize@ByteOrderValueType(Factor, Offset)[Min|Max]Unit Receiver;

[0084] They represent: keyword_signal name, start bit, signal length@byte order, value type, offset, minimum and maximum values, signal unit, and receiving node respectively;

[0085] For example, a signal is: SG_HUD_BrightnessLv:15|4@0+(1,0)[0|15]"lv"ACU,AVNT means that a signal named HUD_BrightnessLv is defined, its starting bit is the 15th bit, and the signal length is 4 bits; the signal is in Motorola format, and the value type is an unsigned number; the factor is 1, and the offset is 0; the signal value range is 0 to 15; the signal unit is the string "lv"; the signal receiving nodes are the two nodes ACU and AVNT.

[0086] 6. Annotation definition

[0087] The format is as follows: CM_Object MessageId / NodeName "Comment";

[0088] They respectively represent: keyword_annotated object type, annotated object, and annotated text information.

[0089] 7. Attribute Definition

[0090] It includes two formats, namely the first format and the second format;

[0091] The first format is as follows: BA_DEF_Object AttributeNameValueType Min Max;

[0092] They represent: keyword_attribute definition object type, attribute name to be defined, attribute value type, and upper and lower limits of the attribute value.

[0093] The second format is as follows: BA_DEF_DEF_AttributeNameDefaultValue;

[0094] They respectively represent: keyword_initial value of the attribute.

[0095] 8. Definition of numerical table

[0096] The format is as follows: VAL_MessageIdSignalName N "DefineN"...0 "Define0";

[0097] They respectively represent: keyword_value table definition, the message ID to which the signal belongs, the signal name, and the value table content.

[0098] 9. J1939 protocol proprietary definition

[0099] The format is as follows: BA_DEF_SG_, BA_DEF_BO_, BA_DEF_BU_, BA_DEF_, BA_DEF_DEF_

[0100] They respectively represent: signal attributes, message frame attributes, network node attributes, first format attributes, and second format attributes.

[0101] In some embodiments of the present invention, the communication matrix is ​​in Excel format, and step S102 specifically includes: using the programming tool Visual Studio to create a C# project, importing the communication matrix, and generating a communication data table (DataTable).

[0102] The communication data table represents a table of data in the memory. The DataTable includes multiple data rows (DataRow) and data columns (DataColumn). The data can be viewed and operated through DataRow and DataColumn.

[0103] In some embodiments of the present invention, each piece of communication data includes multiple lines, and step S103 specifically includes: parsing each line of each piece of communication data.

[0104] In some embodiments of the present invention, Figure 2 As shown, step S103 includes:

[0105] S201, establish an initial character string of variable length;

[0106] S202, parsing the communication data according to the key elements, obtaining the version and new character definition, baud rate definition, network node definition, message frame definition, signal definition, annotation definition, attribute definition, value table definition and J1939 protocol proprietary definition in the communication data;

[0107] S203, write the version and new character definition, baud rate definition, network node definition, message frame definition, signal definition, annotation definition, attribute definition, value table definition and J1939 protocol proprietary definition in the communication data into the initial character string to obtain the communication character string.

[0108] In some embodiments of the present invention, Figure 3 As shown, step S104 includes:

[0109] S301, constructing a DBC empty file;

[0110] S302 , write multiple communication character strings into a DBC empty file and merge them to obtain a DBC file.

[0111] Since the generated target DBC file needs to be readable by the CAN software, in order to avoid the technical problem that the CAN software cannot read the generated target DBC file, resulting in the target DBC file being unavailable, in some embodiments of the present invention, such as Figure 4 As shown, step S105 includes:

[0112] S401, loading the DBC file based on the preset CAN software, and determining whether the loading is successful;

[0113] S402, if the loading is successful, the DBC file is complete and the DBC file is the target DBC file;

[0114] S403: If the loading is unsuccessful, the communication matrix is ​​corrected to obtain a corrected communication matrix, and a target DBC file is obtained based on the corrected communication matrix.

[0115] The embodiment of the present invention loads the DBC file based on the preset CAN software. When the loading is successful, the DBC file is the target DBC file. When the loading is unsuccessful, the communication matrix is ​​corrected to regain the target DBC file, thereby ensuring the reliability of the generated DBC file.

[0116] The CAN software in step S401 may be any CAN software in the prior art and is not specifically limited here.

[0117] The step S403 of obtaining the target DBC file based on the modified communication matrix may specifically include: using the modified communication matrix as the communication matrix, and repeating steps S102 to S105.

[0118] Furthermore, steps S101-S105 realize the generation of the target DBC file. In the actual network development process, it is also necessary to confirm whether the generated target DBC file supports the network simulation function, and the integrity of the target DBC file needs to be further verified through network simulation. Therefore, in some embodiments of the present invention, Figure 5 As shown, the DBC file generation method based on CAN communication also includes:

[0119] S501, establishing a CAN network simulation interface, and loading a target DBC file based on the CAN network simulation interface, performing network simulation, and generating network simulation results and / or simulation messages;

[0120] S502, determining the integrity of the target DBC file according to the simulation message and the communication matrix;

[0121] S503: Verify the network performance of the CAN network according to the network simulation result.

[0122] The embodiment of the present invention can further ensure the integrity and reliability of the target DBC file by determining the integrity of the target DBC file according to the simulation message and the communication matrix. The embodiment of the present invention can verify the network performance of the CAN network according to the network simulation result, thereby realizing the squareness of the CAN network and improving the subsequent vehicle network development efficiency.

[0123] Specifically, step S501 is as follows: establish a CAN network simulation interface, load the currently generated target DBC file for network simulation, synchronize all node data contents on the network segment defined by the target DBC file in the CAN network simulation interface, and load the simulation .dll file in the target DBC file properties as the protocol type. After the configuration is completed, the CAN software with the J1939 configuration can be directly clicked to run the simulation, and the software can merge multiple packets into one packet for parsing according to the J1939 protocol. The CAN network simulation interface will generate network simulation results and / or simulation messages according to the content defined in the target DBC file.

[0124] Specifically, step S502 is: placing the simulation message and the communication matrix in an Excel interface, comparing them through a preset comparison algorithm, identifying the differences between the communication matrix and the simulation message, and verifying the integrity of the target DBC file through the differences.

[0125] Specifically, the network simulation results include but are not limited to the load rate and cycle deviation of the CAN network. The network performance of the CAN network can be obtained through the load rate and cycle deviation of the CAN network.

[0126] In order to better implement the DBC file generation method based on CAN communication in the embodiment of the present invention, based on the DBC file generation method based on CAN communication, correspondingly, Figure 6 As shown, the embodiment of the present invention further provides a DBC file generation device based on CAN communication, and the DBC file generation device based on CAN communication 600 includes:

[0127] The database file parsing unit 601 is used to obtain a CAN database file and parse the CAN database file to obtain multiple key elements;

[0128] The communication matrix processing unit 602 is used to obtain a communication matrix and generate a communication data table according to the communication matrix, wherein the communication data table includes a plurality of communication data;

[0129] The communication data parsing unit 603 is used to parse the communication data one by one according to the key elements to obtain multiple communication character strings;

[0130] A DBC file generating unit 604 is used to merge multiple communication character strings to obtain a DBC file;

[0131] The integrity verification unit 605 is used to verify the integrity of the DBC file based on the preset CAN software and obtain the target DBC file.

[0132] The DBC file generation device 600 based on CAN communication provided in the above embodiment can implement the technical solution described in the above embodiment of the DBC file generation method based on CAN communication. The specific implementation principles of the above modules or units can refer to the corresponding contents in the above embodiment of the DBC file generation method based on CAN communication, which will not be repeated here.

[0133] like Figure 7 As shown, the present invention also provides an electronic device 700. The electronic device 700 includes a processor 701, a memory 702 and a display 703. Figure 7 Only some components of the electronic device 700 are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0134] In some embodiments, the processor 701 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 702, such as the DBC file generation method based on CAN communication in the present invention.

[0135] In some embodiments, the processor 701 may be a single server or a server group. The server group may be centralized or distributed. In some embodiments, the processor 701 may be local or remote. In some embodiments, the processor 701 may be implemented in a cloud platform. In some embodiments of the present invention, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, a multi-cloud, etc., or any combination thereof.

[0136] In some embodiments, the memory 702 may be an internal storage unit of the electronic device 700, such as a hard disk or memory of the electronic device 700. In other embodiments, the memory 702 may also be an external storage device of the electronic device 700, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 700.

[0137] Furthermore, the memory 702 may include both an internal storage unit of the electronic device 700 and an external storage device. The memory 702 is used to store application software installed in the electronic device 700 and various data.

[0138] In some embodiments, the display 703 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 703 is used to display information on the electronic device 700 and to display a visual user interface. The components 701-703 of the electronic device 700 communicate with each other via a system bus.

[0139] In some embodiments of the present invention, when the processor 701 executes the DBC file generation program based on CAN communication in the memory 702, the following steps may be implemented:

[0140] Obtain the CAN database file, and parse the CAN database file to obtain multiple key elements;

[0141] Acquire a communication matrix, and generate a communication data table according to the communication matrix, wherein the communication data table includes a plurality of communication data;

[0142] Parse the communication data one by one according to key elements to obtain multiple communication character strings;

[0143] Merge multiple communication strings to obtain DBC files;

[0144] Verify the integrity of the DBC file based on the preset CAN software and obtain the target DBC file.

[0145] It should be understood that: when the processor 701 executes the DBC file generation program based on CAN communication in the memory 702, in addition to the above functions, other functions can also be implemented. For details, please refer to the description of the corresponding method embodiment above.

[0146] Furthermore, the embodiment of the present invention does not specifically limit the type of the electronic device 700 mentioned, and the electronic device 700 may be a portable electronic device such as a mobile phone, a tablet computer, a personal digital assistant (PDA), a wearable device, a laptop computer, etc. Exemplary embodiments of portable electronic devices include but are not limited to portable electronic devices equipped with IOS, Android, Microsoft or other operating systems. The above-mentioned portable electronic devices may also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present invention, the electronic device 700 may not be a portable electronic device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel).

[0147] Accordingly, an embodiment of the present application also provides a computer-readable storage medium, which is used to store computer-readable programs or instructions. When the program or instructions are executed by a processor, the steps or functions of the DBC file generation method based on CAN communication provided in the above-mentioned method embodiments can be implemented.

[0148] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.

[0149] The DBC file generation method, device, equipment and medium based on CAN communication provided by the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A DBC file generation method based on CAN communication, characterized in that: include: Obtaining a CAN database file, and parsing the CAN database file to obtain multiple key elements; Acquire a communication matrix, and generate a communication data table according to the communication matrix, wherein the communication data table includes a plurality of communication data; Parsing the communication data one by one according to the key elements to obtain multiple communication character strings; Merging the multiple communication character strings to obtain a DBC file; Verify the integrity of the DBC file based on the preset CAN software and obtain the target DBC file; The CAN database file includes a standard frame database file and an extended frame J1939 database file; The various key elements include version and new character definition, baud rate definition, network node definition, message frame definition, signal definition, annotation definition, attribute definition, value table definition and J1939 protocol proprietary definition; The step of parsing the communication data one by one according to the key elements to obtain a plurality of communication character strings includes: Create an initial variable-length string; Parsing the communication data according to the key elements, obtaining version and new character definitions, baud rate definitions, network node definitions, message frame definitions, signal definitions, annotation definitions, attribute definitions, value table definitions, and J1939 protocol-specific definitions in the communication data; The version and new character definition, baud rate definition, network node definition, message frame definition, signal definition, annotation definition, attribute definition, value table definition and J1939 protocol-specific definition in the communication data are written into the initial character string to obtain the communication character string.

2. The DBC file generation method based on CAN communication according to claim 1 is characterized in that: The step of merging the plurality of communication character strings to obtain a DBC file includes: Construct DBC empty file; The multiple communication character strings are written into the DBC empty file and merged to obtain the DBC file.

3. The DBC file generation method based on CAN communication according to claim 1 is characterized in that: The method of verifying the integrity of the DBC file based on the preset CAN software and obtaining the target DBC file includes: Loading the DBC file based on the preset CAN software, and determining whether the loading is successful; If the loading is successful, the DBC file is complete and the DBC file is the target DBC file; If the loading is unsuccessful, the communication matrix is ​​corrected to obtain a corrected communication matrix, and the target DBC file is obtained based on the corrected communication matrix.

4. The DBC file generation method based on CAN communication according to claim 1 is characterized in that: The DBC file generation method based on CAN communication also includes: Establishing a CAN network simulation interface, and loading the target DBC file based on the CAN network simulation interface, performing network simulation, and generating network simulation results and / or simulation messages; Determine the integrity of the target DBC file according to the simulation message and the communication matrix; The network performance of the CAN network is verified according to the network simulation results.

5. A DBC file generation device based on CAN communication, characterized in that: include: A database file parsing unit, used for acquiring a CAN database file and parsing the CAN database file to obtain a plurality of key elements; A communication matrix processing unit, used to obtain a communication matrix and generate a communication data table according to the communication matrix, wherein the communication data table includes a plurality of communication data; A communication data parsing unit, configured to parse the communication data one by one according to the key elements to obtain a plurality of communication character strings; A DBC file generating unit, used for merging the plurality of communication character strings to obtain a DBC file; An integrity verification unit, used to verify the integrity of the DBC file based on a preset CAN software and obtain a target DBC file; The CAN database file includes a standard frame database file and an extended frame J1939 database file; The various key elements include version and new character definition, baud rate definition, network node definition, message frame definition, signal definition, annotation definition, attribute definition, value table definition and J1939 protocol proprietary definition; The step of parsing the communication data one by one according to the key elements to obtain a plurality of communication character strings includes: Create an initial variable-length string; Parsing the communication data according to the key elements, obtaining version and new character definitions, baud rate definitions, network node definitions, message frame definitions, signal definitions, annotation definitions, attribute definitions, value table definitions, and J1939 protocol-specific definitions in the communication data; The version and new character definition, baud rate definition, network node definition, message frame definition, signal definition, annotation definition, attribute definition, value table definition and J1939 protocol-specific definition in the communication data are written into the initial character string to obtain the communication character string.

6. An electronic device, characterized in that: comprising a memory and a processor, wherein: The memory is used to store programs; The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps in the DBC file generation method based on CAN communication as described in any one of claims 1 to 4 above.

7. A computer-readable storage medium, characterized in that: Used to store computer-readable programs or instructions, which, when executed by a processor, can implement the steps in the DBC file generation method based on CAN communication as described in any one of claims 1 to 4 above.

Citation Information

Patent Citations

  • DBC file analysis method and DBC file analysis program design method based on CAN communication

    CN107132832A

  • A method and a system for generating a database file of an automobile communication protocol

    CN109033338A

  • Method for quickly creating DBC file following CAN bus communication protocol

    CN112799321A