Vehicle diagnosis response method and device, electronic equipment and storage medium

By developing Python scripts, automatically parsing the diagnostic request packets of ECU devices, identifying the bus type and generating response packets, it solves the problem of cumbersome manual configuration in ECU device testing, and realizes an efficient and automated testing process.

CN120406392APending Publication Date: 2025-08-01CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510521833.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In the prior art, ECU equipment testing relies on testers to manually trigger response configurations for single-piece triggering, which is cumbersome and time-consuming, making it difficult to meet the needs of large-scale testing.

Method used

By developing Python scripts, the routing table is parsed using the API or interface of the test device, trigger response rules are automatically configured, diagnostic request messages of the device to be tested, bus type is identified, and diagnostic response messages that conform to the bus protocol are dynamically generated.

Benefits of technology

It realizes automated and efficient configuration of ECU equipment testing, reduces human operation errors, supports batch import or export of routing configuration tables, and improves testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120406392A_ABST
    Figure CN120406392A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a vehicle diagnosis response method and device, electronic equipment and a storage medium, and the method comprises the steps: receiving a diagnosis request message sent by to-be-tested equipment, extracting the diagnosis request message to obtain a message identifier, determining the bus type of the diagnosis request message according to the message identifier, and sending the bus type to the to-be-tested equipment; searching a pre-generated routing table of the to-be-tested device according to the message identifier, determining a target diagnosis request identifier and a target diagnosis response identifier matched with the message identifier, generating a diagnosis response message corresponding to the diagnosis request message according to the bus type of the diagnosis request message and the target diagnosis response identifier, and sending the diagnosis response message to the to-be-tested device. And sending the diagnosis response message to the to-be-tested device. According to the method, the diagnosis request messages sent by the to-be-tested equipment are automatically analyzed in batches, and the bus types of the request messages are identified, so that the diagnosis response messages conforming to the bus protocols corresponding to the diagnosis request messages are dynamically generated, and automatic trigger response of the to-be-tested equipment under different bus protocols of CAN and CAN FD is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of vehicle testing, and particularly relates to a vehicle diagnosis response method, a vehicle diagnosis response device, an electronic device, and a computer-readable storage medium. Background Art

[0002] During the development and testing process of an automotive electronic control system (Electronic Control Unit, ECU), the communication function between ECUs is crucial to ensure the normal operation of the vehicle network. To verify the communication function of the ECU, test equipment (such as CANoe, Zhou Ligong, Galaxy, etc.) is widely used to simulate the actual network environment, and the response behavior of the ECU is tested by sending and receiving specific messages.

[0003] Among them, "trigger response" is a common test scenario. Specifically, after the ECU sends a message, the test equipment replies with a specific response message according to a preset rule to verify whether the communication logic or function of the ECU is normal. Currently, when configuring the "trigger response" scenario on the test equipment, it usually requires testers to manually complete the routing relationship and message configuration. Testers need to add the sending and receiving message IDs, data segment definitions, and routing relationships of the ECU (such as forwarding the message of ECU1 to ECU2) one by one in the test software according to the routing table. However, this method of relying on testers to manually configure the trigger response one by one is time-consuming and laborious for complex ECUs or networks with dozens or even hundreds of messages, resulting in cumbersome operations and long time consumption, affecting the configuration efficiency and making it difficult to meet the large-scale test requirements. Summary of the Invention

[0004] In view of this, the present invention aims to provide a vehicle diagnosis response method, device, electronic device, and storage medium to solve the problem that the current ECU device test relies on testers to manually configure the trigger response one by one, which is cumbersome and time-consuming, affects the configuration efficiency, and is difficult to meet the large-scale test requirements.

[0005] According to the first aspect of the present invention, a vehicle diagnosis response method is provided, and the method includes:

[0006] Receiving a diagnostic request message sent by a device under test;

[0007] Extracting a message identifier from the diagnostic request message, and determining the bus type of the diagnostic request message according to the message identifier; wherein, the bus type includes one of a controller area network bus and a variable rate controller area network bus;

[0008] Searching a pre-generated routing table of the device under test according to the message identifier, and determining a target diagnostic request identifier and a target diagnostic response identifier that match the message identifier;

[0009] Generate a diagnostic response message corresponding to the diagnostic request message according to the bus type of the diagnostic request message and the target diagnostic response identifier;

[0010] Send the diagnostic response message to the device under test.

[0011] Optionally, the receiving the diagnostic request message sent by the device under test includes:

[0012] Pre-determine available bus resources, and divide the available bus resources into a receiving message bus and a sending message bus;

[0013] Use the receiving message bus to receive the diagnostic request message sent by the device under test.

[0014] Optionally, the extracting the message identifier from the diagnostic request message and determining the bus type of the diagnostic request message according to the message identifier includes:

[0015] Identify the data frame of the diagnostic request message to determine the data frame corresponding to the message identifier;

[0016] Extract the diagnostic request message according to the data frame corresponding to the message identifier to obtain the message identifier of the diagnostic request message;

[0017] Determine the bus type of the diagnostic request message according to the preset corresponding relationship between the message identifier and the bus type.

[0018] Optionally, the finding the pre-generated routing table of the device under test according to the message identifier and determining the target diagnostic request identifier and the target diagnostic response identifier matching the message identifier includes:

[0019] Use a preset script to find the pre-generated routing table of the device under test, and obtain the diagnostic request identifier and the diagnostic response identifier in the routing table of the device under test;

[0020] Match the message identifier of the diagnostic request message with the diagnostic request identifier in the routing table of the device under test to determine the target diagnostic request identifier matching the message identifier, and the target diagnostic response identifier corresponding to the target diagnostic request identifier.

[0021] Optionally, the generating the diagnostic response message corresponding to the diagnostic request message according to the bus type of the diagnostic request message and the target diagnostic response identifier includes:

