CN118708488A - Virtual simulation method, device and equipment based on Autosar architecture - Google Patents
Virtual simulation method, device and equipment based on Autosar architecture Download PDFInfo
- Publication number
- CN118708488A CN118708488A CN202410826307.0A CN202410826307A CN118708488A CN 118708488 A CN118708488 A CN 118708488A CN 202410826307 A CN202410826307 A CN 202410826307A CN 118708488 A CN118708488 A CN 118708488A
- Authority
- CN
- China
- Prior art keywords
- virtual
- test
- virtual machine
- simulation
- executable file
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 72
- 238000012360 testing method Methods 0.000 claims abstract description 219
- 238000004088 simulation Methods 0.000 claims abstract description 84
- 230000002452 interceptive effect Effects 0.000 claims abstract description 5
- 230000015654 memory Effects 0.000 claims description 42
- 230000006870 function Effects 0.000 claims description 36
- 238000004891 communication Methods 0.000 claims description 24
- 238000013507 mapping Methods 0.000 claims description 6
- 230000005540 biological transmission Effects 0.000 claims description 4
- 238000011161 development Methods 0.000 abstract description 20
- 230000008569 process Effects 0.000 description 18
- 239000000306 component Substances 0.000 description 10
- 230000003993 interaction Effects 0.000 description 8
- 238000012545 processing Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 230000002093 peripheral effect Effects 0.000 description 5
- 238000004590 computer program Methods 0.000 description 4
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 3
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 3
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 3
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 3
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 3
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 238000007726 management method Methods 0.000 description 3
- 238000012546 transfer Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000010354 integration Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 238000004806 packaging method and process Methods 0.000 description 2
- 238000010223 real-time analysis Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000009471 action Effects 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 239000008358 core component Substances 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 230000006855 networking Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000008054 signal transmission Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000010998 test method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3696—Methods or tools to render software testable
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45562—Creating, deleting, cloning virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45595—Network integration; Enabling network access in virtual machine instances
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Stored Programmes (AREA)
- Debugging And Monitoring (AREA)
Abstract
Description
技术领域Technical Field
本申请涉及车辆技术,尤其涉及一种基于Autosar架构的虚拟仿真方法、装置及设备。The present application relates to vehicle technology, and in particular to a virtual simulation method, device and equipment based on the AUTOSAR architecture.
背景技术Background Art
汽车开放系统架构(Automotive Open System Architecture,简称:Autosar)是一种面向汽车电子系统网络化的工程标准,它提供了一套完善的软件开发和部署流程,从而使得汽车电子控制单元之间的通信更加灵活和标准化。Automotive Open System Architecture (AUTOSAR) is an engineering standard for networking automotive electronic systems. It provides a complete software development and deployment process, making communication between automotive electronic control units more flexible and standardized.
Autosar代码的开发和测试过程中,需要将各个软件组件进行集成,测试它们在一起协同工作的能力,包括接口测试、功能测试等,并将软件部署到实际的电子控制单元(Electronic Control Unit,简称:ECU)上,进行硬件与软件的集成测试,测试系统在实际硬件平台上的表现。但在实际车辆环境下进行测试过程中,需要耗费大量时间和资源。During the development and testing of Autosar code, it is necessary to integrate various software components and test their ability to work together, including interface testing, functional testing, etc., and deploy the software to the actual Electronic Control Unit (ECU) to perform hardware and software integration testing and test the performance of the system on the actual hardware platform. However, testing in the actual vehicle environment requires a lot of time and resources.
因此,如何提高Autosar代码的开发和测试效率是亟待解决的问题。Therefore, how to improve the development and testing efficiency of Autosar code is an urgent problem to be solved.
发明内容Summary of the invention
本申请提供一种基于Autosar架构的虚拟仿真方法、装置及设备,用以解决在实际车辆环境下进行Autosar代码的开发和测试过程中,需要耗费大量时间和资源的问题。The present application provides a virtual simulation method, device and equipment based on the Autosar architecture, which is used to solve the problem that a lot of time and resources are consumed during the development and testing of Autosar codes in an actual vehicle environment.
第一方面,本申请提供一种基于Autosar架构的虚拟仿真方法,所述方法包括:In a first aspect, the present application provides a virtual simulation method based on the Autosar architecture, the method comprising:
将编译后的可执行文件传输到虚拟机的文件系统中,所述可执行文件包括Autosar架构中基础软件层的功能模块、应用层的功能模块和运行时环境层;The compiled executable file is transferred to the file system of the virtual machine, wherein the executable file includes the functional modules of the basic software layer, the functional modules of the application layer and the runtime environment layer in the Autosar architecture;
启动所述虚拟机的执行程序,在所述虚拟机环境中加载所述可执行文件,模拟基础软件层的交互功能;Starting the execution program of the virtual machine, loading the executable file in the virtual machine environment, and simulating the interactive function of the basic software layer;
执行虚拟仿真测试,并获取虚拟仿真测试结果。Execute virtual simulation tests and obtain virtual simulation test results.
可选的,所述执行虚拟仿真测试,获取虚拟仿真测试结果,包括:Optionally, performing the virtual simulation test and obtaining the virtual simulation test result includes:
将调试器的虚拟调试指令发送到所述虚拟机;Sending a virtual debugging instruction of a debugger to the virtual machine;
在所述虚拟机中运行所述虚拟调试指令,获取所述虚拟调制指令的虚拟仿真测试结果。The virtual debugging instruction is run in the virtual machine to obtain a virtual simulation test result of the virtual modulation instruction.
可选的,所述方法还包括:Optionally, the method further includes:
在二维仿真图像或者三维仿真图像中显示所述虚拟仿真测试结果。The virtual simulation test result is displayed in a two-dimensional simulation image or a three-dimensional simulation image.
可选的,所述执行虚拟仿真测试,获取虚拟仿真测试结果,包括:Optionally, performing the virtual simulation test and obtaining the virtual simulation test result includes:
获取输入信号测试用例,所述输入信号测试用例中包括多个输入信号和每个输入信号的期望值;Obtaining an input signal test case, wherein the input signal test case includes multiple input signals and an expected value of each input signal;
根据预设的输入信号和通讯协议的映射关系,将所述输入信号测试用例封装成多个模拟报文,每个模拟报文对应一个输入信号的一种通讯协议;According to the preset mapping relationship between the input signal and the communication protocol, the input signal test case is encapsulated into a plurality of simulation messages, each simulation message corresponding to a communication protocol of an input signal;
将所述多个模拟报文发送到虚拟机;Sending the multiple simulated messages to the virtual machine;
获取所述虚拟机对每个模拟报文中的输入信号的测试值。A test value of the virtual machine for an input signal in each simulation message is obtained.
可选的,所述方法还包括:Optionally, the method further includes:
比较每个输入信号的测试值和期望值是否相同;Compare the test value and expected value of each input signal to see if they are the same;
若每个输入信号的测试值和期望值均相同,则虚拟仿真测试通过;If the test value and expected value of each input signal are the same, the virtual simulation test passes;
若任一输入信号的测试值和期望值不相同,则虚拟仿真测试没有通过,修改所述可执行文件对应的配置文件。If the test value of any input signal is different from the expected value, the virtual simulation test fails, and the configuration file corresponding to the executable file is modified.
可选的,所述执行虚拟仿真测试,获取虚拟仿真测试结果,包括:Optionally, performing the virtual simulation test and obtaining the virtual simulation test result includes:
获取输出信号测试用例,所述输出信号测试用例中包括多个输出信号和每个输出信号的期望值;Obtaining an output signal test case, wherein the output signal test case includes a plurality of output signals and an expected value of each output signal;
根据预设的测试代码生成软件工具包生成每个输出信号的测试代码,每个输出信号的测试代码用于在虚拟机中模拟产生输出信号;Generate a test code for each output signal according to a preset test code generation software toolkit, wherein the test code for each output signal is used to simulate and generate the output signal in a virtual machine;
将每个输出信号的测试代码编译生成每个输出信号的可执行文件;Compile the test code of each output signal to generate an executable file for each output signal;
将每个输出信号的可执行文件加载到所述虚拟机中执行,获取每个输出信号的测试值。The executable file of each output signal is loaded into the virtual machine for execution, and the test value of each output signal is obtained.
可选的,所述测试代码中包括测试函数,所述测试函数可以引用不同的输出信号。Optionally, the test code includes a test function, and the test function can reference different output signals.
可选的,所述方法还包括:Optionally, the method further includes:
获取用户配置的硬件属性数据,所述硬件属性数据包括:处理器架构、处理器数量和内存大小,所述硬件属性数据用于模拟目标系统的硬件配置;Acquire hardware attribute data configured by a user, wherein the hardware attribute data includes: processor architecture, number of processors and memory size, and the hardware attribute data is used to simulate the hardware configuration of the target system;
根据所述硬件属性数据在虚拟机中模拟高级精简指令集计算机ARM架构的虚拟机环境。A virtual machine environment of an advanced reduced instruction set computer ARM architecture is simulated in a virtual machine according to the hardware attribute data.
第二方面,本申请还提供一种基于Autosar架构的虚拟仿真装置,所述装置包括:In a second aspect, the present application further provides a virtual simulation device based on the Autosar architecture, the device comprising:
传输模块,用于将编译后的可执行文件传输到所述虚拟机的文件系统中,所述可执行文件包括Autosar架构中基础软件层的功能模块、应用层的功能模块和运行时环境层;A transmission module, used to transmit the compiled executable file to the file system of the virtual machine, wherein the executable file includes the functional modules of the basic software layer, the functional modules of the application layer and the runtime environment layer in the Autosar architecture;
模拟模块,启动所述虚拟机的执行程序,在所述虚拟机环境中加载所述可执行文件,模拟基础软件层的交互功能;A simulation module starts the execution program of the virtual machine, loads the executable file in the virtual machine environment, and simulates the interactive function of the basic software layer;
仿真测试模块,用于执行虚拟仿真测试,并获取虚拟仿真测试结果。The simulation test module is used to perform virtual simulation tests and obtain virtual simulation test results.
第三方面,本申请还提供一种电子设备,所述电子设备包括:处理器,以及与所述处理器通信连接的存储器;In a third aspect, the present application further provides an electronic device, the electronic device comprising: a processor, and a memory communicatively connected to the processor;
所述存储器存储计算机执行指令;The memory stores computer-executable instructions;
所述处理器执行所述存储器存储的计算机执行指令,以实现如第一方面任一项所述的基于Autosar架构的虚拟仿真方法。The processor executes the computer-executable instructions stored in the memory to implement the virtual simulation method based on the Autosar architecture as described in any one of the first aspects.
第四方面,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行指令被处理器执行时用于实现如第一方面任一项所述的基于Autosar架构的虚拟仿真方法。In a fourth aspect, the present application also provides a computer-readable storage medium, in which computer execution instructions are stored. When the computer execution instructions are executed by a processor, they are used to implement the virtual simulation method based on the AUTOSAR architecture as described in any one of the first aspects.
本申请提供的基于Autosar架构的虚拟仿真方法、装置及设备,本方法可以在虚拟环境中模拟将可执行文件加载到真实ECU中的场景,以便进行软件的测试、验证和调试。可以避免在实际车辆环境下进行测试,需要耗费大量时间和资源的问题。可以在真实部署前发现潜在问题,并可以在芯片功能还未实现之前,通过模拟的方式进行超前的软件设计,提高软件的开发效率。The virtual simulation method, device and equipment based on the Autosar architecture provided by the present application can simulate the scenario of loading an executable file into a real ECU in a virtual environment to test, verify and debug the software. It can avoid the problem of consuming a lot of time and resources for testing in an actual vehicle environment. Potential problems can be discovered before real deployment, and advanced software design can be performed through simulation before the chip function is realized, thereby improving the efficiency of software development.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
图1为本申请提供的基于Autosar架构的虚拟仿真系统的软件模块架构示意图;FIG1 is a schematic diagram of the software module architecture of a virtual simulation system based on the Autosar architecture provided by the present application;
图2为本申请提供的基于Autosar架构的虚拟仿真方法实施例一的流程示意图;FIG2 is a flow chart of a first embodiment of a virtual simulation method based on the Autosar architecture provided by the present application;
图3为本申请提供的基于Autosar架构的虚拟仿真方法实施例二的流程示意图;FIG3 is a flow chart of a second embodiment of a virtual simulation method based on the Autosar architecture provided by the present application;
图4为本申请提供的基于Autosar架构的虚拟仿真方法实施例三的流程示意图;FIG4 is a flow chart of a third embodiment of a virtual simulation method based on the Autosar architecture provided by the present application;
图5为本申请提供的基于Autosar架构的虚拟仿真方法实施例四的流程示意图;FIG5 is a flow chart of a fourth embodiment of a virtual simulation method based on the Autosar architecture provided by the present application;
图6为本申请提供的基于Autosar架构的虚拟仿真装置实施例一的结构示意图;FIG6 is a schematic diagram of the structure of a first embodiment of a virtual simulation device based on the Autosar architecture provided by the present application;
图7为本申请提供的一种电子设备的结构示意图。FIG. 7 is a schematic diagram of the structure of an electronic device provided by the present application.
通过上述附图,已示出本申请明确的实施例,后文中将有更详细的描述。这些附图和文字描述并不是为了通过任何方式限制本申请构思的范围,而是通过参考特定实施例为本领域技术人员说明本申请的概念。The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments.
具体实施方式DETAILED DESCRIPTION
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
汽车开放系统架构(Automotive Open System Architecture,简称:Autosar):是一个用于汽车电子系统的开放标准架构,旨在促进汽车电子软件的标准化、可重用性和互操作性。AUTOSAR定义了一套统一的标准和规范,包括接口定义、数据格式、通信协议等。Automotive Open System Architecture (AUTOSAR): is an open standard architecture for automotive electronic systems, which aims to promote the standardization, reusability and interoperability of automotive electronic software. AUTOSAR defines a set of unified standards and specifications, including interface definitions, data formats, communication protocols, etc.
AUTOSAR分层架构主要由以下几个层组成:The AUTOSAR layered architecture mainly consists of the following layers:
应用层(Application Layer):应用层包含与具体汽车功能相关的软件组件,例如引擎控制、制动系统、信息娱乐等。这些软件组件负责实现特定的汽车功能,并通过标准化的接口与其他层进行交互。Application Layer: The application layer contains software components related to specific automotive functions, such as engine control, braking system, infotainment, etc. These software components are responsible for implementing specific automotive functions and interact with other layers through standardized interfaces.
运行时环境层(Runtime Environment Layer):运行时环境层提供了一种标准化的运行时支持环境,用于管理和调度应用层中的软件组件。该层负责处理任务调度、资源管理、通信协议栈以及诊断和自检等功能。Runtime Environment Layer: The runtime environment layer provides a standardized runtime support environment for managing and scheduling software components in the application layer. This layer is responsible for handling task scheduling, resource management, communication protocol stack, and diagnostic and self-test functions.
基础软件层(Basic Software Layer,简称:BSW):基础软件层提供了与硬件相关的抽象接口和服务,包括对底层硬件的驱动、操作系统功能、通信协议栈、诊断服务、网络管理等。这些软件组件屏蔽了底层硬件的细节,使得应用层和运行时环境层能够与硬件平台无关地进行开发和部署。Basic Software Layer (BSW): The basic software layer provides abstract interfaces and services related to hardware, including drivers for the underlying hardware, operating system functions, communication protocol stacks, diagnostic services, network management, etc. These software components shield the details of the underlying hardware, allowing the application layer and runtime environment layer to be developed and deployed independently of the hardware platform.
微控制器抽象层(MicroController Abstraction Layer,简称:MCAL):微控制器抽象层包括针对特定微控制器架构的抽象接口和驱动组件,用于访问微控制器的硬件资源。AUTOSAR架构通过基础软件层将应用层和运行时环境层与硬件平台解耦,实现软件的可移植性和硬件的替换灵活性。Microcontroller Abstraction Layer (MCAL): The MCAL includes abstract interfaces and driver components for specific microcontroller architectures, which are used to access the hardware resources of the microcontroller. The AUTOSAR architecture decouples the application layer and runtime environment layer from the hardware platform through the basic software layer, achieving software portability and hardware replacement flexibility.
然而,Autosar代码的开发和测试过程中,需要将各个软件组件进行集成,测试它们在一起协同工作的能力,包括接口测试、功能测试等,并将软件部署到实际的ECU上,进行硬件与软件的集成测试,测试系统在实际硬件平台上的表现。但在实际车辆环境下进行测试过程中,需要耗费大量时间和资源。However, during the development and testing of Autosar code, it is necessary to integrate various software components and test their ability to work together, including interface testing, functional testing, etc., and deploy the software to the actual ECU to perform hardware and software integration testing and test the performance of the system on the actual hardware platform. However, testing in the actual vehicle environment requires a lot of time and resources.
另外,基于现有芯片的处理能力,有时无法满足超大规模的运算量与软件设计期望的运算速度,比如大规模的神经网络代码或大型的操作系统,往往需要更强处理能力的芯片,现有基于现有的硬件的处理能力会限制超前的软件设计,无法进行预先的软件设计验证。In addition, the processing power of existing chips is sometimes unable to meet the ultra-large-scale computing volume and computing speed expected by software design. For example, large-scale neural network codes or large operating systems often require chips with stronger processing power. The existing processing power based on existing hardware will limit advanced software design and cannot perform preliminary software design verification.
有鉴于此,发明人提出通过虚拟机来模拟硬件,来开发和测试Autosar代码。具体的,通过虚拟机可以模拟高级精简指令集计算机(Advanced RISC Machine,简称:ARM)架构的虚拟机环境,使得虚拟的电子控制单元(Electronic Control Unit,简称:ECU)可以在该环境中运行,将Autosar架构的代码导入虚拟机环境中,进行虚拟的信号输入和输出的仿真测试。通过虚拟机可以超前开发Autosar架构的软件用于虚拟测试,待芯片更新迭代后快速适配,还可以在仿真过程中发现Autosar代码的错误,及时修正错误,提高软件组件和ECU的开发效率。In view of this, the inventor proposes to simulate hardware through a virtual machine to develop and test Autosar code. Specifically, the virtual machine environment of the Advanced RISC Machine (ARM) architecture can be simulated through the virtual machine, so that the virtual electronic control unit (ECU) can run in the environment, and the code of the Autosar architecture can be imported into the virtual machine environment to perform virtual signal input and output simulation tests. Through the virtual machine, the software of the Autosar architecture can be developed in advance for virtual testing, and it can be quickly adapted after the chip is updated and iterated. It can also find errors in the Autosar code during the simulation process, correct the errors in time, and improve the development efficiency of software components and ECUs.
图1为本申请提供的基于Autosar架构的虚拟仿真系统的软件模块架构示意图,该系统可以部署于任一终端设备中,例如电脑,服务器等。如图1所示,该系统包括如下软件模块:FIG1 is a schematic diagram of the software module architecture of the virtual simulation system based on the Autosar architecture provided by the present application. The system can be deployed in any terminal device, such as a computer, a server, etc. As shown in FIG1 , the system includes the following software modules:
用户界面模块:该模块提供一个人机交互界面,使用户可以方便地控制仿真系统的运行。User interface module: This module provides a human-computer interaction interface, allowing users to easily control the operation of the simulation system.
虚拟芯片配置模块:配置虚拟的芯片类型,芯片参数,如时钟频率、内存大小、外设配置等,虚拟芯片配置模块还可以调用芯片镜像文件,该镜像文件包含了芯片的固件、操作系统和其他必要的软件环境。通过加载合适的芯片镜像,虚拟机环境可以模拟出与实际硬件相似的运行环境。通过虚拟芯片配置模块,可以根据需要灵活地配置虚拟机环境中的芯片,以满足不同的仿真需求和测试场景。Virtual chip configuration module: configures the virtual chip type and chip parameters, such as clock frequency, memory size, peripheral configuration, etc. The virtual chip configuration module can also call the chip image file, which contains the chip firmware, operating system and other necessary software environments. By loading the appropriate chip image, the virtual machine environment can simulate an operating environment similar to the actual hardware. Through the virtual chip configuration module, the chip in the virtual machine environment can be flexibly configured as needed to meet different simulation requirements and test scenarios.
虚拟机环境模块:该组件负责模拟ARM架构的虚拟机环境,使得模拟的ECU可以在该环境中运行,为整个仿真系统提供了硬件级别的支持。Virtual machine environment module: This component is responsible for simulating the virtual machine environment of the ARM architecture, so that the simulated ECU can run in this environment, providing hardware-level support for the entire simulation system.
二维仿真引擎模块:该模块负责根据Autosar工程的需求,对ECU进行二维全面的仿真测试。2D simulation engine module: This module is responsible for performing comprehensive 2D simulation tests on ECU according to the requirements of Autosar engineering.
三维仿真引擎模块:该模块负责根据Autosar工程的需求,对ECU进行三维全面的仿真测试。3D simulation engine module: This module is responsible for performing comprehensive 3D simulation testing on ECU according to the requirements of Autosar engineering.
虚拟通信接口模块:该模块负责与其它仿真系统或实际硬件进行通信,实现数据交互。Virtual communication interface module: This module is responsible for communicating with other simulation systems or actual hardware to achieve data interaction.
调试器模块:该模块负责对仿真过程中产生的数据进行实时分析和调试,以便及时发现和修正错误。Debugger module: This module is responsible for real-time analysis and debugging of the data generated during the simulation process in order to discover and correct errors in a timely manner.
测试结果分析模块:进行批量测试结果生成,和测试结果数据分析。Test result analysis module: generates batch test results and analyzes test result data.
Autosar代码加载模块:用于加载Autosar代码,用于虚拟调试。Autosar code loading module: used to load Autosar code for virtual debugging.
本申请的基于Autosar架构的虚拟仿真系统可以在硬件级别进行虚拟仿真模拟,Autosar架构的开发软件代码可以在虚拟的硬件上进行仿真测试,提高开发效率。The virtual simulation system based on the Autosar architecture of the present application can perform virtual simulation at the hardware level, and the development software code of the Autosar architecture can be simulated and tested on virtual hardware to improve development efficiency.
本申请的基于Autosar架构的虚拟仿真方法的执行主体可以是任一种集成基于Autosar架构的虚拟仿真系统的终端设备,或者具备处理能力的芯片。The executor of the virtual simulation method based on the Autosar architecture of the present application can be any terminal device integrated with a virtual simulation system based on the Autosar architecture, or a chip with processing capabilities.
下面以具体地实施例对本申请的技术方案以及本申请的技术方案如何解决上述技术问题进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。下面将结合附图,对本申请的实施例进行描述。The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
图2为本申请提供的基于Autosar架构的虚拟仿真方法实施例一的流程示意图,如图2所示,包括如下步骤:FIG2 is a flow chart of a first embodiment of a virtual simulation method based on the Autosar architecture provided by the present application, as shown in FIG2 , comprising the following steps:
S101、将编译后的可执行文件传输到虚拟机的文件系统中,可执行文件包括Autosar架构中基础软件层的功能模块、应用层的功能模块和运行时环境层。S101, transferring the compiled executable file to the file system of the virtual machine, wherein the executable file includes the functional modules of the basic software layer, the functional modules of the application layer and the runtime environment layer in the Autosar architecture.
在本步骤中,根据用户配置的Autosar架构中的参数,使用Autosar标准定义的软件组件或自定义的模块编译生成的二进制的可执行文件,可执行文件包括编译后的基础软件层的功能模块,运行时环境层,应用层的功能模块和微控制器抽象层(MicroControllerAbstraction Layer,简称:MCAL),微控制器抽象层中包括多种驱动组;应用层的功能模块(即应用层的软件组件)包括具体的应用软件的代码,例如车窗对应一个功能模块,座椅对应一个功能模块;运行时环境层包括支持程序运行所需的运行时环境。可执行文件可以被部署到实际的汽车电子控制单元(ECU)中,在本方案中可执行文件部署于模拟的ECU中。In this step, according to the parameters in the Autosar architecture configured by the user, the software components defined by the Autosar standard or the custom modules are used to compile and generate a binary executable file. The executable file includes the function modules of the compiled basic software layer, the runtime environment layer, the function modules of the application layer and the microcontroller abstraction layer (MicroControllerAbstraction Layer, referred to as: MCAL), and the microcontroller abstraction layer includes a variety of driver groups; the function modules of the application layer (i.e., the software components of the application layer) include the code of the specific application software, for example, the car window corresponds to a function module, and the seat corresponds to a function module; the runtime environment layer includes the runtime environment required to support the program running. The executable file can be deployed to the actual automotive electronic control unit (ECU). In this solution, the executable file is deployed in the simulated ECU.
获取虚拟机的IP地址或主机名,通过网络连接到虚拟机。选择合适的文件传输工具,根据虚拟机的IP地址或主机名在开发机上运行相应的传输命令,将编译后的可执行文件传输到虚拟机的文件系统中。Get the IP address or host name of the virtual machine, connect to the virtual machine through the network, select the appropriate file transfer tool, run the corresponding transfer command on the development machine according to the IP address or host name of the virtual machine, and transfer the compiled executable file to the file system of the virtual machine.
可选的,可执行文件可以根据Autosar架构中源代码编译生成可执行文件。Optionally, the executable file can be compiled from source code in the Autosar architecture to generate an executable file.
示例性的:Exemplary:
获取需要编译的C语言源代码文件(通常以.c为扩展名)以及相关的头文件(通常以.h为扩展名),源代码文件包含了实际的程序逻辑和功能实现,而头文件则包含了函数声明、宏定义和结构体定义等信息。Get the C language source code file (usually with a .c extension) and the related header file (usually with a .h extension) that need to be compiled. The source code file contains the actual program logic and function implementation, while the header file contains information such as function declarations, macro definitions, and structure definitions.
创建一个CMakeLists.txt文件,该文件描述了需要构建的配置和依赖项。Create a CMakeLists.txt file that describes the configuration and dependencies that need to be built.
选择适用于ARM架构的编译器,或者自定义的编译器工具包,并将其添加到系统路径中。Select a compiler for the ARM architecture, or a custom compiler toolkit, and add it to the system path.
使用编译器执行编译操作,将C源代码(.c文件)编译成目标文件(.o文件)或可执行文件(.elf文件)。具体的,将源代码翻译成机器码,并进行符号解析、优化等处理。Use a compiler to compile the C source code (.c file) into an object file (.o file) or an executable file (.elf file). Specifically, the source code is translated into machine code, and symbol resolution and optimization are performed.
将生成的可执行文件下载到虚拟机的目标文件系统中的bin目录下。Download the generated executable file to the bin directory in the target file system of the virtual machine.
S102、启动虚拟机的执行程序,在虚拟机环境中加载可执行文件,用于模拟应用层的功能模块与模拟硬件之间的交互功能。S102: Start the execution program of the virtual machine and load the executable file in the virtual machine environment to simulate the interaction function between the functional modules of the application layer and the simulated hardware.
在本步骤中,在虚拟机环境中打开终端或命令提示符,通过命令切换到存放可执行文件的目录,找到可执行文件。使用相应的命令来执行该可执行文件,例如在终端中输入可执行文件的名称并按下回车键。可执行文件运行后,就可以模拟应用层的功能模块在运行时环境条件下通过基础软件层和微控制器抽象层与模拟硬件之间的交互功能,具体的模拟过程就是后续仿真过程。In this step, open a terminal or command prompt in a virtual machine environment, switch to the directory where the executable file is stored through a command, and find the executable file. Use the corresponding command to execute the executable file, for example, enter the name of the executable file in the terminal and press the Enter key. After the executable file is run, the functional modules of the application layer can be simulated under the runtime environment conditions through the basic software layer and the microcontroller abstraction layer and the interaction between the simulation hardware, and the specific simulation process is the subsequent simulation process.
S103、执行虚拟仿真测试,并获取虚拟仿真测试结果。S103: Execute a virtual simulation test and obtain a virtual simulation test result.
在本步骤中,将可执行文件加载到虚拟环境的开发板中,可以模拟可执行文件加载到真实ECU中的场景,在该场景下可以进行仿真测试,具体可以通过测试用例或者用户输入测试指令的方式模拟应用层的软件与模拟硬件之间的交互,这个过程中还可以模拟整个基础软件链路,信号的封包与解包,信号路由,操作系统调度,以及网络状态等。In this step, the executable file is loaded into the development board of the virtual environment, which can simulate the scenario of loading the executable file into the real ECU. In this scenario, simulation testing can be performed. Specifically, the interaction between the application layer software and the simulation hardware can be simulated through test cases or user input of test instructions. In this process, the entire basic software link, signal packaging and unpacking, signal routing, operating system scheduling, and network status can also be simulated.
可选的,可以通过用户配置的方式构建虚拟机,具体的:Optionally, you can build a virtual machine through user configuration, specifically:
获取用户配置的硬件属性数据,硬件属性数据包括:处理器架构、处理器数量和内存大小,硬件属性数据用于模拟目标系统的硬件配置。The hardware attribute data configured by the user is obtained. The hardware attribute data includes: processor architecture, number of processors and memory size. The hardware attribute data is used to simulate the hardware configuration of the target system.
用户在需要进行虚拟仿真时,首先需要确定需要模拟的硬件配置及硬件环境。用户可以在用户界面中输入或选择硬件属性,也可以将包含硬件属性的配置文件发送到终端设备,终端设备读取其中的硬件属性。When users need to perform virtual simulation, they first need to determine the hardware configuration and hardware environment to be simulated. Users can enter or select hardware attributes in the user interface, or send a configuration file containing hardware attributes to the terminal device, which reads the hardware attributes.
其中,硬件属性数据包括模拟开发板的属性数据,选择的处理器的架构(cortex-A、cortex-M、cortex-R等),处理器的个数,内存大小,kernel内核镜像的存放位置,内核启动的附件参数,根文件系统的镜像位置。Among them, the hardware attribute data includes the attribute data of the simulation development board, the selected processor architecture (cortex-A, cortex-M, cortex-R, etc.), the number of processors, the memory size, the storage location of the kernel image, the additional parameters of the kernel startup, and the image location of the root file system.
模拟开发板是指通过虚拟化技术模拟实际硬件开发板的功能和特性,使用户可以在没有实际硬件设备的情况下进行软件开发、调试和测试。开发板的属性数据包括开发板的处理器架构、外设接口、引脚分配等硬件特性。用户选择特定的开发板型号或类型,在虚拟环境中模拟该开发板的硬件配置和特性。通过模拟开发板,可以在虚拟环境中进行软件开发和测试,验证软件在特定硬件平台上的兼容性和稳定性,同时加快开发周期。A simulated development board is a board that simulates the functions and features of an actual hardware development board through virtualization technology, allowing users to develop, debug, and test software without actual hardware devices. The attribute data of the development board includes the hardware features of the development board, such as the processor architecture, peripheral interfaces, and pin assignments. Users select a specific development board model or type to simulate the hardware configuration and features of the development board in a virtual environment. By simulating the development board, software development and testing can be performed in a virtual environment to verify the compatibility and stability of the software on a specific hardware platform, while speeding up the development cycle.
用户可以通过硬件属性数据配置虚拟机中模拟的处理器个数,例如,单核,双核,四核,八核等,处理器个数不同影响虚拟机的计算性能和并行处理能力,增加处理器个数可以提高虚拟机的计算性能和响应速度。Users can configure the number of processors simulated in the virtual machine through hardware attribute data, for example, single-core, dual-core, quad-core, octa-core, etc. Different numbers of processors affect the computing performance and parallel processing capabilities of the virtual machine. Increasing the number of processors can improve the computing performance and response speed of the virtual machine.
硬件属性数据中指定内核镜像文件的存放位置,用于启动虚拟机时加载相应的内核,内核是虚拟机系统的核心组件,具有管理系统资源和提供服务的功能,必须正确加载才能启动虚拟机系统。The storage location of the kernel image file specified in the hardware attribute data is used to load the corresponding kernel when starting the virtual machine. The kernel is the core component of the virtual machine system and has the functions of providing system resources and services. It must be loaded correctly to start the virtual machine system.
硬件属性数据中指定根文件系统镜像文件的位置,用于虚拟机启动后提供文件系统支持和运行环境,根文件系统包含操作系统的核心文件和目录结构。The location of the root file system image file specified in the hardware attribute data is used to provide file system support and operating environment after the virtual machine is started. The root file system contains the core files and directory structure of the operating system.
硬件属性数据中还包括需要配置的虚拟芯片类型,芯片参数,如时钟频率、内存大小、外设配置等。The hardware attribute data also includes the virtual chip type that needs to be configured, chip parameters such as clock frequency, memory size, peripheral configuration, etc.
根据硬件属性数据在虚拟机中模拟高级精简指令集计算机ARM架构的虚拟机环境。A virtual machine environment of an advanced reduced instruction set computer ARM architecture is simulated in a virtual machine according to hardware attribute data.
选择支持ARM架构模拟的虚拟化软件。在一种实现方式中通过用户操作选择虚拟化软件;在另一种实现方式中,终端设备中只配置了一个虚拟化软件。Select virtualization software that supports ARM architecture simulation. In one implementation, the virtualization software is selected through user operation; in another implementation, only one virtualization software is configured in the terminal device.
根据用户提供的硬件属性数据,使用虚拟化软件创建一个新的虚拟机实例。在创建虚拟机时,根据用户提供的硬件属性数据设置处理器架构为ARM架构(如cortex-A、cortex-M、cortex-R等)、处理器数量、内存大小等参数。According to the hardware attribute data provided by the user, a new virtual machine instance is created using the virtualization software. When creating a virtual machine, the processor architecture is set to ARM architecture (such as cortex-A, cortex-M, cortex-R, etc.), the number of processors, the memory size and other parameters according to the hardware attribute data provided by the user.
设置内核镜像和根文件系统:将内核镜像文件和根文件系统镜像文件放置在虚拟机的指定位置,确保虚拟机可以加载正确的内核和文件系统镜像。内核镜像文件和根文件系统镜像文件可以是用户输入的,也可以是从网站上下载的。Set the kernel image and root file system: Place the kernel image file and the root file system image file in the specified location of the virtual machine to ensure that the virtual machine can load the correct kernel and file system image. The kernel image file and the root file system image file can be entered by the user or downloaded from the website.
根据硬件属性数据中配置的虚拟芯片类型,芯片参数,如时钟频率、内存大小、外设配置等,配置虚拟芯片。The virtual chip is configured according to the virtual chip type configured in the hardware attribute data, chip parameters such as clock frequency, memory size, peripheral configuration, etc.
启动配置好的虚拟机,并等待虚拟机系统启动完成。Start the configured virtual machine and wait for the virtual machine system to start up.
本实施例提供一种基于Autosar架构的虚拟仿真方法,本方法包括:获取用户配置的硬件属性数据,硬件属性数据包括:处理器架构、处理器数量和内存大小,硬件属性数据用于模拟目标系统的硬件配置;根据硬件属性数据在虚拟机中模拟高级精简指令集计算机ARM架构的虚拟机环境;将编译后的可执行文件传输到虚拟机的文件系统中,可执行文件包括Autosar架构中基础软件层的功能模块、应用层的功能模块和运行时环境层;启动虚拟机的执行程序,加载可执行文件,模拟应用层的功能模块与模拟硬件之间的交互功能;执行虚拟仿真测试,并获取虚拟仿真测试结果。通过本方法可以在虚拟环境中模拟将可执行文件加载到真实ECU中的场景,以便进行软件的测试、验证和调试。可以避免在实际车辆环境下进行测试,需要耗费大量时间和资源的问题。帮助用户在真实部署前发现潜在问题,并可以在芯片功能还未实现之前,通过模拟的方式进行超前的软件设计,提高软件和ECU硬件的开发效率。This embodiment provides a virtual simulation method based on the Autosar architecture, which includes: obtaining hardware attribute data configured by the user, the hardware attribute data including: processor architecture, number of processors and memory size, and the hardware attribute data is used to simulate the hardware configuration of the target system; simulating the virtual machine environment of the advanced reduced instruction set computer ARM architecture in the virtual machine according to the hardware attribute data; transferring the compiled executable file to the file system of the virtual machine, the executable file including the functional modules of the basic software layer, the functional modules of the application layer and the runtime environment layer in the Autosar architecture; starting the execution program of the virtual machine, loading the executable file, simulating the interaction function between the functional modules of the application layer and the simulated hardware; performing a virtual simulation test, and obtaining the virtual simulation test result. Through this method, the scenario of loading the executable file into the real ECU can be simulated in a virtual environment, so as to test, verify and debug the software. It can avoid the problem of consuming a lot of time and resources for testing in the actual vehicle environment. It helps users to find potential problems before real deployment, and can perform advanced software design through simulation before the chip function is realized, so as to improve the development efficiency of software and ECU hardware.
在虚拟仿真测试过程中,可以通过用户手动进行仿真测试,下面以一个实施例对手动仿真测试进行介绍。During the virtual simulation test process, the simulation test can be performed manually by the user. The manual simulation test is introduced below with an embodiment.
图3为本申请提供的基于Autosar架构的虚拟仿真方法实施例二的流程示意图,如图3所示,包括如下步骤:FIG3 is a flow chart of a second embodiment of a virtual simulation method based on the Autosar architecture provided by the present application, as shown in FIG3 , comprising the following steps:
S201、将调试器的虚拟调试指令发送到虚拟机。S201, sending a virtual debugging instruction of a debugger to a virtual machine.
在本步骤中,用户通过调试器模块设置调试参数,包括待调试的程序、断点、观察点等,调试参数用于指导调试过程中的行为和目标。调试器模块将设置好的调试参数发送给虚拟机模块。In this step, the user sets debugging parameters through the debugger module, including the program to be debugged, breakpoints, watchpoints, etc. The debugging parameters are used to guide the behavior and goals during the debugging process. The debugger module sends the set debugging parameters to the virtual machine module.
其中,调试器模块采用现有技术中的任何一种调试器。The debugger module adopts any debugger in the prior art.
待调试的程序是Autosar架构中应用层的程序,通过运行时环境层与BSW层、模拟的硬件进行交互。用户可以对其进行功能验证、调试问题、优化性能等操作,以确保程序的正确性和稳定性。The program to be debugged is the application layer program in the Autosar architecture, which interacts with the BSW layer and the simulated hardware through the runtime environment layer. Users can perform functions verification, debug problems, optimize performance, etc. to ensure the correctness and stability of the program.
调试器与虚拟机之间通信的通信协议可以采用任何一种可靠的通信协议。The communication protocol between the debugger and the virtual machine can adopt any reliable communication protocol.
S202、在虚拟机中运行虚拟调试指令,获取虚拟调制指令的虚拟仿真测试结果。S202: Run a virtual debugging instruction in a virtual machine to obtain a virtual simulation test result of the virtual modulation instruction.
在本步骤中,在虚拟环境中,虚拟机执行待调试的程序(可执行文件中的应用层的程序),并实时将程序的运行状态反馈给调试器模块。用户可以通过调试器模块观察程序的运行状态,对程序进行实时调试。当调试完成后,用户可以通过调试器模块导出调试结果,包括程序在运行过程中的各种状态、异常信息等。In this step, in the virtual environment, the virtual machine executes the program to be debugged (the program of the application layer in the executable file), and feeds back the running state of the program to the debugger module in real time. The user can observe the running state of the program through the debugger module and debug the program in real time. When the debugging is completed, the user can export the debugging results through the debugger module, including various states of the program during operation, abnormal information, etc.
示例性的,通过调试器模块编写一个虚拟调试指令,用于模拟信号的发送和接收过程。例如,设置发送端发送特定数据,然后模拟接收端接收并验证数据的正确性。在虚拟机中执行编写的虚拟调试指令,用户可以观察信号传输的过程,检查接收端是否成功接收并处理了发送的信号数据,生成虚拟仿真测试的结果,包括接收到的数据是否与期望值一致,传输是否稳定等方面。Exemplarily, a virtual debugging instruction is written through the debugger module to simulate the signal sending and receiving process. For example, the sending end is set to send specific data, and then the receiving end is simulated to receive and verify the correctness of the data. By executing the written virtual debugging instruction in the virtual machine, the user can observe the signal transmission process, check whether the receiving end successfully receives and processes the sent signal data, and generate the results of the virtual simulation test, including whether the received data is consistent with the expected value, whether the transmission is stable, etc.
又一示例性的,虚拟调试指令是用户在待调试程序中设置了一个断点,即当程序执行到特定的代码行时,会自动停下来等待用户进一步操作。例如,用户希望在程序执行到计算逻辑的关键部分时暂停,以便检查变量的值和程序执行路径。用户通过调试器模块观察程序的实时运行状态,也可以通过调试器模块导出调试结果,包括程序在运行过程中的各种状态、异常信息等。Another example of a virtual debugging instruction is that the user sets a breakpoint in the program to be debugged, that is, when the program executes to a specific line of code, it will automatically stop and wait for further operation by the user. For example, the user wants to pause when the program executes to a critical part of the calculation logic in order to check the value of the variable and the program execution path. The user observes the real-time running status of the program through the debugger module, and can also export the debugging results through the debugger module, including various states of the program during operation, exception information, etc.
又一示例性的,用户通过调制器模块在待调试程序中设置了一个观察点,用于监视特定变量或内存地址的值,在程序执行过程中实时监视该变量的数值变化。在待调试程序执行过程中,调试器模块会实时监视所设置的观察点,记录并显示特定变量或内存地址的数值变化情况,这可以通过调试器提供的变量监视窗口或者日志输出来进行观察。In another exemplary embodiment, the user sets an observation point in the program to be debugged through the debugger module to monitor the value of a specific variable or memory address, and monitors the value change of the variable in real time during the execution of the program. During the execution of the program to be debugged, the debugger module monitors the set observation point in real time, records and displays the value change of the specific variable or memory address, which can be observed through the variable monitoring window or log output provided by the debugger.
需要说明的是,虚拟机产生的虚拟仿真结果返回到调制器模块进行显示。It should be noted that the virtual simulation results generated by the virtual machine are returned to the modulator module for display.
S203、在二维仿真图像或者三维仿真图像中显示虚拟仿真测试结果。S203: Display the virtual simulation test result in a two-dimensional simulation image or a three-dimensional simulation image.
在本步骤中,为了用户方便的获取仿真测试的结果,在二维图像,或者三维图像的模型中显示虚拟仿真测试结果,例如虚拟调试指令是信号灯左转信号,在二维仿真模型或者三维仿真模型中显示运行虚拟调制指令的结果。In this step, in order to facilitate users to obtain the results of the simulation test, the virtual simulation test results are displayed in a two-dimensional image or a three-dimensional image model. For example, if the virtual debugging instruction is a left turn signal of a traffic light, the result of running the virtual modulation instruction is displayed in a two-dimensional simulation model or a three-dimensional simulation model.
示例性的,预先通过二维仿真引擎编辑器对仿真进行编辑,包括对车内电子器件进行排布组态,对各个模拟的信号进行分配,信号类型、信号参数等。如左转信号,需要编辑模组为灯,然后添加该模组信号属性,信号状态等(如:0,1)。二维仿真引擎在运行时(既虚拟仿真测试),虚拟调试指令是左转信号,虚拟仿真测试结果是“信号状态为0”时,二维仿真图像中的左转灯不亮,虚拟仿真测试结果是“信号状态为1”时,二维仿真图像中的左转灯亮,达到仿真效果。用户可以观察仿真二维图像模块,对汽车电子信号进行实时仿真分析。另外,用户可以通过人机交互模块对仿真图像进行操作,如放大、缩小、旋转等,以便更深入地分析汽车电子信号。Exemplarily, the simulation is edited in advance through the two-dimensional simulation engine editor, including the arrangement and configuration of the electronic devices in the car, the allocation of each simulated signal, the signal type, signal parameters, etc. For example, for a left turn signal, it is necessary to edit the module as a light, and then add the signal attributes of the module, the signal state, etc. (such as: 0, 1). When the two-dimensional simulation engine is running (i.e., virtual simulation test), the virtual debugging instruction is a left turn signal. When the virtual simulation test result is "the signal state is 0", the left turn light in the two-dimensional simulation image is not on. When the virtual simulation test result is "the signal state is 1", the left turn light in the two-dimensional simulation image is on, achieving the simulation effect. The user can observe the simulation two-dimensional image module and perform real-time simulation analysis of the automotive electronic signal. In addition, the user can operate the simulation image through the human-computer interaction module, such as zooming in, zooming out, rotating, etc., in order to analyze the automotive electronic signal more deeply.
上述二维仿真引擎也可以转换为三维仿真引擎,可以通过三维模型生成三维图像,更加方便用户观察。The above-mentioned two-dimensional simulation engine can also be converted into a three-dimensional simulation engine, and a three-dimensional image can be generated through a three-dimensional model, which is more convenient for users to observe.
本实施例提供一种用户手动的虚拟仿真测试方法,通过调试器将虚拟调试指令发送到虚拟机;在虚拟机中运行虚拟调试指令,获取虚拟调制指令的虚拟仿真测试结果;显示虚拟仿真结果。在仿真过程中,调试器将对产生的数据进行实时分析和调试,最后将仿真结果通过用户界面展示给用户。用户不需要在真实的硬件上就可以现场调试测试待调试程序,提高开发效率,另外通过二维展示或三维展示的方式可以更加方便用户进行观察和调试。This embodiment provides a user manual virtual simulation test method, which sends virtual debugging instructions to a virtual machine through a debugger; runs virtual debugging instructions in the virtual machine to obtain virtual simulation test results of virtual debugging instructions; and displays virtual simulation results. During the simulation process, the debugger will perform real-time analysis and debugging on the generated data, and finally display the simulation results to the user through the user interface. Users can debug and test the program to be debugged on-site without real hardware, which improves development efficiency. In addition, two-dimensional or three-dimensional display can make it more convenient for users to observe and debug.
下面以一个实施例介绍进行自动仿真测试操作的过程。The following is an example of an implementation to introduce the process of performing an automatic simulation test operation.
图4为本申请提供的基于Autosar架构的虚拟仿真方法实施例三的流程示意图,如图4所示,包括如下步骤:FIG4 is a flow chart of a third embodiment of a virtual simulation method based on the Autosar architecture provided by the present application, as shown in FIG4 , comprising the following steps:
S301、获取输入信号测试用例,输入信号测试用例中包括多个输入信号和每个输入信号的期望值。S301: Obtain an input signal test case, where the input signal test case includes multiple input signals and an expected value of each input signal.
在本步骤中,在进行虚拟仿真过程中可以不需要用户进行手动调试,运行测试用例进行自动测试。首先获取输入信号测试用例,测试用例可以是用户存储在虚拟机系统文件中的,虚拟机可以自动获取,也可以是每次进行虚拟测试时接收用户输入的测试用例。In this step, the user does not need to perform manual debugging during the virtual simulation process, and the test case is run for automatic testing. First, the input signal test case is obtained. The test case can be stored by the user in the virtual machine system file, which can be automatically obtained by the virtual machine, or it can be a test case that receives user input each time a virtual test is performed.
示例性的,For example,
“输入信号:3;"Input signal: 3;
预期结果:门应该处于打开状态;Expected result: The door should be in the open position;
输入信号:25;Input signal: 25;
预期结果:窗户应该处于关闭状态。”Expected Result: The window should be closed. ”
S302、根据预设的输入信号和通讯协议的映射关系,将输入信号测试用例封装成多个模拟报文,每个模拟报文对应一个输入信号的一种通讯协议。S302: Encapsulate the input signal test case into a plurality of simulation messages according to a preset mapping relationship between the input signal and the communication protocol, each simulation message corresponding to a communication protocol of the input signal.
在本步骤中,不同的输入信号遵循的通讯协议不同,因此,根据预设的输入信号和通讯协议的映射关系,将输入信号测试用例封装成多个模拟报文。每个模拟报文对应一个输入信号的一种通讯协议。即将不同的输入信号根据测试例程中的信号矩阵表搭载在不同的协议栈上,如局域网络互联(Local Interconnect Network,简称:LIN)、控制器局域网(Controller Area Network,简称:CAN)、CAN灵活数据速率(CAN Flexible Data-rate,简称:CANFD)、以太网(Ethernet)、Flexray等。具体的,在内置的仿真工具中创建虚拟报文,虚拟报文可以包含各种信号值、周期性和信号值的期望值,以模拟实际车辆中的CAN数据流。模拟相应通信协议向虚拟机发送信号,例如将信号序列化为CAN协议信号发送至虚拟机;将信号序列化为LIN协议信号发送至虚拟机;将信号序列化为Ethernet协议信号发送至虚拟机;将信号序列化为Flexray协议信号发送至虚拟机等操作。In this step, different input signals follow different communication protocols. Therefore, according to the preset mapping relationship between input signals and communication protocols, the input signal test cases are encapsulated into multiple simulation messages. Each simulation message corresponds to a communication protocol for an input signal. That is, different input signals are carried on different protocol stacks according to the signal matrix table in the test routine, such as Local Interconnect Network (LIN), Controller Area Network (CAN), CAN Flexible Data-rate (CANFD), Ethernet, Flexray, etc. Specifically, a virtual message is created in the built-in simulation tool, and the virtual message can contain various signal values, periodicity, and expected values of signal values to simulate the CAN data flow in the actual vehicle. Simulate the corresponding communication protocol to send a signal to the virtual machine, for example, serialize the signal into a CAN protocol signal and send it to the virtual machine; serialize the signal into a LIN protocol signal and send it to the virtual machine; serialize the signal into an Ethernet protocol signal and send it to the virtual machine; serialize the signal into a Flexray protocol signal and send it to the virtual machine, etc.
以CAN FD消息为例进行说明。将信号根据测试用例打包封装成报文帧的步骤:对于每个信号,根据测试用例中的数值范围,构造一个符合CAN FD协议规范的帧(Frame);每个信号可以分配一个唯一的Frame标识,以便虚拟的接收端可以识别并处理不同的信号。将测试用例中的数值作为数据有效载荷(Payload)填充到CAN FD Frame中的数据(Data)段,其中,数据段(Data)中的数据包括测试信号数据和期望值。根据信号的数据范围选择适当的数据帧格式,将构造好的CAN FD Frame封装成CAN FD消息,准备发送到相应的通信介质上。将封装好的CAN FD消息发送到CAN FD总线上,或者通过网关转换后发送到其他协议栈(如LIN、Ethernet、Flexray等)上进行仿真测试。Take CAN FD message as an example. The steps of packaging the signal into a message frame according to the test case are as follows: for each signal, construct a frame that complies with the CAN FD protocol specification according to the value range in the test case; each signal can be assigned a unique frame identifier so that the virtual receiving end can identify and process different signals. Fill the value in the test case as the data payload into the data segment in the CAN FD Frame, where the data in the data segment includes the test signal data and the expected value. Select the appropriate data frame format according to the data range of the signal, and encapsulate the constructed CAN FD Frame into a CAN FD message, ready to be sent to the corresponding communication medium. Send the encapsulated CAN FD message to the CAN FD bus, or send it to other protocol stacks (such as LIN, Ethernet, Flexray, etc.) after conversion through the gateway for simulation testing.
S303、将多个模拟报文发送到虚拟机。S303: Send multiple simulated messages to the virtual machine.
通过相应的通信接口,将准备好的模拟报文发送到虚拟机的虚拟控制单元。The prepared simulation message is sent to the virtual control unit of the virtual machine through the corresponding communication interface.
S304、获取虚拟机对每个模拟报文中的输入信号的测试值。S304: Obtain a test value of the virtual machine for an input signal in each simulation message.
在本步骤中,虚拟机在接收到模拟报文后,解析其中的数据。根据报文帧中数据段的信号数据,提取所需的输入信号。输入信号通常指代预先约定的特定的数据字段或参数,用于表示某种状态、命令或控制信息。根据提取到的信号信息,虚拟机可以执行相应的操作,例如:更新软件组件中对应的接口数值;触发特定的功能或逻辑操作;向其他系统组件发送消息或数据。In this step, after receiving the simulated message, the virtual machine parses the data in it. According to the signal data in the data segment of the message frame, the required input signal is extracted. The input signal usually refers to a specific data field or parameter agreed in advance, which is used to represent a certain state, command or control information. According to the extracted signal information, the virtual machine can perform corresponding operations, such as: updating the corresponding interface value in the software component; triggering a specific function or logical operation; sending messages or data to other system components.
在一种具体的实现方式中,虚拟机向当前运行的软件组件(Software Component,简称:SWC)发送请求,获取在执行输入信号之后对应的特定的接口值,请求通常包括标识要获取的接口、数据格式等信息。In a specific implementation, the virtual machine sends a request to the currently running software component (SWC) to obtain a specific interface value corresponding to the input signal after execution. The request usually includes information such as identification of the interface to be obtained and data format.
可选的,虚拟机将提取到的接口值打印出来,并保存到日志(log)文件中,以备后续参考和分析。Optionally, the virtual machine prints out the extracted interface value and saves it to a log file for subsequent reference and analysis.
S305、比较每个输入信号的测试值和期望值是否相同。S305: Compare the test value and expected value of each input signal to see if they are the same.
在本步骤中,根据获取的接口值(即输入信号的测试值)和虚拟报文帧中数据段中的期望值进行比对,或者,读取log文件中的接口值,并与虚拟报文帧中数据段中的期望值进行比对。In this step, the obtained interface value (ie, the test value of the input signal) is compared with the expected value in the data segment of the virtual message frame, or the interface value in the log file is read and compared with the expected value in the data segment of the virtual message frame.
S306、若每个输入信号的测试值和期望值均相同,则虚拟仿真测试通过。S306: If the test value and the expected value of each input signal are the same, the virtual simulation test passes.
S307、若任一输入信号的测试值和期望值不相同,则虚拟仿真测试没有通过,修改可执行文件对应的配置文件。S307: If the test value of any input signal is different from the expected value, the virtual simulation test fails, and the configuration file corresponding to the executable file is modified.
在本步骤中,一旦发现输入信号的测试值与期望值不同,则表示可执行文件内部的逻辑可能有错误,例如接口配置错误,需要用户手动修正对应的配置文件,或自动化工具或脚本来检查配置文件,并尝试自动修正发现的问题,重新生成Autosar架构的源代码和可执行文件。In this step, once the test value of the input signal is found to be different from the expected value, it means that there may be errors in the logic inside the executable file, such as interface configuration errors. The user needs to manually correct the corresponding configuration file, or an automated tool or script can be used to check the configuration file and try to automatically correct the problems found, and regenerate the source code and executable file of the Autosar architecture.
本实施例提供一种基于Autosar架构的虚拟仿真方法,获取输入信号测试用例,输入信号测试用例中包括多个输入信号和每个输入信号的期望值;根据预设的输入信号和通讯协议的映射关系,将输入信号测试用例封装成多个模拟报文,每个模拟报文对应一个输入信号的一种通讯协议;将多个模拟报文发送到虚拟机;获取虚拟机对每个模拟报文中的输入信号的测试值;比较每个输入信号的测试值和期望值是否相同;若每个输入信号的测试值和期望值均相同,则虚拟仿真测试通过。若任一输入信号的测试值和期望值不相同,则虚拟仿真测试没有通过,修改可执行文件对应的配置文件。通过本方式根据测试用例中的输入信号构建多个虚拟报文,并将输入信号和输入信号的期望值写入虚拟报文的数据段,由此虚拟机接收到虚拟报文之后执行输入信号,将测试值与虚拟报文中的期望值进行比对,可以对不同协议的输入信号都进行自动仿真测试,及时发现和修正错误。The present embodiment provides a virtual simulation method based on the Autosar architecture, obtaining an input signal test case, the input signal test case includes multiple input signals and the expected value of each input signal; according to the preset mapping relationship between the input signal and the communication protocol, the input signal test case is encapsulated into multiple simulation messages, each simulation message corresponds to a communication protocol of an input signal; multiple simulation messages are sent to a virtual machine; the test value of the virtual machine for the input signal in each simulation message is obtained; the test value and the expected value of each input signal are compared to see whether they are the same; if the test value and the expected value of each input signal are the same, the virtual simulation test passes. If the test value and the expected value of any input signal are not the same, the virtual simulation test fails, and the configuration file corresponding to the executable file is modified. In this way, multiple virtual messages are constructed according to the input signal in the test case, and the input signal and the expected value of the input signal are written into the data segment of the virtual message, so that the virtual machine executes the input signal after receiving the virtual message, and compares the test value with the expected value in the virtual message, so that the input signals of different protocols can be automatically simulated and tested, and errors can be found and corrected in time.
实施例三介绍了对于输入信号的仿真测试的过程,下面以一个实施例介绍输出信号的仿真测试过程。The third embodiment introduces the process of simulation test for input signal. The following embodiment introduces the process of simulation test for output signal.
图5为本申请提供的基于Autosar架构的虚拟仿真方法实施例四的流程示意图,如图5所示,包括如下步骤:FIG5 is a flow chart of a fourth embodiment of a virtual simulation method based on the Autosar architecture provided by the present application, as shown in FIG5 , comprising the following steps:
S401、获取输出信号测试用例,输出信号测试用例中包括多个输出信号和每个输出信号的期望值。S401. Obtain an output signal test case, where the output signal test case includes multiple output signals and an expected value of each output signal.
输入信号通常是外部环境产生的,发送给虚拟机的软件组件的数据,而输出信号是由虚拟机软件组件内部的处理逻辑和算法生成的。因此,输出信号的测试需要生成在虚拟机中能够产生输出信号的可执行文件。Input signals are usually data generated by the external environment and sent to the software components of the virtual machine, while output signals are generated by the processing logic and algorithms inside the software components of the virtual machine. Therefore, the test of output signals requires the generation of executable files that can generate output signals in the virtual machine.
获取输出信号的测试用例,每个测试用例都包含了多个输出信号及其相应的期望值。通过执行输出信号的测试用例,可以验证软件组件在不同情况下对应输出信号是否符合预期值,从而确保软件组件的正确性和稳定性。Get the test cases of output signals. Each test case contains multiple output signals and their corresponding expected values. By executing the test cases of output signals, it is possible to verify whether the corresponding output signals of software components in different situations meet the expected values, thereby ensuring the correctness and stability of software components.
示例性的,测试用例1:Exemplary, test case 1:
输出信号1:信号_1Output signal 1: signal_1
期望值:100Expected value: 100
输出信号2:信号_2Output signal 2: signal_2
期望值:窗户状态为开状态。Expected value: The window state is open.
S402、根据预设的测试代码生成软件工具包生成每个输出信号的测试代码,每个输出信号的测试代码用于在虚拟机中模拟产生输出信号。S402: Generate a test code for each output signal according to a preset test code generation software toolkit, wherein the test code for each output signal is used to simulate the generation of the output signal in the virtual machine.
在本步骤中,通过测试代码文件可以直接控制软件组件输出的数据,方便进行结果验证和比对。而生成的测试代码文件是根据具体的测试例程中的每一个输出信号自动生成的,可以针对性地模拟不同的输出信号,可以更好地覆盖各种测试场景。In this step, the data output by the software component can be directly controlled through the test code file, which is convenient for result verification and comparison. The generated test code file is automatically generated according to each output signal in the specific test routine, which can simulate different output signals in a targeted manner and better cover various test scenarios.
具体的,使用测试代码的软件开发工具包(SDK)根据测试用例中的输出信号自动生成测试代码文件(example文件)。其中,测试代码中包括测试函数,测试函数可以引用输出信号测试用例中不同的输出信号,即测试函数中的输出信号被循环赋值,进而生成每一个输出信号对应的测试代码文件。测试代码文件中也包括每一个输出信号的期望值。Specifically, a test code software development kit (SDK) is used to automatically generate a test code file (example file) according to the output signal in the test case. The test code includes a test function, and the test function can reference different output signals in the output signal test case, that is, the output signal in the test function is cyclically assigned, and then a test code file corresponding to each output signal is generated. The test code file also includes the expected value of each output signal.
S403、将每个输出信号的测试代码编译生成每个输出信号的可执行文件。S403: Compile the test code of each output signal to generate an executable file of each output signal.
使用相应的编译工具对每个输出信号的测试代码进行编译,生成对应的可执行文件。Use the corresponding compilation tool to compile the test code of each output signal to generate the corresponding executable file.
S404、将每个输出信号的可执行文件加载到虚拟机中执行,获取每个输出信号的测试值。S404: Load the executable file of each output signal into the virtual machine for execution, and obtain the test value of each output signal.
在本步骤中,虚拟机中的目标程序执行每个输出信号的可执行文件,调用报文监控工具(例如wireshark)获取虚拟机发出的虚拟报文帧,其中,虚拟报文帧中的报文段包括测试结果的测试值,并将其保存为log文件。具体的,根据报文的协议(CAN、LIN、Ethernet、Flexray),对信号payload进行反序列化解析信号组的操作,获取其中的报文段数据,将其中输出信号的测试值保存为log文件。根据log文件中的测试值和可执行文件中的期望值进行比对,若比对一致,则仿真测试通过,若log中测试值与期望值不匹配,则仿真测试不通过。In this step, the target program in the virtual machine executes the executable file of each output signal, calls the message monitoring tool (such as wireshark) to obtain the virtual message frame sent by the virtual machine, wherein the message segment in the virtual message frame includes the test value of the test result, and saves it as a log file. Specifically, according to the protocol of the message (CAN, LIN, Ethernet, Flexray), the signal payload is deserialized and the signal group is parsed to obtain the message segment data therein, and the test value of the output signal is saved as a log file. The test value in the log file is compared with the expected value in the executable file. If the comparison is consistent, the simulation test passes. If the test value in the log does not match the expected value, the simulation test fails.
本实施例提供一种基于Autosar架构的虚拟仿真方法,该方法根据输出信号的测试用例,通过测试代码生成工具将测试代码进行循环赋值,生成每个输出信号的可执行文件,根据可执行文件得到输出结果的测试值。通过虚拟仿真的方式对软件组件进行输出信号的自动仿真测试,可以开发效率,预先发现可执行文件或者软件组件的错误和漏洞。This embodiment provides a virtual simulation method based on the Autosar architecture. According to the test case of the output signal, the test code is cyclically assigned through a test code generation tool to generate an executable file for each output signal, and the test value of the output result is obtained according to the executable file. By performing automatic simulation test on the output signal of the software component in a virtual simulation manner, the efficiency can be improved and errors and vulnerabilities of the executable file or software component can be discovered in advance.
图6为本申请提供的基于Autosar架构的虚拟仿真装置实施例一的结构示意图,如图6所示,基于Autosar架构的虚拟仿真装置600包括:FIG6 is a schematic diagram of the structure of a first embodiment of a virtual simulation device based on the Autosar architecture provided by the present application. As shown in FIG6 , a virtual simulation device 600 based on the Autosar architecture includes:
传输模块613,用于将编译后的可执行文件传输到虚拟机的文件系统中,所述可执行文件包括Autosar架构中基础软件层的功能模块、应用层的功能模块和运行时环境层;A transmission module 613, used to transmit the compiled executable file to the file system of the virtual machine, wherein the executable file includes the functional modules of the basic software layer, the functional modules of the application layer and the runtime environment layer in the Autosar architecture;
模拟模块614,启动所述虚拟机的执行程序,在所述虚拟机环境中加载所述可执行文件,所述在所述虚拟机环境中加载所述可执行文件用于模拟在运行时环境条件下应用层的功能模块通过基础软件层和微控制器抽象层与模拟硬件之间的交互功能;The simulation module 614 starts the execution program of the virtual machine and loads the executable file in the virtual machine environment, wherein the executable file loaded in the virtual machine environment is used to simulate the interaction function between the functional module of the application layer and the simulation hardware through the basic software layer and the microcontroller abstraction layer under the runtime environment condition;
仿真测试模块615,用于执行虚拟仿真测试,并获取虚拟仿真测试结果。The simulation test module 615 is used to perform virtual simulation tests and obtain virtual simulation test results.
可选的,所述装置还包括:获取模块611和虚拟模块612:Optionally, the device further includes: an acquisition module 611 and a virtual module 612:
所述获取模块611,用于获取用户配置的硬件属性数据,所述硬件属性数据包括:处理器架构、处理器数量和内存大小,所述硬件属性数据用于模拟目标系统的硬件配置;The acquisition module 611 is used to acquire the hardware attribute data configured by the user, wherein the hardware attribute data includes: processor architecture, number of processors and memory size, and the hardware attribute data is used to simulate the hardware configuration of the target system;
所述虚拟模块612,用于根据所述硬件属性数据在虚拟机中模拟高级精简指令集计算机ARM架构的虚拟机环境。The virtual module 612 is used to simulate a virtual machine environment of an advanced reduced instruction set computer ARM architecture in a virtual machine according to the hardware attribute data.
可选的,所述仿真测试模块615具体用于:Optionally, the simulation test module 615 is specifically used for:
将调试器的虚拟调试指令发送到所述虚拟机;Sending a virtual debugging instruction of a debugger to the virtual machine;
在所述虚拟机中运行所述虚拟调试指令,获取所述虚拟调制指令的虚拟仿真测试结果。The virtual debugging instruction is run in the virtual machine to obtain a virtual simulation test result of the virtual modulation instruction.
可选的,所述装置还包括显示模块616,所述显示模块616用于:Optionally, the device further includes a display module 616, and the display module 616 is used to:
在二维仿真图像或者三维仿真图像中显示所述虚拟仿真测试结果。The virtual simulation test result is displayed in a two-dimensional simulation image or a three-dimensional simulation image.
可选的,所述仿真测试模块615还用于:Optionally, the simulation test module 615 is further used for:
获取输入信号测试用例,所述输入信号测试用例中包括多个输入信号和每个输入信号的期望值;Obtaining an input signal test case, wherein the input signal test case includes multiple input signals and an expected value of each input signal;
根据预设的输入信号和通讯协议的映射关系,将所述输入信号测试用例封装成多个模拟报文,每个模拟报文对应一个输入信号的一种通讯协议;According to the preset mapping relationship between the input signal and the communication protocol, the input signal test case is encapsulated into a plurality of simulation messages, each simulation message corresponding to a communication protocol of an input signal;
将所述多个模拟报文发送到虚拟机;Sending the multiple simulated messages to the virtual machine;
获取所述虚拟机对每个模拟报文中的输入信号的测试值。A test value of the virtual machine for an input signal in each simulation message is obtained.
可选的,所述仿真测试模块615还用于:Optionally, the simulation test module 615 is further used for:
比较每个输入信号的测试值和期望值是否相同;Compare the test value and expected value of each input signal to see if they are the same;
若每个输入信号的测试值和期望值均相同,则虚拟仿真测试通过;If the test value and expected value of each input signal are the same, the virtual simulation test passes;
若任一输入信号的测试值和期望值不相同,则虚拟仿真测试没有通过,修改所述可执行文件对应的配置文件。If the test value of any input signal is different from the expected value, the virtual simulation test fails, and the configuration file corresponding to the executable file is modified.
可选的,所述仿真测试模块615还用于:Optionally, the simulation test module 615 is further used for:
获取输出信号测试用例,所述输出信号测试用例中包括多个输出信号和每个输出信号的期望值;Obtaining an output signal test case, wherein the output signal test case includes a plurality of output signals and an expected value of each output signal;
根据预设的测试代码生成软件工具包生成每个输出信号的测试代码,每个输出信号的测试代码用于在虚拟机中模拟产生输出信号;Generate a test code for each output signal according to a preset test code generation software toolkit, wherein the test code for each output signal is used to simulate and generate the output signal in a virtual machine;
将每个输出信号的测试代码编译生成每个输出信号的可执行文件;Compile the test code of each output signal to generate an executable file for each output signal;
将每个输出信号的可执行文件加载到所述虚拟机中执行,获取每个输出信号的测试值。The executable file of each output signal is loaded into the virtual machine for execution, and the test value of each output signal is obtained.
可选的,所述测试代码中包括测试函数,所述测试函数可以引用不同的输出信号。Optionally, the test code includes a test function, and the test function can reference different output signals.
本申请实施例提供的基于Autosar架构的虚拟仿真装置,用于实现前述方法实施例中任一项所述的基于Autosar架构的虚拟仿真方法,其实现原理和技术效果类似,在此不做赘述。The virtual simulation device based on the Autosar architecture provided in the embodiment of the present application is used to implement the virtual simulation method based on the Autosar architecture described in any of the aforementioned method embodiments. Its implementation principle and technical effect are similar and will not be elaborated here.
图7为本申请提供的一种电子设备的结构示意图,该电子设备可以是电脑,或者服务器,或者车载终端,或者平板等,如图7所示,所述电子设备700包括:FIG. 7 is a schematic diagram of the structure of an electronic device provided by the present application. The electronic device may be a computer, a server, a vehicle-mounted terminal, a tablet, etc. As shown in FIG. 7 , the electronic device 700 includes:
处理器701,与所述处理器通信连接的存储器702,以及与其他设备交互的通信接口703;A processor 701, a memory 702 in communication with the processor, and a communication interface 703 for interacting with other devices;
所述存储器702存储计算机执行指令;The memory 702 stores computer-executable instructions;
所述处理器701执行所述存储器存储的计算机执行指令,以实现上述任一方法实施例所述的基于Autosar架构的虚拟仿真方法。The processor 701 executes the computer-executable instructions stored in the memory to implement the virtual simulation method based on the Autosar architecture described in any of the above method embodiments.
可选的,该电子设备700的上述各个器件之间可以通过系统总线连接。Optionally, the above-mentioned components of the electronic device 700 may be connected via a system bus.
存储器702可以是单独的存储单元,也可以是集成在处理器中的存储单元。处理器701的数量为一个或者多个。The memory 702 may be a separate storage unit or a storage unit integrated in the processor. The number of the processor 701 may be one or more.
可选的,电子设备还包括多媒体组件,多媒体组件包括在电子设备和用户之间的提供一个输出接口的触控显示屏。在一些实施例中,触控显示屏可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与触摸或滑动操作相关的持续时间和压力。Optionally, the electronic device also includes a multimedia component, which includes a touch display screen that provides an output interface between the electronic device and the user. In some embodiments, the touch display screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
可选的,该电子设备还包括电源组件,电源组件为电子设备的各种部件提供电力。电源组件可以包括电源管理系统,一个或多个电源,及其他与为装置生成、管理和分配电力相关联的组件。Optionally, the electronic device also includes a power supply component that provides power to various components of the electronic device. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device.
应理解,处理器703可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。It should be understood that the processor 703 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.
系统总线可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。系统总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。存储器可能包括随机存取存储器(randomaccess memory,RAM),也可能还包括非易失性存储器(non-volatile memory,NVM),例如至少一个磁盘存储器。The system bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage.
实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一可读取存储器中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储器(存储介质)包括:只读存储器(read-only memory,ROM)、RAM、快闪存储器、硬盘、固态硬盘、磁带(magnetic tape)、软盘(floppy disk)、光盘(optical disc)及其任意组合。All or part of the steps of the above-mentioned method embodiments can be completed by hardware related to program instructions. The above-mentioned program can be stored in a readable memory. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the above-mentioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid state drive, magnetic tape, floppy disk, optical disc and any combination thereof.
本申请实施例提供的电子设备,用于实现前述方法实施例中任一项所述的基于Autosar架构的虚拟仿真方法,其实现原理和技术效果类似,在此不做赘述。The electronic device provided in the embodiment of the present application is used to implement the virtual simulation method based on the Autosar architecture as described in any of the aforementioned method embodiments. Its implementation principle and technical effect are similar and will not be described in detail here.
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行指令被处理器执行时用于实现如前述方法实施例中任一项所述的基于Autosar架构的虚拟仿真方法。The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement a virtual simulation method based on the AUTOSAR architecture as described in any of the aforementioned method embodiments.
可以理解,本申请实施例中的存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(doubledata rateSDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(directrambus RAM,DR RAM)。应注意,上述涉及的存储器旨在包括但不限于这些和任意其它适合类型的存储器。It can be understood that the memory in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus RAM (DR RAM). It should be noted that the above references to memory are intended to include, but are not limited to, these and any other suitable types of memory.
本申请实施例还提供一种计算机程序产品,该计算机程序产品包括计算机程序,该计算机程序存储在计算机可读存储介质中,至少一个处理器可以从该计算机可读存储介质中读取该计算机程序,至少一个处理器执行计算机程序时可实现前述方法实施例中任一项所述的基于Autosar架构的虚拟仿真方法。An embodiment of the present application also provides a computer program product, which includes a computer program, which is stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium, and when at least one processor executes the computer program, it can implement any one of the virtual simulation methods based on the AUTOSAR architecture described in the aforementioned method embodiments.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求书指出。Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求书来限制。It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410826307.0A CN118708488A (en) | 2024-06-25 | 2024-06-25 | Virtual simulation method, device and equipment based on Autosar architecture |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410826307.0A CN118708488A (en) | 2024-06-25 | 2024-06-25 | Virtual simulation method, device and equipment based on Autosar architecture |
Publications (1)
Publication Number | Publication Date |
---|---|
CN118708488A true CN118708488A (en) | 2024-09-27 |
Family
ID=92810291
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410826307.0A Pending CN118708488A (en) | 2024-06-25 | 2024-06-25 | Virtual simulation method, device and equipment based on Autosar architecture |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118708488A (en) |
-
2024
- 2024-06-25 CN CN202410826307.0A patent/CN118708488A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104756086B (en) | System and method for debugging the language depending on field | |
CN116681013B (en) | Simulation verification method, platform, device, equipment and medium of network chip | |
KR102141287B1 (en) | Fault injection test method and system for vehicle software based on autosar | |
CN111813671A (en) | An IMA Software Simulation Test System | |
CN117667714A (en) | Tianmai development environment integrated real-time debugging method and system based on digital target machine | |
Sandmann et al. | Autosar-compliant development workflows: From architecture to implementation-tool interoperability for round-trip engineering and verification and validation | |
JP2011221803A (en) | Test tool and test method | |
CN114895935A (en) | Method and device for flashing vehicle ECU, electronic equipment and storage medium | |
CN114281709A (en) | A unit testing method, system, electronic device and storage medium | |
CN114428702A (en) | Information physical test system containing general interface module | |
CN117331565B (en) | Software generation method, device, computer equipment and storage medium | |
CN113127329B (en) | Script debugging method, device and computer storage medium | |
US20240176632A1 (en) | Method for generating and verifying automotive embedded software based on autosar | |
CN118708488A (en) | Virtual simulation method, device and equipment based on Autosar architecture | |
CN117608686A (en) | Configuration and transmission method, device, equipment, medium and server of accelerator | |
CN112559336B (en) | Method, device and system for self-adaptively debugging heterogeneous computing chip and main board chip | |
CN118363863B (en) | AutoSAR architecture test system and test method | |
CN117873650B (en) | Real-time running environment generation system, method, computer device and storage medium | |
CN114077503B (en) | A simulation proxy calling method, device, computer equipment and storage medium | |
CN112306844A (en) | Interface testing method, device, equipment and storage medium of software development system | |
AU2023201696B2 (en) | Method and device for determining coverage in HIL testing, and storage medium | |
Vuli et al. | Maximizing test asset re-use across MIL, SIL, and HIL development platforms | |
CN116860324B (en) | Development data processing method, development data processing apparatus, and readable storage medium | |
Macieira et al. | Device driver generation and checking approach | |
KR20240077723A (en) | Method for generating and verifying automotive embedded software based on autosar |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |