Controller-based simulation virtualization test method, system, equipment and medium
By building a virtual controller under the AUTOSAR architecture and using pipeline projects for automated testing, the problem of inability to automate testing in virtualization testing is solved, and development efficiency and product quality are improved.
Patent Information
- Application Number
- CN202211185427.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-27
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2042-09-27
AI Technical Summary
In the prior art, controllers based on AUTOSAR architecture cannot perform automated testing in virtualization testing, resulting in the inability to effectively perform integrated delivery testing when software updates are frequent.
By creating pipeline projects, using simulation software to build virtual controllers, importing software components and description files, configuring interface relationships, and using Jenkins for parameterized construction and automated testing, implementing end-to-end simulation testing.
The automated testing process is realized, reducing the communication dependence between application engineers and test engineers, and improving development efficiency and product quality reliability.
Smart Images

Figure CN115542878B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a controller-based simulation virtualization testing method, system, device, and medium. Background Art
[0002] AutoSAR (Automotive Open System Architecture) is gaining increasing popularity in the automotive industry, with an increasing number of projects and controller development based on the AUTOSAR standard. The AUTOSAR standard defines application-layer software components as "reusable software components" and defines how to describe their input and output interfaces and data types. In actual product controllers, many implement AUTOSAR standards. For controllers based on the AUTOSAR architecture, the internal behavior and interface information of the application-layer code are detailed in the system architecture description document.
[0003] Based on the AUTOSAR architecture, software and hardware are decoupled. Software development, especially application software development, can precede hardware design and be independently developed and designed. Application-layer software testing involves unit testing of individual software modules. Later in development, software integration testing, while encompassing both application and middleware software, focuses more on channel testing and driver testing.
[0004] In actual product control, a large number of controllers have not yet implemented AUTOSAR standardization. For controllers based on the AUTOSAR architecture, the internal behavior and interface information of the application layer code are fully described in the system architecture description document. The task of the virtualized controller (ECU) is to appropriately adapt the software engineering code of the real controller. The premise for the new software engineering to run on a PC is that it is hardware-independent.
[0005] During the operation of the virtual ECU, for the complete AUTOSAR controller software project, the code directly related to the hardware needs to be stripped out. However, the remaining part of the software project is incomplete and cannot be directly simulated and compiled. In this case, dSPACE (simulation system) usually provides a simulation OS and MCAL to complete the software project. After completion, it becomes a complete project. However, using the above method to perform simulation function testing on the virtual controller, it is not possible to test only by relying on the application code. The stripped related code project needs to be supplemented according to the test object. At the same time, due to frequent software updates during project delivery, it is impossible to face the pressure of integrated delivery testing. Therefore, a new controller simulation virtualization testing method is urgently needed. Summary of the Invention
[0006] In view of the above-mentioned shortcomings of the prior art, the present application provides a controller simulation virtualization testing method, system, device and medium to solve the problem that virtual controllers cannot perform automated testing.
[0007] The present application provides a controller simulation virtualization testing method, which includes:
[0008] Build a virtual controller based on simulation software;
[0009] Creating at least two pipeline projects, configuring parameters for one of the pipeline projects, determining a branch name, and determining a script branch and a test version of the virtual controller according to the branch name;
[0010] Another pipeline project is used to download and pull the test version associated with the virtual controller, the test version is used to perform a simulation test on the virtual controller, and the simulation test result is determined and outputted.
[0011] In one embodiment of the present application, the step of constructing a virtual controller based on simulation software includes:
[0012] Creating a virtual control project in simulation software, wherein the virtual control project includes a carrier of a virtual electronic control unit, and the virtual controller includes a microcontroller abstraction layer, a basic software layer, and an application layer;
[0013] Importing the source code of at least one software component and a description file of the at least one software component into the virtual control project to obtain an updated virtual control project;
[0014] Creating an instance for each software component in the at least one software component, and associating the at least one software component with the corresponding at least one interface through a preset interface relationship table, wherein the preset interface relationship table is included in a description file of the at least one software component;
[0015] The middleware source code, the interface configuration description file and the description file of the microcontroller abstraction layer are imported into the updated virtual control project to obtain a virtual controller.
[0016] In one embodiment of the present application, before importing the source code of at least one software component and the description file of the at least one software component into the virtual control project to obtain the updated virtual control project, the method further includes:
[0017] Adjusting the software engineering code of the real controller so that the software engineering code is hardware-independent, obtaining an adjusted software engineering code, wherein the adjusted software engineering code includes a remaining portion, and the simulation software is included in the real controller;
[0018] The remaining parts are completed by the microcontroller abstraction layer and the operating system of the microcontroller abstraction layer.
[0019] In one embodiment of the present application, adjusting the software engineering code of the real controller includes:
[0020] Strip the hardware-related code portion from the software engineering code.
[0021] In one embodiment of the present application, the step of importing the middleware source code, the interface configuration description file, and the microcontroller abstraction layer description file into the updated virtual control project to obtain the virtual controller includes:
[0022] Obtaining the middleware source code, the interface configuration description file, and the description file of the microcontroller abstraction layer, wherein the middleware source code is included in the basic software layer, and the source code and description file of the at least one software component are included in the application layer;
[0023] A calling relationship between the application layer and the basic software layer, and a calling relationship between the basic software layer and the microcontroller abstraction layer are established to obtain the virtual controller.
[0024] In one embodiment of the present application, at least two pipeline projects are created, parameters are configured for one of the pipeline projects, a branch name is determined, and a script branch and a test version of the virtual controller are determined according to the branch name, further comprising:
[0025] Create at least two pipeline projects based on Jenkins, build a parameterized script branch in one of the pipeline projects, and determine the version number of the current build based on the script branch, timestamp, and build number of the current build;
[0026] Pull the preset application layer code according to the currently built version number and store it in the specified slave node;
[0027] Packaging and compiling the application layer code and the interface layer code of the virtual controller to obtain a binary file that complies with the virtual environment;
[0028] The product library interface is called to upload the binary file to obtain a test version library containing each test version.
[0029] The interface uploads the binary file to obtain a test version library containing each test version.
[0030] In one embodiment of the present application, after performing simulation testing on the virtual controller using the test version, the method further includes:
[0031] A debugging access interface is created for each of the at least one interface; and the at least one interface is observed in conjunction with the calibration file.
[0032] In one embodiment of the present application, the performing simulation test on the virtual controller using the test version includes:
[0033] Combining the preset test model with the virtual controller and compiling them into a project to be tested;
[0034] Importing the project to be tested into automated testing software;
[0035] The automated testing software calls the executable entity in the at least one software component to perform simulation testing on the system testing task.
[0036] In one embodiment of the present application, the number of the virtual controller is at least one;
[0037] The calling of the executable entity in the at least one software component to perform simulation testing on the system test task includes:
[0038] Creating an external communication connection of at least one virtual controller through an environment configuration tool to obtain a virtual test system;
[0039] The virtual test system calls the executable entity in the at least one software component to perform simulation testing on the system test task.
[0040] In a second aspect, an embodiment of the present application provides a controller simulation virtualization test system, comprising:
[0041] Controller building module, which builds a virtual controller based on simulation software;
[0042] A test version determination module is used to create at least two pipeline projects, configure parameters for one of the pipeline projects, determine a branch name, and determine a script branch and a test version of the virtual controller according to the branch name;
[0043] The simulation test module uses another pipeline project to download and pull the test version associated with the virtual controller, uses the test version to perform simulation testing on the virtual controller, determines the simulation test results and outputs them.
[0044] In a third aspect, the present application provides an electronic device, comprising:
[0045] one or more processors;
[0046] The storage device is used to store one or more programs. When the one or more programs are executed by one or more processors, the electronic device implements the controller simulation virtualization testing method described in the first aspect.
[0047] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor of a computer, the computer is caused to execute the controller simulation virtualization testing method described in the first aspect.
[0048] Beneficial effects of this application: This application implements automated testing by creating a pipeline project, including integrated testing of test scripts, version pulls, test execution, and report uploads. It is no longer limited by the communication between application engineers and test engineers. The entire process is fully automated, realizing an end-to-end testing process, which is conducive to improving development efficiency, development quality, and improving product quality reliability and stability.
[0049] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The accompanying drawings are incorporated into and constitute a part of the specification, illustrating embodiments consistent with the present application and, together with the specification, serving to explain the principles of the present application. It is obvious that the drawings described below are merely some embodiments of the present application, and a person of ordinary skill in the art can derive other drawings based on these drawings without inventive effort. In the drawings:
[0051] Figure 1 is a structural diagram of a virtual controller shown in an exemplary embodiment of the present application;
[0052] Figure 2 This is a flowchart of a controller simulation virtualization testing method according to an exemplary embodiment of the present application;
[0053] Figure 3 is a flowchart of constructing a virtual controller according to an exemplary embodiment of the present application;
[0054] Figure 4 is a flowchart of determining a test version in a virtual controller according to an exemplary embodiment of the present application;
[0055] Figure 5 is a schematic diagram of a virtual controller and its creation components shown in an exemplary embodiment of the present application;
[0056] Figure 6 is another structural diagram of a virtual controller shown in an exemplary embodiment of the present application;
[0057] Figure 7 is a schematic diagram showing a combination of a virtual controller and a test model according to an exemplary embodiment of the present application;
[0058] Figure 8 This is a block diagram of a controller-based simulation virtualization test system shown in an exemplary embodiment of the present application;
[0059] Figure 9 A schematic structural diagram of an electronic device suitable for implementing the embodiments of the present application is shown. DETAILED DESCRIPTION
[0060] The following will describe the embodiments of the present application with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand the other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for the purpose of illustrating the present application and are not intended to limit the scope of protection of the present application.
[0061] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application. Therefore, the illustrations only show components related to the present application and are not drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component can be changed at will, and the component layout type may also be more complicated.
[0062] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.
[0063] First, it's important to note that AutoSAR (Automotive Open System Architecture) is a collaborative development framework for automotive electronic systems, developed by global automakers, parts suppliers, and various research and service organizations. It establishes an open, standard software architecture for automotive control units (ECUs). AutoSAR is primarily divided into three layers: ASW (Application Software Layer), RTE (Runtime Environment), and BSW (Basic Software Layer). To ensure independence between upper and lower layers, each layer typically uses only the interfaces provided by the layer below it and provides corresponding interfaces to the layer above it. This layered architecture is key to achieving hardware-software separation, freeing automotive embedded system control software developers from the traditional reliance on hardware systems during ECU software development and verification.
[0064] The application software layer consists of several SWCs (Software Components), which interact with each other through ports. Each software component can contain one or more Runnable Entities (REs), which encapsulate relevant control algorithms and can be triggered by RTE events. In the embodiments of this application, a SWC file can be regarded as a .c file.
[0065] The runtime environment serves as a bridge between the application software layer and the basic software layer, making it possible to separate software from hardware. RTE can enable communication between software components, between basic software, and between software components and basic software.
[0066] The basic software layer contains numerous basic software modules and is responsible for non-application-related ECU functions. One of the most important functions of the basic software is inter-ECU communication, namely signal exchange. The basic software layer can be divided into four layers: the Services Layer, the ECU Abstraction Layer, the Microcontroller Abstraction Layer (MCAL), and the Complex Drivers.
[0067] The Microcontroller Abstraction Layer (MCAL) is a special layer that unifies different hardware interfaces. The MCAL encapsulates the hardware, preventing upper-layer software from directly manipulating the microcontroller's registers.
[0068] Middleware is a type of software that sits between application systems and system software. It uses the basic services (functions) provided by system software to connect various parts of application systems or different applications on the network, thereby achieving the purpose of resource sharing and function sharing.
[0069] Ethernet is the most widely used local area network (LAN) communication method and also a protocol. The Ethernet protocol defines a series of software and hardware standards for connecting different computer devices. The basic elements of Ethernet networking include switches, routers, hubs, fiber optic cables, regular network cables, and the Ethernet protocol and communication rules. The port that connects network data in Ethernet is called an Ethernet interface, also known as an Ethernet port.
[0070] Figure 1 This is a schematic diagram of the structure of a virtual controller shown in an exemplary embodiment of the present application, wherein the software architecture or software organization AutoSAR is represented by an XML description file; the application layer software code, for example, is represented by the SWC source code included in the application layer; and part of the underlying software is represented by at least one SWC source code and the description files corresponding to each SWC included in the application layer. Figure 6 As shown, the structure of the virtual controller includes an application (App) layer, an RTE layer, and a BSW layer, wherein the BSW layer may include an MCAL (microcontroller abstraction layer) layer and a corresponding OS (Operating System). In the embodiment of the present application, the real physical controller (real controller) and the virtual controller have the same software structure, but the real controller has a physical hardware interface and the virtual controller has a virtual interface. The real controller requires an external connection to a hardware load before it can perform simulation testing, while the virtual controller can perform simulation testing without connecting to an external load.
[0071] See also Figure 2 , Figure 2 This is a flowchart of a controller simulation virtualization testing method according to an exemplary embodiment of the present application. It should be understood that the method can also be applied to other exemplary implementation environments and specifically executed by devices in other implementation environments. This embodiment does not limit the implementation environment to which the method is applicable.
[0072] Step S210: constructing a virtual controller based on the simulation software, wherein the virtual controller includes a microcontroller abstraction layer, a basic software layer, and an application layer;
[0073] Among them, there are multiple virtual controllers, each virtual controller is used to simulate a corresponding physical controller, and each virtual controller includes the same input port and output port as the corresponding physical controller; for example, the first virtual controller is used to simulate the first real controller, the second virtual controller is used to simulate the second real controller, and the third virtual controller is used to simulate the third real controller, and the virtual controller is used to output the simulation signal of the corresponding real controller.
[0074] It should be noted here that simulation software includes but is not limited to dSPACE simulation software, Proteus simulation software, etc. Among them, the dSPACE simulation system has the advantages of strong real-time performance, high reliability, and good scalability. The processor in the dSPACE hardware system has high-speed computing power and is equipped with rich I / O support. Users can combine them according to their needs.
[0075] Step S220: Create at least two pipeline projects, configure parameters for one of the pipeline projects, determine a branch name, and determine a script branch and a test version of the virtual controller according to the branch name;
[0076] Specifically, there are at least two pipeline projects, one is the compilation pipeline and the other is the automated testing pipeline. The compilation pipeline is used to compile and store the version to be tested in a specified environment, while the automated testing pipeline is used to test scripts, pull versions, execute tests, and upload reports.
[0077] For example, in Jenkins, create an independent pipeline project. When configuring the project, select the parameterized build process and enter the branch as the basis for pulling code. The branch name can be customized according to the rules. After definition, write the specific execution steps in the groovy script, which mainly includes pulling code - compiling - packaging and uploading. Specifically, the application layer code of the body controller is automatically pulled, and the OS simulation AUTOSAR OS provided by dSPACE interacts with the application layer code. The microcontroller abstraction layer mainly realizes the simulation of BSW and the communication between the external interface of the virtual controller. In this way, a complete ECU (virtual controller) is formed through the application layer code, AUTOSAR OS and microcontroller abstraction layer. After compiling the above code into a binary file, the artifact library interface is called. After uploading the binary file, a test version library is formed.
[0078] Among them, Jenkins is an open source software project. It is a continuous integration tool developed based on Java. It is used to monitor continuous repetitive work. It aims to provide an open and easy-to-use software platform so that software projects can be continuously integrated.
[0079] Step S230: using another of the pipeline projects to download and pull the test version associated with the virtual controller, using the test version to perform a simulation test on the virtual controller, determining the simulation test result and outputting it.
[0080] For example, automatically pulling test versions and performing automated testing. Having laid the groundwork in the previous pipeline, the system provides flexible control over test versions, enabling the ability to pull specific versions for testing at any time. The key to this step is not only pulling the specified test version, but also matching the corresponding test script. After pulling the software to the specified environment, the corresponding test script is loaded. First, an automated test pipeline is created in Jenkins. The virtual ECU test package is downloaded, and then the test script is pulled from a Git repository (Git, an open-source distributed version control system, can efficiently and quickly manage versions for projects ranging from small to large). This is preparation for test execution. The next step is test execution. After initiating the test using a Python program, the test results are collected in an XML file (generally referring to Extensible Markup Language, a subset of Standard Generalized Markup Language) and uploaded to the metrics dashboard system. This completes a sustainable testing solution for virtual ECU simulation, from code writing to packaging and compilation, test deployment, test execution, and finally, result collection.
[0081] In this embodiment, automated testing is achieved by creating a pipeline project, including integrated testing of test scripts, version pull, test execution, and report upload. It is no longer limited by the communication between application engineers and test engineers. The entire process is fully automated, realizing an end-to-end testing process, which is conducive to improving development efficiency, development quality, and improving product quality reliability and stability.
[0082] like Figure 3 As shown, in an exemplary embodiment, the controller simulation virtualization test method includes at least steps S310 to S340, which are described in detail as follows:
[0083] Step S310 : creating a virtual control project in simulation software. The virtual control project includes a carrier of a virtual electronic control unit. The virtual controller includes a microcontroller abstraction layer, a basic software layer, and an application layer.
[0084] Among them, the simulation software can run in a computer, and the virtual control engineering can create a carrier of a virtual electronic control unit (ECU).
[0085] Step S320 : Importing the source code of at least one software component and the description file of at least one software component into the virtual control project to obtain an updated virtual control project.
[0086] In one embodiment of the present application, before this, the software engineering code of the real controller can be adjusted to make the software engineering code hardware-independent, thereby obtaining the adjusted software engineering code, which includes the remaining part, and the simulation software is included in the real controller.
[0087] The software engineering code for the real controller can be adjusted by stripping out the hardware-related code. For example, code that directly accesses hardware or manipulates hardware registers can be stripped out, making it impossible to simulate on a non-virtual controller. This stripping frees up the hardware-related code, resulting in the remaining code.
[0088] Furthermore, the remaining parts can be completed by the microcontroller abstraction layer (MCAL) and the operating system of the microcontroller abstraction layer (AUTOSAR OS). This is because if the virtual control project is incomplete, simulation compilation cannot be performed directly. In this case, the remaining parts can be completed by MCAL and OS, thereby providing a simulated OS to interact with the application layer code. For ease of explanation, the embodiments of this application will abbreviate AUTOSAR OS as OS, and the two are the same.
[0089] Step S330 : creating an instance for each software component in the at least one software component, and associating the at least one software component with the corresponding at least one interface through a preset interface relationship table, wherein the preset interface relationship table is included in the description file of the at least one software component.
[0090] The software component is recorded as SWC, and the SWC is included in the application layer. The application layer may include at least one SWC. An instance may be created for each SWC, and the instance may include a SWC and a description file of the SWC.
[0091] Step S340 , importing the middleware source code, the interface configuration description file, and the description file of the microcontroller abstraction layer into the updated virtual control project to obtain a virtual controller.
[0092] Specifically, the middleware source code, interface configuration description file and microcontroller abstraction layer description file can be obtained first, wherein the middleware source code is included in the basic software layer, and the source code of at least one SWC and the description files corresponding to each SWC are included in the application layer.
[0093] Furthermore, the calling relationship between the application layer and the basic software layer, and the calling relationship between the basic software layer and the microcontroller abstraction layer can be created to obtain a virtual controller. This virtual controller can achieve complete simulation. Figure 5As shown in FIG, the virtual controller now has the source code and corresponding description files of the application layer, the source code and corresponding description files of the BSW layer, and the description files of the OS and MCAL of the software simulation. Among them, the description files are ARXML files.
[0094] For example, the virtual controller associates the system test task according to the description file of at least one software component, and calls the executable entity in the at least one software component to perform simulation test on the system test task.
[0095] The system test task (OS Task) is included in the OS and can be stored in the OS as a list. The virtual controller can associate the OS Task with the description file of at least one SWC to automatically generate RTE code and other BSW layer code. Furthermore, the runnable entity (Runable) in at least one SWC is called to simulate the system test task.
[0096] In addition, in some other embodiments, first, on the one hand, the controller-related code is stored on the git tool, and then, V-ECU is generated, a project is created in SystemDesk, and the prepared AUTOSAR description file is imported into the newly created SystemDesk project. The ARXML file in the project process needs to be imported together. This step is to lay the foundation for the subsequent generation of dSPACE's AUTOSAR OS and MCAL layer code. Then, a virtual controller is generated with one click to find the corresponding RootComposition (i.e., combination root), which contains all SWCs (i.e., software control) and the connection relationship between them. In this way, the code for the OS and interface layer is generated. Finally, the test script code is also stored in git, and the script is managed based on the git flow branch regulations.
[0097] Secondly, create the first pipeline, select New Project in Jenkins, select Pipeline Project, select Parameterized Build Process under Git Project, create a new option "choice_branch", fill in the code branch name in the following options, such as "develop, master, release, etc.", then define each step in the Groovy script, first, define the version number, the rule is as follows: "Current build branch + timestamp + component number" defines the current build version, next, execute pullgitcode to pull down the application layer code stored in advance in the above steps, the slave node does not virtualize the ECU tool compilation environment, after pulling the application layer code to the specified slave node, start the compilation script, compile the application layer code with the OS and interface layer code as a whole, and compile a binary file that is suitable for running in the virtual environment, and at the same time, upload the binary file to the artifact library for version management. The main purpose of this step is to package and compile the application layer code and the code generated by the virtual ECU as a whole to generate a testable ECU version.
[0098] Finally, create another pipeline project in Jenkins. Similarly, select the parameterized build process, create the GIT parameter "VritualECU_branch", select the branch of the script, create the second parameter "compile_version", select the test version, and return the corresponding artifact list by calling the interface of the artifact library. In this way, when building the test task, you can execute the test task based on different versions. Later, define each execution step in detail in the Groovy script. First, download the test script to the slave node, then download the test version to the slave node, and then start the test script to perform simulation testing. The test results will be saved in the Html file, and the test conclusions will be displayed on the page through the upload interface. In this way, a complete virtual ECU automated testing process is formed. This application is no longer limited to the communication between application engineers and test engineers. The entire process is fully automated, and an end-to-end testing process is realized, which greatly improves the efficiency of testing and development.
[0099] In one embodiment of the present application, after invoking the runnable entity in at least one software component to perform a simulation test on the system test task, a debug access point (DAP) interface can be created for each of the at least one interface and combined with a calibration (A2L) file to observe the at least one interface. In other words, by creating the DAP interface and combining it with the A2L file, the operating status of each interface can be observed.
[0100] In one embodiment of the present application, the preset test model is combined with the virtual controller and compiled into a project to be tested, and the project to be tested is imported into the automated test software. The preset test model can be a Simulink model. Furthermore, the automated test software calls the executable entity in at least one software component to perform a simulation test on the system test task. In other words, after the automated test software is combined with Simulink, automated testing can be achieved. Figure 7 As shown in the figure, the virtual controller (V-ECU) is combined with Simulink moel to obtain an automated testing tool.
[0101] In one embodiment of the present application, the number of virtual controllers is at least one. An external communication connection of at least one virtual controller can be created through an environment configuration tool to obtain a virtual test system; the virtual test system includes at least one virtual controller, each virtual controller corresponds to its own SWC set, and multiple SWC sets can form at least one SWC. Furthermore, the virtual test system can call the executable entity in at least one SWC to perform simulation testing on the system test task. The virtual test system includes virtual controller 1 (V-VIU1), virtual controller 2 (V-VIU2) and virtual controller 3 (V-VIU3), and each virtual controller can be connected together through virtual Ethernet (Virtual ETH), virtual CAN bus, virtual LIN bus or Single base, and connected to the object model (Plant Model) for simulation.
[0102] Through the embodiments of the present application, a computer can create a virtual control project in simulation software, the virtual control project including a carrier of a virtual electronic control unit; import the source code of at least one software component and the description file of at least one software component into the virtual control project to obtain an updated virtual control project; create an instance for each software component in the at least one software component, and associate the at least one software component to the corresponding at least one interface through a preset interface relationship table, the preset interface relationship table being included in the description file of the at least one software component; import the middleware source code, interface configuration description file, and microcontroller abstraction layer description file into the updated virtual control project to obtain a virtual controller; associate the system test task according to the description file of at least one software component through the virtual controller, and call the runnable entity in the at least one software component to simulate the system test task. Through this method, functional testing can be performed in advance, which is conducive to improving development efficiency, development quality, and improving product quality reliability and stability. In addition, the system's pure software development environment does not rely on changes in peripheral hardware, facilitates system transplantation and system generalization, and is convenient for CI / CD integrated operations.
[0103] Figure 8 This is a block diagram of a controller simulation virtualization test system according to an exemplary embodiment of the present application. This device can be used in a vehicle and specifically configured in a computer. This device can also be applied to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which this device is applicable.
[0104] like Figure 8 As shown, the exemplary controller-based simulation virtualization test system includes:
[0105] A controller construction module 810 constructs a virtual controller based on simulation software, wherein the virtual controller includes a microcontroller abstraction layer, a basic software layer, and an application layer;
[0106] It should be noted that the controller construction module 810 further includes: creating a virtual control project in the simulation software, wherein the virtual control project includes a carrier of a virtual electronic control unit;
[0107] Importing the source code of at least one software component and a description file of the at least one software component into the virtual control project to obtain an updated virtual control project;
[0108] Creating an instance for each software component in the at least one software component, and associating the at least one software component with the corresponding at least one interface through a preset interface relationship table, wherein the preset interface relationship table is included in a description file of the at least one software component;
[0109] The middleware source code, the interface configuration description file and the description file of the microcontroller abstraction layer are imported into the updated virtual control project to obtain a virtual controller.
[0110] A test version determination module 820 is configured to create at least two pipeline projects, configure parameters for one of the pipeline projects, determine a branch name, and determine a script branch and a test version of the virtual controller according to the branch name;
[0111] It should be noted that the test version determination module 820 further includes: creating at least two pipeline projects based on Jenkins, building a parameterized script branch in one of the pipeline projects, and determining the version number of the current build based on the script branch, timestamp, and build number of the current build;
[0112] Pull the preset application layer code according to the currently built version number and store it in the specified slave node;
[0113] Packaging and compiling the application layer code and the interface layer code of the virtual controller to obtain a binary file that complies with the virtual environment;
[0114] The product library interface is called to upload the binary file to obtain a test version library containing each test version.
[0115] The interface uploads the binary file to obtain a test version library containing each test version.
[0116] The simulation test module 830 uses another pipeline project to download and pull the test version associated with the virtual controller, uses the test version to perform simulation testing on the virtual controller, determines the simulation test result and outputs it.
[0117] It should be noted that the controller simulation virtualization test system provided in the above embodiment and the controller simulation virtualization test method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs operations has been described in detail in the method embodiment and will not be repeated here. In actual applications, the controller simulation virtualization test system provided in the above embodiment can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.
[0118] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements the controller simulation virtualization testing method provided in the above-mentioned embodiments.
[0119] Figure 9 The following is a schematic diagram showing the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application. Figure 9 The computer system 900 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0120] like Figure 9As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 902 or the program loaded from the storage part 908 into the random access memory (RAM) 903, such as executing the method described in the above embodiment. Various programs and data required for system operation are also stored in the RAM 903. The CPU 901, ROM 902 and RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0121] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, and the like; an output section 907 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 908 including a hard disk and the like; and a communication section 909 including a network interface card such as a LAN (Local Area Network) card or a modem. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. Removable media 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like, are installed in the drive 910 as needed, so that computer programs read therefrom can be installed into the storage section 908 as needed.
[0122] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 909, and / or installed from a removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the various functions defined in the system of the present application are executed.
[0123] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable computer program. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. A computer program embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0124] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. Among them, each box in the flowchart or block diagram can represent a module, program segment, or part of the code, and the above-mentioned module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0125] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. In some cases, the names of these units do not constitute limitations on the units themselves.
[0126] Another aspect of the present application provides a computer-readable storage medium storing a computer program. When executed by a computer processor, the computer program causes the computer to perform the controller simulation virtualization testing method described above. The computer-readable storage medium may be included in the electronic device described in the above embodiments, or may exist independently and not be incorporated into the electronic device.
[0127] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, any equivalent modifications or alterations accomplished by a person of ordinary skill in the art without departing from the spirit and technical concepts disclosed in this application shall be covered by the claims of this application.
Claims
1. A controller simulation virtualization testing method, characterized in that: include: A virtual controller is constructed based on simulation software; wherein, a virtual control project is created in the simulation software, the virtual control project includes a carrier of a virtual electronic control unit, and the virtual controller includes a microcontroller abstraction layer, a basic software layer, and an application layer; the source code of at least one software component and the description file of the at least one software component are imported into the virtual control project to obtain an updated virtual control project; an instance is created for each software component of the at least one software component, and the at least one software component is associated with the corresponding at least one interface through a preset interface relationship table, the preset interface relationship table being included in the description file of the at least one software component; the middleware source code, the interface configuration description file, and the description file of the microcontroller abstraction layer are imported into the updated virtual control project to obtain a virtual controller; Create at least two pipeline projects, configure parameters for one of the pipeline projects, determine the branch name, and determine the script branch and test version of the virtual controller based on the branch name; wherein, create at least two pipeline projects based on Jenkins, build a parameterized script branch in one of the pipeline projects, and determine the version number of the current build based on the script branch, timestamp and build number of the current build; pull the preset application layer code according to the version number of the current build and store it in the designated slave node; package and compile the application layer code and the interface layer code of the virtual controller to obtain a binary file that conforms to the virtual environment; call the product library interface to upload the binary file to obtain a test version library containing each of the test versions; Another pipeline project is used to download and pull the test version associated with the virtual controller, the test version is used to perform a simulation test on the virtual controller, and the simulation test result is determined and outputted.
2. The method according to claim 1, characterized in that Before importing the source code of at least one software component and the description file of the at least one software component into the virtual control project to obtain an updated virtual control project, the method further includes: Adjusting the software engineering code of the real controller so that the software engineering code is hardware-independent, obtaining an adjusted software engineering code, wherein the adjusted software engineering code includes a remaining portion, and the simulation software is included in the real controller; The remaining parts are completed by the microcontroller abstraction layer and the operating system of the microcontroller abstraction layer.
3. The method according to claim 2, characterized in that The adjustment of the software engineering code of the real controller includes: Strip the hardware-related code portion from the software engineering code.
4. The method according to claim 1, wherein The step of importing the middleware source code, the interface configuration description file, and the description file of the microcontroller abstraction layer into the updated virtual control project to obtain the virtual controller includes: Obtaining the middleware source code, the interface configuration description file, and the description file of the microcontroller abstraction layer, wherein the middleware source code is included in the basic software layer, and the source code and description file of the at least one software component are included in the application layer; A calling relationship between the application layer and the basic software layer, and a calling relationship between the basic software layer and the microcontroller abstraction layer are established to obtain the virtual controller.
5. The method according to any one of claims 2 to 4, characterized in that: After performing simulation testing on the virtual controller using the test version, the method further includes: A debugging access interface is created for each of the at least one interface; and the at least one interface is observed in conjunction with the calibration file.
6. The method according to any one of claims 2 to 4, characterized in that: The performing simulation test on the virtual controller using the test version includes: Combining a preset test model with the virtual controller and compiling the result into a project to be tested; Importing the project to be tested into automated testing software; The automated testing software calls the executable entity in the at least one software component to perform simulation testing on the system testing task.
7. The method according to claim 6, characterized in that The number of the virtual controller is at least one; The calling of the executable entity in the at least one software component to perform simulation testing on the system test task includes: Creating an external communication connection of at least one virtual controller through an environment configuration tool to obtain a virtual test system; The virtual test system calls the executable entity in the at least one software component to perform simulation testing on the system test task.
8. A controller-based simulation virtualization test system, characterized in that: include: A controller construction module is configured to construct a virtual controller based on simulation software; wherein a virtual control project is created in the simulation software, the virtual control project including a carrier of a virtual electronic control unit, and the virtual controller including a microcontroller abstraction layer, a basic software layer, and an application layer; the source code of at least one software component and a description file of the at least one software component are imported into the virtual control project to obtain an updated virtual control project; an instance is created for each of the at least one software component, and the at least one software component is associated with at least one corresponding interface through a preset interface relationship table, the preset interface relationship table being included in the description file of the at least one software component; and the middleware source code, the interface configuration description file, and the description file of the microcontroller abstraction layer are imported into the updated virtual control project to obtain a virtual controller; A test version determination module is used to create at least two pipeline projects, configure parameters for one of the pipeline projects, determine the branch name, and determine the script branch and test version of the virtual controller based on the branch name; wherein, at least two pipeline projects are created based on Jenkins, a parameterized script branch is constructed in one of the pipeline projects, and the version number of the current build is determined based on the script branch, timestamp and build number of the current build; the preset application layer code is pulled according to the version number of the current build and stored in the designated slave node; the application layer code and the interface layer code of the virtual controller are packaged and compiled to obtain a binary file that conforms to the virtual environment; the product library interface is called to upload the binary file to obtain a test version library containing each of the test versions; The simulation test module uses another pipeline project to download and pull the test version associated with the virtual controller, uses the test version to perform simulation testing on the virtual controller, determines the simulation test results and outputs them.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the controller simulation virtualization testing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the controller simulation virtualization testing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Embedded software testing method capable of realizing multi-technology fusion
CN104598373A
Virtual controller simulation test method and system and storage medium
CN113946405A