[0022] Determine the bus type of the diagnostic response message to be generated according to the bus type of the diagnostic request message, and configure the data packet format of the diagnostic response message;

[0023] Generate the first-frame data and continuous-frame data of the diagnostic response message according to the data packet format.

[0024] Package the target diagnostic response identifier, the first-frame data, and the continuous-frame data to obtain the diagnostic response message corresponding to the diagnostic request message.

[0025] Optionally, determining the bus type of the diagnostic response message to be generated according to the bus type of the diagnostic request message and configuring the data packet format of the diagnostic response message includes:

[0026] If the bus type of the diagnostic request message is a Controller Area Network (CAN) bus, determine that the bus type of the diagnostic response message to be generated is a CAN bus, and configure the data packet format of the diagnostic response message as the CAN bus format.

[0027] If the bus type of the diagnostic request message is a Variable Bit Rate Controller Area Network (VBR-CAN) bus, determine that the bus type of the diagnostic response message to be generated is a VBR-CAN bus, and configure the data packet format of the diagnostic response message as the VBR-CAN bus format.

[0028] Optionally, sending the diagnostic response message to the device under test includes:

[0029] Send the diagnostic response message to the device under test using a pre-divided message-sending bus.

[0030] Monitor the sending status of the diagnostic response message; the sending status includes sending success and sending failure.

[0031] Record the diagnostic request message, the diagnostic response message, and the sending status to generate a diagnostic log of the device under test.

[0032] According to a second aspect of the present invention, there is provided a vehicle diagnostic response device, the device including:

[0033] A receive message module, configured to receive a diagnostic request message sent by a device under test.

[0034] A message processing module, configured to extract a message identifier from the diagnostic request message and determine the bus type of the diagnostic request message according to the message identifier; wherein, the bus type includes one of a Controller Area Network (CAN) bus and a Variable Bit Rate Controller Area Network (VBR-CAN) bus.

[0035] An identifier matching module, configured to find a pre-generated routing table of the device under test according to the message identifier and determine a target diagnostic request identifier and a target diagnostic response identifier that match the message identifier.

[0036] A response generation module, configured to generate a diagnostic response message corresponding to the diagnostic request message according to the bus type of the diagnostic request message and the target diagnostic response identifier;

[0037] A message sending module, configured to send the diagnostic response message to the device under test.

[0038] According to another aspect of the present invention, there is also provided an electronic device, including:

[0039] A processor;

[0040] A memory for storing executable instructions of the processor;

[0041] Wherein, the processor is configured to execute the instructions to implement the vehicle diagnostic response method as described above.

[0042] According to another aspect of the present invention, there is also provided a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the vehicle diagnostic response method as described above are implemented.

[0043] The vehicle diagnostic response method provided by the embodiments of the present invention receives a diagnostic request message sent by a device under test, extracts a message identifier from the diagnostic request message, determines the bus type of the diagnostic request message according to the message identifier, looks up a pre-generated routing table of the device under test according to the message identifier, determines a target diagnostic request identifier and a target diagnostic response identifier that match the message identifier, generates a diagnostic response message corresponding to the diagnostic request message according to the bus type of the diagnostic request message and the target diagnostic response identifier, and sends the diagnostic response message to the device under test. The embodiments of the present invention automatically and batch-analyze the diagnostic request messages sent by the device under test, identify the bus type of the request messages, thereby dynamically generating diagnostic response messages that conform to the bus protocol corresponding to the diagnostic request messages, realizing automatic trigger response of the device under test under different bus protocols of CAN and CAN FD, without the need for testers to manually configure messages, reducing the human operation error rate, supporting batch import or export of the routing configuration table, improving the configuration efficiency of the device diagnostic response test, and realizing efficient and automatic configuration trigger response.

[0044] The above description is only an overview of the technical solution of the present invention. In order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the description. And in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable, the specific embodiments of the present invention are given below. Description of the Drawings

[0045] By reading the following detailed description of the preferred embodiments, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to be a limitation of the present invention. Also, throughout the drawings, the same reference numerals are used to denote the same components. In the drawings:

[0046] Figure 1 is a flowchart of the steps of a vehicle diagnostic response method provided by an embodiment of the present invention;

[0047] Figure 2 is Figure 1 a flowchart of step 101 in a vehicle diagnostic response method provided by an embodiment of the present invention;

[0048] Figure 3 is Figure 1 a flowchart of step 102 in a vehicle diagnostic response method provided by an embodiment of the present invention;

[0049] Figure 4 is Figure 1 a flowchart of step 103 in a vehicle diagnostic response method provided by an embodiment of the present invention;

[0050] Figure 5 is Figure 1 a flowchart of step 104 in a vehicle diagnostic response method provided by an embodiment of the present invention;

[0051] Figure 6 is Figure 1 a flowchart of step 105 in a vehicle diagnostic response method provided by an embodiment of the present invention;

[0052] Figure 7 is a schematic structural diagram of a vehicle diagnostic response device provided by an embodiment of the present invention;

[0053] Figure 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. Detailed Embodiments

[0054] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will elaborate on each embodiment of the present invention in conjunction with the drawings. However, those of ordinary skill in the art can understand that in each embodiment of the present invention, many technical details are presented for the purpose of enabling readers to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in the present application can still be implemented. The following division of each embodiment is for convenience of description and should not constitute any limitation to the specific implementation of the present invention. Each embodiment can be combined and cross-referenced with each other on the premise of no contradiction.

[0055] Reference Figure 1 , a step flowchart of a vehicle diagnosis response method provided by an embodiment of the present invention is shown. The method may include:

[0056] Step 101, receiving a diagnostic request message sent by a device to be tested.

[0057] In an embodiment of the present invention, to solve the problem that the current ECU device test relies on testers to manually trigger response configuration one by one, which is cumbersome and time-consuming, affects the configuration efficiency, and is difficult to meet the large-scale test requirements, a Python script is developed in this embodiment. The API or interface of the test device is used to parse the routing table and automatically configure the trigger response rules, automatically and batch parse the diagnostic request messages sent by the device to be tested, identify the bus type of the request message, so as to dynamically generate diagnostic response messages that conform to the bus protocol corresponding to the diagnostic request message, realize the automatic trigger response of the device to be tested under different bus protocols of CAN and CAN FD, and eliminate the need for testers to manually configure messages, thereby reducing manual operations and improving the test efficiency of ECU device diagnosis response.

[0058] Specifically, the test device may be CANoe, Zhou Ligong, Galaxy, etc. In this embodiment, the Zhou Ligong test device is taken as an example for illustration. The developed Python script is integrated into the Zhou Ligong test device. This Python script can parse the routing table, extract the transceiver message IDs and routing relationships of the device to be tested, automatically set the trigger message and response message in the Zhou Ligong test device, and can configure the diagnostic response rules of multiple devices to be tested at one time, avoiding manually inputting the message ID and message data one by one. Just running the script can complete the batch trigger response. It should be noted that the Zhou Ligong test device is used for CAN or CANFD testing, simulates the ECU to send or receive CAN or CAN FD messages, and verifies whether the communication protocol meets the specifications. In an embodiment of the present invention, to perform a trigger response test on the ECU device of a vehicle, it is necessary to first determine the device to be tested of the vehicle, identify the vehicle ECU list as the device to be tested through the on-vehicle diagnostic interface or CAN bus scanning tool. The device to be tested can be multiple, and the in-use ECU communicates with multiple types of controller devices. Controller Area Network (CAN) is a serial communication protocol bus for real-time applications, which can use twisted pair to transmit signals. Controller Area Network with Flexible Data rate (CAN FD) is an upgraded version of traditional CAN. CAN FD only upgrades the protocol compared with CAN, and the physical layer remains unchanged.

[0059] In this embodiment, the test device first obtains the diagnostic routing table between the vehicle to-be-tested devices, redirects the diagnostic routing table to obtain a redirected routing table. The diagnostic routing table of the to-be-tested device is obtained through the routing information provided by the vehicle manufacturer. The diagnostic routing table includes the paths and rules between the diagnostic request message and the diagnostic response message in the diagnostic communication of the ECU. Specifically, the diagnostic routing table includes information such as the source of the diagnostic request, the target of the diagnostic request, the source of the diagnostic response, the target of the diagnostic response, and the message ID. Since the original diagnostic routing table contains a large amount of redundant information, in this embodiment, through information extraction and processing, the routing between the real ECUs is redirected to the test device to obtain a redirected routing table. The redirected routing table includes information such as the diagnostic request identifier and the diagnostic response identifier. It should be noted that since the Python script can open Excel format files, in this embodiment, the redirected routing table is stored in the Excel file in the form of a sheet.

[0060] Specifically, in the embodiment of the present invention, the test device receives the diagnostic request message sent by the to-be-tested device. The test device creates a thread in advance through a thread function and starts the thread through a start function. Among them, the thread function is the core function for creating and managing threads, and the start function is the function for starting a new thread, which can call the underlying system resources to create a new execution flow and automatically call the execution method. This thread waits for the message sent by the device under test and receives the message. When the message is received, the function for receiving the message is called to process the message.

[0061] Step 102: Extract the message identifier from the diagnostic request message, and determine the bus type of the diagnostic request message according to the message identifier.

[0062] Among them, the bus type includes one of the controller area network bus and the variable speed rate controller area network bus.

[0063] In the embodiment of the present invention, the test device analyzes the diagnostic request message, extracts the message identifier of the diagnostic request message, and determines the bus type of the diagnostic request message. The bus type of the diagnostic request message determines the format of the diagnostic response message and the determination of the bus for sending the message. Specifically, after receiving the diagnostic request message sent by the to-be-tested device through the thread, the test device receives the diagnostic request message sent by the to-be-tested device using the receiving message bus, identifies the data frame of the diagnostic request message, extracts the message identifier of the diagnostic request message, and determines the bus type of the diagnostic request message according to the message identifier of the diagnostic request message. Among them, the bus type includes one of the controller area network bus and the variable speed rate controller area network bus. This embodiment is used to perform diagnostic response tests on the message sending and receiving of the ECU device on the controller area network bus or the variable speed rate controller area network bus.

[0064] It should be noted that in some embodiments, when the reception of a message sent by the device under test fails, that is, the number of received message data frames is equal to 0, the logging function is started, and the reception failure situation is recorded in the log for testers to trace and correct errors. When the reception of a message sent by the device under test is successful, that is, the number of received message data frames is greater than 0, the test device traverses each data frame of the received message and extracts the message identifier of the data frame. The message identifier, i.e., canid, is an identification bit used to determine whether the message is for a CAN bus or a CANFD bus.

[0065] Step 103: Search for the pre-generated routing table of the device under test according to the message identifier, and determine the target diagnostic request identifier and the target diagnostic response identifier that match the message identifier.

[0066] In the embodiment of the present invention, after receiving a diagnostic request message sent by the device under test, the test device searches for the pre-generated routing table of the device under test according to the message identifier. Specifically, it uses a pre-integrated script to open the Excel file where the redirected routing table is located and searches for the redirected routing table, and determines whether the diagnostic request message of the device under test conforms to the diagnostic response rule in the diagnostic routing table to filter the processing of non-routing table messages, and determines the target diagnostic request identifier and the target diagnostic response identifier that match the message identifier. Among them, the target diagnostic request identifier is the diagnostic request identifier in the redirected routing table that is the same as the message identifier of the diagnostic request message sent by the device under test, and the target diagnostic response identifier is the diagnostic response identifier corresponding to the target diagnostic request identifier in the redirected routing table.

