New energy controller embedded software time performance automatic test system and method
By adopting the pipetting technology based on operating system task scheduling in the new energy controller, a closed-loop control system of the whole vehicle is formed, which solves the problems of incomplete testing and difficulty in automation in the existing technology, and realizes a comprehensive monitoring of the time performance of embedded software and automated testing ensures the correctness and security of task execution.
Patent Information
- Application Number
- CN202411128757.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-12-31
AI Technical Summary
The existing embedded software time performance testing methods require manual preparation of operating condition excitation data, which cannot effectively simulate the driving scenario of the vehicle, and the test script is difficult to reuse, resulting in incomplete testing and difficult automation.
Using the stake technology based on operating system task scheduling, the vehicle closed-loop control system is formed through hardware-in-ring cabinets and the tested embedded software controller. The cycle operation script and monitoring data storage script are written in Python language to automatically simulate the vehicle. Driving scenarios, monitor task execution time and scheduling cycles, generate test reports, and realize the reuse and automation of test scripts.
A comprehensive test of the time performance of the embedded software of the new energy controller is realized, ensuring the rationality of the task execution time and scheduling cycle, avoiding error execution caused by overload or timing errors, and the test script can be reused and has a high degree of automation. .
Smart Images

Figure CN119226141A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of new energy controller embedded software testing, and in particular to a new energy controller embedded software time performance automatic testing system and method. Background Art
[0002] Embedded software is widely used in various fields. Although it has many advantages, it also has disadvantages such as poor software observability and difficulty in exposing faults. A large number of test equipment, test software and test methods are needed for verification to ensure the quality of embedded software.
[0003] For example, in the field of new energy vehicles, new energy electronic control software functions are increasing, and real-time requirements are high. Therefore, it is very important to monitor and test the embedded software tasks of new energy controllers to ensure that tasks are executed at the correct time and in the correct order, and to avoid erroneous execution results caused by program running away due to overload or task timing errors, and data reading and writing being out of sync.
[0004] There are many testing methods for the timing performance of embedded software, but there are some shortcomings. For example, some methods require manual preparation of working condition stimulus data, which cannot effectively simulate the whole vehicle driving scenario, resulting in incomplete test conditions; some are based on function entry and exit stubbing, which is not convenient for reuse of test scripts. Summary of the invention
[0005] The present invention provides a new energy controller embedded software time performance automatic testing system and method. The present invention is based on operating system task scheduling plugging, avoiding the need for manual re-plugging after code modification, and truly realizing the reuse of test scripts and test automation.
[0006] The technical solutions to the above problems are as follows:
[0007] New energy controller embedded software time performance automatic test system, including host computer, hardware-in-the-loop cabinet, embedded software controller under test, and debugger;
[0008] The host computer is connected to the hardware-in-the-loop cabinet;
[0009] The host computer is connected to the debugger;
[0010] The hardware-in-the-loop cabinet is connected to the embedded software controller under test;
[0011] The debugger is connected to the embedded software controller under test;
[0012] The host computer includes embedded software compilation tools, debugging software, test management software, and automatic testing software;
[0013] The automatic test software includes a cycle condition operation script and an embedded software monitoring data storage and analysis script;
[0014] The cycle operating script is programmed in Python, accesses the hardware-in-the-loop cabinet vehicle dynamics model parameters through the test management software API interface, and controls the tested embedded software controller to operate under the cycle operating condition;
[0015] The embedded software monitoring data storage and analysis script is based on Python programming. By accessing the debugging software API, it monitors the operation of the embedded software and stores process data. It performs statistical analysis on the cycle process data to obtain the maximum, minimum and average values of the execution time, scheduling cycle and load rate of each task of the embedded software, and compares them with the expected results, outputs a test report, and implements the test of the time performance of the embedded software of the tested new energy controller.
[0016] The software compilation tool completes the compilation of the embedded software and the plug-in test script to generate executable code;
[0017] The debugger downloads the executable code generated by the software compilation tool to the controller under test and monitors the program running process.
[0018] Furthermore, the host computer is connected to the hardware-in-the-loop cabinet via Ethernet;
[0019] The host computer is connected to the debugger via USB;
[0020] The hardware-in-the-loop cabinet is connected to the embedded software controller under test via a connector and a Phoenix terminal;
[0021] The debugger is connected to the embedded software controller under test via a DAP interface and an I2C interface harness.
[0022] Furthermore, the stub test script includes using the controller's idle GPIO to simulate the I2C protocol, a driver script for stub data transmission to a host computer, and task scheduling based on an operating system.
[0023] Furthermore, the cyclic working condition running script accesses the test management software API to modify the vehicle dynamics model parameters, environmental parameters, and road parameters running in the hardware-in-the-loop cabinet, so that the embedded software can run in different vehicle driving scenarios such as high and low voltage power on and off, mode jump, low speed, high speed, low load, high load, climbing, flat road, and fault.
[0024] Furthermore, the embedded software monitors the data storage and analysis script, and performs statistics on the execution time, scheduling cycle, and load rate of the task for the feedback pile data including the pile name and pile timestamp information related to the task, and obtains the maximum, minimum, and average values; compares the test data with the expected results, outputs the judgment results, and prints a report.
[0025] Further, the following steps are included:
[0026] S1, write the stub test script based on the operating system task scheduling and the driver script for stub data transmission;
[0027] S2, compile the embedded software including the stub test script through the compilation tool chain, generate an executable file, and download the executable file to the controller through the debugger DAP interface;
[0028] S3, run the cycle condition running script;
[0029] S4, stop the cycle condition and run the test data analysis script;
[0030] S5, output the embedded software time performance test report to check whether the test is passed. If it is passed, the test is terminated. If it is not passed, enter S6;
[0031] S6, modify the embedded software, optimize the task for the overloaded task, or adjust and optimize the task scheduling cycle, and enter S2 for retesting.
[0032] The present invention adopts hardware-in-the-loop and the embedded software controller under test to form a closed-loop control system of the whole vehicle to simulate the driving scenario of the whole vehicle. The test conditions can ensure complete coverage and avoid the disadvantage that dangerous fault conditions cannot be covered in the real vehicle. The present invention is based on the task scheduling of the operating system to avoid the need for manual re-insertion after code modification, thereby truly realizing the reuse of test scripts and test automation.
[0033] The embedded software time performance test system of the present invention can realize the monitoring and testing of embedded software task execution time, task scheduling cycle, and load rate under relatively comprehensive working conditions, and the test scripts can be reused and the test is automated, ensuring that the rationality of task design and task scheduling sequence is fully verified. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 This is a schematic diagram of the structure of the embedded software time performance test system.
[0035] Figure 2 A time performance testing method for embedded software. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme in the embodiment of the present invention is described in more detail below in conjunction with the drawings in the embodiment of the present invention. The described embodiments are part of the embodiments of the present invention, not all of the embodiments. The embodiments described below with reference to the drawings are exemplary and are intended to be used to explain the present invention, and cannot be simply understood as limitations on the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present invention.
[0037] like Figure 1 The automatic test system for the time performance of embedded software of the new energy controller of the present invention comprises a host computer, a hardware-in-the-loop cabinet, an embedded software controller to be tested, and a debugger; the host computer is connected to the hardware-in-the-loop cabinet; the host computer and the hardware-in-the-loop cabinet are connected via Ethernet; the host computer is connected to the debugger, and the host computer and the debugger are connected via USB. The hardware-in-the-loop cabinet is connected to the embedded software controller to be tested; the hardware-in-the-loop cabinet and the embedded software controller to be tested are connected via a connector, and are connected via a connector and a Phoenix terminal. The debugger is connected to the embedded software controller under test; the debugger and the embedded software controller under test are connected through a DAP interface (providing debugging, testing and programming access rights to the inside of the target device, allowing developers to communicate with the target device through debugging tools and perform a series of debugging operations), an I2C interface (I2C (Inter-Integrated Circuit) is a two-wire serial communication bus developed by PHILIPS, using a multi-master-slave architecture, for connecting a microcontroller and its peripheral low-speed devices. It is a bus standard widely used in the field of microelectronic communication control. It is a special form of synchronous communication, with the advantages of fewer interface lines, simple control method, small device packaging, and higher communication rate) wiring harness.
[0038] The host computer includes embedded software compilation tools, debugging software, test management software, and automatic testing software; the automatic testing software contains a cyclic working condition operation script and an embedded software monitoring data storage and analysis script; the cyclic working condition operation script is programmed based on the Python language, and accesses the hardware-in-the-loop cabinet vehicle dynamics model parameters through the test management software API interface (application programming interface) to control the embedded software controller under test to operate under cyclic working conditions.
[0039] The embedded software monitoring data storage and analysis script is based on Python language programming. By accessing the debugging software API (API is a software middleware that allows communication and data exchange between different applications or software components), it monitors the operation of the embedded software and stores process data. It performs statistical analysis on the cyclic working condition process data to obtain the maximum, minimum and average values of the execution time, scheduling cycle, load rate, etc. of each task of the embedded software, and compares them with the expected results, outputs a test report, and realizes the test of the time performance of the embedded software of the tested new energy controller.
[0040] The software compilation tool completes the compilation of embedded software and plug-in test scripts to generate executable code. The debugger completes downloading the executable code generated by the software compilation tool to the controller under test and monitors the program running process.
[0041] The test system monitors and tests the time performance of embedded software tasks, such as execution time, scheduling cycle, load rate, etc., in various driving scenarios to ensure that the software task execution time and timing meet expectations, and avoid program runaway, data read and write timing errors, etc. due to overload or timing errors.
[0042] The stub test script includes using the controller's idle GPIO (general purpose input and output) to simulate the I2C protocol, a driver script for transmitting stub data to a host computer, and task scheduling based on the operating system.
[0043] The cyclic working condition running script accesses the test management software API to modify the vehicle dynamics model parameters, environmental parameters, and road parameters running in the hardware-in-the-loop cabinet, so that the embedded software can run in different vehicle driving scenarios such as high and low voltage power on and off, mode jump, low speed, high speed, low load, high load, climbing, flat road, and fault.
[0044] The embedded software monitors the data storage and analysis script, and performs statistics on the execution time, scheduling cycle, and load rate of the task for the feedback pile data including the pile name and pile timestamp information related to the task, and obtains the maximum, minimum, and average values; compares the test data with the expected results, outputs the judgment results, and prints a report.
[0045] like Figure 2 As shown, the automatic testing method for time performance of embedded software of new energy controller of the present invention includes the above-mentioned testing system and comprises the following steps:
[0046] S1, write the stub test script based on the operating system task scheduling and the driver script for stub data transmission;
[0047] S2, compile the embedded software including the stub test script through the compilation tool chain, generate an executable file, and download the executable file to the controller through the debugger DAP interface;
[0048] S3, run the cycle condition running script;
[0049] S4, stop the cycle condition and run the test data analysis script;
[0050] S5, output the embedded software time performance test report to check whether the test is passed. If it is passed, the test is terminated. If it is not passed, enter S6;
[0051] S6, modify the embedded software, optimize the task for the overloaded task, or adjust and optimize the task scheduling cycle, and enter S2 for retesting.
[0052] The present invention forms a simulated vehicle dynamics closed-loop control system with a hardware-in-the-loop cabinet and an embedded software controller under test, runs an upper computer automatic test script to make the vehicle run under a cyclic working condition, and monitors the running status of each task of the embedded software under different working conditions through a debugger, automatically statistically analyzes the test data, obtains the maximum, minimum, average and other time performance of each task execution time, scheduling cycle, load rate, etc., automatically compares them with the expected results, and outputs a test report.
Claims
1. New energy controller embedded software time performance automatic test system, characterized by: Includes host computer, hardware-in-the-loop cabinet, embedded software controller under test, and debugger; The host computer is connected to the hardware-in-the-loop cabinet; The host computer is connected with the debugger; The hardware-in-the-loop cabinet is connected to the embedded software controller under test; The debugger is connected to the embedded software controller under test; The host computer includes embedded software compilation tools, debugging software, test management software, and automatic testing software; The automatic test software includes a cycle condition operation script and an embedded software monitoring data storage and analysis script; The cycle operating script is programmed in Python, accesses the hardware-in-the-loop cabinet vehicle dynamics model parameters through the test management software API interface, and controls the tested embedded software controller to operate under the cycle operating condition; The embedded software monitoring data storage and analysis script is based on Python programming. By accessing the debugging software API, it monitors the operation of the embedded software and stores process data. It performs statistical analysis on the cycle process data to obtain the maximum, minimum and average values of the execution time, scheduling cycle and load rate of each task of the embedded software, and compares them with the expected results, outputs a test report, and implements the test of the time performance of the embedded software of the tested new energy controller. The software compilation tool completes the compilation of embedded software and plug-in test scripts to generate executable code; The debugger downloads the executable code generated by the software compilation tool to the controller under test and monitors the program running process.
2. The automatic time performance test system for embedded software of new energy controller according to claim 1 is characterized in that: The stub test script includes using the controller's idle GPIO to simulate the I2C protocol, a driver script for transmitting stub data to a host computer, and task scheduling based on the operating system.
3. The automatic time performance test system for embedded software of new energy controller according to claim 1 is characterized in that: The cyclic working condition running script accesses the test management software API to modify the vehicle dynamics model parameters, environmental parameters, and road parameters running in the hardware-in-the-loop cabinet, so that the embedded software can run in different vehicle driving scenarios such as high and low voltage power on and off, mode jump, low speed, high speed, low load, high load, climbing, flat road, and fault.
4. The automatic time performance test system for embedded software of new energy controller according to claim 1 is characterized in that: The embedded software monitors the data storage and analysis script, and performs statistics on the execution time, scheduling cycle, and load rate of the task for the feedback pile data including the pile name and pile timestamp information related to the task, and obtains the maximum, minimum, and average values; compares the test data with the expected results, outputs the judgment results, and prints a report.
5. A method for automatically testing the time performance of embedded software of a new energy controller, comprising a test system according to any one of claims 1 to 4, characterized in that: The following steps are involved: S1, write the stub test script based on the operating system task scheduling and the driver script for stub data transmission; S2, compile the embedded software including the stub test script through the compilation tool chain, generate an executable file, and download the executable file to the controller through the debugger DAP interface; S3, run the cycle condition running script; S4, stop the cycle condition and run the test data analysis script; S5, output the embedded software time performance test report to check whether the test is passed. If it is passed, the test is terminated. If it is not passed, enter S6; S6, modify the embedded software, optimize the task for the overloaded task, or adjust and optimize the task scheduling cycle, and enter S2 for retesting.
