1 文档目的(Purpose of this document)
1.1 文档概述(Document Overview)
本文档为使用 AUTOSAR 应用接口(Application Interfaces,AI) 的开发人员提供指南。它解释了:
- AI 表的结构与使用方法;
- AI 在 AUTOSAR 元模型和 ARXML 中的表示;
- AI 工具生成 ARXML 的流程;
- AI 与其他 AUTOSAR 文档(SWC 模板、元模型等)的关系。
2 应用接口表(AI Table)介绍(Introduction to Application Interfaces Table)
AUTOSAR 应用接口(AI)是一组标准化的接口、端口与数据类型,定义了应用软件组件之间以及与基础软件之间的通用交互。
AI 表是 AI 的 Excel 表现形式,每行包含一个 AI 元素,每列包含该元素的属性。AI 表以域(Domain)组织:
- 车身与舒适性(Body and Comfort);
- 底盘(Chassis);
- 动力总成(Powertrain);
- 乘员与行人安全(Occupant and Pedestrian Safety);
- HMI / 多媒体 / 车载信息(Multimedia, Telematics, HMI);
- 通用(General / Cross-Domain)。
2.1 AI 表中域的结构概述(Structural overview of Domains in AI Table)
每个域的 AI 表具有统一的结构:
- 顶层(TopLevel):列出所有 PortPrototypes;
- 接口(Interfaces):列出 SenderReceiver、ClientServer 接口;
- 数据类型(DataTypes):定义 PhysicalQuantity、Record 等类型;
- 单位(Units):定义物理量单位;
- 关键字(Keywords):标准化名称。
3 AUTOSAR 方法论(AUTOSAR Methodology)
3.1 可用文档概览(Overview on available documents)
AI 涉及以下关键文档:
| 编号 | 文档名 | 说明 |
|---|---|---|
| [1] | Software Component Template(软件组件模板) | 定义 SW-C 与接口的元模型 |
| [2] | Standardization Template(标准化模板) | 定义 AUTOSAR 文档结构 |
| [4] | Generic Structure Template(通用结构模板) | 定义 AUTOSAR XML 模式 |
| [6] | AI Specification(AI 规范) | 定义 AI 的 ARXML 模式 |
| [9] | Modeling Guide for Application Interfaces | AI 的建模指南 |
| [10] | AUTOSAR Methodology | 定义整体工程流程 |
| [11]–[15] | 域特定的 AI 解释文档 | 每个域(Body、Chassis、Powertrain 等)的 AI 说明 |
4 AI 表的元模型表示(Metamodel representation of AI Table)
4.1 模型元素类别(Category of Model Elements)
AI 元模型中的模型元素分为三类:
| 类别 | 英文 | 说明 |
|---|---|---|
| 标准 | STANDARD | AUTOSAR 标准化的元素,所有实现应当遵循。 |
| 蓝图 | BLUEPRINT | 用于模板化的可重用模板,可在特定项目中被实例化。 |
| 示例 | EXAMPLE | 示例性元素,仅作参考。 |
4.2 元模型图与 AI 表(Meta model diagrams and the AI Table)
4.2.1 组合(Composition)
AUTOSAR 中通过组合(Composition)关系建模 SW-C 之间的包含关系:
- 父 SW-C(CompositionType);
- 子 SW-C(Component);
- 通过
PortPrototype在 SW-C 间传递数据。
4.2.2 蓝图映射(Blueprint Mapping & BlueprintMappingSet)
蓝图(Blueprint)是可重用的 SW-C 模板,通过 BlueprintMapping 在不同项目中实例化。BlueprintMappingSet 包含一组蓝图映射。
4.2.3 端口原型(PortPrototypes)
每个 SW-C 通过端口原型对外提供或消费接口。端口原型分为:
PPortPrototype:提供端口;RPortPrototype:需求端口。
4.2.4 端口接口(PortInterfaces)
端口接口定义 SW-C 间通信的契约,包括:
SenderReceiverInterface:数据接口;ClientServerInterface:操作调用接口;ModeSwitchInterface:模式切换接口;ParameterInterface:参数接口;TriggerInterface:触发接口;NvDataInterface:非易失数据接口。
4.2.5 数据类型(DataTypes)
AUTOSAR 元模型支持以下数据类型:
- 应用原始类型(ApplicationPrimitiveDataType):整数、浮点、布尔等;
- 应用记录类型(ApplicationRecordDataType):结构体;
- 应用数组类型(ApplicationArrayDataType):数组;
- 应用数组数据原型等。
4.2.6 物理单位(Physical Units)
每个物理量关联一个单位(如 rpm、kPa、°C)。AI 通过 Unit 元类定义单位。
4.2.7 计算方法(Computation Methods)
计算方法描述应用原始类型与物理单位之间的转换关系(线性、缩放、偏移)。
4.2.8 关键字与关键字集(Keyword and KeywordSet)
关键字是 AUTOSAR 标准化命名的基础。每个关键字具有 shortName、abbrName、longName 等属性,分类于不同的关键字集。
5 向后兼容性(Backward Compatibility)
5.1 介绍(Introduction)
AUTOSAR 标准在版本演进时应当保持向后兼容性(BWC),即新版本不应破坏已有的实现。
5.2 向后兼容性定义(Backward Compatibility Definition)
向后兼容性在以下场景中定义:
- 同一接口在不同版本中应保持相同的 API;
- 数据类型的变化应向后兼容(如增加字段不应破坏旧代码);
- 配置项的删除应提供替代方案。
5.3 小结(Summary)
向后兼容性是 AUTOSAR 的核心承诺之一。每个新版本都应当提供 BWC 声明(见 AUTOSAR_TR_BWCStatement)。
6 生命周期状态(Life Cycle States)
6.1 介绍(Introduction)
AUTOSAR 中每个模型元素可处于不同的生命周期状态,例如:
DRAFT(草案);REVIEWED(已评审);APPROVED(已批准);DEPRECATED(已弃用);REMOVED(已移除)。
6.2 在 AI 表中的表示(Representation in AI Table)
AI 表中通过 LifecycleState 列标识每个元素的当前状态。
6.3 在元模型和 arxml 中的表示(Representation in meta model and arxml)
在元模型中,每个 ARElement 都有 LifecycleState 属性。ARXML 中以属性形式保存。
7 应用接口中的视图概念(变体处理)(View Concept in Application Interfaces (Variant Handling))
7.1 介绍(Introduction)
AI 支持视图(View)机制,允许同一接口在不同变体或配置下具有不同实现。视图用于处理变体和可变性。
7.2 在应用接口和元模型表示中的实现(Implementation in Application Interfaces and Meta Model Representation)
视图通过元模型中的 ViewMap、SwcView 等机制实现。具体细节详见原文 7.2 节。
8 应用接口(AI)表的结构(Structure of Application Interfaces (AI) Table)
8.1 AI 表的主要工作表(Main sheets of the AI Table)
AI 表是 Excel 文件,包含多个工作表:
8.1.1 工作表 04_Keywords
列出所有标准化关键字(如 EngineSpeed、VehicleSpeed 等)。每行包含:shortName、abbrName、longName、description、category 等。
8.1.2 工作表 05_TopLevel
列出所有顶层 PortPrototype(提供端口、需求端口)。每行包含:PortPrototype 名称、类型、接口、数据元素等。
8.1.3 工作表 050xxxxx
每个 PortPrototype 的详细描述工作表,列出的 PortPrototype 类型(PPortPrototype / RPortPrototype)、所属 SW-C 类型等。
8.1.4 工作表 06_Interfaces_DataElements (SenderReceiverInterface)
列出所有 SenderReceiver 接口及其数据元素。每行包含:接口名、数据元素名、数据类型、单位、计算方法等。
8.1.5 工作表 06_Interface_ClientServer
列出所有 ClientServer 接口及其操作。每行包含:接口名、操作名、参数列表(输入、输出、输入输出)等。
8.1.6 工作表 07_DataTypes_ContinuousValue
列出所有连续值数据类型(如浮点、整数),包括:数据类型名、单位、计算方法、范围等。
8.1.7 工作表 08_DataTypes_Enumeration
列出所有枚举数据类型,包括:枚举名、字面量集合、底层整数类型等。
8.1.8 工作表 09_DataTypes_Array
列出所有数组数据类型,包括:数组名、元素类型、元素数量(静态/动态)等。
8.1.9 工作表 11_DataTypes_Record
列出所有记录(结构体)数据类型,包括:记录名、字段列表(字段名、类型)等。
8.1.10 工作表 13_Units
列出所有物理单位,包括:单位名、符号、转换因子等。
8.1.11 工作表 15_Redirected_Ports
列出所有端口重定向信息,用于支持 RTE 端口组合。
8.2 AI 表所有工作表的完整列表(Complete List of all Sheets of the AI Table)
完整的 AI 表包含约 15+ 工作表,涵盖所有 AI 元素的定义。详见原文 8.2 节列表。
9 AI 表数据与 XML 输出的关系(Relationship between AI Table data and XML Output)
9.1 概述(Overview)
AI 工具(AI Tool)将 AI 表中的数据转换为 AUTOSAR XML(ARXML)格式。每个 Excel 工作表对应一类 ARXML 元素。
9.1.1 XML 生成的依赖(Dependencies of XML Generation)
XML 生成依赖于:
- AI 工具的正确安装;
- AI 表与元模型版本一致;
- 配置正确的包路径。
9.1.2 生成 XML 的内容(Contents of Generated XML)
生成的 ARXML 包含:
- PortPrototypeBlueprints;
- PortInterfaceBlueprints;
- DataTypeBlueprints;
- UnitBlueprints;
- Keyword sets;
- 等等。
9.1.3 模式结构(Schema Structure)
ARXML 模式遵循 AUTOSAR 元模型。每个 AI 元素对应一个 ARXML 元素。
9.2 通用元素(Common Elements)
9.2.1 包结构(Package Structure)
ARXML 中的包结构按域(Domain)和子包(Sub-Package)组织。
9.2.2 引用(References)
ARXML 中通过引用(Reference)关系链接不同的元素。
9.2.3 实例引用(Instance References)
实例引用指向特定的具体实例而非类型。
9.2.4 类型引用(Type References)
类型引用指向数据类型。
9.2.5 描述(Descriptions)
每个 ARXML 元素都可有 Desc 子元素提供多语言描述。
9.3 组件类型(Component Types)
9.3.1 组合类型(Composition Types)
CompositionType 用于定义 SW-C 的组合。
9.3.2 端口(Ports)
PPortPrototype 与 RPortPrototype 定义 SW-C 的端口。
9.3.3 组件(Components)
ComponentType、ApplicationSwComponentType 等定义 SW-C 类型。
9.3.4 连接器(Connectors)
AssemblySwConnector、DelegationSwConnector 等定义 SW-C 间的连接。
9.4 端口原型蓝图(PortPrototypeBlueprints)
PortPrototypeBlueprint 是可重用的端口模板,用于定义 AI 端口原型。
9.5 端口接口(PortInterfaces)
ARXML 中的 SenderReceiverInterface、ClientServerInterface 等定义端口接口。