[0067] It should be noted that a preset script is used to search for the redirected routing table. By traversing the redirected routing table to filter the processing of non-routing table messages, the message identifier of the diagnostic request message is matched with the diagnostic request identifier in the redirected routing table to determine the diagnostic request identifier that matches the message identifier. Specifically, it is determined whether the message ID sent by the device under test is the same as the diagnostic request message ID in the redirected routing table. If a matching message ID is found, the diagnostic response message ID is extracted from the redirected routing table. If no matching message ID is found, an error is reported, indicating that the message sent by the device under test does not meet the diagnostic response communication test conditions.

[0068] Step 104: Generate a diagnostic response message corresponding to the diagnostic request message according to the bus type of the diagnostic request message and the target diagnostic response identifier.

[0069] In an embodiment of the present invention, the test device automatically generates a diagnostic response message corresponding to the diagnostic request message according to the bus type of the diagnostic request message sent by the device under test and the target diagnostic response identifier determined from the redirection routing table. Specifically, according to the bus type of the diagnostic request message, the bus type of the diagnostic response message to be generated is determined, and the data packet format of the diagnostic response message is configured. According to the data packet format, the first-frame data and continuous-frame data of the diagnostic response message are generated, and the target diagnostic response identifier is packed with the first-frame data and the continuous-frame data to obtain the diagnostic response message corresponding to the diagnostic request message.

[0070] It should be noted that the first-frame data and the continuous-frame data are data frames of the diagnostic response message. If the bus type of the diagnostic request message is a controller area network bus, the data packet is set as the first frame in CAN format, a first-frame data packet dictionary is created and added to the automatic transmission data packet list, the data packet is set as the continuous frame in CAN format, and a continuous-frame data packet dictionary is created and added to the automatic transmission data packet list; if the bus type of the diagnostic request message is a controller area network bus with variable bit rate, the data packet is set as the first frame in CANFD format, a first-frame data packet dictionary is created and added to the automatic transmission data packet list, the data packet is set as the continuous frame in CANFD format, and a continuous-frame data packet dictionary is created and added to the automatic transmission data packet list.

[0071] Step 105: Send the diagnostic response message to the device under test.

[0072] The vehicle diagnostic response method provided by the embodiment of the present invention receives a diagnostic request message sent by a device under test, extracts a message identifier from the diagnostic request message, determines the bus type of the diagnostic request message according to the message identifier, searches a pre-generated routing table of the device under test according to the message identifier to determine a target diagnostic request identifier and a target diagnostic response identifier that match the message identifier, generates a diagnostic response message corresponding to the diagnostic request message according to the bus type of the diagnostic request message and the target diagnostic response identifier, and sends the diagnostic response message to the device under test. The embodiment of the present invention automatically and batch-parses the diagnostic request messages sent by the device under test, identifies the bus type of the request messages, thereby dynamically generating diagnostic response messages that conform to the bus protocol corresponding to the diagnostic request messages, realizing automatic trigger response of the device under test under different bus protocols of CAN and CAN FD, eliminating the need for testers to manually configure messages, reducing the human operation error rate, supporting batch import or export of the routing configuration table, improving the configuration efficiency of the device diagnostic response test, and realizing efficient and automatic configuration trigger response.

[0073] Further, referring to Figure 2 it shows Figure 1Flowchart of step 101 in a provided vehicle diagnosis response method. This method is basically the same as the vehicle diagnosis response method provided in the first embodiment of the present invention. Step 101 may include:

[0074] Step 1011, pre-determine available bus resources, and divide the available bus resources into a receiving message bus and a sending message bus.

[0075] Step 1012, use the receiving message bus to receive the diagnostic request message sent by the device under test.

[0076] It should be noted that in the embodiment of the present invention, the test device automatically detects all available CAN / CAN FD channels, identifies the physical characteristics of each channel, and divides the available bus resources into a receiving message bus and a sending message bus. The purpose of the bus resource division is to enable the test device to obtain the receiving message bus ID and the sending message bus ID, which is convenient for calling when receiving and sending messages of the device under test.

[0077] Specifically, the test device uses the receiving message bus to receive the diagnostic request message sent by the device under test. Among them, the test device can pre-create and start a thread for receiving messages based on the receiving message bus, create a thread through the thread function, start the thread through the start function, and execute the command line process_bus_rcv when processing the receiving message function. That is, this thread has been waiting for the receipt of the message. When the message is received, the receiving message function is called for processing. It should be noted that in order to improve the utilization rate of the code, during the message receiving process, a sleep function can be used to briefly stop for 1 ms to release CPU resources, which will not be elaborated here.

[0078] In the embodiment of the present invention, through bus resource division, the test device obtains the receiving message bus ID and the sending message bus ID, which is convenient for calling when receiving and sending messages of the device under test, so as to batch receive the diagnostic request messages sent by the device under test.

[0079] Further, referring to Figure 3 , shows Figure 1 Flowchart of step 102 in a provided vehicle diagnosis response method. This method is basically the same as the vehicle diagnosis response method provided in the first embodiment of the present invention. Step 102 may include:

[0080] Step 1021, identify the data frame of the diagnostic request message to determine the data frame corresponding to the message identifier.

[0081] Step 1022, extract the diagnostic request message according to the data frame corresponding to the message identifier to obtain the message identifier of the diagnostic request message.

[0082] Step 1023: Determine the bus type of the diagnostic request message according to the preset correspondence between the message identifier and the bus type.

[0083] In the embodiment of the present invention, the test device receives the data on the bus through the receiving function. When the number of received message data frames is greater than 0, the message is successfully received. The test device traverses each data frame of the received diagnostic request message, identifies the data frame corresponding to the message identifier in the diagnostic request message, extracts the diagnostic request message according to the data frame corresponding to the message identifier, extracts the message identifier of the diagnostic request message, and determines the bus type of the diagnostic request message according to the message identifier of the diagnostic request message. When the number of received message data frames is equal to 0, the message reception fails, and the logging function is started to record the failure situation in the log for engineers to correct errors.

