Test method and device of controller local area network and storage medium

By parsing database calibration files and performing initial network checks, the method addresses inefficiencies in CAN testing, enhancing accuracy and efficiency through automated tools and detailed reporting for improved network reliability.

CN119094412APending Publication Date: 2024-12-06DONGFENG MOTOR GRP

Patent Information

Application Number
CN202411166818.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

Current CAN testing methods are complex, time-consuming, prone to human error, and inefficient, especially in multi-device, multi-node networks, with insufficient test coverage and manual operations hindering automated testing.

Method used

A method involving parsing database calibration files to obtain message and diagnostic message identifier arrays, performing initial network checks for error frames, and comprehensive testing based on these arrays to generate a detailed test report, using automated tools to reduce manual intervention and improve efficiency.

Benefits of technology

The method enhances test accuracy and efficiency by providing a systematic data basis for identifying and processing messages, evaluating network stability, and generating detailed reports for optimization and fault diagnosis, thereby improving the reliability of CAN networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094412A_ABST
    Figure CN119094412A_ABST
Patent Text Reader

Abstract

The invention discloses a test method and device of a controller local area network and a storage medium, and relates to the technical field of automotive electronics, the test method of the controller local area network comprises the following steps: analyzing a database calibration file to obtain a message identifier array and a diagnosis message identifier array; performing network initial detection on the controller local area network to obtain error frame number frequency; and testing the controller local area network according to the error frame number frequency, the message identifier array and the diagnosis message identifier array to obtain a target test report, and completing the test. According to the method and the device, the test accuracy is improved, and a reliable basis is provided for network optimization and fault diagnosis through a systematized test result, so that the test efficiency of the controller local area network is improved, and the test reliability of the controller local area network is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of automotive electronic technology, and in particular to a test method, device and storage medium for a controller area network. Background Art

[0002] In modern industrial control systems, Controller Area Network (CAN) is a key communication network widely used in vehicles, automated production lines and other systems with high real-time requirements. With the increase in equipment complexity and system functionality, the demand for CAN testing is also increasing. In order to ensure the stability, reliability and real-time performance of the network, it must be tested in detail, including not only network performance testing, but also fault detection, data integrity verification and real-time response capability testing. Therefore, developing an efficient and comprehensive testing method is crucial to ensure the normal operation of the system.

[0003] Currently, the testing methods for CAN mainly include functional testing, performance testing, and compatibility testing. Functional testing is used to verify whether the implementation of network protocols complies with standard specifications, performance testing focuses on indicators such as data transmission rate, latency, and throughput, and compatibility testing ensures the interoperability between different devices and systems. Usually, these tests require the use of professional testing tools and equipment, such as network analyzers, signal generators, and test software. In addition, the testing process also includes simulating various actual operating environments and abnormal situations to evaluate the performance of the system under different conditions.

[0004] Although existing test methods can cover most of the test requirements of controller area networks, there are still some problems in practical applications. First, the test process is complex and time-consuming, especially in a multi-device, multi-node network environment, the test time often increases significantly. Second, existing test tools and equipment usually require manual configuration and operation, which increases the risk of human error and makes it difficult to achieve automated testing. In addition, the analysis and report generation of test data often rely on manual operations, which is inefficient and prone to omissions. Finally, with the continuous increase in system scale and complexity, existing test methods are difficult to keep up with the pace of change, resulting in insufficient test efficiency and coverage. Therefore, how to improve the test efficiency of controller area networks has become an urgent problem to be solved.

[0005] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0006] The purpose of the present application is to provide a test method, device and storage medium for a controller area network, aiming to solve the technical problem of how to improve the test efficiency of the controller area network.

[0007] To achieve the above object, the present application proposes a method for testing a controller area network, the method comprising:

[0008] Parse the database calibration file to obtain a message identifier array and a diagnostic message identifier array;

[0009] Perform an initial network check on the controller area network to obtain the frequency of error frames;

[0010] The controller area network is tested according to the error frame frequency, the message identifier array and the diagnostic message identifier array, a target test report is obtained, and the test is completed.

[0011] In one embodiment, the step of testing the controller area network according to the error frame frequency, the message identifier array, and the diagnostic message identifier array to obtain a target test report includes:

[0012] Testing the electronic control unit according to the message identifier array and the diagnostic message identifier array to obtain a first test report;

[0013] Detect the message period and the data length code according to the message identifier array to obtain a second test report;

[0014] Detect error frames and undefined messages according to the error frame frequency and the diagnostic message identifier array to obtain a third test report;

[0015] Performing waveform analysis on the controller area network according to the message identifier array to obtain a fourth test report;

[0016] A target test report is obtained according to the first test report, the second test report, the third test report and the fourth test report, and the test is completed.

[0017] In one embodiment, the step of detecting the message period and the data length code according to the message identifier array to obtain the second test report includes:

[0018] Obtaining a message definition period corresponding to a message identifier in the message identifier array;

[0019] The message period is detected based on the message definition period and period deviation requirement, and a message period detection result is obtained;

[0020] Detecting the message data length code corresponding to the message identifier to obtain a message data length code detection result;

[0021] A second test report is obtained according to the message period detection result and the message data length code detection result.

[0022] In one embodiment, the step of performing waveform analysis on the controller area network according to the message identifier array to obtain a fourth test report includes:

[0023] Using a preset tool to capture the waveform of the message corresponding to the message identifier in the message identifier array to obtain a message waveform;

[0024] Recording the message waveform and the message status bit corresponding to the message waveform;

[0025] Dividing the message into a first message and a second message according to the message type;

[0026] Detecting a first preset field of the first message to obtain a first waveform compliance analysis result, wherein the first preset field includes an arbitration field and a data field;

[0027] Detecting a second preset field of the second message to obtain a second waveform compliance analysis result;

[0028] Obtaining a differential waveform of the arbitration field and the data field according to the first waveform compliance analysis result;

[0029] Detecting the oscillation of the differential waveform to obtain an oscillation detection result;

[0030] Detect and analyze the rising edge data and the falling edge data of the message waveform to obtain an edge data detection result;

[0031] A fourth test report is obtained according to the message waveform, the message identifier, the first waveform compliance analysis result, the second waveform compliance analysis result, the differential waveform, the oscillation detection result and the edge data detection result.

[0032] In one embodiment, the step of detecting error frames and undefined messages according to the error frame frequency and the diagnostic message identifier array to obtain a third test report includes:

[0033] When the error frame frequency is greater than the preset frame frequency, error frame detection is performed and continues for a third preset time length;

[0034] When the error frame frequency is less than or equal to the preset frame frequency, the error frame detection is performed and lasts for a fourth preset time length;

[0035] When no error frame is detected, obtaining a first error frame detection result;

[0036] When an error frame is detected, sending a communication instruction to each electronic control unit corresponding to the diagnostic identifier of the diagnostic message identifier array through a unified diagnostic service protocol;

[0037] Performing the error frame detection during the closing communication and recording the number of error frames until all the electronic control units complete the closing communication, thereby obtaining a second error frame detection result;

[0038] Detecting undefined messages according to the database calibration file for a fifth preset time period;

[0039] When the undefined message is not detected, obtaining a first undefined message detection result;

[0040] When the undefined message is detected, the undefined message is recorded in an undefined message list;

[0041] Sending the communication instruction to each of the electronic control units through the unified diagnostic service protocol;

[0042] During the gateway communication, the undefined message is detected until all the electronic control units complete the gateway communication, thereby obtaining a second undefined message detection result;

[0043] A third test report is obtained according to the first error frame detection result, the second error frame detection result, the first undefined message detection result, and the second undefined message detection result.

[0044] In one embodiment, the step of testing the electronic control unit according to the message identifier array and the diagnostic message identifier array to obtain a first test report includes:

[0045] Sending a diagnostic instruction to each electronic control unit corresponding to the diagnostic identifier of the diagnostic message identifier array through a unified diagnostic service protocol to obtain electronic control unit information, a current first fault code list, and a second fault code list that cannot be cleared;

[0046] Obtain a fifth test report according to the diagnostic message identifier array, the electronic control unit information, the first fault code list, and the second fault code list;

[0047] Sending a fault code reading instruction to each of the electronic control units through the unified diagnostic service protocol to obtain supported fault codes of the electronic control unit, and recording the number of supported fault codes;

[0048] Obtain a sixth test report according to the diagnostic message identifier array, the supported fault codes, and the number of supported fault codes;

[0049] According to the second fault code list, recording the number of fault codes of each electronic control unit into a fault code number array;

[0050] According to the fault code number array, a high load test is performed on the controller area network to obtain a seventh test report;

[0051] Controlling the vehicle to execute a preset operation, and performing error frame detection and fault code reading in the controller area network, and obtaining an eighth test report according to the fault code quantity array, the detection result and the reading result;

[0052] The fifth test report, the sixth test report, the seventh test report and the eighth test report are integrated to obtain a first test report.

[0053] In one embodiment, the step of performing a high load test on the controller area network according to the fault code quantity array to obtain a seventh test report includes:

[0054] Obtaining a network load of a controller area network and recording first network load data;

[0055] Sending a test message to each of the electronic control units until the network load is greater than or equal to a preset load threshold and lasts for a first preset time, and saving second network load data of the controller area network;

[0056] After waiting for a second preset time, stop sending the test message, read the current second fault code of each electronic control unit through the unified diagnostic service protocol, and record the second fault code in a third fault code list;

