主要内容

导入Autosar XML描述中万博1manbetx

在Si万博1manbetxmulink中®,,,,you can import AUTOSAR software components, compositions, or packages of shared elements from AUTOSAR XML (ARXML) files. You use the ARXML importer, which is implemented as anarxml.Importer目的。有关更多信息,请参阅Autosar arxml进口商

To import ARXML software description files into Simulink, first call thearxml.Importer功能。在函数参数中,指定一个或多个ARXML文件来描述共享元素的软件组件,组成或软件包。例如:

ar = arxml.importer('thorottlePositionControlComposition.arxml'

功能:

  • 解析ARXML文件以识别AutoSar软件描述。

  • If you entered the function call without a terminating semicolon (;), lists the AUTOSAR content of the specified ARXML file or files.

  • 将手柄返回到ARXML进口商对象。在随后的函数调用中,该对象表示ARXML文件中解析的AutoSar软件说明。

有关更多信息,请参阅创建ARXML进口商对象

接下来,根据您要导入的内容,请致电arxml.Importercreate or update function. For example:

To help support the round trip of AUTOSAR elements between an AUTOSAR authoring tool (AAT) and the Simulink model-based design environment, ARXML import preserves imported AUTOSAR XML file structure, elements, and element universal unique identifiers (UUIDs) for ARXML export. For more information, seeAutosar XML文件结构和元素信息的往返保护

将Autosar软件组件或组合物导入Simulink之后,您可以开发组件或组成模型的行为和配置。万博1manbetx要完善组件配置,请参阅AUTOSAR Component Configuration

要配置ARXML导出选项,请参阅配置AutoSar XML选项

创建ARXML进口商对象

Before you import ARXML descriptions into Simulink, call thearxml.Importer功能。指定一个或多个ARXML文件的名称,其中包含AutoSar软件组件,组成或共享元素的描述。该函数在指定的ARXML文件中解析了描述,并创建代表解析信息的进口商对象。随后的电话CreateComponentAsmodelor other ARXML importer functions must specify the importer object.

例如,此呼叫指定主要的AutoSar软件组件文件,mr_component.arxml,以及包含数据类型,实现和接口信息的相关相关文件,这些信息完成了软件组件描述。

ar = arxml.importer({'mr_component.arxml',,,,'mr_datatype.arxml',,,,...'mr_implement.arxml',,,,'mr_interface.arxml'})

此呼叫指定ARXML文件,throttlePositionControlComposition.arxml,它描述了Autosar软件组成及其汇总的AutoSar组件。ARXML文件位于Matlabroot/examples/autosarblockset/data,在默认MATLAB上®搜索路径。

ar = arxml.importer('thorottlePositionControlComposition.arxml'

If you enter thearxml.Importerfunction call without a terminating semicolon (;), the importer lists the AUTOSAR content of the specified XML file or files. The information includes paths to software components in the AUTOSAR package structure, which you use in the next step.

在此示例中,软件组成的路径throttlePositionControlCompositionis/Company/Components/ThrottlePositionControlComposition。软件组件的路径Controlleris/公司/组件/控制器

ar =文件”小路/tolottlePositionControlComposition。arxml" contains: 1 Composition-Software-Component-Type: '/Company/Components/ThrottlePositionControlComposition' 2 Application-Software-Component-Type: '/Company/Components/Controller' '/Company/Components/ThrottlePositionMonitor' 3 Sensor-Actuator-Software-Component-Type: '/Company/Components/AccelerationPedalPositionSensor' '/Company/Components/ThrottlePositionActuator' '/Company/Components/ThrottlePositionSensor'

Import Software Component and Create Model

要将解析的原子软件组件导入Simulink模型,请致电万博1manbetxCreateComponentAsmodel功能。指定ARXML进口商对象和要创建为模型的组件。解析的ARXML文件必须指定组件的所有依赖项。

这following example creates a Simulink representation of an AUTOSAR atomic software component.

ar = arxml.importer('thorottlePositionControlComposition.arxml');names = getComponentNames(ar)
名称= 5x1 cell {'/company/组件/控制器'} {'/company/components/totottlePositionMonitor'} {'/company/components/components/accelerationPedalPositionSensor'} {'/company/compandents/components/components/totottlepositionActuator'}/throttlePositionSensor'}
createComponentAsmodel(ar,'/Company/Components/Controller',,,,...'ModelPeriodicRunnablesAs',,,,“ AtomicSubsystem”);

'ModelPeriodicRunnablesAs'argument controls whether the importer models AUTOSAR periodic runnables as atomic subsystems with periodic rates (the default) or function-call subsystems with periodic rates. SpecifyAtomicsubsystem除非您的设计需要使用功能通行子系统。有关更多信息,请参阅Import AUTOSAR Software Component with Multiple Runnables

To import Simulink data objects for AUTOSAR data into a Simulink data dictionary, you can set the'Datadictionary'关于模型创建的论点。如果指定的词典尚未存在,则进口商会创建它。

要明确指定可以在组件中运行的初始化的自动座,请使用“初始化”关于模型创建的论点。

有关更多信息,请参阅CreateComponentAsmodel参考页和示例导入Autosar组件以模拟万博1manbetx

Import Software Composition and Create Models

要将解析的原子软件组合物导入模型,请致电万博1manbetxcreateCompositionasmodel功能。指定ARXML进口商对象和为模型创建的组成。解析的ARXML文件必须指定构图的所有依赖项。

以下示例创建了AutoSar软件组成的Simulink表示。万博1manbetx

ar = arxml.importer('thorottlePositionControlComposition.arxml');names = getComponentNames(ar,'作品'
名称= 1x1单元格数组{'/company/components/thtottlePositionControlComposition'}
createCompositionSmodel(ar,'/company/组件/throttlePositionControlComposition');
为组件1 of 5:/company/compants/thtottlePositionSensor创建模型“ thorottlePositionSensor”,为组件2 of 5:/company/company/compants/thtottlePositionMonitor创建模型创建模型'Controller'for Components/company/Company/Compant/Compants/compant/compant/compant/compant/compant/组件4 of 5:/company/compants/accelerationPedAlpositionSensor创建模型的模型“ AccelerationPedAlpositionSensor”创建模型“ thtottlePositionActuator”,用于组件5 of 5:/company/company/company/compand/thtottlePositionActuator创建模型'throttlePositionControlComposition'for Compotition/Comports 1:/comport of 1:/composition'/tolottlePositionControlComposition

要在组成模型中包括现有的Simulink万博1manbetx Atomic软件组件模型,请使用“ componentModels”argument on the composition model creation.

有关更多信息,请参阅createCompositionasmodel参考页和示例导入汽车组合物以模拟万博1manbetx

For compositions containing more than 20 software components, sharing AUTOSAR properties among components can significantly improve performance and reduce duplication for composition workflows. To configure a composition import to store AUTOSAR properties for component sharing, use the'Datadictionary'“ ShareAutoSarproperties”参数。有关更多信息,请参阅createCompositionasmodel参考页和示例导入Autosar组成并共享Autosar词典

导入组件或组成外部更新到模型中

After you import a parsed atomic software component or composition into a Simulink model, the ARXML description of the component or composition might continue to evolve in a different AUTOSAR authoring environment. To update your AUTOSAR component or composition model with external changes, call theupdateModel功能。指定代表ARXML更改的ARXML进口商对象和要更新的现有AutoSar模型。

这following example updates an existing AUTOSAR component model namedController随着文件的更改throttlePositionControlcomPosition_updated.arxml

% Create and open AUTOSAR controller component modelar = arxml.importer('thorottlePositionControlComposition.arxml');createComponentAsmodel(ar,'/Company/Components/Controller',,,,...'ModelPeriodicRunnablesAs',,,,“ AtomicSubsystem”);% Update AUTOSAR controller component model (model must be open)ar2 = arxml.importer('ThrottlePositionControlComposition_updated.arxml');updateModel(ar2,'控制器');

有关更多信息,请参阅updateModel参考页,导入Autosar软件组件更新,,,,和the update section of the example导入Autosar组件以模拟万博1manbetx

Import Shared Element Packages into Component Model

After you create an AUTOSAR software component model, either by starting in Simulink or importing ARXML component descriptions, you can update the AUTOSAR properties of the component model with predefined elements and properties that are shared among components. To update the component AUTOSAR properties with packages of shared element definitions, call theUpdateAutoSarproperties功能。指定代表ARXML共享元素定义和现有AutoSar模型的ARXML进口商对象。

以下示例更新了使用文件中元素定义的AutoSar组件模型swaddrmethods.arxml

addpath(fullfile(matlabroot,'/示例/autosarblockset/main');modelName ='autosar_swc'; open_system(modelName); ar = arxml.importer('SwAddrMethods.arxml');modelName updateAUTOSARProperties (ar);

有关更多信息,请参阅UpdateAutoSarproperties参考页,导入和参考共享的autosar元素定义,示例将AutoSar软件包导入组件模型

也可以看看

相关示例

更多关于