[0084] It should be noted that, according to the preset correspondence between the message identifier and the bus type, the bus type of the diagnostic request message is determined. The message identifier and the bus type are corresponding. The message identifier is the canid, including the identification bits of the CAN frame or the CANFD frame, so as to determine the bus type of the message. The bus type includes one of the Controller Area Network bus and the Controller Area Network with Flexible Data-Rate bus. The Controller Area Network bus CAN is a serial communication protocol bus for real-time applications. The Controller Area Network with Flexible Data-Rate bus CAN FD is an upgraded version of CAN. As the functions of automobiles are increasing, the load rate of the traditional CAN bus (CAN2.0) is getting higher and higher, even up to 95%. In addition, the traditional CAN bus also has some limitations. Therefore, in existing vehicles, in different controllers and application scenarios, CAN and CANFD each have their own application values and coexist in the vehicle. Among them, the data field length of CAN is at most 8 bytes per frame, and the data field length of CAN FD is at most 64 bytes per frame.

[0085] The embodiment of the present invention receives the diagnostic request message sent by the device under test, and identifies the bus type of the diagnostic request message according to the message identifier of the diagnostic request message, so as to dynamically generate a diagnostic response message that conforms to the bus protocol corresponding to the diagnostic request message based on the bus type.

[0086] Further, referring to Figure 4 , shows Figure 1 The flowchart of step 103 in a vehicle diagnostic response method provided, which is basically the same as the vehicle diagnostic response method provided in the first embodiment of the present invention. Step 103 may include:

[0087] Step 1031: Use a preset script to find the pre-generated routing table of the device under test, and obtain the diagnostic request identifier and the diagnostic response identifier in the routing table of the device under test.

[0088] Step 1032: Match the message identifier of the diagnostic request message with the diagnostic request identifier in the routing table of the device under test to determine the target diagnostic request identifier that matches the message identifier, and the target diagnostic request identifier corresponding to the target diagnostic request identifier.

[0089] It should be noted that in the embodiment of the present invention, the routing table of the device under test is a redirected routing table obtained by redirecting the pre-stored diagnostic routing table between the devices under test in the vehicle's overall vehicle data. After the redirected routing table is generated, it is stored in an Excel file, which is convenient for the preset script of the test device to directly open and search for information, and perform batch and automatic processing of messages. Specifically, the test device opens the Excel file where the redirected routing table is located through the preset script, searches for the sheet of the redirected routing table in the Excel file. For example, the openpyxl library of Python can be used. The openpyxl library of Python is a third-party library for processing Excel files, specifically used to read, write, and modify Excel files. According to the meaning of the columns, select the columns with filtering capabilities and traverse the entire table row by row to extract the CAN message information therein, and obtain the diagnostic request identifier and diagnostic response identifier in the redirected routing table. Among them, the diagnostic request identifier and diagnostic response identifier in the routing table of the device under test are extracted based on the diagnostic routing table between the devices under test, which is convenient for the test device to directly match and search for the diagnostic response identifier.

[0090] In this embodiment, after receiving the diagnostic request message, the test device matches the message identifier of the diagnostic request message with the diagnostic request identifier in the routing table of the device under test to filter the processing of messages that are not in the diagnostic routing table, and determines whether the message identifier, that is, the message ID, of the received diagnostic request message is equal to the message identifier of the diagnostic request message in the routing table of the device under test. If there is a match, the target diagnostic request identifier that matches the message identifier, and the target diagnostic request identifier corresponding to the target diagnostic request identifier are determined. Otherwise, the search of the routing table is exited and an error is reported.

[0091] Through the redirection mechanism of the diagnostic routing table, the embodiment of the present invention obtains a routing table that can be directly searched by the developed script. Based on the routing table of the device under test, the test device automatically and batch-parses the diagnostic request messages sent by the device under test using the developed script, and identifies the bus type of the diagnostic request messages.

[0092] It should be noted that in some embodiments, the test device can first obtain the pre-stored diagnostic routing table among the devices to be tested from the vehicle's overall vehicle data. The diagnostic routing table records the communication paths between these devices and is used for data transmission during diagnosis. The diagnostic routing table includes target nodes. For example, the target nodes can be VDC (Vehicle Dynamics Control), BMS (Battery Management System), etc. Specifically, key information is extracted from the diagnostic routing table to obtain routing information and message identification information. Among them, the routing information includes the source device and the target device, and the source device ID, target device ID, communication protocol, etc. are extracted. The message identification information includes the diagnostic request identification and the diagnostic response identification, as well as information such as protocol classification and data length. The routing information and the message identification information are filled into a preset global routing table to obtain a redirected routing table. The preset global routing table is a pre-set routing table template, which will not be specifically described here.

[0093] For example, the routing information and the message identification information are filled into a preset global routing table to obtain a redirected routing table. The redirected routing table includes the diagnostic request identification and the diagnostic response identification. The redirected routing table is as follows:

[0094] Table 1: Redirected Routing Table

[0095]

[0096] It should be noted that DoIP (Diagnostics over IP) in the table is diagnostic communication based on the IP protocol. The DoIP tester is an automotive electronics diagnostic tool based on the IP protocol and is used for operations such as diagnosing, programming, and parameter configuration of vehicle ECUs that support the DoIP protocol; the logical address is the unique address used to identify ECU nodes in DoIP. The target nodes include VDC (Vehicle Dynamics Control), BMS (Battery Management System), OBC (On-Board Charger), CCU (Charging Control Unit), GCU (Gateway Control Unit), and MCU (Motor Control Unit), etc. The addressing mode Phy is physical addressing, which is an addressing mode directly targeting a specific ECU.

