Automatic verification method and device for controller, storage medium and electronic equipment

By building an automated operating environment in the automotive industry, obtaining test cases and generating test scripts, and performing automated testing, the problems of high cost and low efficiency in the controller verification process in the existing technology are solved, and more efficient testing and shortened development cycles are achieved.

CN120066952APending Publication Date: 2025-05-30BEIJING CAVAN NEW ENERGY AUTOMOTIVE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411999448.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

In the automotive industry, during the verification process of controllers, the existing technology relies on HIL testing and actual vehicle testing, resulting in high purchase and maintenance costs, low testing efficiency and long development cycle.

Method used

A controller automation verification method is proposed. By building an automated operating environment, including communication networks, virtual controllers and simulation models, test cases are obtained and test scripts are generated, automated tests are performed and test reports are generated.

Benefits of technology

It reduces purchase and maintenance costs, improves testing efficiency, and effectively shortens the development cycle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066952A_ABST
    Figure CN120066952A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic verification method and device for a controller, a storage medium and electronic equipment, and the method comprises the steps: building an automatic operation environment which comprises a communication network, a virtual controller and a simulation model, and enabling the simulation model to cooperate with the virtual controller for testing; obtaining a test case, and generating a test script based on the test case; and loading the test script into the automatic operation environment to perform automatic test according to the test script, the communication network, the virtual controller and the simulation model, and generating a test report. According to the method, the acquisition cost and the maintenance cost can be reduced, the test efficiency is improved, and the development period is effectively shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of controllers, and in particular, to a method for automatic verification of a controller, a computer-readable storage medium, an electronic device, and a device for automatic verification of a controller. Background Art

[0002] With the continuous progress of technology and the rapid development of society, the automotive industry is also constantly innovating and improving. As an effective means of quality control, automated testing has gradually been widely applied in the automotive industry. Automated testing is a process of converting human-driven test behaviors into machine execution, that is, automatically executing tests by running test scripts compiled in programming languages.

[0003] The controller is a key component in a vehicle and requires complete and reliable testing. Currently, vehicle manufacturers mainly conduct verification through HIL (Hardware in the Loop) testing and on-vehicle testing. Against the backdrop of rapid updates to software requirements and frequent iterations of software versions, verifying only through HIL testing and on-vehicle testing requires an increase in test resources, resulting in high acquisition costs and labor costs, long procurement cycles and test deployment times, and low universality of test environments for different vehicle models and high maintenance costs. Summary of the Invention

[0004] This application aims to at least partly solve one of the technical problems in the related art. For this purpose, the first objective of this application is to propose a method for automatic verification of a controller, to build an automatic operation environment, where the automatic operation environment includes a communication network, a virtual controller, and a simulation model, to obtain test cases, and to generate test scripts based on the test cases, and to load the test scripts into the automatic operation environment to perform automatic testing according to the test scripts, the communication network, the virtual controller, and the simulation model, and to generate a test report. Thus, it is possible to reduce acquisition costs and maintenance costs, improve test efficiency, and effectively shorten the development cycle.

[0005] The second objective of this application is to propose a computer-readable storage medium.

[0006] The third objective of this application is to propose an electronic device.

[0007] The fourth objective of this application is to propose a device for automatic verification of a controller.

[0008] To achieve the above object, an embodiment of the first aspect of the present application provides a method for automatic verification of a controller. The method includes: building an automatic operation environment, where the automatic operation environment includes a communication network, a virtual controller, and a simulation model; obtaining test cases, and generating test scripts based on the test cases; loading the test scripts into the automatic operation environment to perform automatic testing according to the test scripts, the communication network, the virtual controller, and the simulation model, and generating a test report.

[0009] According to the method for automatic verification of a controller in an embodiment of the present application, an automatic operation environment is built, where the automatic operation environment includes a communication network, a virtual controller, and a simulation model. Test cases are obtained, and test scripts are generated based on the test cases. The test scripts are loaded into the automatic operation environment to perform automatic testing according to the test scripts, the communication network, the virtual controller, and the simulation model, and a test report is generated. Thus, this method can reduce the purchase cost and maintenance cost, improve the test efficiency, and effectively shorten the development cycle.

[0010] In addition, the method for automatic verification of a controller according to the above embodiment of the present application may further have the following additional technical features:

[0011] According to an embodiment of the present application, the test cases are determined according to the target required functions. The test cases include multiple sub-functions, each sub-function includes an initialization environment, a cleaning environment, and multiple sub-test cases, and each sub-test case includes multiple sub-test steps.

[0012] According to an embodiment of the present application, the generating test scripts based on the test cases includes: determining the number of sub-functions of the test cases, and generating function codes corresponding to each sub-function based on the attribute information of the test cases; in the case where the number of sub-functions of the test cases is greater than or equal to two, splicing multiple function codes and integrating them into a main function to obtain target codes; converting the target codes into files in a target format to obtain the test scripts.

[0013] According to an embodiment of the present application, the attribute information of the test case includes: test case identification information, test case type information, detailed description of the test case, initialization and test steps of the test case, and expected results of the test case. Among them, the test case type information includes test module, sub-function, initialization environment, cleaning environment, test case, and test steps. Among them, when the type of the test case is a test module, the detailed description of the test case is the name of the test module; when the type of the test case is a sub-function, the detailed description of the test case is the sub-function name; when the type of the test case is a test case, the detailed description of the test case is the test case description; when the type of the test case is an initialization environment, the initialization of the test case is the initialization environment; when the type of the test case is a cleaning environment, the initialization of the test case is the initialization of the cleaning environment.

[0014] According to an embodiment of the present application, the generation of the test report includes: comparing the actual test results after automated testing with the expected results of the test case to generate a test report according to the comparison results.

[0015] According to an embodiment of the present application, the method further includes: building the simulation model based on the target requirement function and the simulation software, and determining the virtual controller based on the virtual simulation technology; wherein, the simulation model includes: an environment model, a physical model, and a controller model, wherein the environment model is used to simulate the environment in which the vehicle runs, the physical model is used to simulate the physical components of the vehicle, and the controller model is used to simulate various controllers of the vehicle.

[0016] According to an embodiment of the present application, the automated testing according to the test script, the communication network, the virtual controller, and the simulation model includes: sending the test cases in the test script to the simulation model based on the communication network, and sending the results after the corresponding functions in the test cases are executed to the virtual controller; after the virtual controller obtains the execution results, executing the corresponding functions based on the test cases in the test script, and sending the results after execution to the simulation model, so that the simulation model executes the corresponding functions and sends the execution results to the test script to complete the closed-loop automated testing.

[0017] To achieve the above object, an embodiment of the second aspect of the present application proposes a computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, the above-mentioned controller automated verification method is implemented.

[0018] A computer-readable storage medium according to an embodiment of the present application, when executed, implements the above-mentioned controller automation verification method, which can reduce the purchase cost and maintenance cost, improve the test efficiency, and effectively shorten the development cycle.

[0019] To achieve the above object, an electronic device according to an embodiment of the third aspect of the present application includes a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, the above-mentioned controller automation verification method is implemented.

[0020] An electronic device according to an embodiment of the present application, by executing the above-mentioned controller automation verification method, can reduce the purchase cost and maintenance cost, improve the test efficiency, and effectively shorten the development cycle.

[0021] To achieve the above object, a controller automation verification device according to an embodiment of the fourth aspect of the present application includes: a building module for building an automated operation environment, where the automated operation environment includes a communication network, a virtual controller, and a simulation model; an obtaining module for obtaining test cases and generating test scripts based on the test cases; and a verification module for integrally loading the test scripts into the automated operation environment to perform automated testing according to the test scripts, the communication network, the virtual controller, and the simulation model, and generating a test report.

[0022] For the controller automation verification device according to an embodiment of the present application, the building module is used to build an automated operation environment, where the automated operation environment includes a communication network, a virtual controller, and a simulation model, the obtaining module is used to obtain test cases and generate test scripts based on the test cases, and the verification module is used to integrally load the test scripts into the automated operation environment to perform automated testing according to the test scripts, the communication network, the virtual controller, and the simulation model, and generate a test report. Thus, the device can reduce the purchase cost and maintenance cost, improve the test efficiency, and effectively shorten the development cycle.

[0023] Additional aspects and advantages of the present application will be given in part in the following description, become apparent in part from the following description, or be learned through the practice of the present application. Description of the Drawings

[0024] Figure 1 It is a flowchart of the controller automation verification method according to an embodiment of the present application;

[0025] Figure 2 It is a flowchart of the controller automation verification method according to a specific example of the present application;

[0026] Figure 3A block diagram of an electronic device according to an embodiment of the present application;

[0027] Figure 4 A block diagram of a controller automation verification device according to an embodiment of the present application. Detailed implementation manners

[0028] The embodiments of the present application will be described in detail below. Examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to explain the present application, and should not be construed as limiting the present application.

[0029] The controller automation verification method, computer-readable storage medium, electronic device, and controller automation verification device proposed by the embodiments of the present application will be described below with reference to the accompanying drawings.

[0030] Figure 1 A flowchart of a controller automation verification method according to an embodiment of the present application.

[0031] As Figure 1 shown, the controller automation verification method of the embodiments of the present application may include the following steps:

[0032] S1. Build an automated operation environment, where the automated operation environment includes a communication network, a virtual controller, and a simulation model, and the simulation model is used to cooperate with the virtual controller for testing.

[0033] S2. Obtain test cases and generate test scripts based on the test cases.

[0034] S3. Load the test scripts into the automated operation environment to perform automated testing according to the test scripts, communication network, virtual controller, and simulation model, and generate a test report.

[0035] Specifically, first build an automated operation environment, which includes a communication network, a virtual controller, and a simulation model. Among them, a simulated communication network, such as a CAN (Controller Area Network) or LIN (Local Interconnect Network) network, can be constructed to simulate the physical communication bus in a vehicle, and network parameters, including network topology and nodes, can be configured. A virtual controller can be created using simulation tools or virtualization technology, which can simulate the functions and responses of a real controller. And integrate the simulation model, which is used to cooperate with the virtual controller for testing, such as including an environment model, a physical model, and a controller model, and these models will simulate the behavior of the controller and the system it controls during actual operation.

[0036] Obtain test cases. For example, according to the function specifications and requirements of the controller, test cases can be determined. Test cases can include test identifiers, types, descriptions, initialization conditions, test steps, and expected results. Corresponding test scripts can be generated based on the attribute information of the test cases themselves. For example, by importing test cases in excel format through a pre-developed small tool, test script code can be automatically generated to implement the test logic defined in the test cases.

[0037] After generating the test script, the test script can be loaded into the automated operation environment, that is, configure the test script to ensure that it can interact correctly with the communication network, virtual controller, and simulation model, so as to perform automated tests according to the test script, communication network, virtual controller, and simulation model, and generate a test report. That is to say, by executing the test script, different operations and conditions can be simulated, and the response of the controller can be monitored. The test script can send instructions to the simulation model or the virtual controller through the communication network according to the function of the test case, and collect the execution results. Thus, the actual test results can be compared with the expected results defined in the test case, and a test report can be generated according to the comparison results, recording the detailed execution situation of the test, including successful and failed test cases and any abnormal situations.

[0038] It should be noted that the construction of the automated operation environment is the foundation to ensure that the test can be carried out in a controlled environment simulating real conditions. The acquisition of test cases and the generation of test scripts are the core, which define the test content and verification logic to be executed. The loading of test scripts and the execution of automated tests are the implementation, using automated tools to execute tests and collect data. The generation of test reports is the output, providing a detailed record and analysis of the test results, helping the development team evaluate the performance and function of the controller, and guiding subsequent development and optimization work.

[0039] The whole process is iterative and continuous. The test results are fed back to the development team for improving the design and implementation of the controller, and then the test is executed again to verify the improvement. Thus, the efficiency and accuracy of the test can be improved, human errors are reduced, and the development and verification process of the controller is accelerated.

[0040] According to an embodiment of the present application, the test cases are determined according to the target required functions. The test cases include multiple sub-functions, each sub-function includes an initialization environment, a cleaning environment, and multiple sub-test cases, and each sub-test case includes multiple sub-test steps.

[0041] Specifically, the target requirement functions of the controller are determined based on the vehicle's design specifications and user requirements. These functions may include power control, safety features, driver assistance systems, etc. Test cases can be designed according to the target requirement functions, aiming to verify whether these functions work as expected, and the test cases can be edited through Excel. A test case may include an initialization environment, a cleaning environment, and multiple sub-functions, that is, each target requirement function can be divided into multiple sub-functions, and each sub-function represents a more specific functional module or component. For example, the power control function can be further divided into sub-functions such as engine control and transmission control. In the test module of the lighting system, the sub-functions may include "headlight control", "turn signal control", etc. Each sub-function is further decomposed into sub-test cases, which are designed to verify specific aspects or behaviors of the sub-function. For example, the sub-test cases for engine control may include start-up tests, idle tests, acceleration tests, etc. Also, for the sub-function of "headlight control", the sub-test cases may include "testing whether the headlights work properly in the night mode". Additionally, each sub-test case contains multiple sub-test steps, which describe in detail how to perform the test, including specific inputs, operations, and expected system responses. For example, the sub-test steps for the start-up test may include: Step 1: Turn the ignition switch to the start position, Step 2: Observe whether the engine starts, Step 3: Check whether the parameters after the engine starts are within the normal range.

[0042] According to an embodiment of the present application, generating a test script based on a test case includes: determining the number of sub-functions of the test case, and generating function codes corresponding to each sub-function based on the attribute information of the test case; in the case where the number of sub-functions of the test case is greater than or equal to two, splicing multiple function codes and integrating them into the main function to obtain the target code; converting the target code into a file in the target format to obtain the test script.

[0043] Specifically, when generating test scripts based on test cases, first, it is necessary to identify and determine the number of sub-functions included in each test case. These sub-functions are smaller and manageable parts within the test case, and they usually correspond to specific test objectives or scenarios. The attribute information of the test case, such as test steps and expected results, can be utilized to generate the code corresponding to each sub-function. Select a programming language or scripting language suitable for writing test scripts, such as CAPL (CAN Application Layer Protocol, which is a high-level programming language specifically used for writing test and diagnostic programs related to CAN (Controller Area Network) network communication), etc., and write code for each sub-function. This code can simulate the test steps defined in the test case and verify the expected results. Judge the number of sub-functions of the current test case. When the number of sub-functions of the test case is greater than or equal to two, multiple function codes can be concatenated. Each function code block can be designed as a module or function for easy management and reuse, and ensure that the logical relationship between each function code block is correct. For example, some test steps may depend on the output of the previous step.