[0057] According to the fault code quantity array, comparing the second fault code list with the third fault code list to obtain a first comparison result;

[0058] A seventh test report is obtained according to the first network load data, the second network load data, the third fault code list, the first comparison result and the diagnostic message identifier array.

[0059] In one embodiment, the preset operation includes a first preset operation and a second preset operation, the step of controlling the vehicle to execute the preset operation, and performing error frame detection and fault code reading in the controller area network, and obtaining an eighth test report according to the fault code quantity array, the detection result and the reading result includes:

[0060] Controlling the vehicle to perform a first preset operation, detecting a first error frame in the controller area network during the operation, and recording first error frame information;

[0061] After the first preset operation is completed, reading the current third fault code of the electronic control unit through the unified diagnostic service protocol, and recording the third fault code in a fourth fault code list;

[0062] According to the fault code quantity array, comparing the second fault code list with the fourth fault code list to obtain a second comparison result;

[0063] Obtaining a ninth test report according to the first error frame information, the fourth fault code list, the second comparison result, and the diagnostic message identifier array;

[0064] controlling the vehicle to perform a second preset operation;

[0065] After the second preset operation is completed, detecting a second error frame in the controller area network and recording second error frame information;

[0066] Detecting the communication recovery status of the electronic control unit by sending the test message;

[0067] Reading a fourth fault code of the electronic control unit through the unified diagnostic service protocol, and recording the fourth fault code into a fifth fault code list;

[0068] According to the fault code quantity array, comparing the second fault code list with the fifth fault code list to obtain a third comparison result;

[0069] Obtaining a tenth test report according to the second error frame information, the communication recovery status, the fifth fault code list, the third comparison result and the diagnostic message identifier array;

[0070] The ninth test report and the tenth test report are integrated to obtain an eighth test report.

[0071] In addition, to achieve the above-mentioned purpose, the present application also proposes a test device for a controller area network, the device comprising:

[0072] A parsing module, used for parsing the database calibration file to obtain a message identifier array and a diagnostic message identifier array;

[0073] The initial inspection module is used to perform an initial network inspection on the controller local area network to obtain the frequency of error frames;

[0074] The test module is used to test the controller local area network according to the error frame frequency, the message identifier array and the diagnostic message identifier array, obtain a target test report, and complete the test.

[0075] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the controller local area network testing method as described above are implemented.

[0076] One or more technical solutions proposed in this application have at least the following technical effects:

[0077] The database calibration file is parsed to obtain the message identifier array and the diagnostic message identifier array; the controller area network is preliminarily inspected to obtain the error frame frequency; the controller area network is tested according to the error frame frequency, the message identifier array and the diagnostic message identifier array to obtain the target test report and complete the test. First, by parsing the database calibration file, the message identifier array and the diagnostic message identifier array are extracted, which provides an accurate data basis for the test, ensuring that various messages can be accurately identified and processed during the test, thereby improving the accuracy of the test. Then, the controller area network is preliminarily inspected and the error frame frequency is calculated, which can preliminarily evaluate the stability and health status of the network, help identify potential problems in the network, and quickly locate performance bottlenecks. Finally, combined with the error frame frequency, the message identifier array and the diagnostic message identifier array, the network is fully tested and a target test report is generated, the test results are systematized, and a detailed basis is provided for network optimization and fault diagnosis, thereby improving the test efficiency of the controller area network. Overall, this application comprehensively improves the testing efficiency and reliability of the controller area network through detailed data analysis and testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0079] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0080] Figure 1 This is a schematic diagram of the test system structure of the controller area network of this application;

[0081] Figure 2 A flowchart of the first embodiment of the test method for the controller area network of the present application is provided;

[0082] Figure 3A flow chart of the second embodiment of the test method for the controller area network of the present application;

[0083] Figure 4 A schematic diagram of a fourth test flow corresponding to a fourth test report provided in Embodiment 2 of the test method for a controller area network of the present application;

[0084] Figure 5 A schematic diagram of the module structure of a test device for a controller area network according to an embodiment of the present application;

[0085] Figure 6 This is a schematic diagram of the device structure of the hardware operating environment involved in the test method for the controller area network in the embodiment of the present application.

[0086] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0087] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0088] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0089] In modern industrial control systems, CAN is the core communication network, and its stability, reliability and real-time performance are crucial. As the complexity of the system increases, the demand for testing CAN networks is growing, including performance, fault detection, data integrity and real-time response capabilities. Although the current functional testing, performance testing and compatibility testing methods can meet these needs to a certain extent, the complexity, time-consuming, manual operation dependence and low efficiency of data analysis and report generation of the testing process still exist. The demand for automated testing is becoming increasingly urgent to improve test efficiency and accuracy while coping with the continuous growth of system scale and complexity.

[0090] The main solution of the embodiment of the present application is: to extract key message identifier information by parsing the database calibration file, and to perform an initial network inspection to evaluate the stability of the CAN network, and then use these data to perform comprehensive network testing and generate a detailed test report.

[0091] It should be noted that the execution subject of the embodiment of the present application can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device that can realize the above functions, a vehicle system, a test computer, a test system, etc. The following takes the test system as an example to illustrate this embodiment and the following embodiments.

[0092] Please refer to Figure 1 , Figure 1 This is a schematic diagram of the test system structure of the controller area network of this application. The figure shows a schematic diagram of the CAN / CANFD (CAN with Flexible Data-rate) network test system structure, in which the system is connected to the system to be tested via a USB interface to realize the automated test of the real vehicle network. The test system includes a parsing module for parsing the DBC (Database Calibration) file to obtain the message identifier array and the diagnostic message identifier array; an initial inspection module for performing preliminary detection of the network and calculating the error frame frequency; and a test module for performing in-depth network performance testing based on the obtained error frame frequency and message identifier array, and generating a target test report. In the test system, the high-level signal line (CANH, CAN High) and the low-level signal line (CANL, CAN Low) represent the two differential signal lines of the CAN bus, corresponding to the high-level and low-level signals, respectively, and GND represents the ground line, which together constitute the physical connection of the CAN bus. The system is connected to CANH and CANL through the CAN tool to send and receive CAN messages to complete the monitoring and testing of network communications. In addition, the system is also connected to an oscilloscope to capture and analyze the signal waveform on the CAN bus to further ensure the integrity and quality of the signal. The design of the entire system aims to improve the efficiency and accuracy of real-vehicle network testing, reduce manual intervention through automation, shorten the time for test preparation and report compilation, and improve the accuracy and reliability of test results. Through this structural design, the test system can comprehensively evaluate the performance of the CAN / CANFD network, including but not limited to key parameters such as message cycle, data length code (DLC), error frame, undefined message, DTC supported by ECU, and CAN waveform, providing strong data support for network optimization and fault diagnosis of automotive electronic technology.

[0093] Based on this, the present application embodiment provides a test method for a controller area network, referring to Figure 2 , Figure 2 This is a flow chart of the first embodiment of the test method for a controller area network of the present application.

[0094] In this embodiment, the method for testing the controller area network includes steps S10 to S30:

[0095] Step S10, parsing the database calibration file to obtain a message identifier array and a diagnostic message identifier array;

[0096] It should be noted that the database calibration file refers to a configuration file used to define and describe data exchange in the controller area network (CAN) network. In this file, the communication protocol, data format and identifier between each node (controller, sensor, etc.) are usually included. Common database calibration file formats include CAN database files (.dbc) and SOME / IP service description files (.sdf). These files define the data encoding method, signal length and position, message cycle, etc. Parsing these files is to understand how data is encoded, transmitted and decoded in the network, so that the communication process can be accurately analyzed and tested. The message identifier array is a set of identifiers extracted from the database calibration file to identify different CAN messages. In the CAN network, each data message has a unique identifier to distinguish different messages and data types. The message identifier array arranges these identifiers in a certain order so that specific messages can be quickly identified and processed during testing and data analysis. For example, the message identifier array can help testers quickly find and process specific CAN messages and verify whether they are sent and received as expected. The diagnostic message identifier array is a collection of message identifiers extracted from the database calibration file and specifically used for diagnostic communication. In vehicles or industrial control systems, diagnostic messages are used to transmit fault information, status reports or equipment diagnostic data. These message identifiers are used to identify diagnosis-related messages so that these diagnostic data can be specially processed during fault detection, system health checks or performance analysis. The diagnostic message identifier array helps testers identify and analyze diagnostic messages to ensure that the system can correctly report and respond to fault conditions.

[0097] It can be understood that parsing the database calibration file refers to the process of extracting key information from the database file containing the communication protocol and data structure definitions, which define the identifiers of each message in the network and its data structure. The parsing process first involves reading the content in the database calibration file to identify all defined CAN messages and their identifiers; next, these message identifiers are classified according to their role in the network to form a message identifier array, which contains the identifiers of all ordinary data messages; at the same time, it is also necessary to extract message identifiers for diagnostic purposes, which are usually related to system status monitoring and fault diagnosis, to form a diagnostic message identifier array; finally, these arrays will serve as the basic data for testing and analysis to verify the performance and reliability of the communication system.

[0098] Step S20, performing an initial network check on the controller local area network to obtain the frequency of error frames;

