Vehicle-mounted bus communication database file detection method and device and storage medium
By parsing and detecting the vehicle bus communication database file, the problem of rapid changes in vehicle bus communication protocols is solved, enabling fast and efficient detection and report generation, and supporting subsequent integration development.
Patent Information
- Application Number
- CN202510073983.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2045-01-17
AI Technical Summary
In the automotive industry, with the widespread application of AUTOSAR and the rapid iteration of ECU versions, the vehicle bus communication protocol changes frequently, which requires DBC and LDF files to be updated and detected quickly. Existing technologies are unable to achieve efficient automated detection.
A method for detecting vehicle bus communication database files is provided. By parsing the vehicle bus communication database file, the message messages are stored in a message list and detected according to multiple preset detection items, including message length matching, whether the initial value of the signal is within the expected range, and whether the signal position is repeated in the same message, a test report is generated.
It enables rapid and efficient detection of vehicle bus communication database files, ensuring accurate detection results, providing support for subsequent integration and development, and shortening the development cycle of new energy vehicle projects.
Smart Images

Figure CN119906649B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of communication detection, in particular to a vehicle-mounted bus communication database file detection method and device and a storage medium. BACKGROUND
[0002] With the increasingly wide application of Automotive Open System Architecture (AUTOSAR) in the automotive field, the development cycle of new energy vehicle projects is gradually shortened, and the version of the Electronic Control Unit (ECU) of the vehicle has realized rapid iteration, resulting in the need for rapid updating of the baseline of the vehicle platform communication protocol (Controller Area Network CAN, Local Interconnect Network LIN) to meet the frequent changing needs of different vehicle models. The CAN database file (DataBase CAN, DBC file) and the LIN description file (LIN Description File, LDF file) after frequent changes need to be quickly and automatically detected to ensure that they are released to the integration team without problems. Therefore, how to quickly and efficiently complete the detection of the vehicle-mounted bus communication database file has become a problem to be solved. SUMMARY
[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present application provides a vehicle-mounted bus communication database file detection method and device and a storage medium.
[0004] In a first aspect, the present application provides a vehicle-mounted bus communication database file detection method, which comprises:
[0005] Obtaining a vehicle-mounted bus communication database file to be detected; wherein the vehicle-mounted bus communication database file comprises a DBC file and / or an LDF file;
[0006] Parsing the vehicle-mounted bus communication database file, and storing the message corresponding to the read vehicle-mounted bus communication database file in a message list;
[0007] 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, detection of whether the signal initial value is in the expected interval, and detection of signal position repetition in the same message;
[0008] According to the detection results, a test report is output.
[0009] Optionally, the vehicle-mounted bus communication database file is parsed, and the message message read from the vehicle-mounted bus communication database file is stored in a message list, including:
[0010] The DBC file is parsed based on a first parsing library, and the CAN message information read is stored in a CAN message list; the first parsing library is used to parse the DBC format file;
[0011] The LDF file is parsed based on a second parsing library, and the LIN message message read is stored in a LIN message list; the second parsing library is used to parse the LDF format file.
[0012] Optionally, the preset detection item further includes at least one of message repetition detection, signal repetition detection, signal interval detection, message unassociated sending node detection, and message unassociated receiving node detection.
[0013] Optionally, the detection process of the message repetition detection includes:
[0014] The message list is polled in sequence, a first target number of occurrences of each target message name is obtained, and a second target number of occurrences of each target message identifier is obtained;
[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 repetition detection includes:
[0018] The message list is polled in sequence, and a third target number of occurrences of each target signal name is obtained;
[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] The message list is polled in sequence, and a data segment byte number of a target message is obtained; the data segment byte number is used to represent a maximum length allowed by the target message;
[0022] A signal start bit and an actual length of the target message are obtained;
[0023] The length of the target message is detected according to the signal start bit, the actual length, and the data segment byte number.
[0024] Optionally, the detection process of the signal range detection comprises:
[0025] sequentially polling the message list to obtain a physical minimum value, a physical maximum value and a data length of a 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 smaller than the physical maximum value, the signal range detection of the target signal is normal;
[0028] the detection process of the signal initial value in expected range detection comprises:
[0029] sequentially polling the message list to obtain a coefficient, a bias value and an initial value of a target signal;
[0030] calculating an actual initial value of the target signal according to the coefficient, the bias value and the initial value;
[0031] judging whether the actual initial value is between the expected minimum value and the expected maximum value.
[0032] Optionally, the detection process of the signal position repetition detection in the same message comprises:
[0033] sequentially polling the message list to obtain a signal start bit and a signal length corresponding to each target signal under a target message;
[0034] calculating a signal range of the target signal according to the signal start bit and the signal length;
[0035] detecting whether the positions of any two target signals under the target message overlap according to the signal range of the target signal; wherein if there are any number of bit positions overlapping between two target signals, the two target signals have position repetition.
[0036] Optionally, the detection process of the message unassociated sending node detection comprises:
[0037] sequentially polling the message list to obtain a sending node of a target message;
[0038] if the sending node is empty, the target message is unassociated with a sending node;
[0039] if the sending node is not empty, judging whether the sending node is unique;
[0040] the detection process of the message unassociated receiving node detection comprises:
[0041] sequentially polling the message list to obtain a 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 node is not empty, determining the number of the receiving nodes.
[0044] Optionally, when the vehicle-mounted bus communication database file is an LDF file, the preset detection items further include encoding format detection; the detection process of the encoding format detection includes:
[0045] sequentially polling the message list to obtain an 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, determining, according to the encoding format value, whether the encoding format is a physical encoding format or a logical encoding format.
[0048] In a second aspect, the present application provides a vehicle-mounted bus communication database file detection device, the device comprising:
[0049] an obtaining module, configured to obtain a vehicle-mounted bus communication database file to be detected; wherein the vehicle-mounted bus communication database file includes a DBC file and / or an LDF file;
[0050] a parsing module, configured to parse the vehicle-mounted bus communication database file and store the message corresponding to the vehicle-mounted bus communication database file read to a message list;
[0051] a detection module, configured 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 in an expected interval and signal position repetition detection in the same message;
[0052] a report output module, configured to output a test report according to the detection results.
[0053] In a third aspect, the present application provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
[0054] the memory, configured to store a computer program;
[0055] A processor is configured to implement the steps of the vehicle bus communication database file detection method according to any one of the first aspect when executing a program stored in a memory.
[0056] In a fourth aspect, the present application provides a computer readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the vehicle bus communication database file detection method according to any one of the first aspect.
[0057] Advantages of the present application:
[0058] The method provided by the embodiment of the present application comprises the following steps: obtaining a vehicle bus communication database file to be detected; wherein the vehicle bus communication database file comprises a DBC file and / or an LDF file; parsing the vehicle bus communication database file, and storing a message corresponding to the vehicle bus communication database file read in a message list; polling the message list, and detecting the message according to a plurality of preset detection items; and outputting a test report according to the detection results. The method can detect the message corresponding to the vehicle bus communication database file read according to the preset detection items, such as message length matching detection, detection of whether a signal initial value is in an 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 DRAWINGS
[0059] The accompanying drawings, which are incorporated herein and constitute part of the 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 technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained based on these drawings without creative labor.
[0061] Figure 1 A system architecture diagram of a vehicle bus communication database file detection method provided by an embodiment of the present application;
[0062] Figure 2 A flowchart of a vehicle bus communication database file detection method provided by an embodiment of the present application;
[0063] Figure 3 A flowchart of a vehicle bus communication database file detection method provided by an embodiment of the present application;
[0064] Figure 4A DBC file detection flowchart provided for an embodiment of the present application;
[0065] Figure 5 An LDF file detection flowchart provided for an embodiment of the present application;
[0066] Figure 6 A structural schematic diagram of a vehicle-mounted bus communication database file detection device provided for an embodiment of the present application;
[0067] Figure 7 A structural schematic diagram of an electronic device provided for an embodiment of the present application. DETAILED DESCRIPTION
[0068] The embodiments of the present application will be described in detail with reference to the drawings and preferred embodiments, and other advantages and effects of the present application can be easily understood by those skilled in the art from the contents disclosed in the present specification. The present application can also be implemented or applied by other different specific embodiments, and various modifications or changes can be made to the details in the present specification based on different views 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, but not for limiting the protection scope of the present application.
[0069] The first embodiment of the present application provides a vehicle-mounted bus communication database file detection method, which can be applied to a system architecture as shown in Figure 1 The system architecture includes at least 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 automatic test system, but is not limited thereto.
[0070] Next, based on the system architecture, the vehicle-mounted bus communication database file detection method will be described in detail, as shown in Figure 2 The vehicle-mounted bus communication database file detection method includes:
[0071] Step 201, acquiring a vehicle-mounted bus communication database file to be detected; wherein the vehicle-mounted bus communication database file includes a DBC file and / or an LDF file.
[0072] In the embodiment, the vehicle-mounted bus communication database files of various vehicle models can be prepared in advance. The vehicle-mounted bus communication database file, i.e., the communication protocol file, can include a DBC file and an LDF file. The vehicle-mounted bus communication database file can be placed in a specified storage address, such as a specified folder. After starting the automatic test system, the files in the folder can be loaded into the automatic test system for file detection.
[0073] The flowchart of the communication protocol file detection by the automatic test system can be as shown inFigure 3 , including: test input each vehicle communication file; CAN, LIN message analysis; CAN, LIN file detection; 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 read vehicle bus communication database file corresponding message message to the message list.
[0075] In one embodiment, parsing the vehicle bus communication database file, and storing the read vehicle bus communication database file corresponding message message to the message list, includes: based on the first analysis library to analyze the DBC file, and storing the read CAN message information to the CAN message list; wherein the first analysis library is used to analyze the DBC format file; based on the second analysis library to analyze the LDF file, and storing the read LIN message message to the LIN message list; wherein the second analysis library is used to analyze the LDF format file.
[0076] In this embodiment, the first analysis library can be the cantools.database library in python, which is used to read the files with.dbc suffix, and all the CAN message information read in sequence is stored in the CAN message list (CAN Messages list) for subsequent retrieval and judgment according to the detection standard. Using the cantools.database library can realize efficient analysis of DBC data, which is more rapid than writing separate code to recognize various contents. The second analysis library can be the ldfparser.parse_ldf library in python, which is used to read the files with.ldf suffix, and all the LIN message information read in sequence is stored in the LIN message list (LIN Messages list) for subsequent retrieval and judgment according to the detection standard.
[0077] Specifically, the cantools.database library is used to analyze the DBC file, and the parsed content at least contains the following 8 kinds 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. Definition of signal: SG_SignalName:StartBit | SignalSize@ByteOrder ValueType(Factor,Offset)
[0083] [Min | Max] Unit Receiver;
[0084] 6. Comment section: CM_Object MessageId / NodeName "Comment";
[0085] 7. Attribute definition section: BA_DEF_Object AttributeName ValueType Min Max; BA_DEF_DEF_AttributeName DefaultValue;
[0086] 8. Value table section: VAL_VAL_MessageId SignalName N "DefineN"... 0 "Define0".
[0087] The ldfparser.parse_ldf library is used to parse the LDF file, and the parsed content at least contains the following 10 kinds 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 message: 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. Schedule table: message name, time delay;
[0096] 9. Description information: signal description defines name, defined numerical table content, maximum value, minimum value, precision, offset;
[0097] 10. Signal description association: signal description defines name, signal.
[0098] In step 203, the message list is polled, and the packet message is detected according to multiple preset detection items; wherein the preset detection items at least include packet length matching detection, signal initial value whether in an expected interval detection, and signal position repetition detection in the same packet.
[0099] In one embodiment, the preset detection items further include at least one of packet repetition detection, signal repetition detection, signal interval detection, packet unassociated sending node detection, and packet unassociated receiving node detection.
[0100] In this embodiment, the preset detection items not only include the three detections of packet length matching detection, signal initial value whether in an expected interval detection, and signal position repetition detection in the same packet, but also include packet repetition detection, signal repetition detection, signal interval detection, packet unassociated sending node detection, and packet unassociated receiving node detection, so that the detection is more comprehensive, and more accurate post-detection data is provided for subsequent integrated development. Next, each detection item is described in detail.
[0101] In one embodiment, the detection process of the packet repetition detection includes: polling the message list in sequence, obtaining a first target number of times of occurrence of each target packet name, and obtaining a second target number of times of occurrence of each target packet identification; if the first target number of times is greater than 1, the target packet corresponding to the first target number of times is repeated; if the second target number of times is greater than 1, the target packet corresponding to the second target number of times is repeated.
[0102] The detection process of the signal repetition detection includes: polling the message list in sequence, obtaining a third target number of times of occurrence of each target signal name; if the third target number of times is greater than 1, the target signal corresponding to the third target number of times is repeated.
[0103] In this embodiment, the message list includes multiple packet messages, a target packet refers to one of all the packet messages, for any target packet, a first target number of times of occurrence of a target packet name name of the target packet is obtained, and a second target number of times of occurrence of a target packet identification frame_id of the target packet is obtained, if the target packet name occurs multiple times or the target packet identification occurs multiple times, the target packet is repeated. The signal repetition detection is similar to the packet repetition detection, the message list is polled, a third target number of times of occurrence of a target signal name name of each target signal signal is obtained, if the third target number of times is greater than 1, the target signal is repeated.
[0104] In one embodiment, the detection process of the message length matching detection includes: polling the message list in sequence to obtain a data segment byte number of the target message; wherein the data segment byte number is used to represent the maximum length allowed by the target message; obtaining a signal start bit and an actual length of the target message; and detecting the length of the target message according to the signal start bit, the actual length and the data segment byte number.
[0105] In this embodiment, the data segment byte number can be the DLC (Data Length Code) of the message, in Byte, the signal start bit and the actual length of the target message are obtained, for example, the DLC of the message_ID1 is 8 Byte, the length range is 0-63 bit, the start bit of the signal_signal1 is 68 and the length is 4 bit, it is obvious that the signal_signal1 has exceeded the overall length range of the message_ID1, and it can be judged that the length of the target message is not matched.
[0106] In one embodiment, the detection process of the signal interval detection includes: polling the message list in sequence to obtain a physical minimum value, a physical maximum value and a data length of the target signal; 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; 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 the signal initial value whether in the expected interval detection includes: polling the message list in sequence to obtain a coefficient, a bias value and an initial value of the target signal; calculating an actual initial value of the target signal according to the coefficient, the bias value and the initial value; and judging whether the actual initial value is between the expected minimum value and the expected maximum value.
[0108] In this embodiment, in the signal interval detection, 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, then 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 the signal interval detection, which will be described in detail in subsequent embodiments.
[0109] In this embodiment, the detection process of the signal initial value whether in the expected interval detection includes: polling the message list in sequence to obtain a coefficient, a bias value and an initial value of the target signal; calculating an actual initial value of the target signal according to the coefficient, the bias value and the initial value; and 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 the signal position repetition detection in the same message includes: polling the message list in sequence to obtain the signal start bit and the signal length corresponding to each target signal under the target message; calculating the signal range of the target signal according to the signal start bit and the signal length; detecting whether the positions of any two target signals under the target message overlap according to the signal range of the target signal; and if there are any number of bit positions overlapping between the two target signals, the two target signals have position repetition.
[0111] If the signal position repetition cannot be intercepted in the detection process, signal loss may be caused due to the signal position repetition, thereby causing great influence or blocking in subsequent communication establishment and communication testing. In the embodiment, the message list is polled to obtain the signal start bit Startbit and the signal length Length corresponding to all signals under the target message, the range of the target signal is calculated according to the signal start bit and the signal length, if there are any number of bit positions overlapping between any two target signals under the target message, the two target signals have position repetition, thereby completing the detection of the signal position repetition.
[0112] In one embodiment, the detection process of the message unassociated sending node detection 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 unassociated with the sending node; and if the sending node is not empty, it is determined 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 unassociated with the receiving node; and if the receiving node is not empty, the number of the receiving nodes is determined.
[0114] In the embodiment, if the sending node is empty, it indicates that the target message is unassociated 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 unassociated with the receiving node, and if the receiving node is not empty, the number of the receiving nodes can be determined.
[0115] In one embodiment, when the vehicle-mounted 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: polling the message list in sequence to obtain the coding format value of the signal of the target message; if the coding format value of the signal of the target message is empty, the signal of the target message is not configured with the coding format; and if the coding format value of the signal of the target message is not empty, it is determined according to the coding format value whether the coding format is a physical coding format or a logical coding format.
[0116] In the embodiment, in the encoding format detection of the LDF file, the encoding format value encoding_type of the target message signal is acquired by polling the message list, and it is judged whether the 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 the physical encoding format physical or the logical encoding format logical according to the value of the encoding_type.
[0117] In step 204, the test report is output according to the detection results.
[0118] The method can detect the message of the read vehicle-mounted bus communication database file according to the preset detection item, such as the message length matching detection, the initial value detection of whether the signal is in the expected interval, and the signal position repetition detection in the same message, so as to efficiently and quickly complete the detection of the vehicle-mounted bus communication database file and provide support for subsequent integrated development.
[0119] In one specific embodiment, the DBC file detection flow chart is as Figure 4 , including:
[0120] First step: message repetition detection. The specific implementation process is as follows:
[0121] 1. Poll the CAN Messages list in turn, and acquire the number of times counter of a single message name name in turn;
[0122] 2. Poll the CAN Messages list in turn, and acquire the number of times counter of a single message frame_id in turn;
[0123] 3. Determine the number of times counter of each message name in turn. If the counter>1, it is determined that the message is repeated.
[0124] 4. Determine the number of times counter of each message frame_id in turn. If the counter>1, it is determined that the message is repeated.
[0125] Second step: signal repetition detection. The specific implementation process is as follows:
[0126] 1. Poll the CAN Messages list in turn, and acquire the number of times counter of the name name of the signal signal in turn;
[0127] 2. Determine the number of times counter of each signal signal under each message in turn. If the counter>1, it is determined that the signal is repeated.
[0128] Step 3: Signal start bit / length and message length mismatch. The specific implementation process is as follows:
[0129] 1. Poll the CAN Messages list in turn, and get the DLC (Data Length Code) of each message in turn, in units of bytes;
[0130] 2. For each message, get the start bit, length (bit), and byte sequence (Motorola or Intel) of the signal signal;
[0131] 3. If the signal signal size range (start bit-termination bit) exceeds the range of DLC, it is determined that the signal length is mismatched. For example, the DLC of message_ID1 is 8 bytes, and the length range is 0-63 bits, the start bit of signal_signal_1 is 68, the length is 4 bits, and the byte sequence is Motorola. Obviously, signal_signal_1 has exceeded the overall length range of message_ID1.
[0132] Step 4: Signal maximum value and minimum value detection (i.e. signal interval detection). The specific implementation process is as follows:
[0133] 1. Poll the CAN Messages list in turn, and get the minimum value Minimum, maximum value Maximum, data type Value Type, Length [Bit], Factor, and Offset of the name name of the signal signal in turn.
[0134] 2. For the data type signed type, the calculation logic is as follows:
[0135] (1) The expected minimum value boundary min_bound = -(2*(signal.Length-1)), and the expected maximum value boundary is max_bound = 2*(signal.Length-1)-1;
[0136] (2) The expected minimum value minimum = round(min_bound*signal.scale+signal.offset), and the expected maximum value maximum = round(max_bound*signal.scale+signal.offset);
[0137] (3) Determine whether the signal minimum value is between the expected minimum and maximum;
[0138] (4) Determine whether the signal maximum value 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 the data type unsigned, the logic is as follows:
[0141] (1) The expected minimum value boundary min_bound = 0, and the expected maximum value boundary is max_bound = 2*(signal.Length-1)-1;
[0142] (2) The expected minimum value minimum = round(min_bound*signal.scale+signal.offset), and the 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: Maximum and minimum value interval detection of the initial value (default value) (i.e., signal initial value expected interval detection).
[0147] The specific implementation process is as follows:
[0148] 1. Poll the CAN Messages list in turn, and obtain the minimum value Minimum, maximum value Maximum, data type Value Type, Length [Bit], Factor, Offset, and Init_Value of the signal signal name name in turn;
[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: Unassociated sending node detection of the message. The specific implementation process is as follows:
[0152] 1. Poll the CAN Messages list in turn, and obtain the sending node Transmitters of the message in turn;
[0153] 2. Determine whether the Transmitters are empty, which means no associated Transmitters.
[0154] Step 7: Message unassociated Receivers detection. The specific implementation process is as follows:
[0155] 1. Poll the CAN Messages list in turn, and obtain the Receivers of the messages in turn;
[0156] 2. Determine whether the Receivers are empty, which means no associated Receivers.
[0157] Step 8: Different signal position repetition detection in the same message. The specific implementation process is as follows:
[0158] 1. Poll the CAN Messages list in turn, and obtain all signal data types Value Type, Startbit, Length[Bit] under each message in turn;
[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 in the order from left to right and from top to bottom.
[0160] 3. Compare and check each signal under each message with other signals under the same message in turn, whether there is overlap. As long as there is 1 bit overlap, it is determined that the position is repeated.
[0161] In one specific embodiment, the LDF file detection flow chart is as follows Figure 5 , including:
[0162] Step 1: Message repetition detection. The specific implementation process is as follows:
[0163] 1. Poll the LIN Messages list in turn, and obtain the number of times counter of a single message name in turn;
[0164] 2. Poll the LIN Messages list in turn, and obtain the number of times counter of a single message frame_id in turn;
[0165] 3. Determine the number of times counter of each message name in turn. If counter > 1, it is determined that the message is repeated.
[0166] 4. Determine the number of times counter of each message frame_id in turn. If counter > 1, it is determined that the message is repeated.
[0167] Second step: signal repetition detection. The specific implementation process is as follows:
[0168] 1. Poll LIN Messages list in turn, and obtain the number of times counter of the name name of the signal signal in turn;
[0169] 2. Determine the number of times counter of each signal signal under each message in turn. If counter>1, it is determined that the signal is repeated.
[0170] Third step: signal start bit / length and message length mismatch. The specific implementation process is as follows:
[0171] 1. Poll LIN Messages list in turn, and obtain the data segment byte number of each message in turn, in units of Byte;
[0172] 2. For each message, obtain the start bit, length (bit), byte sequence (Intel), and encoding format (physical or logical) of the signal signal;
[0173] 3. If the signal signal range (start bit-termination bit) exceeds the length range of the message, it is determined that the signal length is mismatched. For example, the data segment byte number of message_ID1 is 8, the length range is 0-63 bits, the start bit of signal_signal1 is 60, the length is 8 bits, and the last bit 67 is greater than 63. Obviously, the signal_signal1 has exceeded the overall length range of message_ID1.
[0174] Fourth step: signal maximum value and minimum value detection (i.e. signal interval detection). The specific implementation process is as follows:
[0175] 1. Poll LIN Messages list in turn, and obtain the physical minimum value Minimum, physical maximum value Maximum, and data length bit Size_Bit of the name name of the signal signal in turn.
[0176] 2. The signal maximum value and minimum value calculation logic is as follows:
[0177] (1) The expected minimum value boundary min_bound=0, and the expected maximum value boundary is max_bound=2*(signal.Size_Bit-1)-1;
[0178] (2) Determine whether the signal physical minimum value is between the expected min_bound and max_bound;
[0179] (3) Determine whether the signal physical maximum value is between the expected min_bound and max_bound;
[0180] (4) Determine whether the signal physical minimum value < physical maximum value.
[0181] Fifth step: Initial value (default value) is not in the maximum minimum value interval detection (i.e. whether the initial value of the signal is in the expected interval detection).
[0182] The specific implementation process is as follows:
[0183] 1. Poll the LIN Messages list in turn, and obtain the physical minimum value Minimum, physical maximum value Maximum, Factor, Offset, and Init_Value of the signal signal name name in turn. If it is empty, it is automatically filled with 0.
[0184] 2. The actual initial value 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 the fourth step).
[0186] Sixth step: Message unassociated sending node detection. The specific implementation process is as follows:
[0187] 1. Poll the LIN Messages list in turn, and obtain the sending node Publisher of the message in turn.
[0188] 2. Determine whether the sending node Publisher is empty. If it is empty, it indicates that the sending node is not associated.
[0189] 3. Determine the uniqueness of Publisher.
[0190] Seventh step: Message unassociated receiving node detection. The specific implementation process is as follows:
[0191] 1. Poll the LIN Messages list in turn, and obtain the receiving node Subscribers of the message in turn.
[0192] 2. Determine whether the receiving node Subscribers is empty. If it is empty, it indicates that the receiving node is not associated.
[0193] 3. Determine that Subscribers can exist 1 and above.
[0194] The eighth step is to detect whether the message signal in the LDF file is configured with an encoding_type. The specific implementation process is as follows:
[0195] 1. Poll the LIN Messages list in sequence, and obtain the encoding of the message signal encoding_type in sequence.
[0196] 2. Determine whether the encoding encoding_type is empty. If it is empty, it means that the encoding_type is not configured.
[0197] 3. Determine that the value of the encoding_type can be any one of physical or logical or both.
[0198] The ninth step is to detect the repetition 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 signal under each message in sequence.
[0200] 2. Calculate the size range of each signal: [Startbit, Startbit+Length-1].
[0201] 3. Compare and verify each signal under each message with other signals under the same message in sequence. If there is an overlap of 1 bit, it is determined that the position is repeated.
[0202] In this embodiment, the limitations of the prior art are overcome, and a stable, fast, simplified, and reusable automatic detection system for CAN and LIN database files (DBC files and LDF files) is provided for the rhythm of rapid iteration of ECU controllers under the Autosar architecture. The communication files of different vehicle models can be quickly batch detected. The number of communication files of each vehicle model is in the range of 20-30. It only takes about 12-18 seconds to complete the verification of all communication files of a vehicle model, and output a test report, to ensure that the communication protocol can be quickly released to subsequent integration and other teams.
[0203] Based on the same technical concept, the second embodiment of the present application provides a vehicle-mounted bus communication database file detection device, as shown in Figure 6 , the device comprises:
[0204] The acquisition module 601 is configured to acquire a vehicle-mounted bus communication database file to be detected. The vehicle-mounted bus communication database file comprises 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 messages corresponding to the read vehicle bus communication database file into a message list;
[0206] The detection module 603 is used to poll the message list and perform detection on the message according to a number of preset detection items; wherein, the preset detection items include at least message length matching detection, whether the initial value of the signal is within the expected range, and signal position repetition detection in the same message;
[0207] The report output module 604 is used to summarize and output a test report based on the results of each test.
[0208] The device can detect the message messages corresponding to the read vehicle bus communication database file according to preset detection items, such as message length matching detection, whether the initial value of the signal is within the expected range, and repeated detection of the signal position 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 integration development.
[0209] like Figure 7 As shown, the third embodiment of this 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 is used to store computer programs;
[0211] In one embodiment, when the processor 111 executes the program stored in the memory 113, it implements the vehicle bus communication database file detection method provided in any of the foregoing method embodiments.
[0212] The memory and processor in the aforementioned electronic device communicate with each other via a communication bus and communication interface. The communication bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc.
[0213] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0214] The processor described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
[0215] The fourth embodiment of the present application provides a computer readable medium having non-volatile program code executable by a processor.
[0216] Optionally, in the embodiments of the present application, the computer readable medium is configured to store program code for the processor to execute the above method.
[0217] Optionally, the specific examples in the embodiments can refer to the examples described in the above embodiments, and the embodiments will not be described here.
[0218] When the embodiments of the present application are implemented, the corresponding technical effects can be referred to the above embodiments.
[0219] It can be understood that the embodiments described herein can be realized in hardware, software, firmware, middleware, microcode or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units for executing the functions of the present application or a combination thereof.
[0220] For software implementation, the technologies herein can be implemented by units performing functions herein. 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 skilled in the art can clearly understand that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0222] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which 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 the modules is only a logical function division. In actual implementation, another division mode can be used. For example, a plurality of modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.
[0224] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. can be located in one place or distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.
[0225] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.
[0226] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application essentially or the parts that make contributions to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc. Various program codes that can store program codes.
[0227] It should be noted that, in the present document, relational terms such as "first" and "second", and the like can be used solely to distinguish one entity or action from another entity or action, without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0228] The above embodiments are only preferred embodiments of the present application, but the protection scope of the present application is not limited thereto. Any equivalent replacement or transformation made by those skilled in the art based on the present application shall fall within the protection scope of the present application.
Claims
1. A method for detecting vehicle bus communication database files, characterized in that, The method includes: Obtain 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; The vehicle bus communication database file is parsed, and the message messages corresponding to the vehicle bus communication database file read are stored in the message list; The message list is polled, and the message is checked according to a number of preset detection items; wherein, the preset detection items include at least message length matching detection, whether the initial signal value is within the expected range, and signal position duplication detection in the same message; the preset detection items also include at least one of message duplication detection, signal duplication detection, signal range detection, message not associated with sending node detection, and message not associated with receiving node detection; A test report will be compiled and generated based on the results of all tests. The detection process for the signal interval detection includes: The message list is polled sequentially to obtain the physical minimum value, physical maximum value, and data length of the target signal; Obtain the expected minimum and expected maximum values of the target signal; wherein the expected maximum value is calculated based on the data length; If both the physical minimum and the physical maximum are between the expected minimum and the expected maximum, and the physical minimum is less than the physical maximum, then the signal interval detection of the target signal is normal. The detection process for determining whether the initial value of the signal is within the desired range includes: The message list is polled sequentially to obtain the coefficients, deviation values, and initial values of the target signal; The actual initial value of the target signal is calculated based on the coefficient, the deviation value, and the initial value; Determine whether the actual initial value is between the expected minimum value and the expected maximum value.
2. The method according to claim 1, characterized in that, Parse the vehicle bus communication database file and store the message messages corresponding to the read vehicle bus communication database file into a message list, including: The DBC file is parsed using the first parsing library, and the read CAN message information is stored in the CAN message list; wherein, the first parsing library is used to parse the DBC format file; The LDF file is parsed using the second parsing library, and the read LIN message messages are stored in the LIN message list; wherein, the second parsing library is used to parse LDF format files.
3. The method according to claim 1, characterized in that, The message duplication detection process includes: The message list is polled sequentially to obtain the first target count of each target message name and the second target count of each target message identifier. If the first target count is greater than 1, then the target message corresponding to the first target count is duplicated; If the second target count is greater than 1, then the target message corresponding to the second target count is duplicated; The detection process for signal repeatability detection includes: The message list is polled sequentially to obtain the number of times each target signal name appears in the third target; If the number of times the third target is greater than 1, then the target signal corresponding to the number of times the third target is repeated.
4. The method according to claim 1, characterized in that, The message length matching detection process includes: The message list is polled sequentially to obtain the number of bytes in the data segment of the target message; wherein, the number of bytes in the data segment is used to represent the maximum allowed length of the target message; Obtain the signal start bit and actual length of the target message; The length of the target message is detected based on the signal start bit, the actual length, and the number of bytes in the data segment.
5. The method according to claim 1, characterized in that, The detection process for repeated signal position detection in the same message includes: The message list is polled sequentially to obtain the signal start bit and signal length corresponding to each target signal under the target message; The signal range of the target signal is calculated based on the signal start position and the signal length; Based on the signal range of the target signal, the system detects whether the positions of any two target signals in the target message overlap; wherein, if there is any number of bit overlaps between two target signals, then the two target signals have overlapping positions.
6. The method according to claim 1, characterized in that, The detection process for detecting messages not associated with sending nodes includes: The message list is polled sequentially to obtain the sending node of the target message; If the sending node is empty, then the target message is not associated with a sending node; If the sending node is not empty, then determine whether the sending node is unique; The detection process for the message not being associated with a receiving node includes: The message list is polled sequentially to obtain the receiving node of the target message; If the receiving node is empty, then the target message is not associated with a receiving node; If the receiving node is not empty, then the number of receiving nodes is determined.
7. The method according to claim 1, characterized in that, When the vehicle bus communication database file is an LDF file, the preset detection items also include encoding format detection; the detection process for encoding format detection includes: The message list is polled sequentially to obtain the encoding format value of the target message signal; If the encoding format value of the target message signal is empty, then the target message signal has no configured encoding format; If the encoding format value of the target message signal is not empty, then the encoding format is determined to be either a physical encoding format or a logical encoding format based on the encoding format value.
8. A vehicle-mounted bus communication database file detection device, characterized in that, The device includes: An acquisition module 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; The parsing module is used to parse the vehicle bus communication database file and store the message messages corresponding to the vehicle bus communication database file read into the message list; The detection module is used to poll the message list and perform detection on the message messages according to multiple preset detection items; wherein, the preset detection items include at least message length matching detection, detection of whether the initial value of the signal is within the expected range, and detection of repeated signal positions in the same message; the preset detection items also include at least one of message duplication detection, signal duplication detection, signal interval detection, message not associated with a sending node detection, and message not associated with a receiving node detection; wherein, the detection process of the signal interval detection includes: polling the message list sequentially to obtain the physical minimum value, physical maximum value, and data length of the target signal; obtaining the target signal's... The expected minimum and expected maximum values are defined; wherein the expected maximum value is calculated based on the data length; if both the physical minimum and the physical maximum values are between the expected minimum and the expected maximum values, and the physical minimum value is less than the physical maximum value, then the signal interval detection of the target signal is normal; the detection process for whether the initial value of the signal is within the expected interval includes: sequentially polling the message list to obtain the coefficients, deviation values, and initial values of the target signal; calculating the actual initial value of the target signal based on the coefficients, the deviation values, and the initial value; and determining whether the actual initial value is between the expected minimum and the expected maximum values. The report output module is used to summarize and output a test report based on the results of each test.
9. 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, when executing a program stored in memory, implements the method described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-7.
Citation Information
Patent Citations
DBC file detection method and device, vehicle-mounted equipment and storage medium
CN117240942A
Automobile message detection method and device, electronic equipment and storage medium
CN118694678A