[0097] In an embodiment of the present invention, a routable table that can be directly searched by a developed script is obtained through a redirection mechanism of a diagnostic routing table. Based on the redirected routing table, a test device automatically and batch-parses diagnostic request messages sent by a device under test using the developed script, eliminating the need for testers to manually configure the messages, reducing the human operation error rate, supporting batch import or export of routing configuration tables, and improving the configuration efficiency of device diagnostic response testing.

[0098] Further, referring to Figure 5 shows a flowchart of step 104 in a vehicle diagnostic response method provided by Figure 1 The method is substantially the same as the vehicle diagnostic response method provided in the first embodiment of the present invention. Step 104 may include:

[0099] Step 1041: Determine the bus type of the diagnostic response message to be generated according to the bus type of the diagnostic request message, and configure the data packet format of the diagnostic response message.

[0100] Step 1042: Generate the first-frame data and continuous-frame data of the diagnostic response message according to the data packet format.

[0101] Step 1043: Package the target diagnostic response identifier with the first-frame data and the continuous-frame data to obtain the diagnostic response message corresponding to the diagnostic request message.

[0102] It should be noted that in an embodiment of the present invention, when the test device receives the diagnostic request message sent by the device under test, it automatically generates the diagnostic response message corresponding to the diagnostic request message. Among them, the bus type of the diagnostic response message needs to be the same as that of the diagnostic request message. Therefore, according to the bus type of the diagnostic request message, determine the bus type of the diagnostic response message to be generated, and configure the data packet format of the diagnostic response message. Different bus types have different requirements for data packet formats.

[0103] Specifically, first, according to the bus type of the diagnostic request message, determine whether the received diagnostic request message is CAN communication or CANFD. According to the data packet format, generate the first-frame data and continuous-frame data of the diagnostic response message according to the communication bus protocol: If the bus type of the diagnostic request message is a controller area network bus, set the data packet as the first frame in CAN format, create a first-frame data packet dictionary and add it to the automatic transmission data packet list, set the data packet as the continuous frame in CAN format, create a continuous-frame data packet dictionary and add it to the automatic transmission data packet list; If the bus type of the diagnostic request message is a controller area network bus with variable data rate, set the data packet as the first frame in CANFD format, create a first-frame data packet dictionary and add it to the automatic transmission data packet list, set the data packet as the continuous frame in CANFD format, create a continuous-frame data packet dictionary and add it to the automatic transmission data packet list.

[0104] For example, if it is CAN communication, set the data packet as the first frame in CAN format, where the data segment of the first frame is CAN_FF = '10 0A62F1 97 00 11 22'. Set the data packet as a consecutive frame in CAN format, and the data segment of the consecutive frame is CAN_SF = '21 11 22 00 00 00 00 00'. Package the target diagnostic response identifier with the first-frame data and the consecutive-frame data to obtain the diagnostic response message corresponding to the diagnostic request message. If it is CANFD communication, set the data packet as the first frame in CANFD format, where the data segment of the first frame is CANFD_FF = '10 41 62F1 97 00 11 22 33 44 55 667788 99 77 88 55 55 66 77 88 99 77 88 55 55 66 77 88 99 77 88 55 55 66 77 88 99 77 88 55 55 66 77 88 99 77 88 55 55 66 77 88 9977'. Set the data packet as a consecutive frame in CANFD format, where the data segment of the consecutive frame is CANFD_SF = '21 11 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 0000 00 00 00 00 00 00 00'.

[0105] Specifically, step 1041 determines the bus type of the diagnostic response message to be generated according to the bus type of the diagnostic request message, and configuring the data packet format of the diagnostic response message may specifically include:

[0106] First, if the bus type of the diagnostic request message is a Controller Area Network bus, determine that the bus type of the diagnostic response message to be generated is a Controller Area Network bus, and configure the data packet format of the diagnostic response message as the Controller Area Network bus format;

[0107] Second, if the bus type of the diagnostic request message is a Controller Area Network with Flexible Data Rate bus, determine that the bus type of the diagnostic response message to be generated is a Controller Area Network with Flexible Data Rate bus, and configure the data packet format of the diagnostic response message as the Controller Area Network with Flexible Data Rate bus format.

[0108] In the embodiment of the present invention, the first-frame data and continuous-frame data of the diagnostic response message are generated based on the bus type of the diagnostic request message, so as to obtain the diagnostic response message corresponding to the diagnostic request message. The developed script is used to automatically and batch-analyze the diagnostic request messages sent by the device under test, identify the bus type of the request message, and thus dynamically generate a diagnostic response message that conforms to the bus protocol corresponding to the diagnostic request message, realizing the automatic trigger response of the device under test under different bus protocols of CAN and CAN FD.

[0109] Further, referring to Figure 6 , it shows Figure 1 The flowchart of step 105 in a vehicle diagnostic response method provided by

[0110] Step 1051: Send the diagnostic response message to the device under test using the pre-divided bus for sending messages.

[0111] Step 1052: Monitor the sending status of the diagnostic response message; the sending status includes sending successfully and sending failed.

[0112] Step 1053: Record the diagnostic request message, diagnostic response message, and sending status to generate the diagnostic log of the device under test.

[0113] It should be noted that in the embodiment of the present invention, after the test device generates the diagnostic response message, it sends the diagnostic response message to the device under test using the pre-divided bus for sending messages. For example, the message is sent through the dev_auto_send_start function of the Zhouligong test device, and the sending status of the diagnostic response message is monitored; the sending status includes sending successfully and sending failed. According to the monitored message sending status, the log function is started to record the diagnostic request message, diagnostic response message, and sending status to generate the diagnostic log of the device under test.

[0114] The embodiment of the present invention monitors the response message and records all the information in the test process through the log function, which is convenient for engineers to trace and analyze the test results and problems that occur.