[0099] It should be noted that the error frame frequency refers to the number of error frames that appear in the network within a certain period of time, expressed in error frames per second (FPS). For example, if 50 error frames are detected within a detection time of 10 seconds, the error frame frequency is 5 error frames per second (5FPS).

[0100] It can be understood that, first, a network test device or tool is used to monitor the controller area network, capture all transmitted messages during the detection cycle, and identify the error frames (i.e., those frames that failed to pass the verification or had communication problems). Then, the total number of these error frames is counted. Next, by recording the total time used in the detection process, the number of error frames is divided by the detection time to calculate the number of error frames per second, i.e., the error frame frequency. This frequency value represents the average number of error frames that appear in the network per second, thereby helping to evaluate the stability and communication quality of the network.

[0101] Step S30, testing the controller area network according to the error frame frequency, the message identifier array and the diagnostic message identifier array, obtaining a target test report, and completing the test.

[0102] It should be noted that the target test report is a comprehensive document generated based on a detailed test of the controller area network (CAN). The report records the following in detail: (1) Test Overview: The beginning of the report describes the background, purpose, and test methods and tools used in the test. It includes a brief introduction to the test environment, such as network topology, device configuration, and test conditions. (2) Error frame frequency analysis: The report lists in detail the error frame frequency data obtained based on the initial network inspection. This section includes the frequency, distribution, and trend analysis of error frames during the test, helping to evaluate the stability and health of the network. (3) Message identifier analysis: The report lists in detail the message identifier array extracted from the database calibration file and describes the role and performance of these identifiers in the test. The analysis includes whether the transmission of each message is in line with expectations, and whether there are problems such as data loss, delay, or format errors. (4) Diagnostic message identifier analysis: The report also covers the test results of the diagnostic message identifier array extracted from the database calibration file. This section describes the accuracy of the diagnostic message and the system's responsiveness to diagnostic information, and evaluates the effectiveness of the system in fault detection and diagnosis. (5) Read ECU information: Read ECU information results, including the diagnostic message name, diagnostic ID, OEM part number, hardware version number, software version number, currently stored fault code list, and fault code list that cannot be cleared of each ECU. (6) Check message cycle: All message cycle detection results, load rate values ​​and screenshots of the network segment. The message cycle detection results include the message name, ID, DBC definition cycle, average cycle, minimum cycle, maximum cycle, number of cycle abnormal messages, and total number of detected messages of each message. (7) Check DLC: Real-time data of DLC abnormal messages, DLC abnormal detection results, and when there are DLC abnormal messages, output the DLC abnormal message list. (8) Network behavior under high load: The original load rate data and screenshots of the network segment, the data and screenshots after the load rate is increased, and after the high load test, the fault code list of each controller is output, including the diagnostic message name, diagnostic ID, currently stored fault code list, and the comparison result with the initial fault number of each ECU. (9) Network robustness test: record the completion time of each operation, record the error frame information during the process, and after the network robustness test, output the fault code list of each controller, including the diagnostic message name, diagnostic ID, currently stored fault code list, and the comparison result with the initial fault number of each ECU. (10) Line error: record the test start time, record the error frame check after the line error is completed, and after the line error test, output the fault code list of each controller, including the diagnostic message name, diagnostic ID, currently stored fault code list, and the comparison result with the initial fault number of each ECU.(11) Error frame check: Error frame check result. If an error frame is detected, after the communication is completed for each ECU, the communication result is output, including the diagnostic message name, diagnostic ID, and number of error frames per second during the communication. (12) Undefined message detection: Undefined message detection result. If there is an undefined message, the undefined message list is output. After the communication is completed for each ECU, the communication result is output, including the diagnostic message name, diagnostic ID, and undefined message list during the communication. (13) Read DTC supported by ECU: Read the DTC supported by ECU result, including the diagnostic message name, diagnostic ID, number of supported DTCs, and supported DTC list of each ECU. (14) CAN waveform analysis: screenshot of the overall waveform of the message and the values ​​of the ID and key bits; screenshot of the analysis results of each field of the message, detection of the waveform voltage value and bit width, and output of the typical voltage values ​​of the dominant and invisible bits of the corresponding fields CANH, CANL, and CANdiff; analysis and screenshot of the quality of the differential waveform; inspection and analysis of the rising and falling edge data of the message waveform, including the minimum, maximum, average, standard deviation and other test results of the rising and falling edge time. (15) Problem discovery and suggestions: summarizes the main problems found during the test process and provides improvement suggestions. This includes network performance bottlenecks, potential fault points, error source analysis, etc., and also puts forward suggestions for further optimizing network performance and improving test efficiency.

[0103] It can be understood that, first of all, the aforementioned error frame frequency data is used to analyze the frequency and distribution of error frames in the network to evaluate the stability and health of the network. Then, based on the message identifier array, each CAN message is tested to check whether it is transmitted as expected and whether there are problems such as data loss, errors or delays. At the same time, the diagnostic message identifier array is used for testing to verify whether the system can accurately generate and process diagnostic messages to ensure the effectiveness of fault detection and diagnostic functions. All these test results and analysis data will be summarized in the target test report, which records the network performance, data transmission and diagnostic function performance in detail, and finally completes the comprehensive test of the network and provides improvement suggestions.

[0104] This embodiment provides a test method for a controller area network, which parses a database calibration file to obtain a message identifier array and a diagnostic message identifier array; performs a network initial inspection on the controller area network to obtain an error frame frequency; tests the controller area network according to the error frame frequency, the message identifier array, and the diagnostic message identifier array, obtains a target test report, and completes the test. First, by parsing the database calibration file, extracting the message identifier array and the diagnostic message identifier array, an accurate data basis is provided for the test, ensuring that various messages can be accurately identified and processed during the test, thereby improving the accuracy of the test. Next, the controller area network is initially inspected, and the error frame frequency is calculated, which can preliminarily evaluate the stability and health status of the network, help identify potential problems in the network, and quickly locate performance bottlenecks. Finally, combined with the error frame frequency, the message identifier array, and the diagnostic message identifier array, the network is comprehensively tested, and a target test report is generated, the test results are systematized, and a detailed basis is provided for network optimization and fault diagnosis, thereby improving the test efficiency of the controller area network. Overall, this embodiment comprehensively improves the test efficiency and reliability of the controller area network through detailed data analysis and testing.

[0105] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can refer to the above introduction, and will not be repeated later. Figure 3 , Figure 3 This is a flow chart of a second embodiment of a method for testing a controller area network of the present application. Step S30 of the method for testing a controller area network includes steps S31 to S35:

[0106] Step S31, testing the electronic control unit according to the message identifier array and the diagnostic message identifier array to obtain a first test report;

[0107] It should be noted that an Electronic Control Unit (ECU) is an electronic device used to control and manage specific functions in a vehicle or other control system. Each ECU is usually responsible for performing specific tasks, such as engine control, brake system control, or in-vehicle entertainment system control. In a controller area network (CAN) system, the ECU is the main communication node in the network, responsible for receiving and sending data messages. The first test report refers to the report generated after testing the electronic control unit based on the message identifier array and the diagnostic message identifier array. This report covers detailed results and analysis for specific test content.

[0108] It is understandable that, first, using the message identifier array and the diagnostic message identifier array, detailed functional testing is performed on the ECU, which involves sending and receiving specific messages, verifying whether the ECU can correctly process these messages, whether it transmits data according to the defined cycle, and whether it can accurately generate and parse diagnostic information. During the test, the correctness of the message, ECU information, ECU-supported fault codes (DTC), network robustness, line errors, and ECU performance under high load conditions are checked. These test results will be recorded and organized into the first test report, which describes in detail the effectiveness of the ECU functions found in the test, the accuracy of data transmission, and possible performance issues. This report provides a detailed data basis for subsequent comprehensive analysis and helps identify and solve possible problems with the ECU in the network.

[0109] As an example, the electronic control unit is tested according to the message identifier array and the diagnostic message identifier array, and the step of obtaining a first test report includes: sending a diagnostic instruction to each electronic control unit corresponding to the diagnostic identifier of the diagnostic message identifier array through a unified diagnostic service protocol to obtain electronic control unit information, a current first fault code list, and a second fault code list that cannot be cleared; obtaining a fifth test report according to the diagnostic message identifier array, the electronic control unit information, the first fault code list, and the second fault code list; sending a fault code reading instruction to each of the electronic control units through the unified diagnostic service protocol to obtain the supported fault codes of the electronic control unit, And record the number of supported fault codes; obtain a sixth test report according to the diagnostic message identifier array, the supported fault codes and the number of supported fault codes; according to the second fault code list, record the number of fault codes of each electronic control unit into the fault code number array; according to the fault code number array, perform a high load test on the controller area network to obtain a seventh test report; control the vehicle to perform preset operations, and perform error frame detection and fault code reading in the controller area network, and obtain an eighth test report according to the fault code number array, the detection results and the reading results; integrate the fifth test report, the sixth test report, the seventh test report and the eighth test report to obtain a first test report.

