Method and system for dynamic adjustment of can bus load rate based on capl script

CN122933489APending Publication Date: 2026-10-16CHERY AUTOMOBILE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611418652.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-14
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

然而,该方案在报文周期调节时采用统一的调节策略,缺乏针对不同优先级报文的分级精细调节机制,且仅依靠反馈控制,缺少基于负载变化趋势的前馈补偿手段,影响了高负载环境下测试的精度与稳定性

Benefits of technology

本发明通过CAPL脚本构建了一种基于双定时器驱动的CAN总线负载率自动化闭环调节方法,以负载检测定时器周期性采集实际负载率并计算与目标值的差值,以调节完成标志作为闭环终止条件,以报文发送定时器根据动态调整后的发送周期参数持续向总线输出测试报文,三者协同形成完整的闭环反馈控制回路;与现有技术中依赖人工手动配置报文并通过经验估算反复试错的方式相比,本发明实现了从参数配置、定时器启动到负载检测、差值判断、周期调整、报文发送的全流程自动化,用户只需输入目标负载率并触发按钮指令即可完成整个调节过程,显著提高了测试效率,消除了人为计算误差,保障了测试结果的一致性与可重复性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122933489A_ABST
    Figure CN122933489A_ABST
Patent Text Reader

Abstract

The application discloses a CAN bus load rate dynamic adjustment method and system based on a CAPL script, relates to the field of automobile electronic testing technology, and obtains a target load rate parameter and test messages; a current actual load rate of a CAN bus is obtained; whether an absolute value of a difference between the current actual load rate and the target load rate parameter exceeds a load difference judgment threshold value is judged, if the absolute value exceeds the load difference judgment threshold value, the next step is continuously executed; according to the positive and negative of the difference, the sending cycle parameters of multiple test messages are simultaneously adjusted to obtain adjusted sending cycle parameters; the multiple test messages are periodically sent to the CAN bus according to the adjusted sending cycle parameters; the steps of obtaining the actual load rate, calculating the difference, judging the threshold value, adjusting the sending cycle parameters and sending the test messages are repeatedly performed to form a closed-loop feedback adjustment until an adjustment completion flag is set to a completion state. The application realizes a leap from passive manual intervention to active automatic control, and significantly improves test efficiency and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automotive electronic testing technology, and in particular to a method and system for dynamic adjustment of CAN bus load rate based on CAPL scripts. Background Technology

[0002] In the development and testing of automotive electronic systems, the CAN bus, as the core communication protocol of the in-vehicle network, has its load rate as a key indicator for evaluating the stability of the communication system. Traditional testing methods rely on manually configuring a large number of periodic messages and adjusting the transmission frequency through empirical estimation or repeated trial and error to approximate the target load rate. This approach is not only time-consuming and labor-intensive, but also highly susceptible to human calculation errors that can lead to biased results, severely affecting the consistency and repeatability of the tests.

[0003] Existing technologies establish ECU simulation nodes on the CAN network and associate them with dynamic load rate debugging scripts to execute scripts that dynamically adjust the load rate to ensure that the bus load rate equals the expected value. However, this approach uses a uniform adjustment strategy when adjusting the message cycle, lacking a hierarchical fine-tuning mechanism for messages of different priorities. Furthermore, it relies solely on feedback control and lacks feedforward compensation methods based on load change trends, which affects the accuracy and stability of testing under high load conditions. Summary of the Invention

[0004] To overcome the shortcomings of the prior art, this invention provides a method and system for dynamic adjustment of CAN bus load rate based on CAPL scripts, realizing a leap from passive manual intervention to active automatic control, and significantly improving testing efficiency and accuracy.

[0005] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions: In a first aspect, the present invention provides a method for dynamic adjustment of CAN bus load rate based on CAPL scripts, including: Obtain the target load rate parameters and test messages input by the user; In response to the button trigger command, initialize the test message sending cycle parameters, set the adjustment completion flag to the incomplete state, and start the load detection timer and message sending timer; The load detection and adjustment process is periodically triggered by the load detection timer to obtain the current actual load rate of the CAN bus and calculate the difference between the current actual load rate and the target load rate parameter. Determine if the absolute value of the difference exceeds the load difference judgment threshold. If it does not exceed the threshold, set the adjustment completion flag to the completed state and stop the load detection timer. If it exceeds the threshold, continue to the next step. Based on the sign of the difference, the sending period parameters of multiple test messages are adjusted simultaneously to obtain the adjusted sending period parameters; The message sending timer periodically sends multiple test messages to the CAN bus according to the adjusted sending period parameters; Repeat the above steps of obtaining the current actual load rate of the CAN bus, calculating the difference, judging the threshold, adjusting the transmission cycle parameters, and sending test messages to form a closed-loop feedback adjustment until the adjustment completion flag is set to the completion state.

[0006] A further technical solution involves defining environment variables to store the target load rate parameter and the detection cycle parameter in the variable declaration section of the CAPL script, and defining system variables to store the adjustment completion flag and the test message sending cycle parameter.

[0007] A further technical solution is that the button triggering instruction is specifically defined in the CAPL script as follows: when the user clicks the button, the system variable event response function is triggered to execute.

[0008] A further technical solution involves using multiple sampling and averaging to suppress sampling noise when obtaining the current actual load rate of the CAN bus.

[0009] A further technical solution also includes a timeout protection mechanism, specifically: an adjustment round counter is introduced, which increments by 1 each time a periodic adjustment operation is performed; it is determined whether the value of the adjustment round counter exceeds the maximum adjustment round limit. If the absolute value of the difference exceeds the load difference judgment threshold and the value of the adjustment round counter exceeds the maximum adjustment round limit, the timeout protection mechanism is triggered, the load detection timer and the message sending timer are stopped, and an alarm message is output.

[0010] A further technical solution involves adjusting the sending period parameters of multiple test messages simultaneously, based on the sign of the difference. Specifically, this includes: The basic adjustment step size is calculated based on the absolute value of the difference. Based on the basic adjustment step size, the adjustment step size for high-priority messages and the adjustment step size for low-priority messages are calculated separately. Determine the sign of the difference. If the difference is greater than 0, shorten the message transmission period of high-priority and low-priority messages by their corresponding adjustment step size. If the difference is less than 0, extend the message transmission period of high-priority and low-priority messages by their corresponding adjustment step size.