[0115] Referring to Figure 7 , it shows the structural schematic diagram of a vehicle diagnostic response device provided by the embodiment of the present invention. The device includes:

[0116] A message receiving module 201, configured to receive the diagnostic request message sent by the device under test;

[0117] The message processing module 202 is used to extract a message identifier from the diagnostic request message and determine the bus type of the diagnostic request message according to the message identifier; wherein, the bus type includes one of Controller Area Network (CAN) bus and Variable Rate Controller Area Network (VSCAN) bus;

[0118] The identifier matching module 203 is used to search a pre-generated routing table of the device under test according to the message identifier, and determine a target diagnostic request identifier and a target diagnostic response identifier that match the message identifier;

[0119] The response generation module 204 is used to generate a diagnostic response message corresponding to the diagnostic request message according to the bus type of the diagnostic request message and the target diagnostic response identifier;

[0120] The message sending module 205 is used to send the diagnostic response message to the device under test.

[0121] Further, the message receiving module 201 includes:

[0122] The first determination sub-module is used to pre-determine available bus resources and divide the available bus resources into a message receiving bus and a message sending bus;

[0123] The receiving sub-module is used to receive the diagnostic request message sent by the device under test using the message receiving bus.

[0124] Further, the message processing module 202 includes:

[0125] The identification sub-module is used to identify the data frame of the diagnostic request message and determine the data frame corresponding to the message identifier;

[0126] The extraction sub-module is used to extract the diagnostic request message according to the data frame corresponding to the message identifier to obtain the message identifier of the diagnostic request message;

[0127] The second determination sub-module is used to determine the bus type of the diagnostic request message according to the preset corresponding relationship between the message identifier and the bus type.

[0128] Further, the identifier matching module 203 includes:

[0129] The search sub-module is used to search the pre-generated routing table of the device under test using a preset script, and obtain the diagnostic request identifier and diagnostic response identifier in the routing table of the device under test;

[0130] A matching sub-module, configured to match the message identifier of the diagnostic request message with the diagnostic request identifier in the routing table of the device under test, determine a target diagnostic request identifier that matches the message identifier, and the target diagnostic request identifier corresponding to the target diagnostic request identifier.

[0131] Further, the response generation module 204 includes:

[0132] A configuration sub-module, configured to determine the bus type of the diagnostic response message to be generated according to the bus type of the diagnostic request message, and configure the data packet format of the diagnostic response message;

[0133] A generation sub-module, configured to generate the first frame data and continuous frame data of the diagnostic response message according to the data packet format;

[0134] A packing sub-module, configured to pack the target diagnostic response identifier, the first frame data, and the continuous frame data to obtain the diagnostic response message corresponding to the diagnostic request message.

[0135] Further, the configuration sub-module includes:

[0136] A first configuration unit, configured to determine that the bus type of the diagnostic response message to be generated is the controller area network bus if the bus type of the diagnostic request message is the controller area network bus, and configure the data packet format of the diagnostic response message as the controller area network bus format;

[0137] A second configuration unit, configured to determine that the bus type of the diagnostic response message to be generated is the variable speed rate controller area network bus if the bus type of the diagnostic request message is the variable speed rate controller area network bus, and configure the data packet format of the diagnostic response message as the variable speed rate controller area network bus format.

[0138] Further, the message sending module 205 includes:

[0139] A sending sub-module, configured to send the diagnostic response message to the device under test by using a pre-divided message sending bus;

[0140] A monitoring sub-module, configured to monitor the sending status of the diagnostic response message; the sending status includes sending success and sending failure;

[0141] A recording sub-module, configured to record the diagnostic request message, the diagnostic response message, and the sending status to generate a diagnostic log of the device under test.

[0142] The vehicle diagnosis response method provided by the embodiments of the present invention receives a diagnostic request message sent by a device under test, extracts a message identifier from the diagnostic request message, determines the bus type of the diagnostic request message according to the message identifier, looks up a pre-generated routing table of the device under test according to the message identifier, determines a target diagnostic request identifier and a target diagnostic response identifier that match the message identifier, generates a diagnostic response message corresponding to the diagnostic request message according to the bus type of the diagnostic request message and the target diagnostic response identifier, and sends the diagnostic response message to the device under test. By automatically and batch-analyzing the diagnostic request messages sent by the device under test and identifying the bus type of the request messages, the embodiments of the present invention can dynamically generate diagnostic response messages that conform to the bus protocol corresponding to the diagnostic request messages, realize the automatic trigger response of the device under test under different bus protocols of CAN and CAN FD, eliminate the need for testers to manually configure messages, reduce the human operation error rate, support batch import or export of the routing configuration table, improve the configuration efficiency of the device diagnosis response test, and achieve efficient and automatic configuration trigger response.

[0143] Referring to Figure 8 , the embodiments of the present invention also provide an electronic device, as Figure 8 shown, including a processor 301, a communication interface 302, a memory 303, and a communication bus 304. Among them, the processor 301, the communication interface 302, and the memory 303 communicate with each other through the communication bus 304.

[0144] The processor 301 and the memory 303 for storing processor-executable instructions.

[0145] Among them, the processor 301 is configured to execute the instructions to implement the vehicle diagnosis response method described below:

[0146] Receive a diagnostic request message sent by a device under test;

[0147] Extract a message identifier from the diagnostic request message and determine the bus type of the diagnostic request message according to the message identifier. Among them, the bus type includes one of a controller area network bus and a controller area network with flexible data rate bus.

[0148] Look up a pre-generated routing table of the device under test according to the message identifier and determine a target diagnostic request identifier and a target diagnostic response identifier that match the message identifier.

[0149] Generate a diagnostic response message corresponding to the diagnostic request message according to the bus type of the diagnostic request message and the target diagnostic response identifier.

[0150] Send the diagnostic response message to the device under test.

[0151] The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0152] The communication interface is used for communication between the above terminal and other devices.

