A virtual simulation testing method and apparatus for vehicles
By using a virtual simulation method that generates code modules and custom test cases, the high cost of traditional HIL benches is solved, enabling comprehensive vehicle system simulation testing without hardware, reducing hardware costs and improving development efficiency.
Patent Information
- Application Number
- CN202410841353.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-06-26
AI Technical Summary
Traditional HIL test benches are expensive and cannot meet the needs of large-scale vehicle software testing, and hardware-in-the-loop simulation testing methods have great limitations.
By acquiring software component and interface information from the vehicle's ECU, code modules are generated and executable files are constructed. Data reading and writing are performed using a virtual function bus, and simulation tests are conducted using custom test cases, thus avoiding hardware dependencies.
Significantly reduces hardware costs, improves development efficiency, enables comprehensive vehicle system simulation testing, supports continuous integration regression testing, and improves software quality.
Smart Images

Figure CN118709410B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of vehicle simulation and vehicle software development technology, and in particular to a virtual simulation testing method and apparatus for vehicles. Background Technology
[0002] With the rapid development of intelligent connected vehicles, the architecture of automotive software controllers is becoming increasingly complex, and the pace of algorithm software updates and iterations is accelerating, which places higher demands on simulation testing methods. Comprehensive and efficient simulation testing has become crucial to ensuring software quality and system stability.
[0003] Currently, vehicle-level software testing primarily relies on Hardware-in-the-Loop (HIL) simulation testing methods. This method constructs a hardware platform that closely resembles a real vehicle, connecting the various Electronic Control Units (ECUs) under test (ECUs) via wiring harnesses according to the actual connection methods of the vehicle, enabling data communication. During testing, actual actuators (such as headlights, doors, and wipers) or virtual vehicle models are used to simulate the vehicle's real-world behavior. However, HIL bench construction requires a large amount of controller hardware and wiring harnesses, resulting in high costs and limited quantities, making it difficult to meet the needs of large-scale testing. Summary of the Invention
[0004] This disclosure provides a virtual simulation testing method and apparatus for vehicles, which at least solves the problems of high cost of traditional HIL test benches and large limitations of virtual simulation technology in related technologies.
[0005] The first aspect of this application proposes a virtual simulation testing method for a vehicle, comprising: acquiring the software components (SWCs) contained in each electronic control unit (ECU) within the application layer of the vehicle, and acquiring the interface information corresponding to the SWC interfaces contained in each SWC; generating a code module corresponding to each SWC based on the interface information, and generating an executable file for the vehicle based on the code module, wherein, in the executable file, data reading and writing between SWC interfaces with connection relationships are performed through read and write functions; generating test cases corresponding to the vehicle based on the vehicle's testing requirements; and calling the executable file to perform vehicle simulation testing based on the test cases.
[0006] According to one embodiment of this application, generating a code module corresponding to each SWC based on interface information includes: generating interface code corresponding to the SWC interface based on the interface information; obtaining the task function and logic configuration function corresponding to each SWC; and generating a code module corresponding to each SWC based on the interface code, task function, and logic configuration function.
[0007] According to one embodiment of this application, generating interface code corresponding to an SWC interface based on interface information includes: classifying SWC interfaces according to interface information to obtain the interface category corresponding to each SWC interface; and generating interface code corresponding to the SWC interface based on the interface category.
[0008] According to one embodiment of this application, SWC interfaces are classified according to interface information to obtain the interface category corresponding to each SWC interface, including: determining whether each SWC interface has a connection relationship with other SWC interfaces based on the interface information; in response to any SWC interface having a connection relationship with other SWC interfaces in the same ECU, or in response to any SWC interface having a connection relationship with other SWC interfaces in different ECUs, the SWC interface is designated as a first category interface.
[0009] According to one embodiment of this application, classifying SWC interfaces based on interface information and obtaining the interface category corresponding to each SWC interface further includes: in response to the absence of a connection relationship between any SWC interface and other SWC interfaces, and the existence of data interaction between the SWC interface and the hardware pin corresponding to its ECU, classifying the SWC interface as a second category interface.
[0010] According to one embodiment of this application, generating interface code corresponding to an SWC interface based on an interface category includes: in response to the SWC interface being a first-category interface and an output interface, generating a write function corresponding to the SWC interface, wherein each output interface corresponds to a unique first global variable, and the write function is used to write data to the global variable; in response to the SWC interface being a first-category interface and an input interface, generating a read function corresponding to the SWC interface, wherein the read function is used to read data based on the first global variable corresponding to the output interface connected to the SWC interface.
[0011] According to one embodiment of this application, the virtual simulation testing method for vehicles further includes: in response to the SWC interface being a second type interface and the SWC interface being an output interface, generating an assignment function corresponding to the SWC interface, the assignment function being used to simulate hardware response.
[0012] According to one embodiment of this application, the virtual simulation testing method for vehicles further includes: in response to the SWC interface being a second type of interface and the SWC interface being an input interface, defining a unique second global variable corresponding to the SWC interface, and writing the second global variable into the interface code corresponding to the SWC interface.
[0013] According to one embodiment of this application, the test case includes a second global variable, which is used to describe the assignment data of the hardware pins connected to the SWC interface corresponding to the second global variable.
[0014] According to one embodiment of this application, the task function corresponding to the SWC is used to: obtain first data read from all input interfaces related to the task process within the SWC in each function scheduling cycle of the task process corresponding to the task function; execute the task process according to the first data to obtain the generated second data; and write the second data into the first global variable corresponding to the output interface related to the task process within the SWC.
[0015] According to one embodiment of this application, the software components (SWCs) contained in each electronic control unit (ECU) within the application layer of the vehicle are obtained, and the interface information corresponding to the SWC interfaces contained in each SWC is obtained, including: obtaining the configuration file corresponding to the vehicle; parsing the configuration file to obtain the SWCs contained in each ECU within the application layer of the vehicle and the interface information corresponding to the SWC interfaces contained in each SWC.
[0016] A second aspect of this application provides a virtual simulation testing device for a vehicle, comprising: a first acquisition module, configured to acquire software components (SWCs) contained in each electronic control unit (ECU) within the application layer of the vehicle, and to acquire interface information corresponding to the SWC interfaces contained in each SWC; a file generation module, configured to generate a code module corresponding to each SWC based on the interface information, and to generate an executable file for the vehicle based on the code module, wherein data reading and writing between SWC interfaces with a connection relationship are performed through read and write functions in the executable file; a second acquisition module, configured to generate test cases corresponding to the vehicle based on the vehicle's testing requirements; and a simulation testing module, configured to call the executable file to perform vehicle simulation testing based on the test cases.
[0017] According to one embodiment of this application, the file generation module is further configured to: generate interface code corresponding to the SWC interface based on the interface information; obtain the task function and logic configuration function corresponding to each SWC; and generate the code module corresponding to each SWC based on the interface code, task function, and logic configuration function.
[0018] According to one embodiment of this application, the file generation module is further configured to: classify SWC interfaces according to interface information, obtain the interface category corresponding to each SWC interface; and generate the interface code corresponding to the SWC interface according to the interface category.
[0019] According to one embodiment of this application, the file generation module is further configured to: determine, based on the interface information, whether each SWC interface has a connection relationship with other SWC interfaces; and, in response to the existence of a connection relationship between any SWC interface and other SWC interfaces within the same ECU, or in response to the existence of a connection relationship between any SWC interface and other SWC interfaces within different ECUs, classify the SWC interface as a first category interface.
[0020] According to one embodiment of this application, the file generation module is further configured to: in response to the absence of a connection between any SWC interface and other SWC interfaces, and the existence of data interaction between the SWC interface and the hardware pin corresponding to its ECU, designate the SWC interface as a second type of interface.
[0021] According to one embodiment of this application, the file generation module is further configured to: generate a write function corresponding to the SWC interface in response to the SWC interface being a first type interface and the SWC interface being an output interface, wherein each output interface corresponds to a unique first global variable, and the write function is used to write data to the global variable; and generate a read function corresponding to the SWC interface in response to the SWC interface being a first type interface and the SWC interface being an input interface, wherein the read function is used to read data according to the first global variable corresponding to the output interface connected to the SWC interface.
[0022] According to one embodiment of this application, the file generation module is further configured to: in response to the SWC interface being a second type of interface and the SWC interface being an output interface, generate an assignment function corresponding to the SWC interface, the assignment function being used to simulate hardware response.
[0023] According to one embodiment of this application, the file generation module is further configured to: in response to the SWC interface being a second type of interface and the SWC interface being an input interface, define a unique second global variable corresponding to the SWC interface, and write the second global variable into the interface code corresponding to the SWC interface.
[0024] According to one embodiment of this application, the test cases mentioned in the second acquisition module include a second global variable, which is used to describe the assignment data of the hardware pins connected to the SWC interface corresponding to the second global variable.
[0025] According to one embodiment of this application, the task function corresponding to the SWC mentioned in the file generation module is used to: obtain the first data read from all input interfaces related to the task process in the SWC during each function scheduling cycle of the task process corresponding to the task function; execute the task process according to the first data to obtain the generated second data; and write the second data into the first global variable corresponding to the output interface related to the task process in the SWC.
[0026] According to one embodiment of this application, the first acquisition module is further configured to: acquire the configuration file corresponding to the vehicle; parse the configuration file to acquire the SWC contained in each ECU in the application layer of the vehicle and the interface information corresponding to the SWC interface contained in each SWC.
[0027] A third aspect of this application provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to implement a virtual simulation testing method for a vehicle as described in the first aspect of this application.
[0028] A fourth aspect of this application provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to implement a virtual simulation testing method for a vehicle as described in a first aspect of this application.
[0029] The fifth aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the virtual simulation testing method for vehicles as described in the first aspect of this application.
[0030] The technical solutions provided by the embodiments of this disclosure bring at least the following beneficial effects: This application integrates the application layer software in different ECUs together, and can customize the testing of various functional levels, improve development efficiency, and compared with the traditional HIL simulation testing method, can perform comprehensive simulation testing of vehicle systems without actual hardware, significantly reducing hardware costs.
[0031] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0032] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:
[0033] Figure 1 This is a schematic diagram illustrating an exemplary implementation of a virtual simulation testing method for a vehicle, as shown in one embodiment of this application.
[0034] Figure 2 This is a schematic diagram of a seat heating control (SWC) according to one embodiment of this application.
[0035] Figure 3 This is a schematic diagram of an AUTOSAR framework shown in one embodiment of this application.
[0036] Figure 4 This is a schematic diagram illustrating an embodiment of the present application of SWC connection via a virtual function bus.
[0037] Figure 5 This is a schematic diagram illustrating an exemplary implementation of a virtual simulation testing method for a vehicle, as shown in one embodiment of this application.
[0038] Figure 6 This is a general flowchart illustrating an exemplary implementation of a virtual simulation testing method for a vehicle, as shown in one embodiment of this application.
[0039] Figure 7 This is a schematic diagram of a virtual simulation testing device for a vehicle, as shown in one embodiment of this application.
[0040] Figure 8 This is a schematic diagram of an electronic device according to one embodiment of this application. Detailed Implementation
[0041] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein 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 intended to explain this application, and should not be construed as limiting this application.
[0042] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, data stored, data displayed, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0043] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.
[0044] Figure 1 This is a schematic diagram of an exemplary implementation of a virtual simulation testing method for vehicles shown in this application, such as... Figure 1 As shown, the virtual simulation testing method for this vehicle includes the following steps:
[0045] S101, obtain the software component SWC contained in each electronic control unit (ECU) within the vehicle's application layer, and obtain the interface information corresponding to the SWC interface contained in each SWC.
[0046] In a vehicle, the Electronic Control Unit (ECU) is responsible for controlling different subsystems, such as engine control, braking system, airbags, and entertainment system.
[0047] Each ECU contains one or more software components (SWCs).
[0048] Each SWC contains one or more SWC interfaces.
[0049] To facilitate understanding of SWC and the SWC interfaces it contains, Figure 2 This is a schematic diagram of a seat heating control (SWC) shown in this application, as follows: Figure 2 As shown, this SWC requires the following information as input:
[0050] 1. Are there any passengers seated? (via...) Figure 2 The interface shown is "SeatSwitch";
[0051] 2. Seat heating temperature setting (via Figure 2 The interface shown is "Setting";
[0052] 3. Power status (via Figure 2 The interface shown is "PowerManagement".
[0053] This SWC control:
[0054] 1. The DialLED indicator related to seat temperature adjustment (via...) Figure 2 The interface shown is "DialLED";
[0055] 2. Seat heating unit (via Figure 2 The interface shown is "HeatingElement".
[0056] Furthermore, the SWC also has a calibration function (via...). Figure 2 The interface shown, "Calibration," requires the ECU's status (via...). Figure 2 The interface shown, "ecuMode", also requires access to non-volatile memory (NVM) (via...). Figure 2 The interface shown is "nv"".
[0057] As one feasible approach, this application first obtains the vehicle's corresponding configuration file and parses it to obtain the SWCs contained in each ECU within the vehicle's application layer, as well as the interface information corresponding to the SWC interfaces contained in each SWC. The interface information includes the connection relationships between the SWC interfaces.
[0058] S102, generate code modules corresponding to each SWC based on the interface information, and generate an executable file for the vehicle based on the code modules. In the executable file, read and write functions are used to read and write data between SWC interfaces with connection relationships.
[0059] For ease of understanding, Figure 3 This application illustrates a schematic diagram of an AUTOSAR framework, as shown below. Figure 3 As shown, in the AUTOSAR architecture, a SWC can be a software module responsible for a specific function, such as an anti-lock braking system, traction control system, powertrain control, or body control. Each SWC has its own specific inputs, outputs, and internal behaviors. Each ECU has its own real-time operating environment (RTE), which acts as a bridge between the SWC and the basic software layer (BSW).
[0060] In this application, in order to implement the simulation test of the whole vehicle based on code without introducing a basic software layer and hardware layer, it is necessary to introduce the concept of Virtual Function Bus (VFB). Figure 4 This application illustrates a schematic diagram of SWC connection via a virtual function bus, as shown below. Figure 4 As shown, within the AUTOSAR framework, VFB provides an abstraction layer that allows SWCs to define their communication interfaces in a way that is independent of the physical network and ECU. SWCs connect through the VFB concept, meaning they can exchange data and make function calls according to predefined interfaces without directly concerning themselves with the underlying network protocols or hardware implementations. The goal of VFB is to decouple software components from the underlying hardware and network topology, enabling the design and development of software components to be independent of specific ECU and network configurations.
[0061] In the software development of vehicle electronic systems, each Service Controller (SWC) is written independently. These SWCs need to work collaboratively on the ECU, exchanging data through a specific communication protocol. To achieve this, during the build process, each SWC is compiled into a corresponding code module. Next, these code modules are linked together to form the final executable file. Within the executable file, read and write functions are used to read and write data between connected SWC interfaces. That is, by setting read and write functions for the SWC interfaces, data reading and writing between connected SWC interfaces is achieved, thus implementing the connection of the SWC interfaces at the code level.
[0062] S103 generates test cases corresponding to the vehicle based on the vehicle's testing requirements.
[0063] For example, test cases may include test cases for simulating vehicle collision conditions, test cases for simulating vehicle braking performance, test cases for testing vehicle acceleration performance, test cases for testing vehicle waterproofing performance, and so on.
[0064] S104, based on test cases, calls the executable file to perform vehicle simulation testing.
[0065] Virtual simulation testing involves using simulation tools or environments during software development to simulate the behavior of ECUs and SWCs without having to test them on real hardware.
[0066] This application proposes a virtual simulation testing method for vehicles, comprising: acquiring the software components (SWCs) contained in each Electronic Control Unit (ECU) within the vehicle's application layer, and acquiring the interface information corresponding to the SWC interfaces contained in each SWC; generating a code module corresponding to each SWC based on the interface information, and generating an executable file for the vehicle based on the code module, wherein data reading and writing between SWC interfaces with connection relationships are performed through read and write functions in the executable file; generating test cases corresponding to the vehicle based on the vehicle's testing requirements; and calling the executable file to perform vehicle simulation testing based on the test cases. This application integrates the application layer software in different ECUs together, allowing for customized testing at various functional levels, improving development efficiency. Compared to the traditional HIL simulation testing method, it enables comprehensive simulation testing of the vehicle system without actual hardware, significantly reducing hardware costs.
[0067] Furthermore, the virtual simulation testing method for vehicles proposed in this application can be combined with continuous integration technology to automatically perform regression testing on the functions of the entire vehicle after each software release, thereby improving software quality.
[0068] Figure 5 This is a schematic diagram of an exemplary implementation of a virtual simulation testing method for vehicles shown in this application, such as... Figure 5 As shown, the virtual simulation testing method for this vehicle includes the following steps:
[0069] S501, obtain the software components SWC contained in each electronic control unit (ECU) within the vehicle's application layer, and obtain the interface information corresponding to the SWC interfaces contained in each SWC.
[0070] S502, classify the SWC interfaces according to the interface information and obtain the interface category corresponding to each SWC interface.
[0071] In this application, it is necessary to generate the interface code corresponding to the SWC interface based on the interface information obtained above.
[0072] First, based on the interface information, determine whether each SWC interface has a connection relationship with other SWC interfaces.
[0073] If any SWC interface is connected to other SWC interfaces within the same ECU, or if any SWC interface is connected to other SWC interfaces within different ECUs, then that SWC interface is classified as a first-category interface.
[0074] Among them, SWC interfaces that are connected to other SWC interfaces within the same ECU are mainly used for data communication within the same ECU. Through this interface, application-layer SWCs can share information and coordinate their work. For example, within the same ECU, one SWC may be responsible for calculating the vehicle speed, and another SWC may need this speed data to adjust the braking system's response.
[0075] Among them, the SWC interface that has a connection relationship with other SWC interfaces in different ECUs is mainly used for data communication between different ECUs.
[0076] If any SWC interface is not connected to any other SWC interface, but the SWC interface interacts with the hardware pins of its corresponding ECU, the SWC interface is classified as a second-category interface. For example, interfaces that need to acquire external sensor data (such as temperature and pressure sensor signals) or control actuators (such as motors and relays) belong to the second-category interface.
[0077] S503 generates the interface code corresponding to the SWC interface based on the interface category.
[0078] If the SWC interface is a first-class interface and an output interface, generate a write function corresponding to the SWC interface. Each output interface corresponds to a unique first global variable, and the write function is used to write data to the global variable.
[0079] If the SWC interface is a first-category interface and is an input interface, generate a read function corresponding to the SWC interface. The read function is used to read data based on the first global variable corresponding to the output interface connected to the SWC interface.
[0080] If the SWC interface is a second-category interface and is an output interface, such as an SWC interface for driving a motor or controlling the opening and closing of doors and windows, since this application does not set up a hardware layer, an assignment function corresponding to the SWC interface is generated. The assignment function is used to simulate hardware response. This SWC interface also has a unique first global variable.
[0081] If the SWC interface is a second-category interface and is an input interface, such as an SWC interface that needs to acquire external sensor data (e.g., temperature or pressure sensor signals), then define a unique second global variable corresponding to the SWC interface and write the second global variable into the interface code corresponding to the SWC interface.
[0082] Each output interface corresponds to one or more input interfaces.
[0083] S504 retrieves the task function and logic configuration function corresponding to each SWC.
[0084] In this context, task functions refer to the code units within the SWC that actually perform specific functionalities. These functions can be periodically invoked by the scheduler to execute specific tasks.
[0085] The logical configuration functions are used to configure and initialize the SWC. These functions define the initial state, parameter configuration, and runtime behavior logic of the SWC.
[0086] S505 generates the code module corresponding to each SWC based on the interface code, task function, and logic configuration function.
[0087] Taking the data reading process of each SWC as an example, the task function corresponding to the SWC is used to: obtain the first data read from all input interfaces related to the task process within the SWC in each function scheduling cycle of the task process corresponding to the task function; execute the task process according to the first data to obtain the generated second data; and write the second data into the first global variable corresponding to the output interface related to the task process within the SWC.
[0088] S506 generates vehicle executable files based on code modules.
[0089] The code modules of all SWCs in the vehicle are combined to generate the vehicle's executable file.
[0090] S507 generates test cases corresponding to the vehicle based on the vehicle's testing requirements.
[0091] Specifically, the test case needs to include the unique second global variable corresponding to the SWC interface, which belongs to the second category of interfaces and is an input interface. This second global variable describes the assigned values of the hardware pins connected to the SWC interface corresponding to it. For example, it can directly assign values to the temperature and pressure collected by an external sensor connected to the SWC interface.
[0092] S508, based on test cases, calls executable files to perform vehicle simulation tests.
[0093] This application describes in detail the code module generation process for each SWC, especially the generation process of the function corresponding to each SWC interface. The connection between SWC interfaces at the code level is realized through the read and write functions corresponding to the SWC interfaces. Various functional levels of testing can be customized, improving development efficiency. Compared with the traditional HIL simulation testing method, it can perform comprehensive simulation testing of the vehicle system without actual hardware, significantly reducing hardware costs.
[0094] Figure 6 This is a general flowchart of an exemplary implementation of a virtual simulation testing method for vehicles shown in this application, as follows: Figure 6 As shown, the virtual simulation testing method for this vehicle includes the following steps:
[0095] S601, obtain the software components SWC contained in each electronic control unit (ECU) within the vehicle's application layer, and obtain the interface information corresponding to the SWC interfaces contained in each SWC.
[0096] S602 determines, based on the interface information, whether each SWC interface has a connection relationship with other SWC interfaces.
[0097] S603, in response to the existence of a connection relationship between any SWC interface and other SWC interfaces within the same ECU, or in response to the existence of a connection relationship between any SWC interface and other SWC interfaces within different ECUs, designates the SWC interface as a first-category interface.
[0098] S604, in response to the fact that there is no connection between any SWC interface and other SWC interfaces, and that the SWC interface has data interaction with the hardware pins corresponding to its ECU, the SWC interface is designated as a second type of interface.
[0099] S605, in response to the SWC interface being a first-class interface and an output interface, generates the write function corresponding to the SWC interface.
[0100] Each output interface corresponds to a unique first global variable, and the write function is used to write data to the global variable.
[0101] S606, in response to the SWC interface being a first-class interface and the SWC interface being an input interface, generates the read function corresponding to the SWC interface.
[0102] The read function is used to read data based on the first global variable corresponding to the output interface connected to the SWC interface.
[0103] S607, in response to the SWC interface being a second-class interface and an output interface, generates an assignment function corresponding to the SWC interface. The assignment function is used to simulate hardware response.
[0104] S608, in response to the SWC interface being a second-class interface and an input interface, defines a unique second global variable corresponding to the SWC interface and writes the second global variable into the interface code corresponding to the SWC interface.
[0105] For details on the specific implementation of steps S601 to S608, please refer to the relevant parts of the above embodiments, which will not be repeated here.
[0106] S609, obtain the task function and logic configuration function corresponding to each SWC.
[0107] S610 generates the code module corresponding to each SWC based on the interface code, task function, and logic configuration function.
[0108] S611 generates the vehicle's executable file based on the code module.
[0109] S612 generates test cases corresponding to the vehicle based on the vehicle's testing requirements.
[0110] S613, based on test cases, calls the executable file to perform vehicle simulation testing.
[0111] This application describes in detail the code module generation process for each SWC, especially the generation process of the function corresponding to each SWC interface. The connection between SWC interfaces at the code level is realized through the read and write functions corresponding to the SWC interfaces. Various functional levels of testing can be customized, improving development efficiency. Compared with the traditional HIL simulation testing method, it can perform comprehensive simulation testing of the vehicle system without actual hardware, significantly reducing hardware costs.
[0112] Figure 7 This is a schematic diagram of a virtual simulation testing device for a vehicle shown in this application, such as... Figure 7 As shown, the virtual simulation testing device 700 for the vehicle includes a first acquisition module 701, a file generation module 702, a second acquisition module 703, and a simulation testing module 704, wherein:
[0113] The first acquisition module 701 is used to acquire the software components SWC contained in each electronic control unit (ECU) within the application layer of the vehicle, and to acquire the interface information corresponding to the SWC interfaces contained in each SWC.
[0114] The file generation module 702 is used to generate a code module corresponding to each SWC based on the interface information, and to generate an executable file for the vehicle based on the code module. In the executable file, data reading and writing between SWC interfaces with connection relationships are performed through read and write functions.
[0115] The second acquisition module 703 is used to generate test cases corresponding to the vehicle based on the vehicle's testing requirements.
[0116] The simulation test module 704 is used to call an executable file to perform vehicle simulation tests based on test cases.
[0117] This device integrates application-level software from different ECUs, allowing for customized testing at various functional levels, thus improving development efficiency. Compared to traditional HIL simulation testing methods, it enables comprehensive simulation testing of vehicle systems without actual hardware, significantly reducing hardware costs.
[0118] Furthermore, the file generation module 702 is also used to: generate interface code corresponding to the SWC interface based on the interface information; obtain the task function and logic configuration function corresponding to each SWC; and generate the code module corresponding to each SWC based on the interface code, task function, and logic configuration function.
[0119] Furthermore, the file generation module 702 is also used to: classify SWC interfaces according to interface information, obtain the interface category corresponding to each SWC interface; and generate the interface code corresponding to the SWC interface according to the interface category.
[0120] Furthermore, the document generation module 702 is also used to: determine whether each SWC interface has a connection relationship with other SWC interfaces based on the interface information; and in response to the existence of a connection relationship between any SWC interface and other SWC interfaces within the same ECU, or in response to the existence of a connection relationship between any SWC interface and other SWC interfaces within different ECUs, designate the SWC interface as a first category interface.
[0121] Furthermore, the file generation module 702 is also used to: in response to the fact that there is no connection between any SWC interface and other SWC interfaces, and that the SWC interface has data interaction with the hardware pins corresponding to its ECU, the SWC interface is regarded as a second type of interface.
[0122] Furthermore, the file generation module 702 is also used to: generate a write function corresponding to the SWC interface in response to the SWC interface being a first-category interface and the SWC interface being an output interface, wherein each output interface corresponds to a unique first global variable, and the write function is used to write data to the global variable; and generate a read function corresponding to the SWC interface in response to the SWC interface being a first-category interface and the SWC interface being an input interface, wherein the read function is used to read data according to the first global variable corresponding to the output interface connected to the SWC interface.
[0123] Furthermore, the file generation module 702 is also used to: generate an assignment function corresponding to the SWC interface in response to the SWC interface being a second-category interface and the SWC interface being an output interface, the assignment function being used to simulate hardware response.
[0124] Furthermore, the file generation module 702 is also used to: in response to the SWC interface being a second type interface and the SWC interface being an input interface, define a unique second global variable corresponding to the SWC interface, and write the second global variable into the interface code corresponding to the SWC interface.
[0125] Furthermore, the test cases mentioned in the second acquisition module 703 include a second global variable, which is used to describe the assignment data of the hardware pins connected to the SWC interface corresponding to the second global variable.
[0126] Furthermore, the task function corresponding to SWC mentioned in the file generation module 702 is used to: obtain the first data read from all input interfaces related to the task process within SWC in each function scheduling cycle of the task process corresponding to the task function; execute the task process according to the first data to obtain the generated second data; and write the second data into the first global variable corresponding to the output interface related to the task process within SWC.
[0127] Furthermore, the first acquisition module 701 is also used to: acquire the configuration file corresponding to the vehicle; parse the configuration file to acquire the SWC contained in each ECU in the application layer of the vehicle and the interface information corresponding to the SWC interface contained in each SWC.
[0128] To implement the above embodiments, this application also proposes an electronic device 800, such as... Figure 8 As shown, the electronic device 800 includes a processor 801 and a memory 802 communicatively connected to the processor. The memory 802 stores instructions that can be executed by at least one processor. The instructions are executed by at least one processor 801 to implement the virtual simulation test method for a vehicle as shown in the above embodiment.
[0129] To implement the above embodiments, this application also proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to implement the virtual simulation testing method for a vehicle as shown in the above embodiments.
[0130] To implement the above embodiments, this application also proposes a computer program product, including a computer program that, when executed by a processor, implements the virtual simulation testing method for vehicles as shown in the above embodiments.
[0131] In the description of this application, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc., indicating the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application.
[0132] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0133] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0134] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.
[0135] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.
Claims
1. A virtual simulation testing method for vehicles, characterized in that, include: Obtain the software components (SWCs) contained in each electronic control unit (ECU) within the vehicle's application layer, and obtain the interface information corresponding to the SWC interfaces contained in each of the SWCs; The SWC interfaces are classified according to the interface information to obtain the interface category corresponding to each SWC interface; Generate the interface code corresponding to each SWC according to the interface category; Generate the code module corresponding to each SWC based on the interface code; The code modules of all SWCs in the vehicle are connected through the Virtual Function Bus (VFB) to generate the executable file of the vehicle. In the executable file, data reading and writing between SWC interfaces with connection relationship are performed through read and write functions. When the data reading and writing between the SWC interfaces is performed, it does not go through the basic software layer (BSW). Generate test cases for the vehicle based on the vehicle's testing requirements. Based on the test cases, the executable file is invoked to perform simulation testing of the vehicle.
2. The method according to claim 1, characterized in that, The step of generating the code module corresponding to each SWC based on the interface code includes: Obtain the task function and logic configuration function corresponding to each SWC; Based on the interface code, the task function, and the logic configuration function, generate the code module corresponding to each SWC.
3. The method according to claim 2, characterized in that, The step of classifying the SWC interfaces according to the interface information to obtain the interface category corresponding to each SWC interface includes: Based on the interface information, determine whether each SWC interface has a connection relationship with other SWC interfaces; In response to the existence of a connection between any of the SWC interfaces and other SWC interfaces within the same ECU, or in response to the existence of a connection between any of the SWC interfaces and other SWC interfaces within different ECUs, the SWC interface is designated as a first category interface.
4. The method according to claim 3, characterized in that, The method further includes: In response to the absence of a connection between any of the SWC interfaces and other SWC interfaces, and the existence of data interaction between the SWC interface and the hardware pins corresponding to its ECU, the SWC interface is designated as a second type of interface.
5. The method according to claim 4, characterized in that, The step of generating the interface code corresponding to the SWC interface according to the interface category includes: In response to the SWC interface being a first-category interface and the SWC interface being an output interface, a write function corresponding to the SWC interface is generated, wherein each output interface corresponds to a unique first global variable, and the write function is used to write data to the global variable; In response to the SWC interface being a first-category interface and the SWC interface being an input interface, a read function corresponding to the SWC interface is generated, wherein the read function is used to read data according to the first global variable corresponding to the output interface connected to the SWC interface.
6. The method according to claim 5, characterized in that, The method further includes: In response to the fact that the SWC interface is a second-category interface and the SWC interface is an output interface, an assignment function corresponding to the SWC interface is generated, and the assignment function is used to simulate hardware response.
7. The method according to claim 5, characterized in that, The method further includes: In response to the SWC interface being a second type of interface and the SWC interface being an input interface, a unique second global variable corresponding to the SWC interface is defined, and the second global variable is written into the interface code corresponding to the SWC interface.
8. The method according to claim 7, characterized in that, The test case includes the second global variable, which is used to describe the assigned data of the hardware pins connected to the SWC interface corresponding to the second global variable.
9. The method according to any one of claims 5-8, characterized in that, The task function corresponding to the SWC is used for: In each function scheduling cycle of the task process corresponding to the task function, the first data read from all input interfaces related to the task process within the SWC is obtained; The task process is executed based on the first data to obtain the generated second data; Write the second data into the first global variable corresponding to the output interface related to the task process within the SWC.
10. The method according to claim 1, characterized in that, The acquisition of the software components (SWCs) contained in each electronic control unit (ECU) within the vehicle's application layer, and the acquisition of the interface information corresponding to the SWC interfaces contained in each SWC, include: Obtain the configuration file corresponding to the vehicle; The configuration file is parsed to obtain the SWCs contained in each ECU within the vehicle's application layer and the interface information corresponding to the SWC interfaces contained in each SWC.
11. A virtual simulation testing device for vehicles, characterized in that, include: The first acquisition module is used to acquire the software component SWC contained in each electronic control unit (ECU) within the application layer of the vehicle, and to acquire the interface information corresponding to the SWC interface contained in each SWC. The file generation module is used to classify the SWC interfaces according to the interface information and obtain the interface category corresponding to each SWC interface; Generate the interface code corresponding to each SWC according to the interface category; Generate the code module corresponding to each SWC based on the interface code; The code modules of all SWCs in the vehicle are connected through the Virtual Function Bus (VFB) to generate the executable file of the vehicle. In the executable file, data reading and writing between SWC interfaces with connection relationship are performed through read and write functions. When the data reading and writing between the SWC interfaces is performed, it does not go through the basic software layer (BSW). The second acquisition module is used to generate test cases corresponding to the vehicle based on the vehicle's testing requirements. The simulation testing module is used to call the executable file to perform simulation testing of the vehicle based on the test cases.
12. An electronic device, comprising: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method of any one of claims 1-10.
13. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-10.
14. A computer program product comprising a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1-10.
Citation Information
Patent Citations
KR20240009783A