[0044] Write a main function that only calls sub-test cases and can be called by grouping according to sub-functions. For example, the test case includes sub-function 1, sub-function 2, and sub-function 3. For different sub-functions, it can include initializing the environment, sub-test cases, and cleaning the environment. For example, for sub-function 1, it can include initializing the environment, sub-test case 1, sub-test case 2, sub-test case 3, and cleaning the environment. Each sub-test case can include multiple test steps, such as Step 1: Input, result comparison, Step 2: Input, result comparison, etc. Implement flow control logic in the main function, such as loops, conditional judgments, etc., to ensure that the test steps are executed in the correct order. After integrating all function codes into the main function, conduct code review to ensure the accuracy and integrity of the code to obtain the target code. Thus, the target code can be converted into a file in the target format to obtain the test script. For example, save the written code as a file in a specific format, such as writing the complete CAPL code into a.txt format file, and then convert the.txt format file into a.can format file corresponding to the CAPL script. The final obtained file is the test script, which can be directly run in the test environment. This test script can be executed in an automated test tool, such as CANoe, to simulate the test scenario and generate a test report. Thus, the test case is converted into an executable test script, and these scripts can automatically verify the functions and performance of the controller, improving the efficiency and accuracy of the test.

[0045] According to an embodiment of the present application, the attribute information of a test case includes: test case identification information, test case type information, detailed description of the test case, initialization and test steps of the test case, and expected results of the test case. Among them, the test case type information includes test module, sub-function, initialization environment, cleaning environment, test case, and test step. Among them, when the type of the test case is a test module, the detailed description of the test case is the name of the test module; when the type of the test case is a sub-function, the detailed description of the test case is the sub-function name; when the type of the test case is a test case, the detailed description of the test case is the test case description; when the type of the test case is an initialization environment, the initialization of the test case is the initialization environment; when the type of the test case is a cleaning environment, the initialization of the test case is the initialization cleaning environment.

[0046] Specifically, the attribute information of a test case may include test case identification information, that is, each test case has a unique identifier, usually a number or a name, which is used for quick identification and reference in test management and reporting. The identification information helps the test team manage and track test cases, especially in large projects with hundreds or thousands of test cases. The attribute information of a test case may also include the type of the test case. The test case type information defines which category the test case belongs to, such as test module, sub-function, initialization environment, cleaning environment, test case, and test step.

[0047] The attribute information of a test case may also include a detailed description of the test case, which varies according to the type of the test case: for example, in the case where the type of the test case is a test module, the description is the name of the test module; in the case where the type of the test case is a sub - function, the detailed description of the test case is the name of the sub - function; in the case where the type of the test case is a test case, the detailed description of the test case is the test case description. That is, a test module is the largest organizational unit in a test plan, and it usually contains multiple sub - functions and test cases. The detailed description of a test module is its name, and this name should be able to summarize the main function or test scope of the module. For example, if the test module is about the lighting system of a car, the name of the test module may be "Lighting System Test Module". A sub - function is a specific functional point under a test module, and they are the subdivisions of the module. Each sub - function is an independent function in the module and can be tested separately. The detailed description of a sub - function is its name, and this name should be able to accurately describe the specific operation or characteristics of the sub - function. For example, in the "Lighting System Test Module", sub - functions may include "Headlight Turn On", "Turn Signal Flashing", etc. A test case is the smallest execution unit in a test plan, which details how to verify a specific function or requirement. The detailed description of a test case should include the test steps, expected results, and any specific test data or conditions. This description should be detailed enough so that testers can understand and execute the test without additional guidance. For example, for the sub - function "Headlight Turn On", a detailed description of a test case may be: "Verify that the headlight can be turned on normally and illuminate the road ahead in night mode. The test steps include: 1) Set the vehicle to night mode; 2) Operate the headlight switch to the on position; 3) Check whether the headlight lights up and illuminates the road within 10 meters ahead. The expected result is that the headlight lights up successfully and provides sufficient illumination."

[0048] The attribute information of test cases may also include the initialization and test steps of the test cases. That is, the initialization steps define the environmental conditions that need to be set before the execution of the test, such as configuration parameters, initial states, etc. In addition, according to the type of test cases, the initialization content will be different. That is, when the type is to initialize the environment, the initialization is the operation to initialize the environment, and when the type is to clean the environment, the initialization is the operation to clean the environment. When initializing the environment, a series of operations are performed to set up the test environment to make it reach a clean and consistent state for testing. For example, ensuring that the test environment (such as software, hardware, network, etc.) is ready and correctly configured, and clearing any historical data or residual files that may affect the test results. When initializing the cleaning environment, a series of operations are performed to clean the test environment to ensure that the environment returns to the initial state after the test and does not affect subsequent tests or the normal use of the system. For example, deleting or restoring the data generated during the test to prevent data pollution, and restoring the state of the system or device to the state before the test. The purpose of initializing the environment and cleaning the environment is to ensure the independence and repeatability of the test, as well as the stability and security of the test environment. Through these steps, the mutual influence between tests can be reduced, and the accuracy and reliability of the test results can be improved.

[0049] The test steps describe in detail a series of operations required to execute the test. Each step includes specific operation instructions and expected system responses. Clear initialization and test steps ensure that the test cases can be executed by other testers or automated test tools.

[0050] The attribute information of test cases may also include the expected results of the test cases. The expected results define what should happen after the test execution, including system states, output data, return values, etc. That is, after the test is completed, the actual results will be compared with the expected results to verify whether the test is successful. If the actual results do not match the expected results, the test will be regarded as a failure, which helps to identify potential defects or problems. Through these attribute information, test cases become the core components in the test process. They not only guide the execution of the test, but also provide the basis for evaluating software quality and performance.

[0051] According to an embodiment of the present application, a test report is generated, including: comparing the actual test results after automated testing with the expected results of the test cases, and generating a test report according to the comparison results.

[0052] Specifically, when generating a test report, the actual test results after automated testing can be compared with the expected results of the test cases to generate a test report based on the comparison results. That is, before the automated testing starts, the tester prepares the test cases, which define the expected inputs, operation steps, and expected output results. The test cases are usually organized into a test script, and an automated testing tool (such as TestModules in CANoe) executes the tests according to these cases. The test script sends instructions to the simulation model through the communication network to simulate different driving scenarios and conditions. During the test execution, the testing tool monitors the responses of the controller in real time and records the actual test results. These results may include the execution status of control instructions, sensor data, system feedback, etc.

[0053] The expected results are defined in each test case, and these results are formulated according to the functional specifications or design documents. The testing tool will compare the actual test results after automated testing with the expected results defined in the test cases one by one. This process is usually automated, and the tool checks whether the output of each test step meets the expectations. The comparison results will be recorded, which may include the following information: the unique identifier of each test case, the expected output defined according to the test case, the actual output obtained after the test execution, marking whether the test case passes or fails, and recording the details of any mismatches. If the test fails, the report will also include a description of the error message or abnormal situation to help the developer troubleshoot.

[0054] The test report can be generated in various formats, such as PDF, HTML, or Excel, etc., for easy sharing and archiving. The report may include: Test overview: the purpose, scope, and execution time of the test; Test result summary: the number of passed test cases, the number of failed test cases and their ratios; Detailed test results: the detailed information of each test case, including the expected results, actual results, and comparison results; Conclusions and suggestions: the summary of the test results and suggestions for subsequent work. The generated test report can provide an important basis for the development and verification of the controller, ensuring the reliability and safety of the system.

[0055] According to an embodiment of the present application, the controller automated verification method further includes: building a simulation model based on the target requirement function and simulation software, and determining a virtual controller based on virtual simulation technology; wherein, the simulation model includes: an environment model, a physical model, and a controller model, where the environment model is used to simulate the vehicle operation environment, the physical model is used to simulate the physical components of the vehicle, and the controller model is used to simulate various controllers of the vehicle.

[0056] Specifically, it is first necessary to analyze the design objectives and functional requirements of the controller, which include detailed requirements for various vehicle control strategies, safety features, driving assistance functions, etc. Then, select appropriate simulation software, such as Simulink, LabVIEW, PreScan, etc. These software can support complex system modeling and simulation, so that a simulation model can be built according to the target requirements and the simulation software. Among them, the simulation model can include: environmental model, physical model, and controller model. The environmental model is used to simulate the external environment in which the vehicle operates, including road conditions, traffic flow, climate conditions (temperature, humidity, wind speed, etc.), lighting conditions, etc. These factors may affect the performance of the vehicle and the behavior of the controller. The physical model is used to simulate the key physical components and systems of the vehicle, such as the engine, motor, transmission, chassis, braking system, steering system, etc. These models simulate the behavior and performance of these components according to physical laws and actual vehicle parameters. The controller model is used to simulate various electronic control units on the vehicle, such as the engine control unit, body electronic control unit, chassis control unit, etc. These models calculate control commands based on the received sensor data and driver input to control the corresponding vehicle systems.

[0057] In addition, a virtual controller can be determined based on virtual simulation technology, that is, the simulation model is converted into a virtual controller, which can simulate the functions of a real controller in a test environment. After the model development is completed and submitted to Gitlab, it will automatically trigger Jenkins to call the vVirtualTarget tool to generate a virtual controller. That is to say, the model of the controller can be developed in a graphical development environment, which allows engineers to design and simulate the behavior of the controller in a graphical way. Engineers implement the corresponding control logic and algorithms in Simulink according to the functional requirements of the controller. The developed model is submitted to Gitlab, which is a web-based Git repository management system for version control and code management. Gitlab provides a code repository, enabling the development team to collaborate on development, track change history, and manage different development branches. Jenkins is an open-source automation server that can be integrated with Gitlab to achieve continuous integration and continuous deployment. When the model code is pushed to a specific branch of Gitlab (such as master or develop), Jenkins will automatically trigger a new build task. vVirtualTarget is a software tool used to convert a Simulink model into a virtual controller that can run in a test environment. Jenkins calls the vVirtualTarget tool to convert the Simulink model into an executable file or software instance of the virtual controller. Thus, the vVirtualTarget tool generates a virtual controller based on the Simulink model, and this virtual controller can simulate the functions and behaviors of an actual controller in a test environment. In addition, the generated virtual controller needs to meet real-time performance requirements so that it can respond to the instructions of the test script in a timely manner during testing.

[0058] According to an embodiment of the present application, automated testing is performed according to a test script, a communication network, a virtual controller, and a simulation model, including: sending the test cases in the test script to the simulation model based on the communication network, and sending the results after the corresponding functions in the test cases are executed to the virtual controller; after the virtual controller obtains the execution result, executing the corresponding function based on the test cases in the test script, and sending the result after execution to the simulation model, so that the simulation model executes the corresponding function, and sending the execution result to the test script to complete the closed-loop automated testing.

[0059] Specifically, by loading the automated test script into the TestModules of CANoe, the test script can be automatically executed. Among them, TestModules is a functional module in CANoe dedicated to automated testing, which allows users to create, manage, and execute automated test scripts. When conducting automated testing based on the test script, communication network, virtual controller, and simulation model, the test script sends test cases to the simulation model through the communication network (such as CAN, LIN, etc.), which simulates the instructions or sensor data received by the controller in an actual vehicle. After receiving the test cases, the simulation model executes the corresponding functions, such as adjusting the engine speed, changing the gear of the transmission, etc. After executing the function, the simulation model sends the operation results (such as engine start, gear status, etc.) to the virtual controller. After receiving the execution results from the simulation model, the virtual controller executes the corresponding functions according to the test cases in the test script, such as adjusting the engine speed. The simulation model executes the corresponding functions based on the results returned by the virtual controller, such as further adjusting the control strategy, and the simulation model sends the final execution results to the test script. After receiving the final results from the controller simulation model, the test script verifies whether the actual results meet the expected results according to the predefined expected results, that is, the test script generates a test report based on the verification results, which details the execution situation and results of each test case, including success, failure, or abnormal situations.

[0060] For example, a test case is defined in the test script to verify that the controller can correctly control the engine to start and maintain at a specific speed. The test script sends an instruction of "start the engine" to the engine simulation model through the communication network, and this instruction is transmitted through the network and received by the simulation model (engine simulation model). The simulation model simulates the process of engine starting according to the received instruction, including ignition, fuel injection, etc. Once the simulated engine starts, the simulation model sends the status information of "engine started" to the virtual controller. After receiving the status information from the simulation model, the virtual controller processes this information according to its internal logic. The virtual controller can adjust the control strategy, such as adjusting the throttle opening to control the engine speed. The virtual controller sends a control instruction (such as "maintain the engine speed at 1000 revolutions per minute") back to the simulation model. The simulation model receives this instruction and simulates the corresponding physical response, such as adjusting the throttle opening of the engine. The simulation model sends the adjusted speed information back to the test script. The test script verifies whether the engine speed is maintained at 1000 revolutions per minute. If it meets the expectation, the test is considered passed; if not, the test failure is recorded.

[0061] Thus, this closed-loop automated test process ensures that the performance and functionality of the controller under simulated actual operating conditions are fully verified. In this way, problems can be detected and corrected early, improving the reliability and safety of the controller while reducing the cost and risk of real vehicle testing.

[0062] The verification method of the present application will be described below in conjunction with Figure 2 to describe the verification method of the present application.

[0063] As a specific example, the controller automated verification method of the present application may include the following steps:

[0064] S101, build a simulation model based on the target required functions and simulation software, and determine a virtual controller based on virtual simulation technology.

[0065] S102, build an automated operating environment, where the automated operating environment includes a communication network, a virtual controller, and a simulation model.

[0066] S103, obtain test cases, determine the number of sub-functions of the test cases, and generate function codes corresponding to each sub-function based on the attribute information of the test cases.

[0067] S104, when the number of sub-functions of the test cases is greater than or equal to two, splice the multiple function codes and integrate them into the main function to obtain the target code.

[0068] S105, convert the target code into a file in the target format to obtain a test script.

[0069] S106, load the test script into the automated operating environment to perform automated testing according to the test script, communication network, virtual controller, and simulation model, and generate a test report.