[0011] A further technical solution involves calculating the change between the current difference and the previous difference when adjusting the transmission cycle parameters of the test message. Feedforward compensation is performed when the absolute value of the change is greater than a preset threshold.

[0012] Secondly, this invention provides a CAN bus load rate dynamic adjustment system based on CAPL scripts, comprising: The data acquisition module is configured to acquire the target load rate parameters and test messages input by the user. The script startup module is configured to: respond to the button trigger command, initialize the test message sending cycle parameters, set the adjustment completion flag to the incomplete state, and start the load detection timer and message sending timer; The difference calculation module is configured to periodically trigger the load detection and adjustment process by the load detection timer, obtain the current actual load rate of the CAN bus, and calculate the difference between the current actual load rate and the target load rate parameter. The difference judgment module is configured to: determine whether the absolute value of the difference exceeds the load difference judgment threshold; if it does not exceed the threshold, set the adjustment completion flag to the completion state and stop the load detection timer; if it exceeds the threshold, continue to the next step. The parameter adjustment module is configured to adjust the sending period parameters of multiple test messages simultaneously based on the sign of the difference, so as to obtain the adjusted sending period parameters. The message test module is configured to periodically send multiple test messages to the CAN bus according to the adjusted transmission period parameters using a message transmission timer. The closed-loop feedback module is configured to repeat the steps described above: obtaining the current actual load rate of the CAN bus, calculating the difference, judging the threshold, adjusting the transmission cycle parameters, and sending test messages to form a closed-loop feedback adjustment until the adjustment completion flag is set to the completion state.

[0013] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the CAN bus load rate dynamic adjustment method based on CAPL script as described in the first aspect.

[0014] Fourthly, the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps in the CAN bus load rate dynamic adjustment method based on CAPL script as described in the first aspect.

[0015] The above one or more technical solutions have the following beneficial effects: This invention constructs an automated closed-loop adjustment method for CAN bus load rate based on dual timer driving using CAPL scripts. A load detection timer periodically collects the actual load rate and calculates the difference from the target value. An adjustment completion flag serves as the closed-loop termination condition. A message sending timer continuously outputs test messages to the bus according to dynamically adjusted sending cycle parameters. These three elements work together to form a complete closed-loop feedback control loop. Compared to existing technologies that rely on manual message configuration and trial-and-error estimation based on experience, this invention automates the entire process from parameter configuration and timer startup to load detection, difference judgment, cycle adjustment, and message sending. Users only need to input the target load rate and trigger a button command to complete the entire adjustment process, significantly improving testing efficiency, eliminating human calculation errors, and ensuring the consistency and repeatability of test results.

[0016] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0017] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.

[0018] Figure 1 This is a flowchart of the dynamic adjustment method for CAN bus load rate based on CAPL script according to an embodiment of the present invention; Figure 2 This is a schematic diagram showing the output after the script in an embodiment of the present invention has finished. Detailed Implementation

[0019] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0020] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.

[0021] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.

[0022] Terminology Explanation: CAN bus (Controller Area Network): A serial communication protocol used for communication between automotive electronic control units. It features multiple master controllers, strong real-time performance, and strong anti-interference capabilities, and is widely used in key modules such as powertrain systems, body control, chassis electronics, and advanced driver assistance systems.

[0023] CAPL (Communication Access Programming Language): A scripting language developed by Vector for CAN network testing and simulation, supporting functions such as timer event-driven operation, message transmission and reception control, and variable monitoring.

[0024] CANoe platform: A vehicle network development and testing tool launched by Vector, integrating CAPL programming environment, Panel graphical interface design, Trace packet analysis, database management and other functional modules.

[0025] VN5600 interface device: Multi-protocol bus interface hardware manufactured by Vector, supporting multiple vehicle communication protocols such as CAN, CAN FD, FlexRay, and LIN, and connecting to the test host via USB or Ethernet.

[0026] Bus load factor: refers to the ratio of the actual number of data bits transmitted by the CAN bus per unit time to the theoretical maximum transmission capacity of the bus, expressed as a percentage, and is a core indicator for assessing bus communication pressure.

[0027] msCycleSend (message sending timer): A CAPL timer object that periodically triggers the message sending function. Its triggering period is dynamically determined by the sending period parameter of each message.

[0028] With the rapid development of automotive electronic systems, the communication networks within modern vehicles are becoming increasingly complex. CAN (Controller Area Network), as one of the core communication protocols of in-vehicle networks, is widely used in multiple key modules such as powertrain systems, body control, chassis electronics, and advanced driver assistance systems (ADAS). During the vehicle development and testing phase, network load rate becomes a core indicator for evaluating the stability and real-time performance of the communication system. Excessive bus load can lead to serious problems such as message delays, increased arbitration conflicts, and even frame drops or communication interruptions; conversely, insufficient load fails to realistically simulate actual operating conditions, affecting the effectiveness of the test. Therefore, in ECU unit testing and vehicle integration testing, implementing controllable high-load stress testing on specific network segments is particularly important. Traditional testing methods rely on manually configuring a large number of periodic messages and adjusting the transmission frequency through empirical estimation or repeated trial and error to approximate the target load rate. This approach is not only time-consuming and labor-intensive but also highly susceptible to human calculation errors, leading to result deviations and severely impacting test consistency and repeatability. Especially in complex network environments with multiple nodes working collaboratively, manual adjustment is insufficient to meet the demands for efficient and accurate testing.

[0029] This embodiment is based on the following technical background and the problems to be solved, clarifying the logical starting point of the invention: The core solution of existing technologies is that traditional CAN bus load testing methods rely on manually configuring a large number of periodic messages and adjusting the transmission frequency through empirical estimation or repeated trial and error to approximate the target load rate. While some existing dynamic adjustment schemes achieve load rate control by dynamically adjusting the message period through scripts, these schemes use a uniform adjustment strategy, applying the same period increment / decrement step size to all test messages. They lack a hierarchical fine-tuning mechanism for messages of different priorities and rely solely on feedback control, lacking feedforward compensation based on load change trends. This results in slow convergence speed during the adjustment process and a tendency for overshoot, affecting the accuracy and stability of testing under high load conditions. Therefore, this invention proposes a CAN bus load rate dynamic adjustment scheme that combines hierarchical adaptive step size adjustment and feedforward compensation technology to solve the above-mentioned technical deficiencies.