[0110] Unified Diagnostic Services (UDS) is a standard communication protocol for automotive diagnostics that defines the format and transmission of diagnostic messages, including functions such as reading and clearing fault codes and obtaining ECU information. It ensures that diagnostic operations between different manufacturers and different vehicles are compatible and unified. Diagnostic identifiers are codes used in the UDS protocol to specify specific diagnostic services or functions. Each diagnostic identifier corresponds to a specific diagnostic operation, such as reading ECU information or fault codes. Diagnostic instructions are requests sent to the ECU via the UDS protocol to perform specific diagnostic tasks. These instructions include reading part numbers, reading hardware version numbers, reading software version numbers, reading current fault codes, and clearing fault codes. Electronic control unit information is basic data about the ECU obtained through diagnostic instructions, including part numbers, hardware version numbers, and software version numbers. This information helps confirm the model and version of the ECU. The first fault code list is the current set of fault codes read from the ECU, showing all active fault codes reported by the ECU during testing. The second fault code list refers to the set of fault codes that cannot be cleared after trying to clear the fault codes, indicating that these faults may be serious or persistent. The fifth test report is a report generated based on the diagnostic message identifier array and ECU information, which records in detail the diagnostic message name, diagnostic ID, OEM part number, hardware version number, software version number, currently stored fault code list and fault code list that cannot be cleared of each ECU. The fault code reading instruction is a request sent to the ECU via the UDS protocol to obtain all fault codes supported by the ECU. The supported fault code is the type of fault code that the ECU can identify and report, indicating the fault category that the ECU can handle. The number of supported fault codes refers to the total number of fault codes that the ECU can report, which is used to evaluate the diagnostic capability of the ECU. The sixth test report is a report generated based on the supported fault codes and their number, which records the fault codes and their number supported by the ECU, including the diagnostic message name, diagnostic ID, supported DTC number and supported DTC list of each ECU. The number of fault codes refers to the number of fault codes that cannot be cleared by each ECU. The fault code number array is a data set that records the number of fault codes for each ECU, which is used to analyze and compare the number of fault codes of different ECUs. High load testing refers to applying additional communication load in the controller area network to test the performance and stability of the ECU under high pressure, including processing power and response speed. The seventh test report is a report generated based on the fault code quantity array and high-load test results. It records the performance of the ECU under high-load conditions and the fault code processing. It includes the original load rate data and screenshots of the network segment, the data and screenshots after the load rate is increased, and the fault code list of each controller after the high-load test (the diagnostic message name of each ECU, the diagnostic ID, the currently stored fault code list, and the comparison results with the initial fault number).Preset operations refer to specific operations performed in the vehicle control system, such as starting the engine or accelerating, to simulate the real operating environment and test the performance of the ECU under actual working conditions. Error frame detection is the monitoring and recording of erroneous data frames transmitted in the network to identify and analyze problems that may occur during the communication process. Fault code reading is the process of extracting and recording fault codes from the ECU for diagnosis and analysis of faults or problems in the system. Detection results refer to the data and analysis results obtained during the test, including fault codes, network behavior, error frames and other information. The reading results are specific data obtained from the ECU, such as fault code lists, ECU information, etc., reflecting the actual status and performance of the ECU. The eighth test report is a report generated based on the results of error frame detection, fault code reading and preset operations, which records the performance of the ECU and the error conditions in the network under specific operations.

[0111] First, using the unified diagnostic service protocol (UDS), a series of diagnostic instructions are sent to each ECU, which are executed in order: read part number, read hardware version number, read software version number, read current fault code, clear fault code, and read current fault code again. The execution of these instructions will produce three types of results: basic information of ECU (including part number and version number), current first fault code list (displaying all active fault codes), and second fault code list that cannot be cleared (indicating persistent faults). Based on these data, the fifth test report is generated to record the information and fault code status of ECU in detail. Next, the fault code reading instruction is sent through the UDS protocol to obtain and record all fault codes and their numbers supported by each ECU. These data are organized into the sixth test report, showing the diagnostic trouble codes (DTCs) and their numbers that the ECU can recognize. Further, according to the second fault code list, the number of fault codes of each ECU is recorded in the fault code number array, and then a high load test is performed to evaluate the performance of the ECU under high network pressure, and the seventh test report is generated. At the same time, the vehicle is controlled to perform preset operations (such as accelerating or starting the engine), and error frame detection and fault code reading are performed in the controller area network. The eighth test report is generated based on the fault code number array, detection results, and reading results. Finally, the fifth, sixth, seventh, and eighth test reports are integrated to form the first test report, which comprehensively summarizes the functional performance, diagnostic capabilities, and network stability of the ECU.

[0112] As an example, according to the array of the number of fault codes, a high-load test is performed on the controller area network, and the steps of obtaining the seventh test report include: obtaining the network load of the controller area network and recording the first network load data; sending a test message to each of the electronic control units until the network load is greater than or equal to a preset load threshold and lasts for a first preset time, and saving the second network load data of the controller area network; after waiting for the second preset time, stopping sending the test message, reading the current second fault code of each electronic control unit through the unified diagnostic service protocol, and recording the second fault code to the third fault code list; according to the array of the number of fault codes, comparing the second fault code list with the third fault code list to obtain a first comparison result; according to the first network load data, the second network load data, the third fault code list, the first comparison result and the diagnostic message identifier array, obtaining the seventh test report.

[0113] Network load refers to the network resource usage caused by data transmission and communication activities in the controller area network (CAN), which is usually measured by the number of data frames, transmission frequency or bandwidth utilization. The first network load data refers to the initial network load of the controller area network recorded before the test begins, which provides the network usage benchmark data without applying additional load. Test messages refer to specific data frames sent to simulate network load and test network performance. These messages can be randomly generated or predefined, and are used to increase network load and test its performance under high load conditions. The preset load threshold refers to the target value of the network load set in the test, which is 70% of the maximum network load in this embodiment. The purpose of the test is to increase the network load to this threshold or above to evaluate the stability and performance of the network under high load. The first preset duration refers to the length of time that the network load is maintained after reaching the preset load threshold. This period of time is used to observe the performance and stability of the network under continuous high load conditions. The second network load data refers to the network usage recorded during the period when the network load reaches and maintains the preset load threshold. It is used to evaluate the actual load level of the network under high load conditions. The second preset duration refers to the length of time to wait after the high load test ends. No test message is sent during this period to observe the recovery and stability of the network load. The second fault code refers to the new fault code read from each ECU during the high load test. These fault codes may be new or additional fault records caused under high load conditions. The third fault code list refers to all new fault codes recorded after the high load test, including the second fault code read after the second preset time. These fault codes are used to analyze the impact of high load conditions on ECU fault records. The first comparison result refers to the analysis result obtained by comparing the second fault code list with the third fault code list. This comparison is used to identify whether new fault codes have appeared during the high load test, and the changes in these fault codes. The seventh test report is a comprehensive report generated based on network load data, fault code list and comparison results. It records in detail the changes in network load under high load conditions, the addition or change of ECU fault codes, and the evaluation of overall network performance, including the original load rate data and screenshots of the network segment, the data and screenshots after the load rate is increased, and the fault code list of each controller after the high load test (the diagnostic message name of each ECU, the diagnostic ID, the currently stored fault code list, and the comparison result with the initial number of faults).

[0114] First, measure and record the initial network load of the controller area network to obtain the first network load data. Then, send a specific test message to each electronic control unit (ECU), continue to send until the network load reaches or exceeds the preset load threshold, and maintain the load state until the end of the first preset time, and save the network load data at this time to obtain the second network load data. After that, stop sending the test message and wait for the second preset time, which is used to observe the recovery of the network load. During this period, read the current fault code of each ECU through the unified diagnostic service protocol (UDS), and record these fault codes in the third fault code list. Subsequently, compare the second fault code list (fault code during high load) with the third fault code list to obtain the first comparison result and identify the impact of high load test on fault code. Finally, based on the first network load data, the second network load data, the third fault code list, the first comparison result and the diagnostic message identifier array, the seventh test report is comprehensively generated, which records in detail the changes in network load under high load conditions, the addition or change of fault codes, and the overall network performance evaluation.

[0115] As an example, the preset operation includes a first preset operation and a second preset operation, the vehicle is controlled to perform the preset operation, and error frame detection and fault code reading are performed in the controller area network, and the steps of obtaining the eighth test report according to the fault code quantity array, the detection result and the reading result include: controlling the vehicle to perform the first preset operation, detecting the first error frame in the controller area network during the operation, and recording the first error frame information; after the first preset operation is completed, reading the current third fault code of the electronic control unit through the unified diagnostic service protocol, and recording the third fault code to the fourth fault code list; comparing the second fault code list with the fourth fault code list according to the fault code quantity array to obtain a second comparison result; and obtaining a second comparison result according to the first error frame information, the fourth fault code list, the second comparison result and the The diagnostic message identifier array is used to obtain a ninth test report; the vehicle is controlled to perform a second preset operation; after the second preset operation is completed, a second error frame in the controller local area network is detected, and the second error frame information is recorded; the communication recovery status of the electronic control unit is detected by sending the test message; the fourth fault code of the electronic control unit is read through the unified diagnostic service protocol, and the fourth fault code is recorded in the fifth fault code list; according to the fault code quantity array, the second fault code list is compared with the fifth fault code list to obtain a third comparison result; according to the second error frame information, the communication recovery status, the fifth fault code list, the third comparison result and the diagnostic message identifier array, a tenth test report is obtained; the ninth test report and the tenth test report are integrated to obtain an eighth test report.

[0116] The first preset operation refers to the first operation performed when controlling the vehicle, including but not limited to starting the engine, turning on and off the small lights, turning on and off the headlights, turning on and off the doors, turning on and off the central lock, turning on and off the wipers, turning on and off the audio, turning on and off the air conditioner, continuously turning on and off the power, restoring the ON gear, accelerating, starting the engine, etc., which is used to simulate the working state of the vehicle in actual driving. This operation is used to test the responsiveness and stability of the controller area network (CAN). The first error frame refers to the error data frame detected in the controller area network during the execution of the first preset operation. These error frames may be caused by network interference or data transmission problems. The first error frame information refers to a detailed record of the first error frame, including the error type, occurrence time, specific data of the error frame, etc. This information is used to analyze the stability of the network in the first preset operation. The third fault code refers to the new fault code read from each electronic control unit (ECU) through the unified diagnostic service protocol (UDS) after the first preset operation is executed. These fault codes are used to evaluate the fault situation during the operation. The fourth fault code list is all fault codes recorded after the first preset operation is executed, including the third fault code read from the ECU. This list is used to analyze the impact of the operation on the fault code. The second comparison result refers to the analysis result obtained by comparing the second fault code list with the fourth fault code list, which is used to identify the fault codes newly added or changed during the first preset operation. The second preset operation refers to another operation performed in vehicle control, including but not limited to the high-level signal line (CANH, CAN High) of the CAN bus short-circuited to ground, CANH short-circuited to power, low-level signal line (CANL, CAN Low) short-circuited to ground, CANL short-circuited to power, CANH and CANL short-circuited, recovering and restarting the engine or Ready (ready state), used to verify whether the relevant fault codes can be recorded in the case of network online errors, and whether the network can be restored after the line error, and to further test the performance and robustness of the controller area network. The ninth test report is a report generated based on the results of the first preset operation, which records the detailed results of the network robustness test, including the completion time record of each operation, the error frame information record during the operation, the fault code list of each controller after the network robustness test (the diagnostic message name of each ECU, the diagnostic ID, the currently stored fault code list, and the comparison result with the initial fault number), etc., and evaluates the stability and robustness of the network in the first preset operation. The second error frame refers to an error data frame detected in the controller local area network during the execution of the second preset operation. Similar to the first error frame, these error frames indicate the performance of the network in the second preset operation. The second error frame information refers to a detailed record of the second error frame, including the error type, occurrence time, specific data of the error frame, etc. This information is used to analyze the stability of the network in the second preset operation.The communication recovery situation refers to checking the communication recovery ability of the ECU after a high load or error state by sending a test message, and evaluating its response and stability under normal network conditions. The fourth fault code refers to the new fault code read from each ECU through the UDS after the second preset operation is performed. These fault codes are used to evaluate the impact of the second preset operation on the ECU. The fifth fault code list is a record of all fault codes after the second preset operation is performed, including the fourth fault code read from the ECU. This list is used to analyze the impact of the operation on the fault code. The third comparison result refers to the analysis result obtained by comparing the second fault code list with the fifth fault code list, which is used to identify the newly added or changed fault codes during the second preset operation. The tenth test report is a report generated based on the results of the second preset operation, which records the detailed results of the line error test, including the test time record, the error frame check record after the line error is completed, and the fault code list of each controller after the line error test (the diagnostic message name of each ECU, the diagnostic ID, the currently stored fault code list, and the comparison result with the initial fault number), etc., and evaluates the performance and stability of the network in the second preset operation.

[0117] In the process of performing high-load testing and fault code analysis, first, the vehicle is controlled to perform a first preset operation, such as accelerating or starting the engine, and the data transmission in the controller area network (CAN) is monitored during the process, and the first error frame information detected is recorded. These error frames show the network problems that may occur during the operation. After the operation is completed, the current third fault code of each electronic control unit (ECU) is read through the unified diagnostic service protocol (UDS), and these fault codes are recorded in the fourth fault code list. This process is intended to analyze the impact of the first preset operation on the fault code, and compare it with the second fault code list to obtain the second comparison result, which reflects the addition or change of the fault code. Based on these data, including the first error frame information, the fourth fault code list, the second comparison result and the diagnostic message identifier array, a ninth test report is generated, which evaluates the robustness of the network under the first preset operation. Next, the vehicle is controlled to perform a second preset operation, such as emergency braking or steering, and the second error frame is detected during the process and the relevant information is recorded. By sending test messages, the communication recovery capability of the ECU is detected to ensure that normal communication can be restored in the error state. Then read the fourth fault code after the second preset operation through UDS, record it in the fifth fault code list, compare it with the second fault code list, get the third comparison result, and analyze the impact of the operation on the fault code. Finally, based on the second error frame information, communication recovery, the fifth fault code list, the third comparison result, and the diagnostic message identifier array, generate the tenth test report to evaluate the line error and communication recovery. Integrate the ninth and tenth test reports to form the eighth test report, which comprehensively summarizes the results of the network robustness and line error tests.

[0118] Step S32, detecting the message period and the data length code according to the message identifier array to obtain a second test report;

[0119] It should be noted that the message period refers to the time interval between each message being sent once and the next time it is resent in the controller area network (CAN). This period determines the frequency of data updates and affects the real-time and responsiveness of the network. In the test, by checking the message period, it is possible to verify whether the message is sent at the predetermined time interval, ensuring the real-time performance of the system in practical applications. The data length code (DLC) is a field in the CAN protocol used to indicate the number of data bytes contained in each data message. The DLC value determines the length of the data part in the CAN message, ensuring that the receiver can correctly parse the received data. In the test, detecting the data length code can confirm whether the actual length of the data in the message is consistent with the expectation, avoiding data loss or misinterpretation. The second test report refers to the report generated by detecting the message period and data length code in the message identifier array. This report records all relevant information found during the detection process, including whether the period of each message meets expectations and whether the data length code is set correctly. The second test report is used to verify the periodicity of the message and the accuracy of the data length in the CAN network, ensuring the stability and consistency of the network during data transmission.

[0120] It can be understood that, first, the identifiers in the message identifier array are used to periodically monitor each relevant message in the network, and the time interval between each message being sent once and the next time is recorded, so as to confirm whether the message period meets the predetermined requirements. Secondly, the data length code (DLC) of each message is checked to verify whether it correctly represents the actual number of bytes of the data part. These checks ensure that the message transmission frequency and data length meet the design standards of the system in actual applications, avoiding potential transmission errors and data parsing problems. Finally, these test results are integrated to generate a second test report, which records the test results of the message period and data length code in detail, and evaluates the stability of network transmission and data accuracy.

[0121] As an example, the message period and data length code are detected according to the message identifier array, and the step of obtaining a second test report includes: obtaining a message definition period corresponding to the message identifier in the message identifier array; detecting the message period with the message definition period and period deviation requirement as detection criteria to obtain a message period detection result; detecting the message data length code corresponding to the message identifier to obtain a message data length code detection result; and obtaining a second test report based on the message period detection result and the message data length code detection result.

[0122] The message definition period refers to the time interval pre-set for each message in the message identifier array, indicating the period that each message should be repeatedly sent in the network. This period is specified in the network design to ensure that the data is sent within the expected time interval to meet the real-time requirements of the system. The period deviation requirement refers to the error range of the allowed message sending period, that is, the maximum allowable difference between the actual message period and the defined period, which is ±10% in this embodiment. This requirement ensures the accuracy of the message sending time and ensures the stability and consistency of the system. The message period refers to the time interval between each message actually sent in the network from one sending to the next sending. By monitoring and recording the message period, it can be determined whether the message sending meets the preset period definition. The message period detection result refers to the result obtained after comparing the actually monitored message period with the preset message definition period. This result indicates whether the actual message period meets the period definition and period deviation requirements, and reflects whether the message sending frequency is normal. The data length code (DLC) is a field in the CAN protocol that indicates the number of bytes in the data portion of a message. The DLC value of each message should accurately reflect the actual length of the data to ensure that the receiver correctly parses and processes the data. The message data length code detection result refers to the result obtained after detecting the data length code of each message. This result includes checking whether the DLC value is correct and whether it meets the preset requirements to ensure that the data length information in the message is accurate.

[0123] First, the definition period of each message in the message identifier array is obtained. These definition periods are preset time intervals in the network design, indicating the frequency at which each message should be sent in the network. Next, based on these definition periods and the allowed period deviation requirements, the actual message sending period is detected to confirm whether the actual period is within the allowed error range. The result of this step is called the message period detection result, indicating whether the message sending frequency meets the predetermined requirements. Then, the actual data length code (DLC) of each message is checked to ensure that the data length code accurately reflects the actual number of bytes of data in the message, and the message data length code detection result is obtained. Finally, the message period detection result and the message data length code detection result are integrated to generate a second test report. This report records the detection of the message period and the data length code in detail to evaluate whether the message settings in the network meet the design standards.

[0124] Step S33, detecting error frames and undefined messages according to the error frame frequency and the diagnostic message identifier array to obtain a third test report;

[0125] It should be noted that error frames refer to invalid frames generated in the controller area network due to data transmission errors, signal interference or other faults. These frames usually trigger the error handling mechanism of the CAN network and may cause data loss or system instability. The detection of error frames helps to identify problems in the network and debug them. Undefined messages refer to messages that appear in the CAN network, whose identifiers are not in the preset message identifier array, which means that these messages may be invalid messages generated due to network failures, configuration errors or other problems. Detecting undefined messages can help discover system configuration errors or potential security issues. The third test report is a report generated after detecting error frames and undefined messages in the controller area network. The report includes the number of error frames detected and detailed information on undefined messages, evaluates the error rate of the network and the reliability of data transmission, and by analyzing these results, the third test report can provide in-depth insights into the health status of the network and potential problems.

