Simulation test method, device and equipment of vehicle device, medium and product
By decompressing, parsing, and compiling FMU files in an embedded device, generating variable mapping relationships, and running instances in a loop, the problem of low efficiency in vehicle component simulation testing in existing technologies is solved, and an efficient testing process is achieved.
Patent Information
- Application Number
- CN202511665739.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-13
- Publication Date
- 2026-02-06
AI Technical Summary
In existing technologies, vehicle component simulation testing requires transporting the components to the site where the simulator is located, resulting in low testing efficiency and high costs.
The test is conducted using a portable embedded device. The FMU file is decompressed, parsed, and compiled using a tool service to generate a mapping relationship between input and output variables. The FMU instance is then run in a loop to interact with vehicle devices and generate test results.
It improves testing efficiency, reduces costs, and eliminates the need to transport vehicle components and build HIL systems.
Smart Images

Figure CN121479934A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of vehicle technology, and in particular to a simulation testing method, apparatus, equipment, medium, and product for vehicle components. Background Technology
[0002] With the continuous development of technology, there are more and more ways to test vehicle components, evolving from real vehicle testing to simulation testing.
[0003] In existing technologies, testing vehicle components typically requires building a Hardware-in-the-Loop (HIL) test system. This system includes a powerful simulator containing Functional Mock-up Unit (FMU) models, which are simulation models of the vehicle components related to the vehicle component. The vehicle component is transported to the simulator's location, and the simulator connects to the component. The simulator then runs the FMU model to interact with the vehicle component and perform testing.
[0004] In summary, the existing technology of using simulators for simulation testing requires transporting vehicle components to the simulator's location, resulting in low testing efficiency. Summary of the Invention
[0005] The simulation testing method, apparatus, equipment, medium, and product for vehicle components provided in this application are intended to solve the problem of low testing efficiency caused by the need to transport vehicle components to the location of the simulator in the prior art when using a simulator for simulation testing.
[0006] In a first aspect, embodiments of this application provide a simulation testing method for vehicle components, applied to a movable embedded device connected to the vehicle components, the method comprising:
[0007] The tool service is used to decompress, parse, and compile at least one functional model unit (FMU) file to obtain the input variables, output variables, and compiled file of each FMU file.
[0008] Based on the obtained configuration file and the input and output variables of each FMU file, generate the input variable mapping relationship and output variable mapping relationship for each FMU file;
[0009] The compilation file of each FMU file is instantiated to obtain an FMU instance for each FMU file;
[0010] For each FMU file, based on the input variable mapping relationship and output variable mapping relationship of the FMU file, the FMU instance of the FMU file is run in a loop and interacts with the vehicle device to obtain the sub-test results corresponding to the FMU file;
[0011] Test results are generated based on the sub-test results corresponding to each FMU file.
[0012] In one possible implementation, for each FMU file, the input variable mapping relationship of the FMU file is the mapping relationship between the input variables of the FMU file and the data source;
[0013] For each FMU file, the output variable mapping relationship of the FMU file is the mapping relationship between the output variables of the FMU file and the data consumer;
[0014] The data source and data consumer are shared memory addresses of the hardware abstraction layer interface or the test software, and the hardware abstraction layer interface is the data interface corresponding to the vehicle device.
[0015] In one possible implementation, for each FMU file, the subtest result corresponding to the FMU file includes the values of the input variables and the values of the output variables of the FMU file in each loop.
[0016] In one possible implementation, the step of cyclically running the FMU instance in the FMU file and interacting with the vehicle device based on the input variable mapping relationship and output variable mapping relationship of the FMU file includes:
[0017] Each loop process is as follows:
[0018] When the loop start time of the loop process is reached at the current time, the value of each input variable of the FMU file is obtained from the data source according to the input variable mapping relationship of the FMU file;
[0019] Based on the value of each input variable, run the FMU instance of the FMU file to obtain the value of each output variable of the FMU file;
[0020] Based on the output variable mapping relationship of the FMU file, the value of each output variable of the FMU file is transmitted to the data consumer;
[0021] Adding the loop start time to the loop interval in the configuration file yields the loop start time of the next loop in the given loop process.
[0022] In one possible implementation, obtaining the value of each input variable of the FMU file from the data source according to the input variable mapping relationship of the FMU file includes:
[0023] For each input variable in the FMU file, according to the input variable mapping relationship in the FMU file, if it is determined that the data source corresponding to the input variable is a hardware abstraction layer interface, then the value of the input variable is obtained from the vehicle device by interacting with the vehicle device through the hardware abstraction layer interface.
[0024] For each input variable in the FMU file, if the data source corresponding to the input variable is determined to be the shared memory address of the test software according to the input variable mapping relationship in the FMU file, then the value of the input variable is obtained from the memory unit corresponding to the shared memory address.
[0025] In one possible implementation, according to the output variable mapping relationship of the FMU file, the value of each output variable of the FMU file is transmitted to the data consumer, including:
[0026] For each output variable in the FMU file, if the data consumer corresponding to the output variable is determined to be a hardware abstraction layer interface, then the value of the output variable is transmitted to the vehicle device through the hardware abstraction layer interface.
[0027] For each output variable in the FMU file, if the data consumer corresponding to the output variable is determined to be the shared memory address of the test software, the value of the output variable is stored in the memory unit corresponding to the shared memory address.
[0028] In one possible implementation, the method further includes:
[0029] The timer starts when the current loop begins at the current moment.
[0030] The step of adding the loop start time to the loop interval duration in the configuration file to obtain the loop start time of the next loop process of the current loop process includes:
[0031] If the current timing duration is less than the loop interval duration, then the loop start time is added to the loop interval duration in the configuration file to obtain the loop start time of the next loop process of the current loop process.
[0032] In one possible implementation, the method further includes:
[0033] If the current timing duration is greater than or equal to the cycle interval duration, the test will stop and an alarm message will be output.
[0034] Secondly, embodiments of this application provide a simulation testing apparatus for vehicle components, comprising:
[0035] Processing module, used for:
[0036] The tool service is used to decompress, parse, and compile at least one functional model unit (FMU) file to obtain the input variables, output variables, and compiled file of each FMU file.
[0037] Based on the obtained configuration file and the input and output variables of each FMU file, generate the input variable mapping relationship and output variable mapping relationship for each FMU file;
[0038] The compilation file of each FMU file is instantiated to obtain an FMU instance for each FMU file;
[0039] The test module is used for:
[0040] For each FMU file, based on the input variable mapping relationship and output variable mapping relationship of the FMU file, the FMU instance of the FMU file is run in a loop and interacts with the vehicle device to obtain the sub-test results corresponding to the FMU file;
[0041] Test results are generated based on the sub-test results corresponding to each FMU file.
[0042] Thirdly, embodiments of this application provide an embedded device, including:
[0043] Processor, memory, communication interface;
[0044] The memory is used to store the executable instructions of the processor;
[0045] The processor is configured to execute the simulation test method for the vehicle device according to any one of the first aspects by executing the executable instructions.
[0046] Fourthly, embodiments of this application provide a readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the simulation testing method for vehicle devices as described in any of the first aspects.
[0047] Fifthly, embodiments of this application provide a computer program product, including a computer program, which, when executed by a processor, is used to implement the simulation testing method for vehicle devices as described in any of the first aspects.
[0048] The simulation testing method, apparatus, equipment, medium, and product for vehicle devices provided in this application embodiment first decompresses, parses, and compiles the FMU file using a portable embedded device via a tool service to obtain input variables, output variables, and a compiled file. Then, it combines this with a configuration file to generate input variable mapping relationships and output variable mapping relationships for the FMU file. After instantiating the compiled file to obtain an FMU instance, it iteratively runs the FMU instance and interacts with the vehicle device based on the input and output variable mapping relationships to obtain sub-test results corresponding to the FMU file. Finally, it generates test results based on the sub-test results corresponding to each FMU file. This solution improves testing efficiency by using a portable embedded device and completing the test through tool services and mapping relationships. Attached Figure Description
[0049] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0050] Figure 1 A flowchart illustrating an embodiment of the simulation testing method for vehicle components provided in this application;
[0051] Figure 2 This is a schematic diagram of the architecture of the simulation test system provided in this application;
[0052] Figure 3 A flowchart illustrating one cycle provided for this application;
[0053] Figure 4 A schematic diagram of the structure of an embodiment of a simulation testing device for vehicle components provided in this application;
[0054] Figure 5 This is a schematic diagram of the structure of an embedded device provided in this application.
[0055] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0056] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0057] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0058] For vehicle safety, it is necessary to test vehicle components, which can include electronic control units (ECUs), microcontroller units (MCUs), microprocessor units (MPUs), sensors, actuators, etc.
[0059] In existing technologies, testing of vehicle components typically requires building a Hardware-in-the-Loop (HIL) test system. This system includes a powerful simulator containing Functional Mock-up Units (FMUs), which are simulation models of the vehicle components related to the vehicle component. The vehicle component is then transported to the simulator's location, and the simulator connects to the component, running the FMU model to interact with it and perform testing. Because simulation testing requires transporting the vehicle component to the simulator's location, it leads to low testing efficiency and high costs.
[0060] To address the problems existing in the prior art, the inventors, during their research on simulation testing methods for vehicle components, discovered that portable embedded devices can be used for testing to improve testing efficiency and reduce costs. During testing, the portable embedded device first decompresses, parses, and compiles the FMU file using a tool service, obtaining input variables, output variables, and a compiled file. Then, it combines this with a configuration file to generate the input and output variable mapping relationships for the FMU file. After instantiating the compiled file to obtain an FMU instance, the FMU instance is run cyclically and interacts with the vehicle component based on the input and output variable mapping relationships, obtaining the sub-test results corresponding to the FMU file. Finally, the test results are generated based on the sub-test results corresponding to each FMU file. This eliminates the need to transport the vehicle component and build a HIL system, improving testing efficiency and reducing costs. Based on the above inventive concept, the simulation testing scheme for vehicle components in this application was designed.
[0061] The following provides examples illustrating the application scenarios of the simulation testing method for vehicle components provided in this application.
[0062] For example, in this application scenario, the user needs to test the ECU regarding engine-related tests. The ECU is connected to an embedded device, which deploys the FMU file of the engine's FMU model. The user inputs the configuration file into the embedded device.
[0063] The embedded device uses a tool service to decompress, parse, and compile the FMU file to obtain the input variables, output variables, and compiled files of the FMU file.
[0064] Then, based on the configuration file and the input and output variables of the FMU file, the input variable mapping relationship and output variable mapping relationship of the FMU file are generated; the compiled file of the FMU file is instantiated to obtain the FMU instance of the FMU file.
[0065] Then, based on the input and output variable mapping relationships of the FMU file, the FMU instance of the FMU file is run in a loop and interacts with the ECU to obtain the sub-test results corresponding to the FMU file.
[0066] Since there is only one FMU file, the sub-test results corresponding to that FMU file are used as the test results.
[0067] Users can obtain test results from embedded devices to determine whether the ECU is functioning correctly.
[0068] It should be noted that the above scenario is only an example of an application scenario provided by the embodiments of this application. The embodiments of this application do not limit the actual form of the various devices included in the scenario, nor do they limit the interaction method between devices. In the specific application of the solution, it can be set according to actual needs.
[0069] The technical solution of this application will now be described in detail through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0070] Figure 1 This is a flowchart illustrating an embodiment of the simulation testing method for vehicle components provided in this application. This embodiment describes how an embedded device tests a vehicle component using tool services, input variable mapping relationships, and output variable mapping relationships. The method in this embodiment can be implemented through software, hardware, or a combination of both. Figure 1 As shown, the simulation testing method for this vehicle component specifically includes the following steps:
[0071] S101: Decompress, parse, and compile at least one FMU file obtained through the tool service to obtain the input variables, output variables, and compiled files of each FMU file.
[0072] To test vehicle components using embedded devices, users connect the embedded devices to the vehicle components, deploy the FMU files used for testing in the embedded devices, and also input the configuration files into the embedded devices.
[0073] In this step, the embedded device begins testing by decompressing, parsing, and compiling at least one FMU file using a tool service to obtain the input variables, output variables, and compiled files for each FMU file.
[0074] Since the FMU file is a compressed archive, it needs to be decompressed to obtain the data. After decompression, it needs to be parsed to obtain the input and output variables. Finally, the decompressed FMU file needs to be compiled to generate an FMU instance.
[0075] Tool services are software or scripts pre-configured in embedded devices for decompression, parsing, and compilation. Since embedded devices lack file systems and dynamic loaders, tool services are required for decompression, parsing, and compilation.
[0076] S102: Based on the obtained configuration file and the input and output variables of each FMU file, generate the input variable mapping relationship and output variable mapping relationship for each FMU file.
[0077] In this step, after the embedded device obtains the input and output variables of each FMU file, in order to perform subsequent testing, it needs to generate the input variable mapping relationship and output variable mapping relationship of each FMU file based on the obtained configuration file and the input and output variables of each FMU file.
[0078] For each FMU file, the input variable mapping relationship of the FMU file is the mapping relationship between the input variables of the FMU file and the data source.
[0079] For each FMU file, the mapping relationship of the output variables of the FMU file is the mapping relationship between the output variables of the FMU file and the data consumers.
[0080] Among them, the data source and data consumer are the shared memory addresses of the hardware abstraction layer interface or the test software, and the hardware abstraction layer interface is the data interface corresponding to the vehicle device.
[0081] Since the configuration file includes each input variable of each FMU file and its corresponding data source, as well as each output variable of each FMU file and its corresponding data consumer, input variable mapping relationships and output variable mapping relationships can be generated.
[0082] It should be noted that the test software is the software that exchanges data with the FMU instance during the test. The test software can run based on the data output by the FMU instance, and the FMU instance can run based on the data output by the test software.
[0083] S103: Instantiate the compilation file of each FMU file to obtain an FMU instance for each FMU file.
[0084] In this step, after the embedded device obtains the compiled file of the FMU file, it needs to instantiate the compiled file of each FMU file in order to perform subsequent testing, so as to obtain the FMU instance of each FMU file.
[0085] It should be noted that the execution order of steps S102 and S103 can be as follows: step S102 can be executed first, followed by step S103; step S103 can be executed first, followed by step S102; or steps S102 and S103 can be executed simultaneously. This embodiment does not limit the execution order of steps S102 and S103, and it can be determined according to the actual situation.
[0086] S104: For each FMU file, based on the input variable mapping relationship and output variable mapping relationship of the FMU file, run the FMU instance of the FMU file in a loop and interact with the vehicle device to obtain the sub-test results corresponding to the FMU file.
[0087] In this step, after the embedded device generates the FMU instance, input variable mapping relationship, and output variable mapping relationship, for each FMU file, according to the input variable mapping relationship and output variable mapping relationship of the FMU file, the FMU instance of the FMU file is run in a loop and interacts with the vehicle device to obtain the sub-test results corresponding to the FMU file.
[0088] For each FMU file, the subtest results corresponding to that FMU file include the values of the input variables and the values of the output variables of that FMU file in each loop.
[0089] Specifically, each loop process is as follows:
[0090] When the current time reaches the start time of the loop process, the value of each input variable of the FMU file is obtained from the data source according to the input variable mapping relationship of the FMU file.
[0091] Based on the value of each input variable, run the FMU instance of the FMU file to obtain the value of each output variable of the FMU file.
[0092] Based on the output variable mapping relationship of the FMU file, the value of each output variable of the FMU file is transmitted to the data consumer.
[0093] Add the loop start time to the loop interval in the configuration file to get the start time of the next loop in the current loop process.
[0094] Specifically, based on the input variable mapping relationship of the FMU file, the method for obtaining the value of each input variable of the FMU file from the data source is as follows:
[0095] For each input variable in the FMU file, if the data source corresponding to the input variable is determined to be the hardware abstraction layer interface according to the input variable mapping relationship in the FMU file, then the value of the input variable is obtained from the vehicle device by interacting with the vehicle device through the hardware abstraction layer interface.
[0096] For each input variable in the FMU file, if the data source corresponding to the input variable is determined to be the shared memory address of the test software, based on the input variable mapping relationship in the FMU file, the value of the input variable is obtained from the memory unit corresponding to the shared memory address.
[0097] Based on the output variable mapping relationship of the FMU file, the method for transmitting the value of each output variable of the FMU file to the data consumer is as follows:
[0098] For each output variable in the FMU file, if the data consumer corresponding to the output variable is determined to be a hardware abstraction layer interface, then the value of the output variable is transmitted to the vehicle device through the hardware abstraction layer interface.
[0099] For each output variable in the FMU file, if the data consumer corresponding to the output variable is determined to be the shared memory address of the test software, the value of the output variable is stored in the memory unit corresponding to the shared memory address.
[0100] It should be noted that for the first loop process, the loop starts at the current time, so the first loop process will be executed immediately without waiting.
[0101] It should be noted that the configuration file also includes a loop end time; when the current time reaches the loop end time, the loop process ends.
[0102] S105: Generate test results based on the sub-test results corresponding to each FMU file.
[0103] In this step, after the embedded device obtains the sub-test results corresponding to each FMU file, it combines the sub-test results of each FMU file to obtain the test results. Users can then use the test results to determine whether there are any abnormalities in the vehicle components.
[0104] In one implementation, steps S102-S105 can be implemented through a scheduling service in the embedded device, which is created and initialized when the embedded device is powered on. During compilation, the scheduling service, the decompressed FMU file, and the test software can be compiled together into a firmware image.
[0105] For example, Figure 2 The schematic diagram of the simulation test system provided in this application is as follows: Figure 2 As shown, the vehicle components are connected to an embedded device, which includes a hardware abstraction layer interface, tool services, a scheduling service, test software, and an FMU instance. The tool services decompress, parse, and compile the FMU file, obtaining input variables, output variables, and the compiled file, which are then transmitted to the scheduling service. The scheduling service generates input variable mapping relationships, output variable mapping relationships, and the FMU instance based on this data. Furthermore, the scheduling service, based on the input and output variable mapping relationships, runs the FMU instance cyclically and interacts with the vehicle components and the test software through the hardware abstraction layer interface to obtain sub-test results.
[0106] For example, in Figure 2 On this basis, Figure 3 A flowchart illustrating one cycle provided for this application is shown below. Figure 3As shown, for each input variable in the FMU file, the scheduling service, based on the input variable mapping relationship of the FMU file, determines whether the data source corresponding to the input variable is a Hardware Abstraction Layer (HAL) interface. If so, it interacts with the vehicle device through the HAL interface to obtain the value of the input variable from the vehicle device. If it determines that the data source corresponding to the input variable is the shared memory address of the test software, it obtains the value of the input variable from the memory unit corresponding to the shared memory address. Then, based on the value of each input variable, the FMU instance of the FMU file is run to obtain the value of each output variable of the FMU file. For each output variable in the FMU file, if the data consumer corresponding to the output variable is determined to be a HAL interface, it interacts with the vehicle device through the HAL interface to transmit the value of the output variable to the vehicle device. If the data consumer corresponding to the output variable is determined to be the shared memory address of the test software, the value of the output variable is stored in the memory unit corresponding to the shared memory address. Finally, the scheduling service calculates the start time of the next loop process, which is obtained by adding the loop start time to the loop interval duration in the configuration file.
[0107] It should be noted that the scheduling service execution step S104 can be executed immediately after the embedded device obtains the generated FMU instance, input variable mapping relationship, and output variable mapping relationship; it can also be executed after receiving the start command sent by the operating system; or it can be executed after receiving the start command sent by the user through the terminal device. This application embodiment does not limit the conditions for triggering step S104, and can be determined according to the actual situation.
[0108] The simulation testing method for vehicle components provided in this embodiment involves a portable embedded device first decompressing, parsing, and compiling an FMU file using a tool service to obtain input variables, output variables, and a compiled file. Then, it combines this with a configuration file to generate input and output variable mapping relationships for the FMU file. After instantiating the compiled file to obtain an FMU instance, the FMU instance is run cyclically and interacts with the vehicle component based on the input and output variable mapping relationships to obtain sub-test results corresponding to the FMU file. Finally, test results are generated based on the sub-test results for each FMU file. This solution performs testing using a portable embedded device and completes the test through a tool service and mapping relationships, eliminating the need to transport vehicle components or build a HIL system, thus improving testing efficiency and reducing costs.
[0109] Furthermore, FMU files can be processed in embedded devices through decompression, parsing, and compilation via tool services. By utilizing a hardware abstraction layer interface and establishing input and output variable mappings, this solution becomes adaptable to various vehicle components. The embedded device is small in size and can be carried to various locations for use.
[0110] Based on the above embodiments, the following describes the second embodiment of the simulation test method for vehicle devices provided in this application, which involves timing the embedded device in each cycle to determine whether any abnormalities occur during the test.
[0111] During normal testing, for each loop, the time from the start of the loop to transmitting the value of the output variable to the data consumer should be less than the loop interval to ensure that the next loop can proceed normally.
[0112] Therefore, the embedded device starts timing when the current loop begins at the current moment.
[0113] After transmitting the value of the output variable to the data consumer, obtain the current time duration.
[0114] If the current timing duration is less than the loop interval duration, it means that the current loop process is normal. Then, add the loop interval duration in the configuration file to the loop start time to obtain the loop start time of the next loop process of the current loop process.
[0115] If the current timing duration is greater than or equal to the loop interval duration, it indicates that the current loop has timed out and an abnormality has occurred in the test. The test will then be stopped and an alarm message will be output.
[0116] The simulation testing method for vehicle components provided in this embodiment improves test safety by determining whether the loop process times out and whether any abnormalities occur during the test. If an abnormality occurs, the test is terminated and an alarm is issued, thus ensuring the smooth progress of the test. If no abnormality occurs, the start time of the next loop process is determined to guarantee the smooth operation of the test.
[0117] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0118] Figure 4 This application provides a schematic diagram of the structure of a simulation testing device for vehicle components; this device can be integrated into the embedded device in the above method embodiments, or it can be implemented through the embedded device in the above method embodiments. Figure 4 As shown, the simulation test device 40 for the vehicle component includes:
[0119] Processing module 41 is used for:
[0120] The tool service is used to decompress, parse, and compile at least one functional model unit (FMU) file to obtain the input variables, output variables, and compiled file of each FMU file.
[0121] Based on the obtained configuration file and the input and output variables of each FMU file, generate the input variable mapping relationship and output variable mapping relationship for each FMU file;
[0122] The compilation file of each FMU file is instantiated to obtain an FMU instance for each FMU file;
[0123] Test module 42 is used for:
[0124] For each FMU file, based on the input variable mapping relationship and output variable mapping relationship of the FMU file, the FMU instance of the FMU file is run in a loop and interacts with the vehicle device to obtain the sub-test results corresponding to the FMU file;
[0125] Test results are generated based on the sub-test results corresponding to each FMU file.
[0126] Furthermore, for each FMU file, the input variable mapping relationship of the FMU file is the mapping relationship between the input variables of the FMU file and the data source;
[0127] For each FMU file, the mapping relationship between the output variables of the FMU file and the data consumer is the mapping relationship between the output variables of the FMU file and the data consumer;
[0128] Among them, the data source and data consumer are the shared memory addresses of the hardware abstraction layer interface or the test software, and the hardware abstraction layer interface is the data interface corresponding to the vehicle device.
[0129] Furthermore, for each FMU file, the subtest results corresponding to the FMU file include the values of the input variables and the values of the output variables of the FMU file in each loop.
[0130] Furthermore, test module 42 is specifically used for:
[0131] Each loop process is as follows:
[0132] When the loop begins at the current time, the value of each input variable in the FMU file is obtained from the data source according to the input variable mapping relationship in the FMU file.
[0133] Based on the value of each input variable, run the FMU instance in the FMU file to obtain the value of each output variable in the FMU file;
[0134] Based on the output variable mapping relationship of the FMU file, the value of each output variable of the FMU file is transmitted to the data consumer;
[0135] Add the loop start time to the loop interval in the configuration file to get the start time of the next loop in the loop process.
[0136] Furthermore, test module 42 is specifically used for:
[0137] For each input variable in the FMU file, based on the input variable mapping relationship in the FMU file, if the data source corresponding to the input variable is determined to be the hardware abstraction layer interface, then the value of the input variable is obtained from the vehicle device by interacting with the vehicle device through the hardware abstraction layer interface.
[0138] For each input variable in the FMU file, if the data source corresponding to the input variable is determined to be the shared memory address of the test software, based on the input variable mapping relationship in the FMU file, the value of the input variable is obtained from the memory unit corresponding to the shared memory address.
[0139] Furthermore, test module 42 is specifically used for:
[0140] For each output variable in the FMU file, if the data consumer corresponding to the output variable is determined to be a hardware abstraction layer interface, then the value of the output variable is transmitted to the vehicle device through the hardware abstraction layer interface.
[0141] For each output variable in the FMU file, if the data consumer corresponding to the output variable is determined to be the shared memory address of the test software, the value of the output variable is stored in the memory unit corresponding to the shared memory address.
[0142] Furthermore, the test module 42 is also used to start timing when the current time reaches the start time of the current loop process;
[0143] Test module 42 is also used to: if the current timing duration is less than the loop interval duration, add the loop start time to the loop interval duration in the configuration file to obtain the loop start time of the next loop process of the current loop process.
[0144] Furthermore, the test module 42 is also used to stop the test and output an alarm message if the current timing duration is greater than or equal to the loop interval duration.
[0145] The vehicle device simulation testing device provided in this embodiment is used to execute the technical solution of the embedded device in any of the aforementioned method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.
[0146] Figure 5This is a schematic diagram of the structure of an embedded device provided in this application. Figure 5 As shown, the embedded device 50 includes:
[0147] Processor 51, memory 52, and communication interface 53;
[0148] Memory 52 is used to store executable instructions of processor 51;
[0149] The processor 51 is configured to execute the technical solution of the embedded device in any of the foregoing method embodiments by executing executable instructions.
[0150] Optionally, the memory 52 can be either standalone or integrated with the processor 51.
[0151] Optionally, when the memory 52 is a device independent of the processor 51, the embedded device 50 may further include:
[0152] Bus 54, memory 52 and communication interface 53 are connected to processor 51 through bus 54 and complete communication with each other. Communication interface 53 is used to communicate with other devices.
[0153] Optionally, the communication interface 53 can be implemented using a transceiver. The communication interface is used to enable communication between the database access device and other devices (e.g., clients, read-write databases, and read-only databases). The memory may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk drive.
[0154] Bus 54 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, only one thick line is used in the diagram, but this does not indicate that there is only one bus or one type of bus.
[0155] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0156] The embedded device is used to execute the technical solution of the embedded device in any of the aforementioned method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.
[0157] This application also provides a readable storage medium storing a computer program thereon, which, when executed by a processor, implements the technical solutions provided in any of the foregoing method embodiments.
[0158] This application also provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the technical solutions provided in any of the foregoing method embodiments.
[0159] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0160] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A simulation testing method for vehicle components, characterized in that, The method, applied to a portable embedded device connected to vehicle components, includes: The tool service is used to decompress, parse, and compile at least one functional model unit (FMU) file to obtain the input variables, output variables, and compiled file of each FMU file. Based on the obtained configuration file and the input and output variables of each FMU file, generate the input variable mapping relationship and output variable mapping relationship for each FMU file; The compilation file of each FMU file is instantiated to obtain an FMU instance for each FMU file; For each FMU file, based on the input variable mapping relationship and output variable mapping relationship of the FMU file, the FMU instance of the FMU file is run in a loop and interacts with the vehicle device to obtain the sub-test results corresponding to the FMU file; Test results are generated based on the sub-test results corresponding to each FMU file.
2. The method according to claim 1, characterized in that, For each FMU file, the input variable mapping relationship of the FMU file is the mapping relationship between the input variables of the FMU file and the data source; For each FMU file, the output variable mapping relationship of the FMU file is the mapping relationship between the output variables of the FMU file and the data consumer; The data source and data consumer are shared memory addresses of the hardware abstraction layer interface or the test software, and the hardware abstraction layer interface is the data interface corresponding to the vehicle device.
3. The method according to claim 1, characterized in that, For each FMU file, the subtest results corresponding to the FMU file include the values of the input variables and the values of the output variables of the FMU file in each loop.
4. The method according to claim 2, characterized in that, The step of cyclically running the FMU instance in the FMU file and interacting with the vehicle device based on the input variable mapping relationship and output variable mapping relationship of the FMU file includes: Each loop process is as follows: When the loop start time of the loop process is reached at the current time, the value of each input variable of the FMU file is obtained from the data source according to the input variable mapping relationship of the FMU file; Based on the value of each input variable, run the FMU instance of the FMU file to obtain the value of each output variable of the FMU file; Based on the output variable mapping relationship of the FMU file, the value of each output variable of the FMU file is transmitted to the data consumer; Adding the loop start time to the loop interval in the configuration file yields the loop start time of the next loop in the given loop process.
5. The method according to claim 4, characterized in that, The step of obtaining the value of each input variable of the FMU file from the data source according to the input variable mapping relationship of the FMU file includes: For each input variable in the FMU file, according to the input variable mapping relationship in the FMU file, if it is determined that the data source corresponding to the input variable is a hardware abstraction layer interface, then the value of the input variable is obtained from the vehicle device by interacting with the vehicle device through the hardware abstraction layer interface. For each input variable in the FMU file, if the data source corresponding to the input variable is determined to be the shared memory address of the test software according to the input variable mapping relationship in the FMU file, then the value of the input variable is obtained from the memory unit corresponding to the shared memory address.
6. The method according to claim 4, characterized in that, Based on the output variable mapping relationship of the FMU file, the value of each output variable of the FMU file is transmitted to the data consumer, including: For each output variable in the FMU file, if the data consumer corresponding to the output variable is determined to be a hardware abstraction layer interface, then the value of the output variable is transmitted to the vehicle device through the hardware abstraction layer interface. For each output variable in the FMU file, if the data consumer corresponding to the output variable is determined to be the shared memory address of the test software, the value of the output variable is stored in the memory unit corresponding to the shared memory address.
7. The method according to claim 4, characterized in that, The method further includes: The timer starts when the current loop begins at the current moment. The step of adding the loop start time to the loop interval duration in the configuration file to obtain the loop start time of the next loop process of the current loop process includes: If the current timing duration is less than the loop interval duration, then the loop start time is added to the loop interval duration in the configuration file to obtain the loop start time of the next loop process of the current loop process.
8. The method according to claim 7, characterized in that, The method further includes: If the current timing duration is greater than or equal to the cycle interval duration, the test will stop and an alarm message will be output.
9. A simulation testing device for vehicle components, characterized in that, include: Processing module, used for: The tool service is used to decompress, parse, and compile at least one functional model unit (FMU) file to obtain the input variables, output variables, and compiled file of each FMU file. Based on the obtained configuration file and the input and output variables of each FMU file, generate the input variable mapping relationship and output variable mapping relationship for each FMU file; The compilation file of each FMU file is instantiated to obtain an FMU instance for each FMU file; The test module is used for: For each FMU file, based on the input variable mapping relationship and output variable mapping relationship of the FMU file, the FMU instance of the FMU file is run in a loop and interacts with the vehicle device to obtain the sub-test results corresponding to the FMU file; Test results are generated based on the sub-test results corresponding to each FMU file.
10. An embedded device, characterized in that, include: Processor, memory, communication interface; The memory is used to store the executable instructions of the processor; The processor is configured to execute the simulation test method for the vehicle device according to any one of claims 1 to 8 by executing the executable instructions.
11. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the simulation test method for the vehicle device according to any one of claims 1 to 8.
12. A computer program product, characterized in that, It includes a computer program, which, when executed by a processor, is used to implement the simulation test method for the vehicle device according to any one of claims 1 to 8.