Vehicle-mounted bus communication database file detection method and device and storage medium
Through a method of detecting a vehicle bus communication database file, including parsing and detecting message messages in the vehicle bus communication database file, the requirements for communication protocol detection in a fast iterative ECU environment are solved, and fast and efficient detection effects are achieved, providing reliable support for integrated development.
Patent Information
- Application Number
- CN202510073983.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2045-01-17
AI Technical Summary
In the context of rapid iteration of automotive electronic control units (ECUs), on-board bus communication database files (such as CAN database files and LIN description files) need to be quickly automated to ensure that communication protocols are released to the integration team without problems.
Provide a method for detecting database files on-board bus communication, including obtaining the database files to be detected, parsing the files and storing message messages, polling the message list for a number of preset detection items (such as message length matching, signal initial value interval detection and signal position repeat detection), and summarizing and outputting test reports.
It realizes fast and efficient detection of vehicle-mounted bus communication database files, ensures the correctness and consistency of communication protocols, and provides support for subsequent integrated development.
Smart Images

Figure CN119906649A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication detection technology, and in particular to a vehicle bus communication database file detection method, device and storage medium. Background Art
[0002] With the increasingly widespread application of Automotive Open System Architecture (AUTOSAR) in the automotive field, the development cycle of new energy vehicle projects has been shortened, and the version of the automotive electronic control unit (ECU) has been rapidly iterated, resulting in the need for the vehicle platform communication protocol (controller area network CAN, local interconnect network LIN) to quickly update the baseline in response to the frequent changes in the needs of different models. The frequently changed communication protocol CAN database files (DataBase CAN, referred to as DBC files) and LIN Description Files (LIN Description File, referred to as LDF files) need to be quickly and automatically tested to ensure that they are released to the integration team without problems. Therefore, how to quickly and efficiently complete the detection of the vehicle bus communication database files has become an urgent problem to be solved. Summary of the invention
[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present application provides a vehicle bus communication database file detection method, device and storage medium.
[0004] In a first aspect, the present application provides a method for detecting a vehicle bus communication database file, the method comprising:
[0005] Acquire a vehicle bus communication database file to be detected; wherein the vehicle bus communication database file includes a DBC file and / or an LDF file;
[0006] Parsing the vehicle bus communication database file, and storing the message corresponding to the read vehicle bus communication database file into a message list;
[0007] Polling the message list, and testing the message according to a plurality of preset test items; wherein the preset test items at least include a message length matching test, a signal initial value detection whether it is within an expected interval, and a signal position repetition test in the same message;
[0008] The test report is output based on the summary of each test result.
[0009] Optionally, parsing the vehicle bus communication database file, and storing the message corresponding to the read vehicle bus communication database file into a message list includes:
[0010] Parsing the DBC file based on the first parsing library, and storing the read CAN message information into a CAN message list; wherein the first parsing library is used to parse files in DBC format;
[0011] The LDF file is parsed based on a second parsing library, and the read LIN message message is stored in a LIN message list; wherein the second parsing library is used to parse files in the LDF format.
[0012] Optionally, the preset detection items also include at least one of message repeatability detection, signal repeatability detection, signal interval detection, message unassociated sending node detection and message unassociated receiving node detection.
[0013] Optionally, the detection process of the message duplication detection includes:
[0014] Poll the message list in sequence to obtain a first target number of occurrences of each target message name, and obtain a second target number of occurrences of each target message identifier;
[0015] If the first target number is greater than 1, the target message corresponding to the first target number is repeated;
[0016] If the second target number is greater than 1, the target message corresponding to the second target number is repeated;
[0017] The detection process of the signal repeatability detection includes:
[0018] Polling the message list in sequence to obtain the third target number of occurrences of each target signal name;
[0019] If the third target number is greater than 1, the target signal corresponding to the third target number is repeated.
[0020] Optionally, the detection process of the message length matching detection includes:
[0021] Poll the message list in sequence to obtain the number of bytes of the data segment of the target message; wherein the number of bytes of the data segment is used to represent the maximum length allowed by the target message;
[0022] Obtaining the signal start bit and actual length of the target message;
[0023] The length of the target message is detected according to the signal start bit, the actual length and the number of bytes in the data segment.
[0024] Optionally, the detection process of the signal interval detection includes:
[0025] Poll the message list in sequence to obtain the physical minimum value, physical maximum value and data length of the target signal;
[0026] Obtaining an expected minimum value and an expected maximum value of the target signal; wherein the expected maximum value is calculated based on the data length;
[0027] If the physical minimum value and the physical maximum value are both between the expected minimum value and the expected maximum value, and the physical minimum value is less than the physical maximum value, the signal interval detection of the target signal is normal;
[0028] The detection process of whether the initial value of the signal is within the expected interval includes:
[0029] Poll the message list in sequence to obtain the coefficient, deviation value and initial value of the target signal;
[0030] Calculate the actual initial value of the target signal according to the coefficient, the deviation value and the initial value;
[0031] It is determined whether the actual initial value is between the expected minimum value and the expected maximum value.
[0032] Optionally, the detection process of repeated detection of signal positions in the same message includes:
[0033] Poll the message list in sequence to obtain the signal start bit and signal length corresponding to each target signal under the target message;
[0034] Calculate the signal range of the target signal according to the signal start bit and the signal length;
[0035] According to the signal range of the target signal, whether the positions of any two target signals under the target message overlap is detected; wherein, if there is any number of bit overlaps between the two target signals, there is position duplication between the two target signals.
[0036] Optionally, the detection process of detecting that the message is not associated with a sending node includes:
[0037] Poll the message list in sequence to obtain the sending node of the target message;
[0038] If the sending node is empty, the target message is not associated with a sending node;
[0039] If the sending node is not empty, determining whether the sending node is unique;
[0040] The detection process of the message not being associated with the receiving node includes:
[0041] Poll the message list in sequence to obtain the receiving node of the target message;
[0042] If the receiving node is empty, the target message is not associated with a receiving node;
[0043] If the receiving nodes are not empty, the number of the receiving nodes is determined.
[0044] Optionally, when the vehicle bus communication database file is an LDF file, the preset detection item further includes coding format detection; the detection process of the coding format detection includes:
[0045] Poll the message list in sequence to obtain the encoding format value of the target message signal;
[0046] If the encoding format value of the target message signal is empty, the target message signal is not configured with an encoding format;
[0047] If the encoding format value of the target message signal is not empty, the encoding format is determined to be a physical encoding format or a logical encoding format according to the encoding format value.
[0048] In a second aspect, the present application provides a vehicle bus communication database file detection device, the device comprising:
[0049] An acquisition module, used for acquiring a vehicle bus communication database file to be detected; wherein the vehicle bus communication database file includes a DBC file and / or an LDF file;
[0050] A parsing module, used for parsing the vehicle bus communication database file, and storing the message corresponding to the vehicle bus communication database file read into a message list;
[0051] A detection module, used to poll the message list and detect the message according to a plurality of preset detection items; wherein the preset detection items at least include message length matching detection, signal initial value detection whether it is in an expected interval, and signal position duplication detection in the same message;
[0052] The report output module is used to summarize and output the test report based on the test results.
[0053] In a third aspect, the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0054] Memory, used to store computer programs;
[0055] The processor is used to implement the steps of the vehicle bus communication database file detection method described in any embodiment of the first aspect when executing the program stored in the memory.
[0056] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the vehicle bus communication database file detection method as described in any embodiment of the first aspect are implemented.
[0057] Beneficial effects of this application:
[0058] The method provided in the embodiment of the present application obtains the vehicle bus communication database file to be detected; wherein the vehicle bus communication database file includes a DBC file and / or an LDF file; parses the vehicle bus communication database file, and stores the message corresponding to the read vehicle bus communication database file into a message list; polls the message list, and detects the message according to a plurality of preset detection items; and outputs a test report based on the summary of the detection results. The method can detect the message corresponding to the read vehicle bus communication database file according to the preset detection items, such as message length matching detection, signal initial value detection whether it is in the expected interval, and signal position repetition detection in the same message, so as to efficiently and quickly complete the detection of the vehicle bus communication database file, and provide support for subsequent integrated development. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0060] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0061] Figure 1 A system architecture diagram of a vehicle bus communication database file detection method provided by one embodiment of the present application;
[0062] Figure 2 A flowchart of a vehicle bus communication database file detection method provided by one embodiment of the present application;
[0063] Figure 3 A flowchart of a vehicle bus communication database file detection method provided by one embodiment of the present application;
[0064] Figure 4A DBC file detection flow chart provided for an embodiment of the present application;
[0065] Figure 5 A LDF file detection flow chart provided for an embodiment of the present application;
[0066] Figure 6 A schematic diagram of the structure of a vehicle bus communication database file detection device provided by one embodiment of the present application;
[0067] Figure 7 A schematic diagram of the structure of an electronic device provided in accordance with an embodiment of the present application. DETAILED DESCRIPTION
[0068] The following will describe the implementation methods of the present application with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for illustrating the present application, not for limiting the scope of protection of the present application.
[0069] The first embodiment of the present application provides a vehicle bus communication database file detection method, which can be applied to Figure 1 The system architecture shown in the figure at least includes a file acquisition module 101 and a file detection module 102, and the file acquisition module 101 and the file detection module 102 establish a communication connection. Specifically, the system architecture can be an automated testing system, without limitation.
[0070] Next, based on the system architecture, the vehicle bus communication database file detection method is described in detail, such as Figure 2 The vehicle bus communication database file detection method comprises:
[0071] Step 201, obtaining a vehicle bus communication database file to be detected; wherein the vehicle bus communication database file includes a DBC file and / or an LDF file.
[0072] In this embodiment, the vehicle bus communication database file of each vehicle model can be prepared in advance. The vehicle bus communication database file is a communication protocol file, which can include a DBC file and an LDF file. The vehicle bus communication database file can be placed in a specified storage address, such as a specified folder. After the automatic test system is started, the file in the folder can be loaded into the automatic test system for file detection.
[0073] The flow chart of the communication protocol file detection of the automated test system can be as follows: Figure 3 , including: testing input of communication files of various vehicle models; CAN and LIN message analysis; CAN and LIN file detection; and test report generation. The specific steps are described in detail in the following embodiments.
[0074] Step 202: parse the vehicle bus communication database file, and store the message corresponding to the read vehicle bus communication database file into a message list.
[0075] In one embodiment, the vehicle bus communication database file is parsed, and the message information corresponding to the read vehicle bus communication database file is stored in a message list, including: parsing the DBC file based on the first parsing library, and storing the read CAN message information in the CAN message list; wherein the first parsing library is used to parse the file in the DBC format; parsing the LDF file based on the second parsing library, and storing the read LIN message information in the LIN message list; wherein the second parsing library is used to parse the file in the LDF format.
[0076] In this embodiment, the first parsing library can be the cantools.database library in python. For files with a suffix of .dbc, the cantools.database library in python is introduced to read, and all the CAN message information read in sequence is stored in the CAN message list (CAN Messages list) for subsequent retrieval and judgment based on the detection standard. The use of the cantools.database library can achieve efficient parsing of DBC data, which is faster than writing code to identify various contents separately. The second parsing library can be the ldfparser.parse_ldf library in python. For files with a suffix of .ldf, the ldfparser.parse_ldf library in python is introduced to read, and all the LIN message information read in sequence is stored in the LIN message list (LIN Messages list) for subsequent retrieval and judgment based on the detection standard.
[0077] Specifically, the DBC file is parsed using the cantools.database library. The parsed content contains at least the following 8 types of information:
[0078] 1. Version and new symbol: VERSION;
[0079] 2. Baud rate definition: BS_:[baudrate:BTR1,BTR2];
[0080] 3. Network node definition: BU_:Nodename1 Nodename2;
[0081] 4. Definition of message frame: BO_MessageId MessageName:MessageSize Transmitter;
[0082] 5. Signal definition: SG_SignalName:StartBit|SignalSize@ByteOrder ValueType(Factor,Offset)
[0083] [Min|Max]Unit Receiver;
[0084] 6. Comment part: CM_Object MessageId / NodeName "Comment";
[0085] 7. Attribute definition part: BA_DEF_Object AttributeName ValueType Min Max; BA_DEF_DEF_AttributeName DefaultValue;
[0086] 8. Value table part: VAL_VAL_MessageId SignalName N "DefineN"...0 "Define0".
[0087] Use the ldfparser.parse_ldf library to parse the LDF file. The parsed content contains at least the following 10 types of information:
[0088] 1.ldf file configuration: version, baud rate;
[0089] 2. Node definition: master node, slave node;
[0090] 3.Signal definition: signal name, signal length, signal initial value, receiving node;
[0091] 4. Diagnostic signal information: message name, message length, signal initial value;
[0092] 5. Message information: message name, message ID, sending node, message length, signal name, signal start bit;
[0093] 6. Diagnostic message information: message name, message ID, signal name, signal start bit;
[0094] 7. Slave node information: protocol version, etc.
[0095] 8. Scheduling table: message name, delay;
[0096] 9. Description information: signal description definition name, defined value table content, maximum value, minimum value, precision, offset;
[0097] 10. Signal description association: Signal description defines the name and signal.
[0098] Step 203, polling the message list, and detecting the message according to a plurality of preset detection items; wherein the preset detection items at least include message length matching detection, whether the signal initial value is within the expected interval detection, and signal position repetition detection in the same message.
[0099] In one embodiment, the preset detection items further include at least one of message repeatability detection, signal repeatability detection, signal interval detection, message unassociated sending node detection, and message unassociated receiving node detection.
[0100] In this embodiment, the preset detection items may include not only the three detections of message length matching detection, signal initial value detection whether it is in the expected interval detection, and signal position duplication detection in the same message, but also message repeatability detection, signal repeatability detection, signal interval detection, message unassociated sending node detection, and message unassociated receiving node detection, so as to make the detection more comprehensive and provide more accurate post-detection data for subsequent integrated development. Next, each detection item is described in detail.
[0101] In one embodiment, the detection process of message duplication detection includes: polling the message list in sequence, obtaining the first target number of occurrences of each target message name, and obtaining the second target number of occurrences of each target message identifier; if the first target number is greater than 1, the target message corresponding to the first target number is repeated; if the second target number is greater than 1, the target message corresponding to the second target number is repeated.
[0102] The detection process of signal repeatability detection includes: polling the message list in sequence to obtain the third target number of occurrences of each target signal name; if the third target number is greater than 1, the target signal corresponding to the third target number is repeated.
[0103] In this embodiment, the message list includes multiple message messages, and the target message refers to a message message among all the messages. For any target message, the first target number of occurrences of the target message name name of the target message is obtained, and the second target number of occurrences of the target message identifier frame_id of the target message is obtained. If the target message name appears multiple times or the target message identifier appears multiple times, the target message is repeated. The signal repeatability detection is similar to the message repeatability detection. The message list is polled to obtain the third target number of occurrences of the target signal name name of each target signal signal. If the third target number is greater than 1, the target signal is repeated.
[0104] In one embodiment, the detection process of message length matching detection includes: polling the message list in sequence to obtain the number of data segment bytes of the target message; wherein the number of data segment bytes is used to represent the maximum length allowed by the target message; obtaining the signal start bit and actual length of the target message; and detecting the length of the target message based on the signal start bit, actual length and number of data segment bytes.
[0105] In this embodiment, the number of bytes in the data segment can be the DLC (Data Length Code) of the message, in bytes, to obtain the signal start bit and actual length of the target message. For example, if the DLC of message_ID1 is 8 bytes, the length range is 0-63 bits, and the start bit of signal signal_1 is 68 and the length is 4 bits, then it is obvious that signal signal_1 has exceeded the overall length range of message_ID1, and it can be determined that the length of the target message does not match.
[0106] In one embodiment, the detection process of signal interval detection includes: polling the message list in sequence to obtain the physical minimum value, physical maximum value and data length of the target signal; obtaining the expected minimum value and expected maximum value of the target signal; wherein the expected maximum value is calculated based on the data length; if the physical minimum value and the physical maximum value are both between the expected minimum value and the expected maximum value, and the physical minimum value is less than the physical maximum value, then the signal interval detection of the target signal is normal.
[0107] The detection process of whether the initial value of the signal is within the expected interval includes: polling the message list in sequence to obtain the coefficient, deviation value and initial value of the target signal; calculating the actual initial value of the target signal according to the coefficient, deviation value and initial value; and judging whether the actual initial value is between the expected minimum value and the expected maximum value.
[0108] In this embodiment, when detecting the signal interval, the physical minimum value Minimum, the physical maximum value Maximum and the data length signal.Length of the target signal can be obtained. The expected minimum value and the expected maximum value of the target signal can be calculated based on the data length. If the physical minimum value and the physical maximum value are both between the expected minimum value and the expected maximum value, and the physical minimum value is less than the physical maximum value, the signal interval detection of the target signal is normal. It should be noted that the DBC file and the LDF file are slightly different in signal interval detection, which will be described in detail in the subsequent embodiments.
[0109] In this embodiment, the detection process of whether the initial value of the signal is within the expected interval includes: polling the message list in sequence to obtain the coefficient Factor, deviation value Offset and initial value Init_Value of the target signal; calculating the actual initial value of the target signal according to the coefficient, deviation value and initial value; judging whether the actual initial value is between the expected minimum value and the expected maximum value.
[0110] In one embodiment, the detection process of signal position duplication detection in the same message includes: polling the message list in sequence to obtain the signal start bit and signal length corresponding to each target signal under the target message; calculating the signal range of the target signal based on the signal start bit and the signal length; based on the signal range of the target signal, detecting whether the positions of any two target signals under the target message overlap; wherein, if there is any number of bit overlaps between the two target signals, then there is position duplication between the two target signals.
[0111] If the problem of repeated signal positions cannot be intercepted during the detection process, the signal may be lost due to repeated signal positions, which will cause great impact or blockage in the subsequent communication establishment and communication test. In this embodiment, the message list is polled to obtain the signal start bit and signal length Length corresponding to all signals under the annihilation message, and the range of the target signal is calculated according to the signal start bit and signal length. If there is any number of bit overlaps between any two target signals under the target message, the two target signals have repeated positions, thereby completing the detection of repeated signal positions.
[0112] In one embodiment, the detection process of the message not associated with the sending node includes: polling the message list in sequence to obtain the sending node of the target message; if the sending node is empty, the target message is not associated with the sending node; if the sending node is not empty, determining whether the sending node is unique.
[0113] The detection process of the message unassociated receiving node detection includes: polling the message list in sequence to obtain the receiving node of the target message; if the receiving node is empty, the target message is not associated with the receiving node; if the receiving node is not empty, determining the number of receiving nodes.
[0114] In this embodiment, if the sending node is empty, it means that the target message is not associated with the sending node. If the sending node is not empty, it is determined whether the sending node is unique. If the receiving node is empty, the target message is not associated with the receiving node; if the receiving node is not empty, the number of receiving nodes can be determined.
[0115] In one embodiment, when the vehicle bus communication database file is an LDF file, the preset detection items also include coding format detection; the detection process of the coding format detection includes: polling the message list in sequence to obtain the coding format value of the target message signal; if the coding format value of the target message signal is empty, the target message signal is not configured with a coding format; if the coding format value of the target message signal is not empty, determining whether the coding format is a physical coding format or a logical coding format according to the coding format value.
[0116] In this embodiment, when detecting the encoding format of the LDF file, the encoding format value encoding_type of the target message signal is obtained in turn by polling the message list, and it is determined whether encoding_type is empty. If it is empty, it indicates that the encoding format is not configured. If it is not empty, the encoding format can be determined as a physical encoding format physical or a logical encoding format logical according to the value of encoding_type.
[0117] Step 204: Output a test report based on the test results.
[0118] The method can detect the message information corresponding to the read vehicle bus communication database file according to preset detection items, such as message length matching detection, signal initial value detection whether it is in the expected interval, and signal position repetition detection in the same message, so as to efficiently and quickly complete the detection of the vehicle bus communication database file and provide support for subsequent integrated development.
[0119] In a specific embodiment, the DBC file detection flow chart is as follows: Figure 4 ,include:
[0120] Step 1: Message duplication detection. The specific implementation process is as follows:
[0121] 1. Poll the CAN Messages list in sequence and obtain the number of times a single message name is received in sequence;
[0122] 2. Poll the CAN Messages list in sequence and obtain the counter of the number of frame_ids of a single message in sequence;
[0123] 3. Determine the number of times each message name is counter. If counter>1, the message is considered to be repeated.
[0124] 4. Determine the number of frame_id counts of each message in turn. If counter>1, the message is determined to be repeated.
[0125] Step 2: Signal repeatability detection. The specific implementation process is as follows:
[0126] 1. Poll the CAN Messages list in sequence and obtain the number of times the signal name name is counter;
[0127] 2. Determine the number of times each signal signal occurs in each message in turn. If counter>1, the signal is determined to be repeated.
[0128] Step 3: The signal start bit / length does not match the message length. The specific implementation process is as follows:
[0129] 1. Poll the CAN Messages list in sequence and obtain the DLC (Data Length Code) of each message in turn, in bytes;
[0130] 2. For each message, get the start bit, length (bits), and byte order (Motorola or Intel) of the signal signal;
[0131] 3. If the signal size range (start bit - end bit) exceeds the DLC range, the signal length is determined to be mismatched. For example, if the DLC of message_ID1 is 8Byte, the length range is 0-63bit, and the start bit of signal_1 is 68, the length is 4 bits, and the byte order is Motorola. Obviously, signal_1 has exceeded the overall length range of message_ID1.
[0132] Step 4: Detect the maximum and minimum values of the signal (i.e., signal interval detection). The specific implementation process is as follows:
[0133] 1. Poll the CAN Messages list in sequence to obtain the minimum value Minimum, maximum value Maximum, data type Value Type, Length [Bit], Factor, and Offset of the signal name name in sequence.
[0134] 2. For data types of signed type, the calculation logic is as follows:
[0135] (1) The expected minimum boundary min_bound = -(2*(signal.Length-1)), and the expected maximum boundary max_bound = 2*(signal.Length-1)-1;
[0136] (2) Expected minimum value minimum = round (min_bound * signal.scale + signal.offset), expected maximum value maximum = round (max_bound * signal.scale + signal.offset);
[0137] (3) Determine whether the minimum value of the signal is between the expected minimum and maximum;
[0138] (4) Determine whether the maximum value of the signal is between the expected minimum and maximum;
[0139] (5) Determine whether the minimum value of the signal is less than the maximum value.
[0140] 3. For unsigned data types, the calculation logic is as follows:
[0141] (1) The expected minimum boundary min_bound = 0, and the expected maximum boundary max_bound = 2*(signal.Length-1)-1;
[0142] (2) Expected minimum value minimum = round (min_bound * signal.scale + signal.offset), expected maximum value maximum = round (max_bound * signal.scale + signal.offset);
[0143] (3) Determine whether the minimum value of the signal is between the expected minimum and maximum;
[0144] (4) Determine whether the maximum value of the signal is between the expected minimum and maximum;
[0145] (5) Determine whether the minimum value of the signal is less than the maximum value.
[0146] Step 5: Check whether the initial value (default value) is within the maximum and minimum value interval (i.e., check whether the initial value of the signal is within the expected interval).
[0147] The specific implementation process is as follows:
[0148] 1. Poll the CAN Messages list in sequence, and obtain the minimum value Minimum, maximum value Maximum, data type Value Type, Length [Bit], Factor, Offset, and Init_Value of the signal name name in sequence;
[0149] 2. The actual initial value of the signal default = signal.Init_Value * signal.Factor + signal.offset;
[0150] 3. Determine whether the initial value is between the expected minimum and maximum (calculated in step 4);
[0151] Step 6: Detection of message not being associated with the sending node. The specific implementation process is as follows:
[0152] 1. Poll the CAN Messages list in sequence and obtain the Transmitters of the message in sequence;
[0153] 2. Determine whether the sending node Transmitters is empty. If it is empty, it means that there is no associated sending node.
[0154] Step 7: Detection of message not being associated with receiving node. The specific implementation process is as follows:
[0155] 1. Poll the CAN Messages list in turn and obtain the receiving nodes of the messages in turn;
[0156] 2. Determine whether the receiving node Receivers is empty. If it is empty, it means that there is no associated receiving node.
[0157] Step 8: Repeat detection of different signal positions in the same message. The specific implementation process is as follows:
[0158] 1. Poll the CAN Messages list in sequence, and obtain the signal data types Value Type, Startbit, and Length[Bit] of all signals in each message in sequence;
[0159] 2. Calculate the size range of each signal: Value Type = Motorola (big endian timing: high byte first, low byte last), that is, data is stored from left to right and from top to bottom;
[0160] 3. Compare each signal in each message with other signals in the same message to check if there is any overlap. If there is any overlap at all, the position is considered to be repeated.
[0161] In a specific embodiment, the LDF file detection flow chart is as follows: Figure 5 ,include:
[0162] Step 1: Message duplication detection. The specific implementation process is as follows:
[0163] 1. Poll the LIN Messages list in sequence and obtain the counter of the number of times a single message name appears in sequence;
[0164] 2. Poll the LIN Messages list in sequence and obtain the counter of the number of frame_ids of a single message in sequence;
[0165] 3. Determine the number of times each message name is counter. If counter>1, the message is considered to be repeated.
[0166] 4. Determine the number of frame_id counts of each message in turn. If counter>1, the message is determined to be repeated.
[0167] Step 2: Signal repeatability detection. The specific implementation process is as follows:
[0168] 1. Poll the LIN Messages list in sequence and obtain the number of times the signal name name is counter;
[0169] 2. Determine the number of times each signal signal occurs in each message in turn. If counter>1, the signal is determined to be repeated.
[0170] Step 3: The signal start bit / length does not match the message length. The specific implementation process is as follows:
[0171] 1. Poll the LIN Messages list in sequence and obtain the number of bytes in the data segment of each message in Byte;
[0172] 2. For each message, obtain the start bit, length (bits), byte order (Intel), and encoding format (physical or logical) of the signal signal;
[0173] 3. If the signal range (start bit - end bit) exceeds the range of the message length, the signal length is determined to be mismatched. For example, the number of bytes in the data segment of message_ID1 is 8, and the length range is 0-63 bits. The start bit of signal_1 is 60, the length is 8 bits, and the last bit 67 is greater than 63. It is obvious that signal_1 has exceeded the overall length range of message_ID1.
[0174] Step 4: Detect the maximum and minimum values of the signal (i.e., signal interval detection). The specific implementation process is as follows:
[0175] 1. Poll the LIN Messages list in sequence, and obtain the physical minimum value Minimum, physical maximum value Maximum, and data length bit Size_Bit of the signal name name in sequence.
[0176] 2. The calculation logic of the maximum and minimum values of the signal is as follows:
[0177] (1) The expected minimum boundary min_bound = 0, and the expected maximum boundary max_bound = 2*(signal.Size_Bit-1)-1;
[0178] (2) Determine whether the signal's physical minimum value is between the expected min_bound and max_bound;
[0179] (3) Determine whether the signal's physical maximum value is between the expected min_bound and max_bound;
[0180] (4) Determine whether the signal's physical minimum value is less than its physical maximum value.
[0181] Step 5: Check whether the initial value (default value) is within the maximum and minimum value interval (i.e., check whether the initial value of the signal is within the expected interval).
[0182] The specific implementation process is as follows:
[0183] 1. Poll the LIN Messages list in sequence, and obtain the physical minimum value Minimum, physical maximum value Maximum, Factor, Offset, and Init_Value of the signal name signal in sequence. If they are empty, they are automatically filled with 0;
[0184] 2. The actual initial value of the signal default = signal.Init_Value * signal.Factor + signal.offset;
[0185] 3. Determine whether the actual initial value is between the expected min_bound and max_bound (calculated in step 4);
[0186] Step 6: Detection of message not being associated with the sending node. The specific implementation process is as follows:
[0187] 1. Poll the LIN Messages list in sequence and obtain the sending node Publisher of the message in sequence;
[0188] 2. Determine whether the sending node Publisher is empty. If it is empty, it means that there is no associated sending node;
[0189] 3. Determine the uniqueness of the Publisher.
[0190] Step 7: Detection of message not being associated with receiving node. The specific implementation process is as follows:
[0191] 1. Poll the LIN Messages list in turn and obtain the receiving nodes of the message in turn;
[0192] 2. Determine whether the receiving node Subscribers is empty. If it is empty, it means that there is no associated receiving node;
[0193] 3. Determine whether there are 1 or more Subscribers.
[0194] Step 8: The message signal in the LDF file is not configured with encoding_type detection. The specific implementation process is as follows:
[0195] 1. Poll the LIN Messages list in sequence and obtain the encoding_type of the message signal in sequence;
[0196] 2. Determine whether encoding_type is empty. If it is empty, it means encoding_type is not configured;
[0197] 3. Determine whether the value of encoding_type is physical or logical, or both.
[0198] Step 9: Repeat detection of different signal positions in the same message. The specific implementation process is as follows:
[0199] 1. Poll the LIN Messages list in sequence, and obtain the Startbit and Length[Bit] of all signals in each message in sequence;
[0200] 2. Calculate the size range of each signal: [Startbit, Startbit+Length-1];
[0201] 3. Compare each signal in each message with other signals in the same message to check if there is any overlap. If there is only one bit overlap, the position is considered to be repeated.
[0202] In this embodiment, the limitations of the prior art are overcome, and a stable, fast, simplified, and reusable automated detection system for CAN and LIN database files (DBC files and LDF files) is provided for the rapid iteration rhythm of ECU controllers under the Autosar architecture. The communication files of different models can be quickly batch tested. The number of communication files for each model is in the range of 20-30. It only takes about 12s-18s to complete the verification of all communication files of a model, and output a test report to ensure that the communication protocol can be quickly released to other teams such as subsequent integration.
[0203] Based on the same technical concept, the second embodiment of the present application provides a vehicle bus communication database file detection device, such as Figure 6 , the device comprises:
[0204] The acquisition module 601 is used to acquire the vehicle bus communication database file to be detected; wherein the vehicle bus communication database file includes a DBC file and / or an LDF file;
[0205] The parsing module 602 is used to parse the vehicle bus communication database file and store the message corresponding to the vehicle bus communication database file read into a message list;
[0206] A detection module 603 is used to poll the message list and detect the message according to a plurality of preset detection items; wherein the preset detection items at least include a message length matching detection, a signal initial value detection whether it is in an expected interval, and a signal position repetition detection in the same message;
[0207] The report output module 604 is used to output a test report based on the summary of various test results.
[0208] The device can detect the message information corresponding to the read vehicle bus communication database file according to preset detection items, such as message length matching detection, signal initial value detection whether it is in the expected interval, and signal position repetition detection in the same message, so as to efficiently and quickly complete the detection of the vehicle bus communication database file and provide support for subsequent integrated development.
[0209] like Figure 7 As shown, the third embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0210] Memory 113, used for storing computer programs;
[0211] In one embodiment, the processor 111 is configured to implement the vehicle bus communication database file detection method provided by any one of the aforementioned method embodiments when executing the program stored in the memory 113 .
[0212] The memory and processor in the above electronic device communicate through a communication bus and a communication interface. The communication bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus can be divided into an address bus, a data bus, a control bus, etc.
[0213] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0214] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0215] A fourth embodiment of the present application provides a computer-readable medium having a non-volatile program code executable by a processor.
[0216] Optionally, in an embodiment of the present application, a computer-readable medium is configured to store program code for a processor to execute the above method.
[0217] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.
[0218] When the embodiments of the present application are specifically implemented, reference may be made to the above-mentioned embodiments, which have corresponding technical effects.
[0219] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions of the present application, or a combination thereof.
[0220] For software implementation, the technology of this article can be implemented by a unit that performs the functions of this article. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.
[0221] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0222] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0223] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0224] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0225] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0226] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0227] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0228] The above embodiments are only preferred embodiments for fully illustrating the present application, and the protection scope of the present application is not limited thereto. Any equivalent substitution or change made by a person skilled in the art based on the present application is within the protection scope of the present application.
Claims
1. A vehicle bus communication database file detection method, characterized in that: The method comprises: Acquire a vehicle bus communication database file to be detected; wherein the vehicle bus communication database file includes a DBC file and / or an LDF file; Parsing the vehicle bus communication database file, and storing the message corresponding to the read vehicle bus communication database file into a message list; Polling the message list, and testing the message according to a plurality of preset test items; wherein the preset test items at least include a message length matching test, a signal initial value detection whether it is within an expected interval, and a signal position repetition test in the same message; The test report is output based on the summary of each test result.
2. The method according to claim 1, characterized in that Parsing the vehicle bus communication database file, and storing the message corresponding to the read vehicle bus communication database file into a message list, including: Parsing the DBC file based on the first parsing library, and storing the read CAN message information into a CAN message list; wherein the first parsing library is used to parse files in DBC format; The LDF file is parsed based on a second parsing library, and the read LIN message message is stored in a LIN message list; wherein the second parsing library is used to parse files in the LDF format.
3. The method according to claim 1, characterized in that The preset detection items also include at least one of message repeatability detection, signal repeatability detection, signal interval detection, message unassociated sending node detection and message unassociated receiving node detection.
4. The method according to claim 3, characterized in that The detection process of the message duplication detection includes: Poll the message list in sequence to obtain a first target number of occurrences of each target message name, and obtain a second target number of occurrences of each target message identifier; If the first target number is greater than 1, the target message corresponding to the first target number is repeated; If the second target number is greater than 1, the target message corresponding to the second target number is repeated; The detection process of the signal repeatability detection includes: Polling the message list in sequence to obtain the third target number of occurrences of each target signal name; If the third target number is greater than 1, the target signal corresponding to the third target number is repeated.
5. The method according to claim 3, characterized in that: The detection process of the message length matching detection includes: Poll the message list in sequence to obtain the number of bytes of the data segment of the target message; wherein the number of bytes of the data segment is used to represent the maximum length allowed by the target message; Obtaining the signal start bit and actual length of the target message; The length of the target message is detected according to the signal start bit, the actual length and the number of bytes in the data segment.
6. The method according to claim 3, characterized in that The detection process of the signal interval detection includes: Poll the message list in sequence to obtain the physical minimum value, physical maximum value and data length of the target signal; Acquire an expected minimum value and an expected maximum value of the target signal; wherein the expected maximum value is calculated based on the data length; If the physical minimum value and the physical maximum value are both between the expected minimum value and the expected maximum value, and the physical minimum value is less than the physical maximum value, the signal interval detection of the target signal is normal; The detection process of whether the initial value of the signal is within the expected interval includes: Poll the message list in sequence to obtain the coefficient, deviation value and initial value of the target signal; Calculate the actual initial value of the target signal according to the coefficient, the deviation value and the initial value; It is determined whether the actual initial value is between the expected minimum value and the expected maximum value.
7. The method according to claim 1, characterized in that The detection process of repeated detection of signal positions in the same message includes: Poll the message list in sequence to obtain the signal start bit and signal length corresponding to each target signal under the target message; Calculate the signal range of the target signal according to the signal start bit and the signal length; According to the signal range of the target signal, whether the positions of any two target signals under the target message overlap is detected; wherein, if there is any number of bit overlaps between the two target signals, there is position duplication between the two target signals.
8. The method according to claim 3, characterized in that The detection process of the message not being associated with the sending node includes: Poll the message list in sequence to obtain the sending node of the target message; If the sending node is empty, the target message is not associated with a sending node; If the sending node is not empty, determining whether the sending node is unique; The detection process of the message not being associated with the receiving node includes: Poll the message list in sequence to obtain the receiving node of the target message; If the receiving node is empty, the target message is not associated with a receiving node; If the receiving nodes are not empty, the number of the receiving nodes is determined.
9. The method according to claim 1, characterized in that: When the vehicle bus communication database file is an LDF file, the preset detection item further includes coding format detection; the detection process of the coding format detection includes: Poll the message list in sequence to obtain the encoding format value of the target message signal; If the encoding format value of the target message signal is empty, the target message signal is not configured with an encoding format; If the encoding format value of the target message signal is not empty, the encoding format is determined to be a physical encoding format or a logical encoding format according to the encoding format value.
10. A vehicle bus communication database file detection device, characterized in that: The device comprises: An acquisition module, used for acquiring a vehicle bus communication database file to be detected; wherein the vehicle bus communication database file includes a DBC file and / or an LDF file; A parsing module, used for parsing the vehicle bus communication database file, and storing the message corresponding to the vehicle bus communication database file read into a message list; A detection module, used to poll the message list and detect the message according to a plurality of preset detection items; wherein the preset detection items at least include message length matching detection, signal initial value detection whether it is in an expected interval, and signal position duplication detection in the same message; The report output module is used to summarize and output the test report based on the test results.
11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method according to any one of claims 1 to 9 when executing a program stored in a memory.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Gateway routing automatic test system and test method based on CAN / LIN / MOST hybrid buses
CN106330618A
DBC file detection method and device, vehicle-mounted equipment and storage medium
CN117240942A
Performance test method and device of vehicle-mounted controller, electric vehicle and medium
CN118348958A
Automobile message detection method and device, electronic equipment and storage medium
CN118694678A
Method for converting information analyzed from a network database to software architecture design
KR101725155B1