[0126] It is understandable that the error frame frequency, which reflects the number of error frames that occur within a specific time, is first used to monitor the error frames in the controller area network (CAN). This includes identifying and counting the error frames that appear in the network and determining the frequency of their occurrence. Next, based on the diagnostic message identifier array, the messages that appear in the network are checked to find out whether there are undefined messages, that is, messages whose identifiers are not in the preset array, which may indicate problems with the network configuration or data transmission. By detecting these error frames and undefined messages, the stability of the network and the correctness of data transmission can be fully evaluated. Finally, the test results are sorted and analyzed to generate a third test report, which records the number and frequency of error frames and the situation of undefined messages in detail, providing an in-depth understanding of the health of the network and areas that may need improvement.

[0127] As an example, the steps of detecting error frames and undefined messages according to the error frame frequency and the diagnostic message identifier array to obtain a third test report include: when the error frame frequency is greater than the preset frame frequency, performing error frame detection and continuing for a third preset time length; when the error frame frequency is less than or equal to the preset frame frequency, performing error frame detection and continuing for a fourth preset time length; when no error frame is detected, obtaining a first error frame detection result; when an error frame is detected, sending a communication shutdown instruction to each electronic control unit corresponding to the diagnostic identifier of the diagnostic message identifier array through a unified diagnostic service protocol; performing the error frame detection during the communication shutdown period and recording the error frame number until all the electronic control units are Complete the closing communication and obtain a second error frame detection result; detect the undefined message according to the database calibration file and continue for a fifth preset time; when the undefined message is not detected, obtain the first undefined message detection result; when the undefined message is detected, record the undefined message in the undefined message list; send the closing communication instruction to each of the electronic control units through the unified diagnostic service protocol; detect the undefined message during the closing communication until all the electronic control units complete the closing communication and obtain a second undefined message detection result; obtain a third test report according to the first error frame detection result, the second error frame detection result, the first undefined message detection result and the second undefined message detection result.

[0128] The preset frame frequency refers to the threshold used to determine the frequency of error frames when performing error frame detection. In this embodiment, it is 100 frames / second. If the frequency of error frames exceeds this preset frame frequency, detailed error frame detection is required to evaluate the network status. The third preset duration refers to the time period for error frame detection when the error frame frequency is greater than the preset frame frequency. In this embodiment, it is 4-6s. This period allows the system to collect enough data to analyze the occurrence of error frames. The fourth preset duration refers to the time period for error frame detection when the error frame frequency is less than or equal to the preset frame frequency. In this embodiment, it is 15-25s. This period is used to monitor and record the occurrence of error frames to ensure the normal operation of the network. The first error frame detection result refers to the result obtained if no error frame is detected within the specified time during the error frame detection process. This indicates that no error frame occurred in the network during the detection period. The communication off instruction refers to the instruction sent to each electronic control unit through the unified diagnostic service protocol, which is used to shut down or disable the communication function of these units, which helps to eliminate possible interference when performing error frame detection and ensure the accuracy of the detection results. The number of error frames refers to the number of error frames actually detected in the network during the error frame detection process. This data helps to evaluate the stability and transmission quality of the network. The second error frame detection result refers to the result of error frame detection after sending the off communication command and completing the off communication of all electronic control units. This result includes the number of error frames recorded during the off communication, which helps to analyze the error performance of the network in different states. The fifth preset duration refers to the time period used when detecting undefined messages. In this embodiment, it is 4-6s. This period allows the system to obtain sufficient data during the undefined message detection process. The first undefined message detection result refers to the result obtained when no undefined message is detected within the specified detection time, which indicates that no undefined message appears in the network. The undefined message list refers to the collection of all undefined messages recorded during the detection process. This list contains all messages that appear in the network that are not defined in the message identifier array. The second undefined message detection result refers to the result of undefined message detection after sending the off communication command and completing the off communication of all electronic control units. This result includes the undefined message recorded during the off communication, which helps to analyze the message problem of the network in different states.

[0129] According to the steps of the error frame frequency and the diagnostic message identifier array, the error frames and undefined messages in the controller local area network need to be detected first, and the specific steps include: when the detected error frame frequency exceeds the preset frame number, the error frame detection is performed, and the duration is the third preset duration; if the error frame frequency is lower than or equal to the preset frame number, the error frame detection is performed, and the duration is the fourth preset duration. If no error frame is found during the detection period, it is recorded as the first error frame detection result; if an error frame is found, a communication shutdown instruction is sent to each electronic control unit through the unified diagnostic service protocol, and then the error frame is continued to be detected during the communication shutdown period, and the number of error frames is recorded until all electronic control units complete the communication shutdown, and finally the second error frame detection result is obtained. Next, the undefined message is detected according to the database calibration file, and it lasts for the fifth preset duration; if no undefined message is found, it is recorded as the first undefined message detection result; if an undefined message is found, these messages are recorded in the undefined message list. Subsequently, a communication shutdown instruction is sent to each electronic control unit through the unified diagnostic service protocol, and undefined messages are continuously detected during the communication shutdown period, and the results are recorded until all electronic control units complete the communication shutdown, and the second undefined message detection result is obtained. Finally, the first and second error frame detection results and the first and second undefined message detection results are integrated to generate a third test report, which integrates the detection of error frames and undefined messages in the network and provides a comprehensive assessment of network stability and message definition accuracy.

[0130] Step S34, performing waveform analysis on the controller area network according to the message identifier array to obtain a fourth test report;

[0131] It should be noted that waveform analysis refers to evaluating the performance and stability of the controller area network (CAN) by monitoring and analyzing the signal waveform of the controller area network (CAN). Specifically, this includes capturing and measuring the voltage and signal waveform on the CAN bus to check the quality and stability of data transmission. By analyzing the signal waveform, possible interference, signal distortion, communication delay or other potential problems can be identified, thereby evaluating the reliability and communication status of the system. The fourth test report refers to the test result report based on waveform analysis. This report records in detail all abnormalities, signal quality problems and performance evaluation results found during the waveform analysis process, including: screenshots of the overall waveform of the message and the values ​​of the ID and key bits; screenshots of the analysis results of each field of the message, detection of the waveform voltage value and bit width, and output of the corresponding field CANH, CANL, CAN diff (differential signal of the CAN bus) The typical voltage values ​​of the dominant and invisible bits; analysis and screenshots of the quality of the differential waveform; inspection and analysis of the rising and falling edge data of the message waveform, including the minimum, maximum, average, standard deviation and other test results of the rising and falling edge time, etc. It provides a comprehensive assessment of signal integrity and data transmission quality in a CAN and consolidates this information into a detailed document for evaluating system health and communication performance.

[0132] It can be understood that, first, all relevant data message signals in the controller area network (CAN) are identified and monitored according to the definitions in the message identifier array. Next, an oscilloscope or similar device is used to capture and record the voltage waveforms of these signals, and their shapes, amplitudes, and frequencies are analyzed to evaluate the quality and stability of data transmission. By comparing the actual waveform with the expected waveform, check whether there are problems such as signal distortion, waveform distortion, delay, or interference. Finally, the results of these waveform analyses are integrated into a fourth test report, which describes in detail any anomalies or problems in the signal transmission process and provides a comprehensive evaluation of the performance of the controller area network. This process ensures that the data transmission of the system in actual operation meets the predetermined standards and provides an in-depth understanding of network stability and reliability.

[0133] As an example, the steps of performing waveform analysis on the controller area network according to the message identifier array to obtain a fourth test report include: using a preset tool to capture the waveform of the message corresponding to the message identifier in the message identifier array to obtain a message waveform; recording the message waveform and the message status bit corresponding to the message waveform; dividing the message into a first message and a second message according to the message type; detecting the first preset field of the first message to obtain a first waveform compliance analysis result, wherein the first preset field includes an arbitration field and a data field; detecting the second preset field of the second message to obtain a second waveform compliance analysis result; obtaining a differential waveform of the arbitration field and the data field according to the first waveform compliance analysis result; detecting the oscillation of the differential waveform to obtain an oscillation detection result; detecting and analyzing the rising edge data and the falling edge data of the message waveform to obtain an edge data detection result; obtaining a fourth test report according to the message waveform, the message identifier, the first waveform compliance analysis result, the second waveform compliance analysis result, the differential waveform, the oscillation detection result and the edge data detection result.