[0070] In summary, according to the controller automated verification method of the embodiments of the present application, an automated operating environment is built, where the automated operating environment includes a communication network, a virtual controller, and a simulation model, test cases are obtained, and a test script is generated based on the test cases. The test script is loaded into the automated operating environment to perform automated testing according to the test script, communication network, virtual controller, and simulation model, and generate a test report. Thus, this method can reduce the purchase cost and maintenance cost, improve the test efficiency, and effectively shorten the development cycle.

[0071] Corresponding to the above embodiments, the present application also proposes a computer-readable storage medium.

[0072] The computer-readable storage medium of the embodiments of the present application stores a program thereon, and when the program is executed by a processor, it implements the above-mentioned controller automated verification method.

[0073] According to the computer-readable storage medium of the embodiments of the present application, by executing the above-mentioned controller automation verification method, the acquisition cost and maintenance cost can be reduced, the test efficiency can be improved, and the development cycle can be effectively shortened.

[0074] Corresponding to the above embodiments, the present application also proposes an electronic device.

[0075] As Figure 3 shown, the electronic device 200 of the embodiments of the present application may include: a memory 210, a processor 220, and a program stored in the memory 210 and executable on the processor 220. When the processor 220 executes the program, the above-mentioned controller automation verification method is implemented.

[0076] According to the electronic device of the embodiments of the present application, by executing the above-mentioned controller automation verification method, the acquisition cost and maintenance cost can be reduced, the test efficiency can be improved, and the development cycle can be effectively shortened.

[0077] Corresponding to the above embodiments, the present application also proposes a controller automation verification device.

[0078] As Figure 4 shown, the controller automation verification device 100 of the embodiments of the present application includes: a building module 110, an acquisition module 120, and a verification module 130.

[0079] Among them, the building module 110 is used to build an automated operation environment, where the automated operation environment includes a communication network, a virtual controller, and a simulation model. The acquisition module 120 is used to acquire test cases and generate test scripts based on the test cases. The verification module 130 is used to integrally load the test scripts into the automated operation environment to perform automated testing according to the test scripts, the communication network, the virtual controller, and the simulation model, and generate a test report.

[0080] According to an embodiment of the present application, the test cases are determined according to the target required functions. The test cases include multiple sub-functions, each sub-function includes sub-test cases, and each sub-test case includes multiple sub-test steps.

[0081] According to an embodiment of the present application, the acquisition module 120 generates test scripts based on the test cases, specifically: determining the number of sub-functions of the test cases, and generating function codes corresponding to each sub-function based on the attribute information of the test cases; in the case where the number of sub-functions of the test cases is greater than or equal to two, splicing multiple function codes and integrating them into the main function to obtain target codes; converting the target codes into files in a target format to obtain test scripts.

[0082] According to an embodiment of the present application, the attribute information of a test case includes: test case identification information, test case type information, detailed description of the test case, initialization and test steps of the test case, and expected results of the test case. Among them, the test case type information includes test module, sub-function, initialization environment, cleaning environment, test case, and test steps. Among them, when the type of the test case is a test module, the detailed description of the test case is the name of the test module. When the type of the test case is a sub-function, the detailed description of the test case is the sub-function name. When the type of the test case is a test case, the detailed description of the test case is the test case description; when the type of the test case is an initialization environment, the initialization of the test case is the initialization environment. When the type of the test case is a cleaning environment, the initialization of the test case is the initialization of the cleaning environment.

[0083] According to an embodiment of the present application, the verification module 130 generates a test report, specifically for: comparing the actual test results after automated testing with the expected results of the test case to generate a test report according to the comparison results.

[0084] According to an embodiment of the present application, the building module 110 is further configured to: build a simulation model based on the target requirement function and simulation software, and determine a virtual controller based on virtual simulation technology; wherein, the simulation model includes: an environment model, a physical model, and a controller model. Among them, the environment model is used to simulate the environment in which the vehicle runs, the physical model is used to simulate the physical components of the vehicle, and the controller model is used to simulate various controllers of the vehicle.

[0085] According to an embodiment of the present application, the verification module 130 performs automated testing according to the test script, communication network, virtual controller, and simulation model, specifically for: sending the test cases in the test script to the simulation model based on the communication network, and sending the results after executing the corresponding functions in the test cases to the virtual controller; after the virtual controller obtains the execution results, executing the corresponding functions based on the test cases in the test script, and sending the results after execution to the simulation model, so that the simulation model executes the corresponding functions and sends the execution results to the test script to complete the closed-loop automated testing.

[0086] It should be noted that for the details not disclosed in the controller automated verification device of the embodiment of the present application, please refer to the details disclosed in the controller automated verification method of the embodiment of the present application, and will not be elaborated here specifically.

[0087] According to the controller automation verification device of the embodiments of the present application, the building module is used to build an automated operation environment, where the automated operation environment includes a communication network, a virtual controller, and a simulation model. The acquisition module is used to acquire test cases and generate test scripts based on the test cases. The verification module is used to integrally load the test scripts into the automated operation environment to perform automated testing according to the test scripts, the communication network, the virtual controller, and the simulation model, and generate a test report. Thus, the device can reduce the purchase cost and maintenance cost, improve the test efficiency, and effectively shorten the development cycle.

[0088] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a definite sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or in combination with these instruction execution systems, apparatus, or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer diskette (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation, or otherwise processing as appropriate, and then stored in a computer memory.

[0089] It should be understood that each part of the present application can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.

[0090] In the description of this specification, the descriptions referring to terms such as "one embodiment", "some embodiments", "examples", "specific examples", or "some examples", etc., mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of this application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.

[0091] In addition, the terms "first" and "second" are used only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one of these features. In the description of this application, "a plurality of" means at least two, such as two, three, etc., unless otherwise specifically and clearly defined.

[0092] In this application, unless otherwise clearly specified and defined, terms such as "installed", "connected", "joined", "fixed", etc. shall be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or integrated; it may be a mechanical connection or an electrical connection; it may be directly connected or indirectly connected through an intermediate medium, and it may be the communication inside two elements or the interaction relationship between two elements, unless otherwise clearly defined. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0093] Although the embodiments of this application have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting this application. Those of ordinary skill in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.

Claims

1. A controller automatic verification method, characterized in that: The method comprises: Building an automated operating environment, wherein the automated operating environment includes a communication network, a virtual controller, and a simulation model, wherein the simulation model is used to cooperate with the virtual controller for testing; Obtaining a test case, and generating a test script based on the test case; The test script is loaded into the automated operating environment to perform automated testing according to the test script, the communication network, the virtual controller and the simulation model, and to generate a test report.

2. The controller automatic verification method according to claim 1, characterized in that: The test case is determined according to the target requirement function, and the test case includes multiple sub-functions, each sub-function includes an initialization environment, a cleaning environment and multiple sub-test cases, and each sub-test case includes multiple sub-test steps.

3. The controller automatic verification method according to claim 2, characterized in that: The generating a test script based on the test case comprises: Determine the number of sub-functions of the test case, and generate a function code corresponding to each sub-function based on the attribute information of the test case; When the number of sub-functions of the test case is greater than or equal to two, a plurality of the function codes are concatenated and integrated into a main function to obtain a target code; The target code is converted into a file in a target format to obtain the test script.

4. The controller automatic verification method according to claim 3, characterized in that: The attribute information of the test case includes: test case identification information, test case type information, test case detailed description, test case initialization and test steps, and expected results of the test case, wherein the test case type information includes test module, sub-function, initialization environment, cleaning environment, test case and test step, wherein, when the test case type is a test module, the test case detailed description is the name of the test module, when the test case type is a sub-function, the test case detailed description is the sub-function name, when the test case type is a test case, the test case detailed description is the test case description; when the test case type is an initialization environment, the initialization of the test case is the initialization environment, and when the test case type is a cleaning environment, the initialization of the test case is the initialization of the cleaning environment.

5. The controller automatic verification method according to claim 4, characterized in that: The generating of the test report includes: The actual test results after the automated test are compared with the expected results of the test case to generate a test report based on the comparison results.

6. The controller automatic verification method according to claim 1, characterized in that: The method further comprises: The simulation model is built based on the target requirement functions and simulation software, and a virtual controller is determined based on virtual simulation technology; wherein the simulation model includes: an environment model, a physical model and a controller model, wherein the environment model is used to simulate the environment in which the vehicle operates, the physical model is used to simulate the physical components of the vehicle, and the controller model is used to simulate various controllers of the vehicle.

7. The controller automatic verification method according to claim 6, characterized in that: The performing automated testing according to the test script, the communication network, the virtual controller and the simulation model comprises: Sending the test cases in the test script to the simulation model based on the communication network, and sending the results of the execution of the corresponding functions in the test cases to the virtual controller; After the virtual controller obtains the execution result, it executes the corresponding function based on the test case in the test script, and sends the execution result to the simulation model so that the simulation model executes the corresponding function and sends the execution result to the test script to complete the closed-loop automated test.

8. A computer-readable storage medium, characterized in that: A program is stored thereon, and when the program is executed by a processor, the controller automatic verification method according to any one of claims 1-7 is implemented.

9. An electronic device, characterized in that: include: A memory, a processor, and a program stored in the memory and executable on the processor, wherein when the processor executes the program, the controller automatic verification method according to any one of claims 1 to 7 is implemented.

10. A controller automatic verification device, characterized in that: The device comprises: A building module, used to build an automated operating environment, wherein the automated operating environment includes a communication network, a virtual controller and a simulation model; An acquisition module, used to acquire test cases and generate test scripts based on the test cases; A verification module is used to integrate and load the test script into the automated operating environment to perform automated testing based on the test script, the communication network, the virtual controller and the simulation model, and generate a test report.

Citation Information

Patent Citations

  • Whole vehicle controller environmental model generation method and system

    CN104865947A

  • HIL and real vehicle generalization test case design method

    CN118012751A