System, method and device for testing network wake-up function of controller
By working together with the PCAN device and the test equipment, wake-up messages are automatically sent and timestamps are recorded, which solves the problem of low efficiency in traditional manual testing and realizes efficient and accurate testing of the controller's network wake-up function.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHERY AUTOMOBILE CO LTD
- Filing Date
- 2026-01-06
- Publication Date
- 2026-05-15
AI Technical Summary
Traditional manual testing of controller network wake-up functionality is inefficient, unable to cover tens of thousands of repeated wake-up scenarios, and prone to subjective errors, leading to missed or incorrect judgments.
By monitoring the message traffic on the CAN bus using the PCAN device, and automatically sending wake-up messages using the test script on the test device, recording the timestamp of the wake-up response message, and generating a test report, the accuracy of the test faults is ensured.
It enables automatic controller wake-up and accurate fault recording, improves testing efficiency, reduces human error, and shortens troubleshooting time.
Smart Images

Figure CN122053431A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of controller testing, and in particular to a controller wake-up function testing system, method and apparatus. Background Technology
[0002] Testing the network wake-up function of the vehicle controller is a key step in the development and verification process of automotive electronic control systems.
[0003] Traditional testing methods for the Wake-up functionality of controllers primarily rely on manual testing. Testers manually operate the testing equipment, send Wake-up frames to the controller, and manually observe bus logs and the controller's response status to determine if the wake-up was successful. Manual testing is typically used for simple functional verification and is insufficient to cover scenarios involving thousands or even tens of thousands of repeated wake-ups. Furthermore, manual observation and recording are prone to subjective errors, potentially leading to missed or incorrect assessments. Summary of the Invention
[0004] This application provides a controller wake-up function testing system, device, and storage medium, which can be used to improve the efficiency and accuracy of testing the controller wake-up function.
[0005] The technical solution is as follows: In a first aspect, a controller wake-up network function test system is provided, the system comprising: a test device and a PCAN device, the test device being electrically connected to the PCAN device, and the test device having a test script; The PCAN device is used to listen to the message traffic on the CAN bus when connected to the controller via the CAN bus, and to send the message traffic to the test device. The test equipment is used to receive message traffic and, based on the test script and the message traffic, determine that the controller is in a sleep state and send a wake-up message to the PCAN device. The PCAN device is used to forward wake-up messages to the controller and record the timestamp of the forwarded wake-up message. The testing equipment is used to obtain a timestamp and generate a test report corresponding to the timestamp if no wake-up response message is received from the controller within a preset time after sending the wake-up message.
[0006] Secondly, a method for testing the network wake-up function of a controller is provided, the method comprising: After receiving the message traffic corresponding to the CAN bus, if the controller is determined to be in a sleep state based on the message traffic according to the test script, a wake-up message is sent to the PCAN device so that the PCAN device forwards the wake-up message to the controller connected to the PCAN device via the CAN bus. If no wake-up response message is received from the controller within a preset time after sending the wake-up message, the timestamp is obtained and a test report corresponding to the timestamp is generated. The timestamp is recorded when the PCAN device forwards the wake-up message to the controller.
[0007] Thirdly, a controller wake-up function testing device is provided, the device comprising: The wake-up message sending module is used to receive the message traffic corresponding to the CAN bus, and when the controller is determined to be in a sleep state based on the message traffic according to the test script, it sends a wake-up message to the PCAN device so that the PCAN device forwards the wake-up message to the controller connected to the PCAN device through the CAN bus. The test report generation module is used to obtain a timestamp and generate a test report corresponding to the timestamp if no wake-up response message is received from the controller within a preset time after sending the wake-up message. The timestamp is recorded when the PCAN device forwards the wake-up message to the controller.
[0008] The technical solution provided in this application brings at least the following beneficial effects: This application connects the test equipment and the controller via a PCAN device. Since the PCAN device and the controller are connected via a CAN bus, the PCAN device can monitor the message traffic on the CAN bus and send the message traffic to the test equipment. Based on the message traffic, a test script on the test equipment automatically sends a wake-up message when the controller is in a sleep state, thus waking the controller automatically. Simultaneously, this application also obtains the controller's wake-up response message. If no wake-up response message is received from the controller within a preset time after sending the wake-up message, the timestamp recorded by the PCAN device for forwarding the wake-up message is obtained. A test report corresponding to the timestamp is generated based on the timestamp, ensuring the accuracy of recorded test faults, directly guiding engineers to focus on core issues, and improving the efficiency of controller wake-up function testing. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1This is a schematic diagram of the structure of a controller wake-up function test system provided in an embodiment of this application; Figure 2 This is one of the flowcharts of the controller network wake-up function test method provided in the embodiments of this application; Figure 3 This is the second flowchart of the controller network wake-up function test method provided in the embodiments of this application; Figure 4 This is a schematic diagram of the structure of a controller network wake-up function test device provided in an embodiment of this application. Detailed Implementation
[0011] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0012] This application provides a controller wake-up function testing system (hereinafter referred to as the system). Please refer to... Figure 1 The diagram illustrates a system structure provided in an embodiment of this application. The system includes a test device 10 and a PCAN device 11, wherein the test device 10 is electrically connected to the PCAN device 11, and the test device 10 has a test script.
[0013] PCAN device 11, namely computer CAN bus communication device, is used to realize communication between computer and CAN (Controller Area Network) or CAN FD (Controller Area Network Flexible Data-Rate) bus system. PCAN device 11 can send, receive, save and filter messages on CAN / CAN FD and monitor CAN bus data flow. At the same time, PCAN device 11 also has high-precision timestamp and log functions, which can be used to record key contents such as CAN / CAN FD bus communication data, device status, error information and corresponding timestamps.
[0014] In one possible implementation, the PCAN device 11 is connected to the controller 12 via the CAN bus. Therefore, the PCAN device 11 can monitor the message traffic on the CAN bus and send the message traffic to the test device 10. The test device 10 analyzes the message traffic by executing a test script to determine the state of the controller 12, including sleep and wake-up states. Simultaneously, the test device 10 sends messages to the PCAN device 11 based on the test script. The PCAN device forwards the messages to the controller 12, allowing the controller 12 to respond to the messages and execute the corresponding actions.
[0015] In one possible implementation, when the test device 10 tests the controller 12, the specific test situation can be displayed in real time on the console of the test device 10, such as displaying log information.
[0016] The following is a detailed description of the controller wake-up function testing system provided in the embodiments of this application: In this embodiment of the application, the system includes: a test device and a PCAN device, the test device being electrically connected to the PCAN device, and the test device having a test script.
[0017] When the controller needs to be tested, the PCAN device and the controller are connected via the CAN bus.
[0018] The controller is a controller on the vehicle. For example, the controller can be a VCU (Vehicle Control Unit), BCM (Body Control Module), or other controllers with communication functions.
[0019] In this embodiment, the controller is treated as a single unit to test the network management of a single controller during the R&D phase or before production and warehousing. This allows for the early and efficient discovery and location of design defects without relying on the entire vehicle, significantly reducing the risks and costs of later vehicle integration testing.
[0020] When connected to the controller via the CAN bus, the PCAN device listens to the message traffic on the CAN bus and sends the message traffic to the test device.
[0021] The test device receives message traffic and, based on the test script and the message traffic, determines that the controller is in a sleep state and sends a wake-up message to the PCAN device.
[0022] In one possible implementation, the test script needs to be initialized before the test device receives the message traffic. During the initialization process, the test script will automatically configure the CAN (or CAN FD) bus communication parameters, such as channel and baud rate. At the same time, the test script establishes communication connections with the controller, gateway and other related ECUs, receives user-configured test parameters or automatically generates test parameters. The test parameters include the number of test cycles, the time point of message transmission, the bus load target, the abnormal message type and injection rules, etc.
[0023] Message traffic is primarily measured by "bus load rate," which is the proportion of the bus occupied by messages per unit of time. Message traffic reflects the communication activity level of the controller on the CAN bus, the controller's operating status, and function execution. Understandably, if the bus load rate corresponding to the message traffic is low, the CAN bus is in a silent state; conversely, if the bus load rate corresponding to the message traffic is high, the CAN bus is in an active state.
[0024] After receiving message traffic, the test equipment can determine whether the controller is in sleep mode based on the duration of the CAN bus silence reflected by the message traffic. If the silence duration exceeds the silence threshold, the controller is determined to be in sleep mode.
[0025] The wake-up message is also known as the network wake-up frame.
[0026] In one possible implementation, before receiving message traffic, the test device also sends a state switching command to the controller via the PCAN device. Upon receiving and responding to the state switching command, the controller is allowed to gradually switch from an active state to a sleep state. Thus, after receiving and responding to the state switching command, the controller begins to gradually switch from an active state to a sleep state. The controller will not enter a sleep state if it does not receive a state switching command. The state switching command can be implemented by sending an electrical signal to the controller's pins. After determining that the controller is in a sleep state, the test device will send a wake-up sub-message to the PCAN device sequentially at the target time corresponding to each test time point, according to the order of the test time points in the test time sequence.
[0027] The test script includes a test time series T, which represents the time points in the test parameters where messages are sent. The test time series T includes at least one test time point T. i T i The value is the target time of the i-th test time point, where any two test time points T in the test time sequence T are... i The values are different, so the controller is woken up after remaining in a sleep state for any length of time.
[0028] In one possible implementation, to facilitate the configuration of the test time series, the user can input or the system can automatically generate the initial time interval 'a', the time interval variation 'b', and the initial time 'c' for the test time series. This ensures that the test time point T in the test time series T generated based on the initial time interval, the time interval variation, and the initial time... i Satisfying T i+1= T i +a+b*(i-1)T 1= c > 0.
[0029] In one possible implementation, the test time series T can be randomly generated. i The value of .
[0030] For example, for a test time series T={T1, T2, T3}, the test device will first send the wake-up sub-message 1 corresponding to T1 to the PCAN device at the target time indicated by the test time point T1, then send the wake-up sub-message 2 corresponding to T2 to the PCAN device at the target time indicated by the test time point T2, and then send the wake-up sub-message 3 corresponding to T3 to the PCAN device at the target time indicated by the test time point T3.
[0031] Since wake-up sub-messages need to be sent at different test time points, in order to wake up the controller at different test time points, the controller needs to have sufficient time to enter a sleep state after responding to a wake-up sub-message and to deal with the next wake-up sub-message. In one possible implementation, the test device is also used to increase the time interval between test time points if it is determined that the controller is not in a sleep state based on the message traffic.
[0032] In one possible implementation, before sending a wake-up sub-message to the PCAN device at the target time corresponding to each test time point according to the order of the test time points in the test time sequence, the test device is further used to increase the minimum value if the minimum value of the time interval between test time points is less than or equal to a first duration. The first duration is the time interval between a first preset time point and a first acquisition time point for acquiring message traffic. The first preset time point is any time point after the controller is connected to the PCAN device.
[0033] In one possible implementation, the first preset time point is the time point after responding to the state switching instruction. For example, the time point after the state switching instruction is executed can be used as the first preset time point.
[0034] If the controller is determined to be in a sleep state based on the message traffic at the first acquisition time point, it means that the controller needs to spend the time corresponding to the first duration to enter the sleep state. Therefore, before sending a wake-up sub-message to the PCAN device, if the minimum time interval between test time points is greater than the first duration, it means that the controller has sufficient time to enter the sleep state after responding to a wake-up sub-message, and there is no need to increase the minimum time interval between test time points. If, before sending a wake-up sub-message to the PCAN device, the minimum time interval between test time points is less than or equal to the first duration, it means that the controller does not have sufficient time to enter the sleep state after responding to a wake-up sub-message. Therefore, before sending a wake-up sub-message to the PCAN device, if the minimum time interval between test time points is less than or equal to the first duration, the minimum value is increased.
[0035] In one possible implementation, if the controller is determined to be in a sleep state and the minimum value is greater than the first duration based on the packet traffic at the first acquisition time point before sending the wake-up sub-message, the minimum value of the time interval between test time points can also be increased.
[0036] It is understandable that when increasing the minimum value, the target time of only one test time point in the test time series can be modified, or the target time of two or more test time points in the test time series can be modified, or the target time of all test time points in the test time series can be modified.
[0037] Since the controller gradually enters a sleep state, it may be in a sleep state or not when acquiring message traffic at the first acquisition time point. Therefore, in one possible implementation, if the test device determines that the controller is in a sleep state based on the first message traffic and the minimum value is greater than the first duration, it executes the step of sending a wake-up sub-message to the PCAN device sequentially at the target time corresponding to each test time point according to the order of the test time points in the test time sequence. If it determines that the controller is not in a sleep state based on the first message traffic, it generates a new first acquisition time point and a first duration corresponding to the new first acquisition time point, and executes the step of acquiring the first message traffic corresponding to the first time point based on the new first acquisition time point. The first message traffic is the message traffic acquired at the first acquisition time point.
[0038] In this embodiment, when the controller is determined to be in an active state based on message traffic, a waiting period is initiated before acquiring message traffic again. This ensures accurate determination of whether the controller has entered a sleep state. Specifically, if bus activity is detected, the waiting time is automatically extended before re-detection, guaranteeing the accuracy of each test start point and preventing invalid wake-up tests when the controller is not in sleep mode or the network is still active. Furthermore, the process of determining whether the controller has entered a sleep state is coupled with the process of modifying the minimum value. Before the PCAN device sends the wake-up sub-message, the minimum value of the time interval between acquiring message traffic and the test time point is compared to optimize the minimum value. This allows for adaptive modification of the target time corresponding to the test time point in the test time sequence while simultaneously detecting whether the controller is in sleep mode.
[0039] After receiving the wake-up sub-messages corresponding to each test time point, the PCAN device forwards the wake-up sub-messages to the controller and records the timestamps of each forwarded wake-up sub-message.
[0040] After receiving the wake-up sub-message, if the controller's network wake-up function is normal, the controller will be woken up normally and will send a target wake-up response message for the wake-up sub-message.
[0041] For any wake-up sub-message, if the test device does not receive a target wake-up response message from the controller within a preset time after sending the wake-up sub-message, the wake-up sub-message will be treated as the target wake-up message. The test device will obtain the target timestamp of the forwarded target wake-up message recorded by the PCAN device and generate a test report corresponding to the target timestamp. That is, when the test finds that the controller has failed to wake up, the test device will switch from the test mode of sending wake-up messages to the diagnostic mode of generating test reports.
[0042] In one possible implementation, a test report corresponding to the target timestamp is generated, including: The testing equipment determines a corresponding time window for each target timestamp. A test report is generated based on the log information corresponding to each time window.
[0043] Specifically, for any target timestamp, the test equipment determines the first timestamp before the target timestamp and the second timestamp after the target timestamp, obtains the first log information between the first timestamp and the target timestamp, and determines the third timestamp where the wake-up failure occurs based on the first log information. It then obtains the second log information between the target timestamp and the second timestamp, and determines the fourth timestamp when the controller returns to normal based on the second log information. Based on the third and fourth timestamps corresponding to each target timestamp, a time window corresponding to each target timestamp is generated. A test report is generated based on the log information corresponding to the time window, and the time window is highlighted in the test report.
[0044] In this embodiment, the test device uses the target timestamp T_fail as a benchmark to determine the first timestamp T_fail-t and the second timestamp T_fail+t, where t is an empirical value. Then, for the first log information belonging to [T_fail-t, T_fail], a binary search algorithm is used for testing. By continuously narrowing the search range, the third timestamp T_first, in which the first wake-up failure occurs, is accurately found in the first log information. Similarly, for the second log information belonging to [T_fail, T_fail+t], a binary search algorithm is used for testing to determine the fourth timestamp T_last, in which the controller recovers to normal. Thus, a time window is constructed based on T_first and T_last, and a test report is generated based on the log information corresponding to the time window. The time window is highlighted in the test report, so that after all test points are completed, a final report integrating raw data and intelligent diagnostic conclusions is automatically generated. Engineers can directly focus on this specific time period to analyze logs, power traces, or software status, greatly shortening the time for troubleshooting the root cause of the problem.
[0045] In one possible implementation, for the first log message belonging to [T_fail-t, T_fail], a binary search algorithm is used for testing. By continuously narrowing the search range, the third timestamp T_first, in which the first wake-up failure occurs in the first log message, is precisely found, including: A fourth timestamp is generated, wherein the fourth timestamp is obtained based on the average of the first timestamp and the target timestamp. For example, the fourth timestamp is the average of the first timestamp and the target timestamp or the difference between the fourth timestamp and the average of the first timestamp and the target timestamp is within a preset range.
[0046] A first test time sequence is generated based on a first timestamp and a fourth timestamp. The first test time sequence includes multiple first fault test time points. The time indicated by each first fault test time point is greater than the time indicated by the first timestamp, and the time indicated by each first fault test time point is less than or equal to the time indicated by the fourth timestamp. A first wake-up detection sub-message is sent to the PCAN device according to the time indicated by each first fault test time point in the first test time sequence, and it is determined whether a wake-up response message is received within a preset time.
[0047] A second test time sequence is generated based on the fourth timestamp and the target timestamp. This second test time sequence includes multiple second fault test time points. The time indicated by each second fault test time point is greater than the time indicated by the fourth timestamp, and the time indicated by each second fault test time point is less than or equal to the time indicated by the target timestamp. A second wake-up detection sub-message is sent to the PCAN device according to the time indicated by each second fault test time point in the second test time sequence, and it is determined whether a wake-up response message for the second wake-up detection sub-message is received within a preset time.
[0048] For example, if [T_fail-t, T_fail] is [1,3], then the fourth timestamp is generated as [2], and the first test time sequence X={X1, X2, X3}={1.3,1.6,1.9} is generated. Based on the first test time sequence X, the first wake-up detection sub-message is sent, that is, the first wake-up detection sub-message corresponding to the first fault test time point X1 is sent 1.3 seconds after the controller is allowed to switch to sleep mode. If a wake-up response message is received, it means that the controller did not fail at the first fault test time point X1. Then, the first wake-up detection sub-message corresponding to the first fault test time point X2 is sent 1.6 seconds after the controller is allowed to switch to sleep mode, and then the first wake-up detection sub-message corresponding to the first fault test time point X3 is sent 1.9 seconds after the controller is allowed to switch to sleep mode. If the wake-up response message for the first fault test time point X3 is not obtained, it means that the first fault test time point X3 is the time when the first wake-up failure occurred, and the time indicated by the first fault test time point X3 is used as the third timestamp T_first.
[0049] Similarly, a fifth timestamp can be generated, which is obtained based on the average of the second timestamp and the target timestamp. For example, the fifth timestamp is the average of the second timestamp and the target timestamp, or the difference between the fifth timestamp and the average of the second timestamp and the target timestamp is within a preset range.
[0050] A third test time sequence is generated based on the target timestamp and the fifth timestamp. This third test time sequence includes multiple third fault test time points. The time indicated by each third fault test time point is greater than the time indicated by the target timestamp, and the time indicated by each third fault test time point is less than or equal to the time indicated by the fifth timestamp. A third wake-up detection sub-message is sent to the PCAN device according to the time indicated by each third fault test time point in the third test time sequence, and it is determined whether a wake-up response message is received within a preset time.
[0051] A fourth test time sequence is generated based on the fifth and second timestamps. This fourth test time sequence includes multiple fourth fault test time points. The time indicated by each fourth fault test time point is greater than the time indicated by the fifth timestamp, and the time indicated by each fourth fault test time point is less than or equal to the time indicated by the second timestamp. A fourth wake-up detection sub-message is sent to the PCAN device according to the time indicated by each fourth fault test time point in the fourth test time sequence, and it is determined whether a wake-up response message for the fourth wake-up detection sub-message is received within a preset time.
[0052] Then, based on the wake-up response messages corresponding to the first wake-up detection sub-message, the wake-up response messages corresponding to the second wake-up detection sub-message, the wake-up response messages corresponding to the third wake-up detection sub-message, and the wake-up response messages corresponding to the fourth wake-up detection sub-message, the fault test time point where the wake-up failure occurred is determined, and the time corresponding to the fault test time point is used as the third timestamp.
[0053] Understandably, the interval formed by the first and fourth timestamps can be further divided based on the dichotomy method. The specific process can be referred to the above, and will not be repeated here.
[0054] It is understandable that when configuring test parameters, the time interval between adjacent fault test time points can be configured. The time interval between adjacent fault test time points can be the same or different. For example, as mentioned above, in the first test time series X={X1, X2, X3}={1.3,1.6,1.9}, X2-X3=X1-X2. In one possible implementation, after obtaining the logs, the logs can be automatically analyzed to display the fault level and repair suggestions. For example, different fault levels such as [ERROR] and [WARNING] can be displayed along with repair suggestions.
[0055] In this embodiment, a PCAN device connects the test equipment and the controller. Since the PCAN device and the controller are connected via a CAN bus, the PCAN device can monitor the message traffic on the CAN bus and send the message traffic to the test equipment. Based on the message traffic, the test script on the test equipment automatically sends a wake-up message when it determines that the controller is in a sleep state, thereby waking up the controller automatically. Simultaneously, this application also obtains the controller's wake-up response message. If no wake-up response message is received from the controller within a preset time after sending the wake-up message, the timestamp of the forwarded wake-up message recorded by the PCAN device is obtained through the PCAN device's timestamp recording capability. A test report corresponding to the timestamp is generated, ensuring the accuracy of recorded test faults, directly guiding engineers to focus on core issues, improving the efficiency of controller wake-up function testing, and avoiding the inefficiency, error-proneness, and inability to perform long-term, high-intensity repetitive tests of existing manual testing methods.
[0056] Please refer to Figure 2 The document illustrates a flowchart of a controller wake-up function testing method provided in an embodiment of this application. The method is applied to a test device electrically connected to a PCAN device. The test device has a test script, and the PCAN device is connected to the controller via a CAN bus. The method includes: Step 101: After receiving the message traffic corresponding to the CAN bus, if the controller is in a sleep state based on the message traffic determined by the test script, a wake-up message is sent to the PCAN device so that the PCAN device forwards the wake-up message to the controller connected to the PCAN device via the CAN bus.
[0057] Step 102: If no wake-up response message is received from the controller within a preset time after sending the wake-up message, obtain the timestamp and generate a test report corresponding to the timestamp. The timestamp is recorded when the PCAN device forwards the wake-up message to the controller.
[0058] The specific process of steps 101-102 can be referred to the description of the controller network wake-up function test system above, and will not be repeated here.
[0059] The controller wake-up function testing method provided in this application connects the test device and the controller via a PCAN device. Since the PCAN device and the controller are connected via a CAN bus, the PCAN device can monitor the message traffic on the CAN bus and send the message traffic to the test device. Based on the message traffic, the test script on the test device automatically sends a wake-up message when it determines that the controller is in a sleep state, thereby waking up the controller automatically. Simultaneously, this application also obtains the controller's wake-up response message. If no wake-up response message is received from the controller within a preset time after sending the wake-up message, the timestamp of the forwarded wake-up message recorded by the PCAN device is obtained through the PCAN device's timestamp recording capability. A test report corresponding to the timestamp is generated based on the timestamp, ensuring the accuracy of recorded test faults, directly guiding engineers to focus on core issues, and improving the efficiency of controller wake-up function testing.
[0060] In one possible implementation, the test script includes a test time sequence, which includes at least one test time point, and sends a wake-up message to the PCAN device, including: According to the order of the test time points in the test time series, at the target time corresponding to each test time point, a wake-up sub-message is sent to the PCAN device so that the PCAN device forwards the wake-up sub-message to the controller and records the timestamp of forwarding the wake-up sub-message.
[0061] In one possible implementation, if no wake-up response message is received from the controller within a preset time after sending the wake-up message, a timestamp is obtained, and a test report corresponding to the timestamp is generated, including: If no target wake-up response message is received from the controller within a preset time after sending the wake-up sub-message, the wake-up sub-message is used as the target wake-up message, the target timestamp corresponding to the target wake-up message is obtained, and a test report corresponding to the target timestamp is generated.
[0062] In one possible implementation, the method further includes: If, based on the packet traffic, it is determined that the controller is not in a sleep state, the time interval between the test time points is increased.
[0063] In one possible implementation, generating a test report corresponding to the target timestamp includes: For each timestamp, a time window is determined; based on the log information corresponding to each time window, a test report is generated.
[0064] In one possible implementation, for each timestamp, a time window is determined, including: for any target timestamp, determining a first timestamp before the target timestamp and a second timestamp after the target timestamp; obtaining first log information between the first timestamp and the target timestamp, and determining a third timestamp where a wake-up failure occurs based on the first log information; obtaining second log information between the target timestamp and the second timestamp, and determining a fourth timestamp when the controller recovers to normal based on the second log information; and generating a time window corresponding to each target timestamp based on the third and fourth timestamps corresponding to each target timestamp.
[0065] The following is passed Figure 3 The method for testing the controller's Wake-on-LAN function provided in the embodiments of this application is described below. Please refer to [link / reference]. Figure 3 The controller network wake-up function test method provided in this application embodiment includes steps S1-S9.
[0066] S1, Initialization.
[0067] The controller wake-up function test system includes a PCAN device and a test device, the latter containing test scripts. After connecting the PCAN device, test device, and controller, the controller wake-up function test system initializes. During initialization, the test script automatically configures CAN (or CAN FD) bus communication parameters, such as channel and baud rate. Simultaneously, the test script establishes communication connections with the controller, gateway, and other relevant ECUs, receiving user-configured test parameters or automatically generating test parameters. These parameters include the number of test cycles, the time interval between test points when sending wake-up messages, the time interval between fault test points when sending wake-up messages, the bus load target, the abnormal message type, and injection rules. The configuration method for test points can be found above and will not be elaborated upon here.
[0068] The configuration process for fault test time points is based on the same principle as the configuration process for test time points. Specifically, configuring fault test time points includes: generating the time interval for fault test time points according to user or system instructions; determining the first timestamp T_fail-t and the second timestamp T_fail+t based on the target timestamp T_fail; and, if the time interval for fault test time points is greater than 2t, decreasing the time interval for fault test time points or increasing the value of t based on the time span 2t (2t = second timestamp - first timestamp) between the first timestamp T_fail-t and the second timestamp T_fail+t.
[0069] S2, hibernation detection. S2 includes: S21-S23.
[0070] S21, the test device acquires the first packet traffic at the first acquisition time point and determines whether the controller should go into sleep mode based on the packet traffic.
[0071] S22, when the test device determines that the controller is in a sleep state based on the first message flow, it determines whether the minimum value of the time interval between test time points is greater than the first duration. If the minimum value is greater than the first duration, S3 is executed. If the minimum value is less than or equal to the first duration, S3 is executed after increasing the minimum value.
[0072] S23, when the test device determines that the controller is in an active state based on the first message traffic, it generates a new first acquisition time point and a first duration corresponding to the new first acquisition time point, and executes S21 based on the new first acquisition time point.
[0073] The specific process of step S2 can be referred to above, and will not be repeated here.
[0074] S3: Determine if there are any unexecuted test time points. If so, execute S4; otherwise, execute S9.
[0075] Among them, the unexecuted test time point refers to the time point at which the wake-up sub-message was not sent at the target time indicated by the test time point.
[0076] S4, based on the order of test time points in the test time series, sends a wake-up sub-message at the first target time in the test time series that has not been indicated by a test time point.
[0077] If it has already been based on the test time point T i If a wake-up sub-message is sent at the indicated target time, then the first untested time point in the test time sequence after executing S3 is test time point T. i+1 Furthermore, based on the test time point T i+1 The wake-up sub-message is sent at the indicated target time. For example, for a test time series T={T1, T2, T3}, if a wake-up sub-message has already been sent based on the target time indicated by test time point T1, then after executing S3, the first untested time point in the test time series is test time point T2. Therefore, a wake-up sub-message is sent based on the target time indicated by test time point T2. The specific process of sending the wake-up sub-message can be referred to the above and will not be repeated here.
[0078] S5: Check if a wake-up response message has been received. If so, proceed to S6; otherwise, proceed to S7.
[0079] S6 records successful response logs.
[0080] After logging a successful response, execute S3.
[0081] S7 records unsuccessful response logs.
[0082] If the test device does not receive a target wake-up response message from the controller within a preset time after sending the wake-up sub-message, the wake-up sub-message will be used as the target wake-up message, and the target timestamp T_fail will be obtained.
[0083] S8, Fault Location. Fault location is performed based on the target timestamp T_fail.
[0084] S8 includes: S81-S83.
[0085] S81, generate a fault test time series based on the time interval between the first timestamp T_fail-t, the second timestamp T_fail+t, and the fault test time point. The specific process of generating the fault test time series can be referred to the description of generating the first fault test time series, the second fault test time series, the third fault test time series, and the fourth fault test time series above, and will not be repeated here.
[0086] S82, according to the order of the fault test time points in the fault test time sequence, send wake-up detection sub-messages sequentially based on the time indicated by each fault test time point, and check whether a wake-up detection response sub-message corresponding to the wake-up detection sub-message is received after a preset time after sending the wake-up detection sub-message.
[0087] S83, obtain the third timestamp T_first when the first wake-up failure occurs in the log information, and the fourth timestamp T_last when the controller returns to normal, and construct a wake-up failure time window based on the third timestamp T_first and the fourth timestamp T_last.
[0088] After executing S8, execute S3.
[0089] S9 generates a test report.
[0090] After all test points are completed, log information and diagnostic results are automatically generated, integrating controller sleep time, number of test rounds, test results for each round, and wake-up failure time window. Please refer to... Figure 4 This illustration shows a schematic diagram of the controller wake-up function testing device 20 provided in an embodiment of this application. The testing device is electrically connected to a PCAN device, and the testing device has a test script. The PCAN device is connected to the controller via a CAN bus. The device 20 includes: The wake-up message sending module 201 is used to receive the message traffic corresponding to the CAN bus, and when the controller is determined to be in a sleep state based on the message traffic according to the test script, send a wake-up message to the PCAN device so that the PCAN device forwards the wake-up message to the controller connected to the PCAN device through the CAN bus. The test report generation module 202 is used to obtain a timestamp and generate a test report corresponding to the timestamp if no wake-up response message is received from the controller within a preset time after sending the wake-up message. The timestamp is recorded when the PCAN device forwards the wake-up message to the controller.
[0091] In one possible implementation, the test script includes a test time series, which includes at least one test time point; The wake-up message sending module 201 is specifically used to send a wake-up sub-message to the PCAN device at the target time corresponding to each test time point according to the order of the test time points in the test time sequence, so that the PCAN device forwards the wake-up sub-message to the controller, and the PCAN device records the timestamp of forwarding the wake-up sub-message.
[0092] In one possible implementation, the test report generation module 202 is specifically used to, if no target wake-up response message for the wake-up sub-message is received from the controller within a preset time after sending the wake-up sub-message, take the wake-up sub-message as the target wake-up message, obtain the target timestamp corresponding to the target wake-up message, and generate a test report corresponding to the target timestamp.
[0093] In one possible implementation, the wake-up message sending module 201 is also used to increase the time interval between test time points if the controller is not in a sleep state based on the message traffic.
[0094] In one possible implementation, the test report generation module 202 is specifically used to determine a time window for each timestamp and generate a test report based on the log information corresponding to each time window.
[0095] In one possible implementation, the test report generation module 202 is further configured to determine, for any target timestamp, a first timestamp before the target timestamp and a second timestamp after the target timestamp; Obtain the first log information between the first timestamp and the target timestamp, and determine the third timestamp where the wake-up failure occurred based on the first log information; Obtain the second log information between the target timestamp and the second timestamp, and determine the fourth timestamp when the controller returns to normal based on the second log information; Based on the third and fourth timestamps corresponding to each target timestamp, a time window is generated for each target timestamp.
[0096] This device connects the test equipment and the controller via a PCAN device. Since the PCAN device and the controller are connected via a CAN bus, the PCAN device can monitor the message traffic on the CAN bus and send the message traffic to the test equipment. Based on the message traffic, a test script on the test equipment automatically sends a wake-up message when it determines that the controller is in a sleep state, thus waking the controller automatically. Simultaneously, this application also obtains the controller's wake-up response message. If no wake-up response message is received from the controller within a preset time after sending the wake-up message, the timestamp recorded by the PCAN device for forwarding the wake-up message is obtained. A test report corresponding to the timestamp is generated based on the timestamp, ensuring the accuracy of recorded test faults, directly guiding engineers to focus on core issues, and improving the efficiency of controller wake-up function testing.
[0097] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.
[0098] In an exemplary embodiment, a computer-readable storage medium is also provided, which stores at least one computer program that is loaded and executed by a processor of a computer device to enable the computer to implement any of the controller wake-up function testing methods described above.
[0099] In one possible implementation, the aforementioned computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0100] In an exemplary embodiment, a computer program product or computer program is also provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform any of the controller wake-up function testing methods described above.
[0101] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, data stored, data displayed, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0102] It should be understood that "multiple" as used in this article refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0103] It should be noted that the terms "first," "second," etc. (if applicable) in the specification and claims of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0104] The above description is merely an exemplary embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A controller wake-up network function testing system, characterized in that, The system includes: a test device and a PCAN device, wherein the test device is electrically connected to the PCAN device and the test device has a test script; The PCAN device is used to listen to the message traffic on the CAN bus when connected to the controller via the CAN bus, and to send the message traffic to the test device. The test device is used to receive the message traffic and, if the test script determines that the controller is in a sleep state based on the message traffic, send a wake-up message to the PCAN device. The PCAN device is used to forward the wake-up message to the controller and record the timestamp of forwarding the wake-up message; The test device is used to obtain the timestamp and generate a test report corresponding to the timestamp if no wake-up response message is received from the controller within a preset time after the wake-up message is sent.
2. The system according to claim 1, characterized in that, The test script includes a test time series, and the test time series includes at least one test time point; The test device is specifically used to send a wake-up sub-message to the PCAN device at the target time corresponding to each test time point in the test time sequence, according to the order of the test time points in the test time sequence, when the test script determines that the controller is in a sleep state based on the message traffic; The PCAN device is specifically used to forward the wake-up sub-message to the controller and to record the timestamp of forwarding the wake-up sub-message; The test equipment is specifically used to, for any of the wake-up sub-messages, if no target wake-up response message is received from the controller for the wake-up sub-message within a preset time after sending the wake-up sub-message, treat the wake-up sub-message as the target wake-up message, obtain the target timestamp corresponding to the target wake-up message, and generate a test report corresponding to the target timestamp.
3. The system according to claim 2, characterized in that, Before sending a wake-up sub-message to the PCAN device sequentially at the target time corresponding to each test time point according to the order of the test time points in the test time sequence, the test device is further configured to: If the minimum time interval between the test time points is less than or equal to a first duration, the minimum value is increased. The first duration is the time interval between a first preset time point and a first acquisition time point for acquiring the message traffic. The first preset time point is any time point after the controller is connected to the PCAN device.
4. The system according to claim 3, characterized in that, The testing equipment is specifically used for: If the controller is determined to be in a sleep state based on the first message traffic, and if the minimum value is greater than the first duration, then the step of sending the wake-up sub-message to the PCAN device sequentially at the target time corresponding to each test time point according to the order of the test time points in the test time sequence is executed. If it is determined that the controller is in an active state based on the first message traffic, a new first acquisition time point and the first duration corresponding to the new first acquisition time point are generated, and the step of acquiring the first message traffic corresponding to the first time point is executed based on the new first acquisition time point. The first message traffic is the message traffic acquired at the first acquisition time point.
5. The system according to claim 4, characterized in that, The testing equipment is used to determine a time window for each timestamp and generate a test report based on the log information corresponding to each time window. Preferably, the testing device is further configured to, for any target timestamp, determine a first timestamp before the target timestamp and a second timestamp after the target timestamp; Obtain first log information between the first timestamp and the target timestamp, and determine the third timestamp at which the wake-up failure occurred based on the first log information; Obtain second log information between the target timestamp and the second timestamp, and determine a fourth timestamp when the controller returns to normal based on the second log information; Based on the third and fourth timestamps corresponding to each target timestamp, a time window corresponding to each target timestamp is generated.
6. A method for testing the network wake-up function of a controller, characterized in that, The method includes: After receiving the message traffic corresponding to the CAN bus, if the controller is in a sleep state based on the message traffic and the test script determines that the controller is in a sleep state, a wake-up message is sent to the PCAN device so that the PCAN device forwards the wake-up message to the controller connected to the PCAN device through the CAN bus. If no wake-up response message is received from the controller within a preset time after the wake-up message is sent, a timestamp is obtained and a test report corresponding to the timestamp is generated. The timestamp is recorded when the PCAN device forwards the wake-up message to the controller.
7. The method according to claim 6, characterized in that, The test script includes a test time series, and the test time series includes at least one test time point; Sending a wake-up message to the PCAN device includes: According to the order of the test time points in the test time sequence, at the target time corresponding to each test time point, a wake-up sub-message is sent to the PCAN device, so that the PCAN device forwards the wake-up sub-message to the controller, and the PCAN device records the timestamp of forwarding the wake-up sub-message. Preferably, if no wake-up response message is received from the controller within a preset time after sending the wake-up message, obtaining a timestamp and generating a test report corresponding to the timestamp includes: If no target wake-up response message is received from the controller within a preset time after sending the wake-up sub-message, the wake-up sub-message is taken as the target wake-up message, the target timestamp corresponding to the target wake-up message is obtained, and a test report corresponding to the target timestamp is generated.
8. The method according to claim 7, characterized in that, Before sending a wake-up sub-message to the PCAN device at the target time corresponding to each test time point according to the order of the test time points in the test time sequence, the method further includes: If the minimum time interval between the test time points is less than or equal to a first duration, the minimum value is increased. The first duration is the time interval between a first preset time point and a first acquisition time point for acquiring the message traffic. The first preset time point is any time point after the controller is connected to the PCAN device.
9. A controller wake-up network function testing device, characterized in that, The device includes: The wake-up message sending module is used to receive the message traffic corresponding to the CAN bus, and when the controller is determined to be in a sleep state based on the message traffic according to the test script, send a wake-up message to the PCAN device so that the PCAN device forwards the wake-up message to the controller connected to the PCAN device through the CAN bus. The test report generation module is used to obtain a timestamp and generate a test report corresponding to the timestamp if no wake-up response message is received from the controller within a preset time after sending the wake-up message. The timestamp is recorded when the PCAN device forwards the wake-up message to the controller.
10. The apparatus according to claim 9, characterized in that, The test script includes a test time series, and the test time series includes at least one test time point; The wake-up message sending module is specifically used to send a wake-up sub-message to the PCAN device at the target time corresponding to each test time point according to the order of the test time points in the test time sequence, so that the PCAN device forwards the wake-up sub-message to the controller, and the PCAN device records the timestamp of forwarding the wake-up sub-message. Preferably, the test report generation module is specifically used to, if no target wake-up response message is received from the controller for the wake-up sub-message within a preset time after sending the wake-up sub-message, take the wake-up sub-message as the target wake-up message, obtain the target timestamp corresponding to the target wake-up message, and generate a test report corresponding to the target timestamp.