[0134] The preset tool is an oscilloscope tool for waveform capture and analysis, which is CANSCOPE in this embodiment, for measuring and recording the waveform of the message in CAN. The message waveform refers to the graph of the voltage change over time of the CAN message captured by the CANSCOPE tool. The message waveform can display the shape, amplitude, frequency, etc. of the signal. The message status bit is the value of a specific position in the message, such as the data bit length (BDL, Bit Data Length), the event data length (EDL, Event Data Length), the bit rate switching (BRS, Bit Rate Switching), etc., which are used to identify the state of the message and its attributes. The message type refers to that the CAN message is usually divided into a standard CAN message and a CANFD message, the latter supports a higher data transmission rate, and different types of messages may involve different fields and detection methods when waveform detection. The first message refers to a standard CAN message, and the second message refers to a CANFD message. These message types are detected and analyzed according to different fields. The first preset field (including the arbitration field, data field, cyclic redundancy check (CRC) delimiter, and acknowledgement (ACK) field in this embodiment) is a specific part or field of the CAN message. Each field has its own unique function. For example, the arbitration field is used to determine the priority of the message, and the data field carries the actual transmitted data. The first waveform compliance analysis result refers to the compliance result obtained after detecting the waveform of the first preset field to confirm whether the waveform meets the standard requirements. The arbitration field is a key field in the CAN message, which is used to determine the priority when multiple messages are transmitted simultaneously. The data field is the field that actually carries data in the CAN message, including the content of the data sent. The second preset field (including the arbitration field, bit rate switching (BRS) bit, data field, CRC delimiter, ACK field in this embodiment) is a field with a specific function in the CANFD message, where the BRS bit is used to control the data transmission rate. The second waveform compliance analysis result is the compliance analysis result obtained after detecting the waveform of the second preset field. The differential waveform refers to the differential signal between the two signal lines (CANH and CANL) of the CAN bus, which is used to judge the quality and stability of the waveform. Oscillation: In waveform analysis, detecting the oscillation of the waveform can help determine the stability of signal transmission, especially the fluctuation when the signal edge changes. The oscillation detection result refers to the detection result of the signal stability obtained by analyzing the oscillation of the differential waveform. The rising edge data and falling edge data refer to the instantaneous voltage changes of the waveform from low voltage to high voltage (rising edge) and from high voltage to low voltage (falling edge), which are used to evaluate the response speed and quality of the signal.Detection and analysis refers to the comprehensive detection and analysis of the captured waveform, usually including statistical analysis of the waveform's amplitude, time, frequency, etc. Edge data detection results refer to the results of the detection of rising and falling edge data, usually including the minimum, maximum, average and standard deviation of these data.

[0135] First, use a preset tool (such as CANSCOPE) to capture the waveform of the message corresponding to each message identifier in the message identifier array, and generate the corresponding message waveform. These waveforms are not only recorded, but also associated with the status bits (such as BDL, EDL, BRS, etc.) in the message for subsequent analysis. Then, according to the message type, the captured message is divided into a first message (usually a standard CAN message) and a second message (CANFD message), and the preset fields of these two types of messages are tested in detail. For the first message, the detected fields include the arbitration field and the data field, and the waveform is analyzed to see whether it meets the specification, thereby obtaining the first waveform compliance analysis result. Similarly, the preset fields of the second message (including the arbitration field, BRS bit, data field, etc.) are tested to generate the second waveform compliance analysis result. Next, based on the first waveform compliance analysis result, the differential waveforms of the arbitration field and the data field are further analyzed, especially the oscillation of the detection waveform, to evaluate the stability of the signal and obtain the oscillation detection result. In addition, the rising and falling edge data of the message waveform must be analyzed to determine the speed and quality of the signal change and obtain the corresponding edge data detection results. Finally, all these detection and analysis results, including message waveform, message identifier, waveform compliance analysis results, differential waveform, oscillation detection results and edge data detection results, are combined to generate the fourth test report, providing a comprehensive evaluation of the Controller Area Network communication quality.

[0136] Please refer to Figure 4 , Figure 4The flowchart of the fourth test corresponding to the fourth test report provided in the second embodiment of the test method for the controller area network of this application shows the detailed process of the CAN waveform analysis corresponding to the fourth test report, which is a key component of the automated test method and focuses on in-depth waveform analysis of the message transmitted on the CAN bus. At the beginning of the test, the system uses the CANSCOPE tool to capture the corresponding CAN or CANFD message waveform for each unique identifier in the message ID array. Subsequently, the system organizes and screenshots the captured waveforms, and records the ID of each message and related status bits such as BDL, EDL, BRS, etc. in detail. In the waveform data analysis stage, the system distinguishes between CAN and CANFD messages, and conducts a comprehensive evaluation of the arbitration field, data field, CRC delimiter, and ACK field respectively. The analysis results will be recorded in the form of screenshots, including the voltage value and bit width of the waveform, and output the typical voltage values ​​of the dominant and invisible bits of CANH, CANL and CAN differential signals (CAN diff). Next, the system conducts a detailed analysis of the differential waveform quality of the arbitration field and data field of the message, especially detecting the waveform oscillation after the data bit width is 50% to evaluate the stability and integrity of the signal. Finally, the system will also check and analyze the rising and falling edge data of the message waveform, and output a series of test results including minimum, maximum, average, and standard deviation, thereby providing a comprehensive evaluation of the performance of the CAN network. Through this process, the test system can accurately capture and analyze the communication quality on the CAN bus, providing an important basis for fault diagnosis and network optimization, and ensuring the accuracy and reliability of CAN / CANFD network testing.

[0137] Step S35, obtaining a target test report according to the first test report, the second test report, the third test report and the fourth test report, and completing the test.

[0138] It should be noted that, first of all, the content and results of the first, second, third and fourth test reports are analyzed one by one. The first test report focuses on the basic communication stability and basic functional testing of the CAN bus, including basic signal transmission and data integrity checks. The second test report covers a more in-depth signal quality assessment, such as detection of signal noise, interference and transmission errors. The third test report tests the system performance under different operating environments and load conditions to evaluate the performance of the system in actual usage scenarios. The fourth test report provides detailed waveform analysis results, including message waveforms, status bits, differential waveforms, and oscillation conditions.

[0139] Understandably, when generating a target test report, the key data and analysis results of these four reports are first summarized, and their impact on system performance is comprehensively analyzed by comparing the test conditions and results described in each report. Focus on key parameters in each report, such as signal stability, waveform compliance, system response speed, and data integrity, to identify system strengths and potential problems. Through this comprehensive evaluation, a comprehensive understanding of the performance and reliability of the system under various conditions can be achieved. Finally, these analyses and findings are integrated into a target test report to form a comprehensive evaluation document that covers the comprehensive results of all test stages, thus completing the entire test process.

[0140] In this embodiment, the electronic control unit is tested according to the message identifier array and the diagnostic message identifier array to obtain a first test report; the message period and data length code are detected according to the message identifier array to obtain a second test report; the error frame and undefined message are detected according to the error frame frequency and the diagnostic message identifier array to obtain a third test report; the controller area network is waveform analyzed according to the message identifier array to obtain a fourth test report; the target test report is obtained according to the first test report, the second test report, the third test report and the fourth test report to complete the test. First, by testing the electronic control unit (ECU) according to the message identifier array and the diagnostic message identifier array, a first test report is generated. This stage verifies the basic processing and response capabilities of the ECU to different messages and ensures that its communication function is normal. Next, the message period and data length code are detected according to the message identifier array to obtain a second test report. This step checks the timeliness and accuracy of data transmission, thereby improving the data transmission stability of the system. Subsequently, the error frames and undefined messages are detected according to the frequency of the error frames and the array of diagnostic message identifiers to generate the third test report. This stage identifies communication errors and potential problems in the system, which helps to improve the reliability and stability of the system. Finally, the fourth test report is generated by waveform analysis of the controller area network. This step evaluates the quality and stability of the signal to ensure that data transmission meets the specifications. Combining these reports to form the final target test report not only provides a comprehensive evaluation of the overall performance of the ECU and CAN, but also integrates the test results of each stage, helps identify the strengths and weaknesses of the system, and provides an important basis for system optimization, ensuring its reliability and functionality in practical applications.

[0141] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the test method of the controller local area network of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0142] This application also provides a test device for a controller area network, please refer to Figure 5 , the test device of the controller area network comprises:

[0143] The parsing module 10 is used to parse the database calibration file to obtain a message identifier array and a diagnostic message identifier array;

[0144] The initial inspection module 20 is used to perform an initial network inspection on the controller local area network to obtain the frequency of error frames;

[0145] The test module 30 is used to test the controller area network according to the error frame frequency, the message identifier array and the diagnostic message identifier array, obtain a target test report, and complete the test.

[0146] The controller local area network test device provided by the present application adopts the controller local area network test method in the above embodiment, which can solve the technical problem of how to improve the test efficiency of the controller local area network. Compared with the prior art, the beneficial effects of the controller local area network test device provided by the present application are the same as the beneficial effects of the controller local area network test method provided by the above embodiment, and other technical features in the controller local area network test device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0147] The present application provides a test device for a controller area network, and the test device for a controller area network includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the test method for the controller area network in the above-mentioned embodiment one.

[0148] Reference below Figure 6 , which shows a schematic diagram of the structure of a test device for a controller area network suitable for implementing an embodiment of the present application. The test device for the controller area network in the embodiment of the present application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The test equipment for the controller area network shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0149] like Figure 6 As shown, the test equipment for the controller area network may include a processing device 1001 (such as a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In the RAM 1004, various programs and data required for the operation of the test equipment for the controller area network are also stored. The processing device 1001, the ROM 1002, and the RAM 1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems may be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 may allow the test equipment of the controller area network to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows the test equipment of the controller area network with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.

[0150] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0151] The controller local area network test device provided by the present application adopts the controller local area network test method in the above embodiment, which can solve the technical problem of how to improve the test efficiency of the controller local area network. Compared with the prior art, the beneficial effects of the controller local area network test device provided by the present application are the same as the beneficial effects of the controller local area network test method provided by the above embodiment, and other technical features in the controller local area network test device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0152] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0153] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0154] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the test method of the controller area network in the above-mentioned embodiment.

