主要内容

Model AUTOSAR Component Behavior

In Simulink®, you can model AUTOSAR component behavior, including behavior of runnables, events, and inter-runnable variables.

AUTOSAR建模组件行为的元素

模拟AUTOSAR component behavior, you model AUTOSAR elements that describe scheduling and resource sharing aspects of a component. The AUTOSAR elements that bear on component behavior include:

  • Runnables and the events to which they respond

  • Inter-runnable variables, used to communicate data between runnables in the same component

  • Included data type sets, which provide component internal data types

  • System constants, used to specify system-level constant values that are available for reference in component algorithms

  • 每种计算内存,用于指定组件中特定实例的全局内存

  • 静态和恒定内存,用于访问组件中的全局数据和参数值

  • Shared and per-instance parameters, for access to component internal parameter data

  • Port parameters, for port-based access to parameter data

This topic describes how to model the AUTOSAR elements that help you define component behavior.

Runnables

AUTOSAR software components contain runnables that are directly or indirectly scheduled by the underlying AUTOSAR operating system.

This figure shows an AUTOSAR software component with two runnables,可运行1可运行2。RTEEvents, events generated by the AUTOSAR Runtime Environment (RTE), trigger each runnable. For example, TimingEvent is an RTEEvent that is generated periodically.

A component also can contain a single runnable, represented by a model, and can be single-rate or multirate.

Note

无论建模模式如何,该软件都会为初始化功能生成额外的运行。

For more information, seeConfigure AUTOSAR Runnables and Events

可肺间变量

In AUTOSAR,可笑的variables are used to communicate data between runnables in the same component. You define these variables in a Simulink model by the signal lines that connect subsystems (runnables). For example, in the following figure,irv1,irv2,irv3, 和irv4are inter-runnable variables.

You can specify the names and data access modes of the inter-runnable variables that you export.

Included Data Type Sets

In an AUTOSAR software component model, you can import and export an ARXML description of an AUTOSAR included data type set (包括datatypeset)。一个包括datatypesetis defined as part of the internal behavior of a software component. It contains references to AUTOSAR data type definitions that are internal to a component and not present in the component interface descriptions. The referenced internal data type definitions can be shared among multiple software components, as described inImport and Reference Shared AUTOSAR Element Definitions

If you import ARXML files that contain an包括datatypeset描述为Simulink,进口商在A万博1manbetxutoSar组件模型中创建内部数据类型并将其映射到标题文件Rte_Type.h

In an AUTOSAR component model, to configure internal data types for export in an ARXML包括datatypesetdescription, map the internal data types to header fileRte_Type.h。构建组件模型:

  • Exports an ARXML包括datatypesetdescription for internal data types that are used in the model code.

  • 生成Rte_Type.hheader file entries for the internal data types.

For AUTOSAR包括datatypesetexport, Simulink supports these data types:

  • Numeric

  • 别名

  • Bus

  • Fixed-point

  • Enumerated

枚举文字的文字前缀在导入和创建之间的处理方式不同包括datatypesets:

  • If you import an包括datatypeset定义一个literalPrefixas a common prefix for enumeration literals, the importer preserves theliteralPrefix用于出口和往返包括datatypeset

  • 如果您在组件模型中配置内部数据类型,以在AutoSar中导出包括datatypeset,出口商在一个中生成数据类型包括datatypeset用空literalPrefix

For more information, seeConfigure Internal Data Types for AUTOSAR IncludedDataTypeSets

System Constants

AUTOSAR system constants (SwSystemConstants) specify system-level constant values that are available for reference in component algorithms. To add AUTOSAR system constants to your model, you can:

  • Import them from ARXML files.

  • 通过使用在simulink中创万博1manbetx建它们AUTOSAR.Parameter具有的对象存储类set toSystemConstant

You can then reference the AUTOSAR system constants in Simulink algorithms. For example, you can reference a system constant in a Gain block, or in a condition formula inside a variant subsystem or model reference.

When you reference an AUTOSAR system constant in your model:

  • Exported ARXML files contain a correspondingSwSystemConstant以及相应的汽车变异点代理(VariationPointProxy) that references theSwSystemConstant。If you generate modular ARXML files, theSwSystemConstant位于modelname_datatype.arxml和theVariationPointProxy位于modelname_component.arxml

  • Generated C code uses the generatedVariationPointProxyin places where the model uses theSwSystemConstant

For an example of an AUTOSAR system constant that represents a conditional value associated with variant condition logic, see为AutoSar可运行的实现配置变体

每种结构内存

AUTOSAR supports per-instance memory, which allows you to specify instance-specific global memory within a software component. An AUTOSAR run-time environment generator allocates this memory and provides an API through which you access this memory.

可以按照自动符合的或C型的c-ty型内存。autosar typed / nastance内存(arTypedPerInstanceMemory) is described using AUTOSAR data types rather than C types. When exported in ARXML files,arTypedPerInstanceMemoryallows the use of calibration and measurement tools to monitor the global variable corresponding to per-instance memory.

AUTOSAR also allows you to use per-instance memory as a RAM mirror for data in nonvolatile RAM (NVRAM). You can access and use NVRAM in your AUTOSAR application. For more information about modeling software component access to AUTOSAR nonvolatile memory, see型号Autosar非易失性内存

要向模型添加AutoSar的每种固定内存,您可以:

  • Import per-instance memory definitions from ARXML files.

  • Create model content that represents per-instance memory.

模拟arTypedPerInstanceMemory,您可以在AutoSar模型中使用块信号,离散状态或数据存储:

  • 要使用块信号和离散状态,请使用代码映射编辑器,Signals/Statestab, to select a signal or state and map it toarTypedPerInstanceMemory。要查看和修改AutoSar代码和校准属性的每个属性内存,请单击icon.

  • To use data stores, use the Code Mappings editor,数据存储tab, to select a data store and map it toarTypedPerInstanceMemory。要查看和修改AutoSar代码和校准属性的每个属性内存,请单击icon.

For more information, see配置AutoSar / nastance内存

Static and Constant Memory

AUTOSAR supports static memory (StaticMemory) and constant memory (ConstantMemory) data. Static memory corresponds to Simulink internal global signals. Constant memory corresponds to Simulink internal global parameters. In Simulink, you can import and export ARXML descriptions of AUTOSAR static and constant memory. When exported in ARXML files, static memory and constant memory allow the use of calibration and measurement tools to monitor the internal memory data.

模拟AUTOSAR static memory in Simulink, use the Code Mappings editor,Signals/States或者数据存储tab. Select a signal, state, or data store and map it to静态体积。To view and modify AUTOSAR code and calibration attributes for the static memory, click theicon.

模拟AUTOSAR constant memory in Simulink, use the Code Mappings editor,Parameters选项卡,选择一个参数并将其映射到常数。要查看和修改常数内存的AutoSar代码和校准属性,请单击icon.

For more information, seeConfigure AUTOSAR Static Memory配置AutoSar常数内存

共享和综合参数

AutoSar支万博1manbetx持共享参数(共享参数s) and per-instance parameters (PerInstanceParameters) for use in software components that are potentially instantiated multiple times. Shared parameter values are shared among all instances of a component. Per-instance parameter values are unique and private to each component instance.

In Simulink, you can import and export ARXML descriptions of AUTOSAR shared and per-instance parameters. When exported in ARXML files, shared and per-instance parameters enable the use of calibration and measurement tools to monitor component parameters.

要在Simulink中建模AutoSar共享参数,请配置不是模型参数的模型工作空万博1manbetx间参数(也不是Multi-Insance模型的每个实例所唯一的)。例如,在参数的模型资源管理器视图中,清除争论property. In the Code Mappings editor,Parameters选项卡,选择参数并将其映射到参数type共享参数。To view and modify AUTOSAR code and calibration attributes for the shared parameter, click theicon.

模拟an AUTOSAR per-instance parameter in Simulink, configure a model workspace parameter that is a model argument (that is, unique to each instance of a multi-instance model). For example, in the Model Explorer view of the parameter, select the争论property. In the Code Mappings editor,Parameters选项卡,选择参数并将其映射到参数PerInstanceParameter。To view and modify AUTOSAR code and calibration attributes for the per-instance parameter, click theicon.

For more information, seeConfigure AUTOSAR Shared or Per-Instance Parameters

端口参数

Autosar标准定义了用于参数通信的基于端口的参数。AutoSar参数通信依赖参数软件组件(ParameterSwComponent)和一个或多个需要基于端口的参数数据访问的原子软件组件。这ParameterSwComponent表示包含AutoSar参数的内存,并为连接的原子软件组件提供参数数据。

In Simulink, you can model the receiver side of AUTOSAR parameter communication. By importing ARXML descriptions or configuring a software component model, you can model:

  • AUTOSAR parameter receiver component, which communicates with aParameterSwComponentto receive parameter data.

  • AUTOSAR parameter interface, which contains parameter data elements. The data elements map to parameter or lookup table objects in the model workspace.

  • AUTOSAR parameter receiver port used to communicate with theParameterSwComponent

When you generate code for the AUTOSAR parameter receiver component:

  • 导出的ARXML文件包含参数接收器组件,参数接口,参数数据元素和参数接收器端口的描述。

  • 生成的C代码包含Autosar端口参数Rte功能调用。

At run time, the software can access the parameter data elements as port-based parameters.

因为端口参数数据范围范围为模型工作区和AutoSar组件:

  • Different components can use the same parameter names without naming conflicts.

  • AutoSar组合物可以包含参数接收器组件的多个实例,每个实例都具有特定于实例的端口参数数据值。

For more information, seeConfigure AUTOSAR Port Parameters for Communication with Parameter Component

See Also

Related Examples

More About