[0153] The memory may include a Random Access Memory (RAM), or may also include a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.

[0154] The above-mentioned processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may 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.

[0155] In another embodiment provided by the present invention, a computer-readable storage medium is also provided. A computer program is stored on the readable storage medium, and when the computer program is executed by a processor, the vehicle diagnosis response method described in any one of the above embodiments is implemented.

[0156] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)).

[0157] It should be noted that, in this document, 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 actual relationship or order between these entities or operations. Moreover, the term "comprising", "including", or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device that includes a series of elements includes not only those elements but also other elements that are not explicitly listed, or also includes elements that are inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article, or device that includes the element.

[0158] Each embodiment in this specification is described in a related manner. The same or similar parts among the embodiments can be referred to each other, and the differences between each embodiment and other embodiments are emphasized. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.

[0159] The above are only the preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention are all included in the protection scope of the present invention.

Claims

1. A vehicle diagnosis response method, characterized in that, The method includes: Receiving a diagnostic request message sent by a device under test; Extracting a message identifier from the diagnostic request message, and determining the bus type of the diagnostic request message according to the message identifier; wherein, the bus type includes one of a Controller Area Network (CAN) bus and a Variable Rate Controller Area Network (VSCAN) bus; Looking up a pre-generated routing table of the device under test according to the message identifier, and determining a target diagnostic request identifier and a target diagnostic response identifier that match the message identifier; Generating a diagnostic response message corresponding to the diagnostic request message according to the bus type of the diagnostic request message and the target diagnostic response identifier; Sending the diagnostic response message to the device under test.

2. The method according to claim 1, wherein The receiving the diagnostic request message sent by the device under test includes: Pre-determining available bus resources, and dividing the available bus resources into a receive message bus and a send message bus; Receiving the diagnostic request message sent by the device under test using the receive message bus.

3. The method according to claim 1, wherein The extracting a message identifier from the diagnostic request message and determining the bus type of the diagnostic request message according to the message identifier includes: Identifying a data frame of the diagnostic request message to determine the data frame corresponding to the message identifier; Extracting the diagnostic request message according to the data frame corresponding to the message identifier to obtain the message identifier of the diagnostic request message; Determining the bus type of the diagnostic request message according to a preset correspondence between the message identifier and the bus type.

4. The method according to claim 1, wherein The looking up a pre-generated routing table of the device under test according to the message identifier and determining a target diagnostic request identifier and a target diagnostic response identifier that match the message identifier includes: Using a preset script to look up a pre-generated routing table of the device under test, and obtaining the diagnostic request identifier and the diagnostic response identifier in the routing table of the device under test; Matching the message identifier of the diagnostic request message with the diagnostic request identifiers in the routing table of the device under test to determine a target diagnostic request identifier that matches the message identifier, and the target diagnostic response identifier corresponding to the target diagnostic request identifier.

5. The method according to claim 1, wherein The generating a diagnostic response message corresponding to the diagnostic request message according to the bus type of the diagnostic request message and the target diagnostic response identifier includes: Determining the bus type of the diagnostic response message to be generated according to the bus type of the diagnostic request message, and configuring the data packet format of the diagnostic response message; Generating the first frame data and the continuous frame data of the diagnostic response message according to the data packet format; Packing the target diagnostic response identifier, the first frame data, and the continuous frame data to obtain the diagnostic response message corresponding to the diagnostic request message.

6. The method according to claim 5, wherein The determining the bus type of the diagnostic response message to be generated according to the bus type of the diagnostic request message and configuring the data packet format of the diagnostic response message includes: If the bus type of the diagnostic request message is a Controller Area Network (CAN) bus, determining that the bus type of the diagnostic response message to be generated is a Controller Area Network (CAN) bus, and configuring the data packet format of the diagnostic response message as the Controller Area Network (CAN) bus format; If the bus type of the diagnostic request message is a Controller Area Network (CAN) bus with variable bit rate, determine that the bus type of the diagnostic response message to be generated is a CAN bus with variable bit rate, and configure the data packet format of the diagnostic response message as the CAN bus with variable bit rate format.

7. The method according to claim 1, characterized in that, The step of sending the diagnostic response message to the device under test includes: Sending the diagnostic response message to the device under test using a pre-divided message sending bus; Monitoring the sending status of the diagnostic response message; the sending status includes sending success and sending failure; Recording the diagnostic request message, the diagnostic response message, and the sending status to generate a diagnostic log of the device under test.

8. A vehicle diagnostic response device, characterized in that, The apparatus includes: A receive message module, configured to receive a diagnostic request message sent by a device under test; A message processing module, configured to extract a message identifier from the diagnostic request message and determine the bus type of the diagnostic request message according to the message identifier; wherein, the bus type includes one of a Controller Area Network (CAN) bus and a CAN bus with variable bit rate; An identifier matching module, configured to search a pre-generated routing table of the device under test according to the message identifier to determine a target diagnostic request identifier and a target diagnostic response identifier that match the message identifier; A response generation module, configured to generate a diagnostic response message corresponding to the diagnostic request message according to the bus type of the diagnostic request message and the target diagnostic response identifier; A send message module, configured to send the diagnostic response message to the device under test.

9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus; The memory is used to store a computer program; When the processor executes the program stored on the memory, it implements the method according to any one of claims 1-7.

10. A computer-readable storage medium, on which instructions are stored, and when executed by one or more processors, cause the processors to execute the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Vehicle diagnosis method and device

    CN110661847A

  • Diagnostic method and device and vehicle

    CN117459546A

  • Testing method and device for diagnosing routing physical addressing, computer equipment and medium

    CN119544673A

  • Diagnosis message processing method and device, vehicle and storage medium

    CN119788731A

  • Vehicle diagnosis method, apparatus and device, readable storage medium and program product

    WO2024037303A1