[0030] To address the issues of low accuracy, slow convergence, and easy overshoot in existing CAN bus load rate adjustment technologies, this invention provides a dynamic CAN bus load rate adjustment scheme based on CAPL scripts. This scheme first defines target load rate parameters, adjustment completion flags, load detection timers, message transmission timers, detection cycle parameters, load difference judgment thresholds, and multiple test messages and their corresponding transmission cycle parameters in the CAPL script. The user sets the target load rate and configures test message identifiers through the Panel. Upon responding to a button trigger command, the transmission cycles of each message are initialized and timers are started. The load detection timer periodically triggers the load detection and adjustment process, obtaining the current actual load rate and calculating the difference between it and the target load rate. If the difference exceeds the judgment threshold, the adjustment step size is adaptively calculated based on the difference, with different step sizes used for high-priority and low-priority messages for tiered adjustment. Simultaneously, feedforward compensation is performed based on the load change trend, and boundary protection is implemented for the adjusted cycle parameters. The message transmission timer periodically sends test messages according to the adjusted cycle parameters. This process is repeated until the actual load rate stabilizes within the target range. This scheme, through hierarchical differentiated adjustment and feedforward compensation technology, is significantly different from the uniform step-size feedback adjustment scheme of existing technologies.

[0031] Examples of the environments in which various embodiments of this application can be implemented include the CANoe test platform, the VN5600 interface device, and the unit under test (DUT).

[0032] The CANoe test platform is a test host that runs the CANoe software. It is equipped with a high-performance processor and a multi-channel interface card, and is responsible for running CAPL scripts and data acquisition. It can also be expanded into other vehicle network test platforms that support CAPL programming.

[0033] The VN5600 interface device serves as a bridge for CAN bus communication. Its CAN channel is electrically connected to the CAN interface of the unit under test (DUT) via the T1+ and T1- lines. The VN5600 interface device can also be expanded to other bus interface devices that support CAN communication.

[0034] The unit under test (DUT) can be an automotive electronic control unit, vehicle module, or other CAN bus node. It is connected to the power supply U via KL30 and K15 power cables to obtain operating power. The CANoe test platform, VN5600 interface device, and the ground terminal of the DUT are all connected to a common ground point.

[0035] The CANoe test platform communicates with the VN5600 interface device via a USB or Ethernet interface, while the VN5600 interface device communicates with the unit under test (DUT) via a CAN bus.

[0036] The data collection and processing in this application strictly comply with relevant laws and regulations. The collected bus communication data is used solely for testing purposes and not for any other unauthorized use. It should be understood that the above example environment is described for illustrative purposes only and does not imply any limitation on the scope of this disclosure. This invention can also be applied to other types of vehicle bus testing scenarios.

[0037] The core innovation of this invention lies in the construction of a fully automated, closed-loop feedback load regulation system (Example 1). like Figure 1 As shown, this embodiment discloses a method for dynamic adjustment of CAN bus load rate based on CAPL scripts. This method is implemented in a test system consisting of a CANoe test platform and a VN5600 interface device electrically connected via a CAN channel. The method includes the following steps: S1: Obtain the target load rate parameters and test messages input by the user.

[0038] In this embodiment, in the variable declaration section of the CAPL script, the environment variable `expBusLoad` is defined to store the target load rate parameter. Its data type is floating-point, and its value range is 0 to 100, with the unit being percentage. The system variable `adjustBusLoadOk` is defined to store the adjustment completion flag. Its data type is integer, and its value is 0 or 1. A timer object `msBusLoad` is defined as the load detection timer. A timer object `msCycleSend` is defined as the message sending timer. The environment variable `durationTime` is defined to store the detection period parameter. Its data type is integer, and the unit is milliseconds. Eight test messages are defined: message objects `msg1`, `msg2`, `msg3`, `msg4`, `msg5`, `msg6`, `msg7`, and `msg8`. System variables are defined. , , , , , , , Store the sending period parameters of the above 8 test messages respectively, using integer data types. Define constants. Used to store minimum cycle limit parameters.

[0039] In addition, an integer variable `adjustCount` is defined to store the adjustment round counter, with an initial value of 0; an integer constant `maxAdjustCount` is defined to store the maximum adjustment round limit; an integer variable `channelIndex` is defined to store the target CAN channel index, with a value range of 1 to 4; and a floating-point variable is defined. Used to store the arithmetic mean of the load rate from multiple samples.

[0040] Furthermore, a load difference judgment threshold is set. This threshold determines whether adjustment should continue, and its value must strike a balance between adjustment accuracy and stability. If the threshold is too large (e.g., 5%), there will still be a significant deviation between the actual load rate and the target value after adjustment, failing to meet high-precision testing requirements. If the threshold is too small (e.g., 0.1%), the system will remain in a state of micro-oscillation for a long time, making convergence difficult and extremely sensitive to bus noise and sampling errors. Based on the bus load rate sampling accuracy of the CANoe platform (typically approximately ±0.5%) and the engineering requirements for load rate control accuracy in automotive electronics testing (usually within ±1% of the target value), the load difference judgment threshold is set to 1%. That is, adjustment is considered complete when the absolute value of the difference between the actual load rate and the target load rate is less than 1%. This value ensures that the adjustment accuracy meets engineering requirements while avoiding system oscillations caused by an excessively small threshold. Preferably, the load difference judgment threshold ranges from 0.5% to 2%, and can be adjusted according to the accuracy requirements of specific testing scenarios.

[0041] Furthermore, minimum period limit parameters Determination: This is used to limit the lower limit of the message transmission period, preventing bus congestion caused by excessively short periods. At a standard baud rate (e.g., 500 kbps), the theoretical transmission time for a single standard data frame (8 bytes of data) on the CAN bus is approximately 0.134 to 0.208 milliseconds (including bit stuffing overhead). If eight messages are transmitted simultaneously, with each message's period approaching zero, the number of messages per unit time will approach infinity, far exceeding the bus's carrying capacity, leading to severe arbitration conflicts and message loss. Considering the bus occupancy when eight messages are transmitted simultaneously, and the minimum resolution of the CANoe platform timer (typically 1 millisecond), the following measures are taken: The value is set to 1 millisecond. This value, while ensuring no bus congestion, limits the transmission frequency of a single message to 1000 times / second. This corresponds to a maximum load contribution of approximately 8% to 13% for a single message (depending on message length). Eight messages combined can contribute a maximum of approximately 64% to 100% of the load, covering common high-load test scenarios. Preferably, The value ranges from 1 millisecond to 5 milliseconds and can be adjusted according to the bus baud rate and the number of messages.

[0042] Furthermore, the determination of the detection period parameter durationTime: durationTime determines the trigger interval of the load detection timer, i.e., the sampling period of the closed-loop control. If durationTime is too small (e.g., 10 milliseconds), the controller sampling frequency is too high, and the bus load rate has not stabilized after each adjustment before the next sampling, causing the controller to make incorrect judgments based on transient data and exacerbating oscillations. If durationTime is too large (e.g., 2000 milliseconds), the system's response to load changes is sluggish, and the adjustment convergence time is too long. According to the dynamic response characteristics of the CAN bus load rate, the bus load rate usually tends to a new steady state within 100 to 300 milliseconds after the message transmission period is adjusted. Considering both response speed and stability, durationTime is set to 200 milliseconds, allowing the system sufficient time to wait for the bus load rate to stabilize after each adjustment before performing the next sampling and judgment, thereby ensuring the stable convergence of the closed-loop control. Preferably, the durationTime value ranges from 100 milliseconds to 500 milliseconds. In scenarios requiring fast convergence, 100 milliseconds can be used, while in scenarios requiring high stability, 300 milliseconds to 500 milliseconds can be used.

[0043] The above technical solution provides a data foundation for subsequent adjustment processes, ensuring that the script can correctly store and access various parameters.

[0044] In this embodiment, a user interface is designed in the CANoe Panel, including a numeric input box for setting the expBusLoad value and eight text input boxes for setting the message identifiers msg1 to msg8. The user enters the desired bus load rate in the numeric input box; for example, entering 70 indicates a target load rate of 70%. The user enters the CAN ID of the test message in each of the eight text input boxes. The message IDs entered in the Panel are assigned to the corresponding message objects using statements such as @panel_set_msg:msg1 in the CAPL script.

[0045] The above technical solution enables user interaction with the script, allowing users to flexibly configure the target button trigger load rate and test messages according to testing needs without modifying the script code, thus improving the script's versatility and ease of use.

[0046] S2: In response to the button trigger command, initialize the test message sending cycle parameters, set the adjustment completion flag to the incomplete state, and start the load detection timer and message sending timer; In this embodiment, a system variable event response function `on sysvarsysvarAdjustBusLoad` is defined in the CAPL script. When the user clicks the "Start" button in the Panel, the value of the system variable `sysvarAdjustBusLoad` associated with the button changes from 0 to 1, triggering the execution of this function. Within this function, the value of `sysvarAdjustBusLoad` is first checked. If its value is equal to 1, it indicates that the user has clicked the Start button, and then an initialization operation is performed: [The function is then executed]. to All eight transmission cycle parameters are initialized to the preset initial cycle values, and adjustBusLoadOk is set to 0 to indicate that the adjustment is not yet complete. At the same time, the adjustment cycle counter adjustCount is initialized to 0. Then, setTimer(msBusLoad, durationTime) is called to start the load detection timer msBusLoad, and setTimer(msCycleSend, msg1_cycle) is called to start the message transmission timer msCycleSend.

[0047] Preferably, the initial cycle value is uniformly set to 1 millisecond to maximize the initial load rate and speed up the start of the adjustment process.

[0048] The above technical solution completes the script initialization, preparing for the subsequent automatic adjustment process. Users only need to press one button to start the entire testing process, achieving one-click operation.

[0049] S3: The load detection and adjustment process is periodically triggered by the load detection timer to obtain the current actual load rate of the CAN bus and calculate the difference between the current actual load rate and the target load rate parameter. In this embodiment, a timer event response function `on timer msBusLoad` is defined in the CAPL script. This function is triggered when the load detection timer `msBusLoad` times out. Within this function, the value of `adjustBusLoadOk` is first checked. If `adjustBusLoadOk` equals 0, it indicates that the adjustment is not complete and the adjustment process needs to continue. If `adjustBusLoadOk` equals 1, it indicates that the adjustment is complete, and `cancelTimer(msBusLoad)` is called to stop the load detection timer. If `adjustBusLoadOk` equals 2, it indicates that the adjustment has terminated due to a timeout exception, and the timer is stopped and the process exits.

[0050] When adjustBusLoadOk equals 0, the current actual load rate of CAN channel 1 is obtained by accessing the built-in system variable can1.BusLoad of CANoe. The data type of this variable is floating point, the value range is 0 to 100, and the unit is percentage.

[0051] Furthermore, to improve the accuracy of load rate sampling, this invention employs a method of averaging multiple samples to suppress sampling noise. The system variable can1.BusLoad provided by the CANoe platform is a moving average of the bus load rate calculated based on a sliding window algorithm. This value is subject to sampling noise due to factors such as instantaneous message bursts and bus arbitration delays in a short period of time, and a single sample value may deviate from the actual load rate. If the can1.BusLoad value from a single sample is directly used in the difference calculation, it may lead to adjustment decisions based on inaccurate load rate data, causing unnecessary periodic adjustments or adjustment oscillations.

[0052] To address the aforementioned issues, this invention samples can1.BusLoad N times consecutively each time the load detection timer is triggered, and calculates its arithmetic mean. This serves as an estimate of the current actual load rate. Specifically, in the `on timer msBusLoad` event response function, the current value of `can1.BusLoad` is read N times consecutively using a loop, and denoted as follows: , ... The formula for calculating the arithmetic mean is:

[0053] in, This is the arithmetic mean of multiple samples; to For continuous The bus load rate value of the next sample; The number of samples is a positive integer.

[0054] Calculated Then, use The can1.BusLoad parameter, used in place of a single sample, is used in subsequent difference calculations. By averaging multiple samples, the impact of instantaneous noise on a single sample value is averaged out, making... It is closer to the true value of the actual load rate, thereby reducing the impact of noise interference on regulation decisions.

[0055] Preferably, the number of samples N is 3, and the time interval between two adjacent samples is set to 10 milliseconds. Under this configuration, the total time to complete 3 samples and calculate the average value is about 20 to 30 milliseconds, which is a small time overhead compared to the trigger period durationTime of the load detection timer (200 milliseconds). It will not significantly increase the system's response latency, and can effectively suppress sampling noise.

[0056] This mechanism effectively improves the accuracy and stability of load rate sampling by averaging multiple samples, reduces misjudgments and unnecessary adjustment actions caused by sampling noise, and improves the smoothness and convergence stability of the adjustment process.

[0057] Calculate the difference ,in, This is the difference between the actual load rate and the target load rate. The target load factor parameter; This represents the current actual load rate of the CAN channel (arithmetic average of multiple samples). If delta is positive, it means the actual load rate is lower than the target load rate, and the load needs to be increased; if delta is negative, it means the actual load rate is higher than the target load rate, and the load needs to be reduced.

[0058] The above technical solution enables real-time monitoring of bus load rate, providing data for subsequent adjustment decisions and forming the core of closed-loop feedback control.

[0059] S4: Determine whether the absolute value of the difference exceeds the load difference judgment threshold. If it does not exceed the threshold, set the adjustment completion flag to the completion state and stop the load detection timer. If it exceeds the threshold, continue to the next step. In this embodiment, the absolute value of the difference is calculated. ,in Represents the absolute value of the difference. Judgment Does it exceed the load difference threshold? If the actual load rate exceeds the threshold, it indicates that the deviation between the actual load rate and the target load rate exceeds the allowable range, and the adjustment process needs to continue, proceeding to step S5. If the actual load rate is less than or equal to the threshold, it means that the actual load rate has stabilized within the allowable deviation range of the target load rate, the adjustment target has been achieved, and setting adjustBusLoadOk to 1 indicates that the adjustment is complete.

[0060] Preferably, the load difference judgment threshold is set to 1%, that is, when the absolute value of the difference between the actual load rate and the target load rate is less than 1%, the adjustment is considered to be complete.

[0061] To ensure the robustness of the test system, this invention further includes a timeout protection mechanism. In actual testing, if the user-set target load rate expBusLoad exceeds the bus's carrying capacity, or if there are hardware connection anomalies (such as an open circuit, short circuit, or missing terminating resistor on the CAN bus causing messages to fail to be sent normally), the adjustment process may fail to converge for a long time, causing the script to get stuck in an infinite loop, consuming system resources and unable to exit normally.

[0062] To avoid the above problems, this invention introduces an adjustment round counter, adjustCount, to record the number of times the adjustment process is executed. In the script startup phase of step S2, adjustCount is initialized to 0. Each time the periodic adjustment operation in step S5 is executed, adjustCount increments by 1, i.e., adjustCount = adjustCount + 1, where adjustCount is the adjustment round counter, initially set to 0, and increments by 1 each time step S5 is executed.

[0063] Meanwhile, a constant `maxAdjustCount` is defined in the CAPL script to set the maximum adjustment cycle limit. In the conditional judgment logic of step S4, besides judging the absolute value of the difference... In addition to determining whether the load difference threshold is exceeded, it is also necessary to check whether adjustCount exceeds maxAdjustCount. If the load exceeds the threshold and adjustCount exceeds maxAdjustCount, a timeout protection mechanism is triggered: cancelTimer(msBusLoad) is called to stop the load detection timer, cancelTimer(msCycleSend) is called to stop the message sending timer, and the CAPL write function outputs the alarm message "Load rate adjustment timed out, please check the target load rate setting or hardware connection" to the CANoe Write window. The adjustBusLoadOk value is set to 2, indicating that the adjustment process terminated due to a timeout exception. Here, adjustCount is the adjustment round counter; maxAdjustCount is the maximum adjustment round limit; and adjustBusLoadOk of 2 indicates an abnormal termination state.

[0064] Preferably, maxAdjustCount is set to 200 times. With the load detection timer's trigger period durationTime configured to be 200 milliseconds, the total time for performing 200 adjustments is approximately 40 seconds. This duration is sufficient to cover the convergence time of most normal adjustment scenarios (usually completed within 10 to 20 seconds), while also being able to detect abnormal situations and terminate the adjustment process within a reasonable time.

[0065] This mechanism, by introducing a round counter and a maximum round limit, enables effective monitoring of the execution time of the adjustment process. It can promptly terminate script execution and output alarm information in abnormal situations where the adjustment cannot converge, preventing the script from getting stuck in an infinite loop and ensuring the robustness and maintainability of the test system.

[0066] The above technical solution realizes the logic for determining the completion of adjustment, avoiding resource waste and unnecessary oscillations caused by continuing adjustment after the load rate has reached the target range, and improving the stability and efficiency of adjustment.

[0067] S5: Based on the sign of the difference, adjust the sending period parameters of multiple test messages simultaneously to obtain the adjusted sending period parameters; In this embodiment, the step includes the following sub-steps: S501: Calculate the adaptive adjustment step size. Based on the absolute value of the difference delta. Calculate the basic adjustment step size step, using the following formula:

[0068] in, Adjust the step size based on the baseline; The absolute value of the difference; This is a rounding function; To maximize the function, ensure that the minimum value of step is not less than 1.

[0069] This formula indicates that when abs_delta is large, step is also large, enabling fast adjustment with large step size; when abs_delta is small, step is also small, enabling fine adjustment with small step size.

[0070] Preferably, when When it is 10%, milliseconds; when When it is 1.5%, millisecond.

[0071] S502: Calculate the step size for adjusting the priority of high-priority and low-priority messages. Divide the eight test messages (msg1 to msg8) into two groups according to their priority: the high-priority message group includes msg1, msg2, msg3, and msg4, and the low-priority message group includes msg5, msg6, msg7, and msg8.

[0072] Calculate the adjustment step size for high-priority messages The calculation formula is:

[0073] in, Adjustment step size for high-priority messages; Adjust the step size based on the baseline; This is a rounding function; To ensure the maximum value function, The minimum value is not less than 1.

[0074] Calculate the adjustment step size for low-priority messages The calculation formula is:

[0075] in, Adjustment step size for low-priority messages; Adjust the step size based on the baseline.

[0076] Preferably, when step is 5 milliseconds, millisecond, milliseconds; when step is 1 millisecond, millisecond, millisecond.

[0077] Furthermore, the specific criteria for distinguishing between high-priority and low-priority messages include: Based on the first criterion, the priority is determined by the CAN protocol arbitration rules. According to the CAN protocol arbitration mechanism, messages with smaller CAN ID values ​​have higher priority during bus arbitration, and their real-time transmission requirements are also higher. In actual vehicle networks, critical safety messages such as powertrain control messages and braking system messages are usually assigned smaller CAN IDs to ensure they can obtain priority transmission rights when the bus is congested. Therefore, this invention classifies messages with smaller CAN ID values ​​(msg1 to msg4) into a high-priority message group, and messages with larger CAN ID values ​​(msg5 to msg8) into a low-priority message group. Specifically, in step S1, when configuring message IDs through the Panel, if the user assigns IDs ranging from 0x100 to 0x1FF to msg1 to msg4, and IDs ranging from 0x200 to 0x2FF to msg5 to msg8, then msg1 to msg4 are automatically assigned to the high-priority group.

[0078] Based on the second criterion, the classification is based on user-manual annotation. Considering that different test scenarios may have different definitions of message priority, this invention adds a priority annotation control to the Panel, allowing users to manually assign high or low priority labels to each message via drop-down menus or checkboxes while configuring the message ID. The CAPL script dynamically adjusts the priority group to which each message belongs by reading the priority annotation values ​​in the Panel to adapt to the needs of different test scenarios. For example, users can label msg1, msg3, msg5, and msg7 as high priority and msg2, msg4, msg6, and msg8 as low priority; the script will then regroup accordingly and apply the corresponding adjustment step size.

[0079] High-priority messages use a smaller step size Fine-tuning is performed to minimize variations in the transmission period, preventing significant fluctuations in the period of critical messages from impacting the real-time response performance of the DUT and ensuring the communication stability of high-priority messages; low-priority messages use larger step sizes. Coarse-grained adjustment allows for greater variation in the transmission cycle, enabling rapid shifts in the overall bus load rate towards the target value and accelerating adjustment convergence. By employing differentiated adjustment strategies for messages of different priorities, the adjustment speed is maintained while ensuring the communication quality of critical messages.

[0080] Preferably, when using criterion one for segmentation, the ID range for high-priority messages is 0x000 to 0x1FF, and the ID range for low-priority messages is 0x200 to 0x7FF. When using criterion two for segmentation, the priority labeling control in the Panel will by default label msg1 to msg4 as high priority and msg5 to msg8 as low priority; users can modify the labeling according to their actual needs.

[0081] By clarifying the criteria for priority division and implementing tiered differentiated adjustments, the periodic jitter of high-priority messages is effectively reduced while ensuring adjustment speed, thereby improving the stability of critical message communication and making the adjustment process more in line with the actual communication characteristics of vehicle networks.

[0082] S503: Perform feedforward compensation. Define variables. This is used to store the difference from the previous sampling period, with an initial value set to 0. The current difference is calculated after each execution of step S3. Difference from the previous time The amount of change between:

[0083] in, The change in the difference; This represents the difference between the current sampling periods; This is the difference between the previous sampling period and the previous one.

[0084] according to The positive or negative sign indicates the trend of load change. When When the absolute value of the load exceeds a preset threshold, the load change trend is considered significant, requiring feedforward compensation. and A preset threshold indicates that the actual load rate is consistently lower than the target load rate and the deviation is widening. Based on the current adjustment, the cycle parameter is further reduced, with a compensation amount of [amount missing]. or 50%. like and <- Preset threshold indicates that the actual load rate is consistently higher than the target load rate and the deviation is widening. An additional period parameter is added to the current adjustment, with a compensation amount of [amount missing]. or 50%. Update after each adjustment. .

[0085] Preferably, the preset threshold for feedforward compensation is set to 0.5%.

[0086] S504: Execute cycle parameter adjustment. Determine the sign of the difference delta. If delta > 0, it indicates that the actual load rate is lower than the target load rate, and the load needs to be increased, i.e., the message sending cycle needs to be shortened, and high-priority messages will be decremented. Decrease the priority of low-priority messages. If delta < 0, it indicates that the actual load rate is higher than the target load rate, and the load needs to be reduced, i.e., the message sending period needs to be extended, and auto-incrementing is performed on high-priority messages. Perform auto-increment on low-priority messages. .

[0087] S505: Execution cycle boundary protection. For the adjusted... to A total of 8 periodic parameters are checked for boundary conditions one by one. For each periodic parameter, it is determined whether it is less than... If it is less than, then the period parameter will be forcibly set to... .

[0088] Through the above five sub-steps, the periodic adjustment process based on hierarchical adaptive step size, feedforward compensation, and boundary protection is completed.

[0089] S6: The message sending timer periodically sends multiple test messages to the CAN bus according to the adjusted sending period parameters; S7: Repeat the above steps of obtaining the current actual load rate of the CAN bus, calculating the difference, judging the threshold, adjusting the transmission cycle parameters, and sending test messages to form a closed-loop feedback adjustment until the adjustment completion flag is set to the completion state.

[0090] In this embodiment, a timer event response function `on timer msCycleSend` is defined in the CAPL script. This function is triggered when the message transmission timer `msCycleSend` times out. Within this function, `output(msg1)` through `output(msg8)` are called sequentially to send eight test messages to the CAN bus. After each message is sent, the timer is reset according to its corresponding period parameter.

[0091] Since the period parameter of each message has been dynamically adjusted in step S5, the actual transmission frequency of each message also changes accordingly, thereby changing the amount of data transmitted on the CAN bus per unit time, and thus changing the bus load rate. Figure 2 As shown.

[0092] As a preferred embodiment of the present invention, a multi-channel expansion mechanism is also provided to support load rate testing of multiple CAN network segments. The schemes in the above embodiments default to monitoring and adjusting the load rate of a single CAN channel (can1). In actual vehicle network testing, the vehicle communication system typically includes multiple CAN network segments, each corresponding to a different CAN channel interface of the test platform. To achieve load rate testing of different network segments, traditional methods require writing independent scripts for each channel, resulting in a large workload for script maintenance and poor versatility.

[0093] This invention enables dynamic switching of multiple CAN channels by a single script through the introduction of the channel index variable `channelIndex`. Specifically, in the variable declaration section of the CAPL script, the environment variable `channelIndex` is defined to store the target channel number, with an integer data type. A channel selection control (such as a drop-down menu or a numeric input box) is added to the CANoe Panel, allowing the user to select the target channel number before starting the script. For example, entering 1 selects channel CAN1, entering 2 selects channel CAN2, and so on.

[0094] In the load detection process of step S3, the script dynamically selects the BusLoad variable of the corresponding channel based on the value of channelIndex using conditional branch statements. Specifically, if channelIndex equals 1, it accesses can1.BusLoad; if channelIndex equals 2, it accesses can2.BusLoad; if channelIndex equals 3, it accesses can3.BusLoad; and if channelIndex equals 4, it accesses can4.BusLoad. The obtained load rate value is then used for multiple sampling average calculations. In the message sending process of step S6, the message is also routed to the corresponding CAN channel based on channelIndex during message sending. Message routing is achieved by specifying the target channel parameter in the output function.

[0095] Preferably, the value of channelIndex is in the range of 1 to 4, corresponding to the maximum of 4 CAN channels supported by the VN5600 interface device. The default value of the channel selection control in the Panel is set to 1, that is, the CAN1 channel is selected by default.

[0096] This mechanism introduces channel index variables and enables dynamic channel switching, allowing the same script to be reused for load rate testing on different CAN network segments. This significantly improves the script's versatility and maintainability, reduces repetitive development work, and expands the engineering application scope of the present invention.

[0097] When adjustBusLoadOk is in an incomplete state, steps S3 to S6 are repeated to form a closed-loop feedback control. This cycle continues until the actual load rate stabilizes within the allowable deviation range of the target load rate, at which point the adjustment process ends.

[0098] The adaptive step size adjustment mechanism improves adjustment speed and accuracy; the hierarchical differentiated adjustment mechanism reduces the periodic jitter of high-priority messages; the feedforward compensation mechanism reduces overshoot and shortens adjustment stabilization time; the periodic boundary protection mechanism prevents bus congestion and ensures stable system operation; the multiple sampling and averaging mechanism reduces the standard deviation of sampling noise, making adjustment decisions more accurate; the priority hierarchical division mechanism further enhances the stability of critical message communication; the multi-channel expansion mechanism allows a single script to be reused on multiple CAN network segments, significantly improving engineering versatility; the adjustment timeout anomaly protection mechanism prevents the script from getting stuck in an infinite loop, ensuring the robustness of the test system; and the entire adjustment process is fully automated, improving test efficiency.

[0099] To address the pain points of existing technologies, an automated solution based on the CAPL (Communication Access Programming Language) scripting language is proposed. This solution leverages the mature CANoe testing platform and VN5600 series hardware to build an intelligent scripting system capable of real-time monitoring of CAN network segment load rates and dynamic closed-loop adjustment. This technology represents a leap from "passive manual intervention" to "active automatic control," significantly improving testing efficiency and accuracy, and possesses significant engineering application value.

[0100] This mechanism completely eliminates the heavy reliance on manual operation in traditional testing. Its main innovations are reflected in the following four aspects: 1. Automated load monitoring and feedback adjustment mechanism The script uses the built-in can1.BusLoad variable in CANoe to obtain the current bus load percentage of the CAN channel in real time and compares it with the user-preset target value (expBusLoad). Once the deviation exceeds the set threshold (e.g., ±1%), the system immediately starts the adjustment logic, dynamically adjusting the sending period of multiple test messages to form a complete negative feedback control system, ensuring that the load quickly converges to the target range.

[0101] 2. Multi-message coordinated adjustment strategy The system supports the simultaneous management of up to eight independent test messages (msg1 to msg8), each of which can be configured with an initial ID and sending period. During the adjustment process, all messages participate synchronously in the period increment / decrement calculation, avoiding the nonlinear response and oscillation risks associated with adjusting based on a single message. This multi-channel collaborative mechanism greatly enhances the smoothness and robustness of the adjustment.

[0102] 3. High integration and ease of use design All key parameters (such as target load rate, test duration, and message IDs) are configured graphically through CANoe's Panel. Users do not need programming knowledge; they can simply enter the parameters on the interface and click the start button to run the script, truly achieving a "zero-code" operation experience. This greatly lowers the barrier to entry and makes it suitable for all types of test engineers to get started quickly.

[0103] 4. Highly efficient and stable execution logic The script employs the timer event-driven model (on timer) in the CAPL language to achieve precise time control. The load detection timer msBusLoad triggers a load detection and adjustment action every durationTime. This trigger interval ensures that after each adjustment, the bus load rate has sufficient time to tend towards a new steady state before the next sampling and judgment, thereby guaranteeing stable convergence of closed-loop control and avoiding erroneous adjustment decisions based on transient data due to overly frequent sampling. Furthermore, this scheme uses a feedforward compensation mechanism to perform pre-emptive compensation adjustments based on load change trends, further suppressing overshoot and improving the overall stability and reliability of the adjustment.

[0104] In summary, the entire process of this invention requires no manual intervention and is completed autonomously by the script, truly achieving "one-click" high-load testing. This technology breaks through the limitations of traditional testing methods in terms of efficiency, accuracy, and consistency, and constructs a new load testing mode with high automation, high precision, and high repeatability. It is particularly suitable for key scenarios such as ECU function verification, vehicle durability testing, and communication bottleneck analysis.

[0105] Example 2 This embodiment discloses a CAN bus load rate dynamic adjustment system based on CAPL scripts, including: The data acquisition module is configured to acquire the target load rate parameters and test messages input by the user. The script startup module is configured to: respond to the button trigger command, initialize the test message sending cycle parameters, set the adjustment completion flag to the incomplete state, and start the load detection timer and message sending timer; The difference calculation module is configured to periodically trigger the load detection and adjustment process by the load detection timer, obtain the current actual load rate of the CAN bus, and calculate the difference between the current actual load rate and the target load rate parameter. The difference judgment module is configured to: determine whether the absolute value of the difference exceeds the load difference judgment threshold; if it does not exceed the threshold, set the adjustment completion flag to the completion state and stop the load detection timer; if it exceeds the threshold, continue to the next step. The parameter adjustment module is configured to adjust the sending period parameters of multiple test messages simultaneously based on the sign of the difference, so as to obtain the adjusted sending period parameters. The message test module is configured to periodically send multiple test messages to the CAN bus according to the adjusted transmission period parameters using a message transmission timer. The closed-loop feedback module is configured to repeat the steps described above: obtaining the current actual load rate of the CAN bus, calculating the difference, judging the threshold, adjusting the transmission cycle parameters, and sending test messages to form a closed-loop feedback adjustment until the adjustment completion flag is set to the completion state.

[0106] Example 3 The purpose of this embodiment is to provide a computing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method of Embodiment 1.

[0107] Example 4 The purpose of this embodiment is to provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the steps of the method of Embodiment 1.

[0108] The steps and methods involved in the apparatuses of Embodiments 3 and 4 above correspond to those in Embodiment 1. For specific implementation details, please refer to the relevant description section of Embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood as including any medium capable of storing, encoding, or carrying an instruction set for execution by a processor and enabling the processor to perform any of the methods in this invention.

[0109] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computer devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computer device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. The present invention is not limited to any particular combination of hardware and software.

[0110] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

[0111] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.

Claims

1. A method for dynamic adjustment of CAN bus load rate based on CAPL script, characterized in that, include: Obtain the target load rate parameters and test messages input by the user; In response to the button trigger command, initialize the test message sending cycle parameters, set the adjustment completion flag to the incomplete state, and start the load detection timer and message sending timer; The load detection and adjustment process is periodically triggered by the load detection timer to obtain the current actual load rate of the CAN bus and calculate the difference between the current actual load rate and the target load rate parameter. Determine if the absolute value of the difference exceeds the load difference judgment threshold. If it does not exceed the threshold, set the adjustment completion flag to the completed state and stop the load detection timer. If it exceeds the threshold, continue to the next step. Based on the sign of the difference, the sending period parameters of multiple test messages are adjusted simultaneously to obtain the adjusted sending period parameters; The message sending timer periodically sends multiple test messages to the CAN bus according to the adjusted sending period parameters; Repeat the above steps of obtaining the current actual load rate of the CAN bus, calculating the difference, judging the threshold, adjusting the transmission cycle parameters, and sending test messages to form a closed-loop feedback adjustment until the adjustment completion flag is set to the completion state.

2. The method for dynamic adjustment of CAN bus load rate based on CAPL script as described in claim 1, characterized in that, In the variable declaration section of the CAPL script, define environment variables to store the target load rate parameter and the detection cycle parameter, and define system variables to store the adjustment completion flag and the test message sending cycle parameter.

3. The method for dynamic adjustment of CAN bus load rate based on CAPL script as described in claim 1, characterized in that, The button trigger instruction is specifically defined as follows: a system variable event response function is defined in the CAPL script, and when the user clicks the button, the system variable event response function is triggered to execute.

4. The method for dynamic adjustment of CAN bus load rate based on CAPL script as described in claim 1, characterized in that, When obtaining the current actual load rate of the CAN bus, the sampling noise is suppressed by taking multiple samples and averaging them.

5. The method for dynamic adjustment of CAN bus load rate based on CAPL script as described in claim 1, characterized in that, An adjustment timeout protection mechanism is also set up, which is as follows: an adjustment round counter is introduced, which increments by 1 each time a periodic adjustment operation is performed; it is determined whether the value of the adjustment round counter exceeds the maximum adjustment round limit. If the absolute value of the difference exceeds the load difference judgment threshold and the value of the adjustment round counter exceeds the maximum adjustment round limit, the timeout protection mechanism is triggered, the load detection timer and the message sending timer are stopped, and an alarm message is output.

6. The method for dynamic adjustment of CAN bus load rate based on CAPL script as described in claim 1, characterized in that, Based on the sign of the difference, the sending period parameters of multiple test messages are adjusted simultaneously, specifically including: The basic adjustment step size is calculated based on the absolute value of the difference. Based on the basic adjustment step size, the adjustment step size for high-priority messages and the adjustment step size for low-priority messages are calculated separately. Determine the sign of the difference. If the difference is greater than 0, shorten the message transmission period of high-priority and low-priority messages by their corresponding adjustment step size. If the difference is less than 0, extend the message transmission period of high-priority and low-priority messages by their corresponding adjustment step size.

7. The method for dynamic adjustment of CAN bus load rate based on CAPL script as described in claim 6, characterized in that, When adjusting the sending period parameters of the test message, the change between the current difference and the previous difference is also calculated. Feedforward compensation is performed when the absolute value of the change is greater than the preset threshold.

8. A CAN bus load rate dynamic adjustment system based on CAPL script, characterized in that, include: The data acquisition module is configured to acquire the target load rate parameters and test messages input by the user. The script startup module is configured to: respond to the button trigger command, initialize the test message sending cycle parameters, set the adjustment completion flag to the incomplete state, and start the load detection timer and message sending timer; The difference calculation module is configured to periodically trigger the load detection and adjustment process by the load detection timer, obtain the current actual load rate of the CAN bus, and calculate the difference between the current actual load rate and the target load rate parameter. The difference judgment module is configured to: determine whether the absolute value of the difference exceeds the load difference judgment threshold; if it does not exceed the threshold, set the adjustment completion flag to the completion state and stop the load detection timer; if it exceeds the threshold, continue to the next step. The parameter adjustment module is configured to adjust the sending period parameters of multiple test messages simultaneously based on the sign of the difference, so as to obtain the adjusted sending period parameters. The message test module is configured to periodically send multiple test messages to the CAN bus according to the adjusted transmission period parameters using a message transmission timer. The closed-loop feedback module is configured to repeat the steps described above: obtaining the current actual load rate of the CAN bus, calculating the difference, judging the threshold, adjusting the transmission cycle parameters, and sending test messages to form a closed-loop feedback adjustment until the adjustment completion flag is set to the completion state.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps in the CAN bus load rate dynamic adjustment method based on CAPL script as described in any one of claims 1-7.

10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps in the CAN bus load rate dynamic adjustment method based on CAPL script as described in any one of claims 1-7.