[0155] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0156] The computer-readable storage medium may be included in the test device of the controller area network; or may exist independently without being assembled into the test device of the controller area network.

[0157] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the test equipment of the controller local area network, the test equipment of the controller local area network: parses the database calibration file to obtain the message identifier array and the diagnostic message identifier array; performs an initial network inspection on the controller local area network to obtain the error frame frequency; tests the controller local area network according to the error frame frequency, the message identifier array and the diagnostic message identifier array, obtains the target test report, and completes the test.

[0158] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0159] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0160] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0161] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned test method for the controller local area network, and can solve the technical problem of how to improve the test efficiency of the controller local area network. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the test method for the controller local area network provided by the above-mentioned embodiment, and will not be repeated here.

[0162] The present application also provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, the steps of the above-mentioned controller area network testing method are implemented.

[0163] The computer program product provided by the present application can solve the technical problem of how to improve the test efficiency of the controller local area network. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the test method of the controller local area network provided by the above-mentioned embodiment, which will not be repeated here. The above description is only a partial embodiment of the present application, and does not limit the patent scope of the present application. All equivalent structural transformations made by using the contents of the specification and drawings of the present application under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A test method for a controller area network, It is characterized in that The method comprises: Parse the database calibration file to obtain a message identifier array and a diagnostic message identifier array; Perform an initial network check on the controller area network to obtain the frequency of error frames; The controller area network is tested according to the error frame frequency, the message identifier array and the diagnostic message identifier array, a target test report is obtained, and the test is completed.

2. The method according to claim 1, It is characterized in that The step of testing the controller area network according to the error frame frequency, the message identifier array and the diagnostic message identifier array to obtain a target test report includes: Testing the electronic control unit according to the message identifier array and the diagnostic message identifier array to obtain a first test report; Detect the message period and the data length code according to the message identifier array to obtain a second test report; Detect error frames and undefined messages according to the error frame frequency and the diagnostic message identifier array to obtain a third test report; Performing waveform analysis on the controller area network according to the message identifier array to obtain a fourth test report; A target test report is obtained according to the first test report, the second test report, the third test report and the fourth test report, and the test is completed.

3. The method according to claim 2, It is characterized in that The step of detecting the message period and the data length code according to the message identifier array to obtain a second test report comprises: Obtaining a message definition period corresponding to a message identifier in the message identifier array; The message period is detected based on the message definition period and period deviation requirement, and a message period detection result is obtained; Detecting the message data length code corresponding to the message identifier to obtain a message data length code detection result; A second test report is obtained according to the message period detection result and the message data length code detection result.

4. The method according to claim 2, It is characterized in that The step of performing waveform analysis on the controller area network according to the message identifier array to obtain a fourth test report comprises: Using a preset tool to capture the waveform of the message corresponding to the message identifier in the message identifier array to obtain a message waveform; Recording the message waveform and the message status bit corresponding to the message waveform; Dividing the message into a first message and a second message according to the message type; Detecting a first preset field of the first message to obtain a first waveform compliance analysis result, wherein the first preset field includes an arbitration field and a data field; Detecting a second preset field of the second message to obtain a second waveform compliance analysis result; Obtaining a differential waveform of the arbitration field and the data field according to the first waveform compliance analysis result; Detecting the oscillation of the differential waveform to obtain an oscillation detection result; Detect and analyze the rising edge data and the falling edge data of the message waveform to obtain an edge data detection result; A fourth test report is obtained according to the message waveform, the message identifier, the first waveform compliance analysis result, the second waveform compliance analysis result, the differential waveform, the oscillation detection result and the edge data detection result.

5. The method according to claim 2, It is characterized in that The step of detecting error frames and undefined messages according to the error frame frequency and the diagnostic message identifier array to obtain a third test report comprises: When the error frame frequency is greater than the preset frame frequency, error frame detection is performed and continues for a third preset time length; When the error frame frequency is less than or equal to the preset frame frequency, the error frame detection is performed and lasts for a fourth preset time length; When no error frame is detected, obtaining a first error frame detection result; When an error frame is detected, sending a communication instruction to each electronic control unit corresponding to the diagnostic identifier of the diagnostic message identifier array through a unified diagnostic service protocol; Performing the error frame detection during the closing communication and recording the number of error frames until all the electronic control units complete the closing communication, thereby obtaining a second error frame detection result; Detecting undefined messages according to the database calibration file for a fifth preset time period; When the undefined message is not detected, obtaining a first undefined message detection result; When the undefined message is detected, the undefined message is recorded in an undefined message list; Sending the communication instruction to each of the electronic control units through the unified diagnostic service protocol; During the gateway communication, the undefined message is detected until all the electronic control units complete the gateway communication, thereby obtaining a second undefined message detection result; A third test report is obtained according to the first error frame detection result, the second error frame detection result, the first undefined message detection result, and the second undefined message detection result.

6. The method according to claim 2, It is characterized in that The step of testing the electronic control unit according to the message identifier array and the diagnostic message identifier array to obtain a first test report comprises: Sending a diagnostic instruction to each electronic control unit corresponding to the diagnostic identifier of the diagnostic message identifier array through a unified diagnostic service protocol to obtain electronic control unit information, a current first fault code list, and a second fault code list that cannot be cleared; Obtain a fifth test report according to the diagnostic message identifier array, the electronic control unit information, the first fault code list, and the second fault code list; Sending a fault code reading instruction to each of the electronic control units through the unified diagnostic service protocol to obtain supported fault codes of the electronic control unit, and recording the number of supported fault codes; Obtain a sixth test report according to the diagnostic message identifier array, the supported fault codes, and the number of supported fault codes; According to the second fault code list, recording the number of fault codes of each electronic control unit into a fault code number array; According to the fault code number array, a high load test is performed on the controller area network to obtain a seventh test report; Controlling the vehicle to execute a preset operation, and performing error frame detection and fault code reading in the controller area network, and obtaining an eighth test report according to the fault code quantity array, the detection result and the reading result; The fifth test report, the sixth test report, the seventh test report and the eighth test report are integrated to obtain a first test report.

7. The method according to claim 6, It is characterized in that The step of performing a high load test on the controller area network according to the fault code quantity array to obtain a seventh test report comprises: Obtaining a network load of a controller area network and recording first network load data; Sending a test message to each of the electronic control units until the network load is greater than or equal to a preset load threshold and lasts for a first preset time, and saving second network load data of the controller area network; After waiting for a second preset time, stop sending the test message, read the current second fault code of each electronic control unit through the unified diagnostic service protocol, and record the second fault code in a third fault code list; According to the fault code quantity array, comparing the second fault code list with the third fault code list to obtain a first comparison result; A seventh test report is obtained according to the first network load data, the second network load data, the third fault code list, the first comparison result and the diagnostic message identifier array.

8. The method according to claim 6, It is characterized in that The preset operation includes a first preset operation and a second preset operation, the step of controlling the vehicle to execute the preset operation and performing error frame detection and fault code reading in the controller area network, and obtaining an eighth test report according to the fault code quantity array, the detection result and the reading result includes: Controlling the vehicle to perform a first preset operation, detecting a first error frame in the controller area network during the operation, and recording first error frame information; After the first preset operation is completed, reading the current third fault code of the electronic control unit through the unified diagnostic service protocol, and recording the third fault code in a fourth fault code list; According to the fault code quantity array, comparing the second fault code list with the fourth fault code list to obtain a second comparison result; Obtaining a ninth test report according to the first error frame information, the fourth fault code list, the second comparison result, and the diagnostic message identifier array; controlling the vehicle to perform a second preset operation; After the second preset operation is completed, detecting a second error frame in the controller area network and recording second error frame information; Detecting the communication recovery status of the electronic control unit by sending the test message; Reading a fourth fault code of the electronic control unit through the unified diagnostic service protocol, and recording the fourth fault code into a fifth fault code list; According to the fault code quantity array, comparing the second fault code list with the fifth fault code list to obtain a third comparison result; Obtaining a tenth test report according to the second error frame information, the communication recovery status, the fifth fault code list, the third comparison result and the diagnostic message identifier array; The ninth test report and the tenth test report are integrated to obtain an eighth test report.

9. A test device for a controller area network, It is characterized in that The device comprises: A parsing module, used for parsing the database calibration file to obtain a message identifier array and a diagnostic message identifier array; The initial inspection module is used to perform an initial network inspection on the controller local area network to obtain the frequency of error frames; The test module is used to test the controller local area network according to the error frame frequency, the message identifier array and the diagnostic message identifier array, obtain a target test report, and complete the test.

10. A storage medium, It is characterized in that The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the method for testing a controller area network according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Automatic vehicle-mounted electronic control unit CAN bus communication testing device and system

    CN104298224A

  • Finished automobile CAN (Controller Area Network) network automatic testing platform and optimization method thereof

    CN107222362A

  • Automatic network diagnosis test system for automobile electric control unit and test method thereof

    CN112711242A

  • ECU fault code test system, electronic controller and automobile

    CN114879647A

  • CAN communication automation test method

    CN116489043A

Cited By

  • Data storage method based on two-dimensional array and related device

    CN120744184A

  • Data storage method based on two-dimensional array and related device

    CN120744184B