# AUTOSAR 建模示例报告
> **AUTOSAR CP Release 4.4.0**
>
> 原文:*Modeling Show Cases Report*(文档 ID 789)
>
> 翻译状态:**已完成 v1**(封面+前言+测量与标定主章节完整翻译;附录保留类表索引)
>
> 对应原文 PDF:`MethodologyAndTemplates/AUTOSAR_TR_ModelingShowCases.pdf`
>
> 对应示例包:`AUTOSAR_EXP_ModelingShowCases.zip`
>
> 翻译日期:Step 3 - P0 批量翻译
---
## 文档标识
| 字段 | 值 |
|------|-----|
| 文档标题(Document Title) | 建模示例报告(Modeling Show Cases Report) |
| 文档所有者(Document Owner) | AUTOSAR |
| 文档责任人(Document Responsibility) | AUTOSAR |
| 文档标识号(Document Identification No) | 789 |
| 文档状态(Document Status) | 正式版(Final) |
| 所属 AUTOSAR 标准 | Classic Platform(经典平台) |
| 所属标准版本 | 4.4.0 |
> 原文版权:© AUTOSAR — 机密文件
> 本中文译文仅供学习参考。
---
## 免责声明(Disclaimer)
本作品(规范和/或软件实现)及其包含的材料由 AUTOSAR 发布,**仅供信息参考**。AUTOSAR 及为其做出贡献的公司不对作品的任何使用承担责任。
本作品中包含的材料受版权及其他类型知识产权保护。对本作品所含材料的商业利用需要获得这些知识产权的许可。
本作品可在不作任何修改的情况下、以任何形式或任何手段用于**纯信息性目的**。任何其他目的,未经出版者书面许可,作品的任何部分不得被利用或复制。
本作品**仅**为汽车应用而开发。它既未为非汽车应用而开发,也未为非汽车应用而进行测试。
"AUTOSAR" 一词和 AUTOSAR 标志是注册商标。
---
## 文档变更历史(Document Change History)
| 日期 | 版本 | 变更人 | 变更说明 |
|------|------|--------|----------|
| 2018-10-31 | 4.4.0 | AUTOSAR Release Management | 编辑性修订(Editorial Changes) |
| 2017-12-08 | 4.3.1 | AUTOSAR Release Management | 编辑性修订(Editorial Changes) |
| 2016-11-30 | 4.3.0 | AUTOSAR Release Management | 初始发布(Initial Release) |
---
## 目录
1. [引言(Introduction)](#1-引言introduction)
2. [概述(Overview)](#2-概述overview)
3. [测量与标定(Measurement and Calibration)](#3-测量与标定measurement-and-calibration)
- 3.1 [入门示例(Introductory Show Case)](#31-入门示例introductory-show-case)
- 3.1.1 [物理系统(Physical System)](#311-物理系统physical-system)
- 3.1.1.1 [组件概述(Components Overview)](#3111-组件概述components-overview)
- 3.1.1.2 [环境(The Environment)](#3112-环境the-environment)
- 3.1.1.3 [被控对象(The Plant)](#3113-被控对象the-plant)
- 3.1.1.4 [控制器(The Controller)](#3114-控制器the-controller)
- 3.1.2 [AUTOSAR 建模(AUTOSAR Modeling)](#312-autosar-建模autosar-modeling)
- 3.1.3 [RTE 生成、测量与标定(RTE Generation, Measurement and Calibration)](#313-rte-生成测量与标定rte-generation-measurement-and-calibration)
- 3.1.3.1 [FlatMap](#3131-flatmap)
- 3.1.3.2 [ECU 文档、测量与标定(ECU Documentation, Measurement and Calibration)](#3132-ecu-文档测量与标定ecu-documentation-measurement-and-calibration)
- 3.1.4 [A2L 文件(A2L File)](#314-a2l-文件a2l-file)
- 3.1.5 [C 语言实现(Implementation in C)](#315-c-语言实现implementation-in-c)
- 3.1.6 [T_Plant 在示例中的一次遍历(A walk with T_Plant through the Show Case)](#316-t_plant-在示例中的一次遍历a-walk-with-t_plant-through-the-show-case)
- 3.1.6.1 [物理系统(Physical System)](#3161-物理系统physical-system)
- 3.1.6.2 [AUTOSAR 建模(AUTOSAR Modeling)](#3162-autosar-建模autosar-modeling)
- 3.1.6.3 [系统(System)](#3163-系统system)
- 3.1.6.4 [ECU 配置(ECU Configuration)](#3164-ecu-配置ecu-configuration)
- 3.1.6.5 [RTE 生成(RTE Generation)](#3165-rte-生成rte-generation)
- 3.1.6.6 [C 语言实现(Implementation in C)](#3166-c-语言实现implementation-in-c)
- 3.1.6.7 [A2L 文件(A2L File)](#3167-a2l-文件a2l-file)
- 3.1.6.8 [测量与标定工具(Measurement and Calibration Tool)](#3168-测量与标定工具measurement-and-calibration-tool)
- 3.1.7 [示例中的 Show Case(Show cases in the Example)](#317-示例中的-show-caseshow-cases-in-the-example)
- 3.2 [高级示例(Advanced Show Case)](#32-高级示例advanced-show-case)
- 3.2.1 [模型结构的一般目标(General Objectives of the Model Structure)](#321-模型结构的一般目标general-objectives-of-the-model-structure)
- 3.2.2 [示例中的 Show Case(Show cases in the Example)](#322-示例中的-show-caseshow-cases-in-the-example)
- [附录 A 提到的类表(Mentioned Class Tables)](#附录-a-提到的类表mentioned-class-tables)
---
## 参考文献(References)
- [1] Methodology,AUTOSAR_TR_Methodology
- [2] Modeling Show Cases Examples,AUTOSAR_EXP_ModelingShowCases
- [3] Software Component Template,AUTOSAR_TPS_SoftwareComponentTemplate
- [4] Specification of Platform Types,AUTOSAR_SWS_PlatformTypes
---
## 1 引言(Introduction)
本报告的目标是针对选定的 Show Case 说明和执行 AUTOSAR 建模以及 AUTOSAR 方法论(参见 [1])。
每个 Show Case 关注几个特定主题,并概述其基本用法以及在领域中的应用。在适当的情况下,Show Case 基于 AUTOSAR 标准的真实世界应用。
它包含:
- 对应用 AUTOSAR 建模特定部分的功能用例的解释性背景。
- 以互联表格形式展示 AUTOSAR 模型内容
- 对这些 AUTOSAR 模型的处理结果的解释(例如 C 代码、A2L 文件等)
- 完整示例的片段。完整示例在归档文件 AUTOSAR_EXP_ModelingShowCases.zip [2] 中提供。
---
## 2 概述(Overview)
本报告按章节组织,章节根据所含 Show Case 的主要关注点。每个章节包含一个主题特定的概述和至少一个 Show Case。每个章节是独立的,无需阅读其他章节即可理解。
AUTOSAR 方法论 [1] 的技术报告值得作为浏览 Show Case 的伴随文档特别提及。
在本技术报告的第一版中,Show Case 面向测量和标定主题,涉及基于 AUTOSAR 模型创建 A2L 文件。对于这些 Show Case,软件组件模板 [3] 的规范也是一个很好的伴随文档。
---
## 3 测量与标定(Measurement and Calibration)
测量与标定(简称 MC)是电子控制单元(ECU)开发中的重要步骤。测量和标定系统(MC 系统)涉及软件工具(MC 工具)以及用于访问 ECU 的硬件(此处不关注),使开发人员能够在 ECU 的运行时测量变量并调整标定参数(或"特性")。
例如,以下任务通常由"测量与标定"完成:
- 适应实际硬件(例如插入传感器的电气特性)
- 控制器的标定(例如调整闭环控制器的参数)
- ECU 内部环境模型的调优(例如用于"虚拟传感器")
- ECU 功能的验证
- 开发错误的跟踪
- 收集用于自动优化参数的数据
"入门示例"(参见 3.1)说明了从将由 ECU 控制的物理系统到使用 MC 系统进行测量和标定的所有基本产物。作为教学简化,仅使用了少数数据类型,例如,既没有选择 CURVE[^1] 也没有选择 MAP[^2],也没有任何 ApplicationCompositeDataType。
然而,这些高级主题、它们在 AUTOSAR 中的建模以及它们向 MC 工具的传递是特别感兴趣的:它们在领域中经常被需要和使用。因此,第 3.2 章中的"高级示例"特别强调了这些主题。此示例直接源自动力总成领域主要 Tier 1 的真实世界建模和结构方法。因此它还说明了领域中用于设计 AUTOSAR 系统的"良好实践",这些系统将在其开发后期被测量和标定。
[^1]: CURVE 是通过轴点和相应函数值定义的二维函数。插值或外推用于计算未直接定义的函数值。
[^2]: MAP 类似于 CURVE 但是三维的。
### 3.1 入门示例(Introductory Show Case)
作为使用 AUTOSAR 进行测量和标定的介绍,选择了一个简单的人造闭环控制系统。这在使用 MC 工具时允许有趣的系统反馈。同时,模型、源代码和生成的文件仍然是可理解的。
一个缺点是,并非所有典型的"真实世界"数据类型都出现,例如。此类主题在"高级示例"第 3.2 章中介绍。
#### 3.1.1 物理系统(Physical System)
本节包含物理系统设置的描述。如果读者只对 AUTOSAR 建模本身感兴趣,可以安全跳过本节。
##### 3.1.1.1 组件概述(Components Overview)
对于此 Show Case,与真实物理环境的交互完全被排除在外,即没有加热功率输出组件,并且 TEnv 的曲线在组件 Environment 内随机生成。这从示例中削减了大量复杂性,并允许在 PC 上运行软件系统而无需复杂的环境仿真。
为完整性起见:被控对象模型在组件 Plant 内计算,控制器在组件 Controller 内计算。
作为 ECU 的典型情况,计算以时间离散方式进行,即组件中的计算以离散时间步长定期执行。在下文中,索引 n ∈ {1, 2, ...} 表示当前时间步长。前一个时间步长由索引 n-1 表示。索引 0 表示初始化值。这也意味着时间步长 1 是 ECU 实际计算的第一个。
此外,∆t 表示从前一个时间步长的计算到当前时间步长所经过的时间(以秒为单位)。在时间步长 1 的情况下,∆t 表示从系统初始化到时间步长 1 所经过的时间。对于 ∆t 的实际值,必须考虑系统中物理属性的频带。降低 ∆t 的值通常会提高物理信号采样的质量,直到进一步降低 ∆t 值的成本超过在信号质量方面获得的收益为止。
##### 3.1.1.2 环境(The Environment)
环境的建模和实现不是此 Show Case 的重点。温度 T_envn [°C] 是(伪)随机生成的。这样做是为了在系统运行时"实时"查看控制器和被控对象模型。生成的曲线是一个由上限和下限限制的随机游动,在这些边界处饱和。
随机游动可通过 TLowLimit [°C] 和 THighLimit [°C](用于边界)和 TStepSize [K](用于一个时间步长内温度的变化)配置。
假设 randn [-] ∈ {-1, 0, 1} 且 n ∈ {1, 2, 3, ...},则 T_envn 由以下方程表征(其中 T_env0 [°C] = -273.15 [°C]):
$$T\_env_n [°C] = T\_env_{n-1} [°C] + TStepSize [K] \cdot randn [-]$$
当且仅当 T_envn 在边界内时,即
$$T_{LowLimit} < T\_env_n < T_{HighLimit}$$
如果 T_envn 在某个边界之外,则将其设置为该边界的值。
##### 3.1.1.3 被控对象(The Plant)
被控对象是暴露于环境中气流中的电加热质量。存储在被控对象内部的热量 Qplant 被认为始终与温度 T 成正比,比例因子为常数。被控对象的质量和比热容在我们系统的运行期间都不会变化。
为简单起见,该比例因子被视为 1 [J/K]。对于 Plant 组件内的计算,我们始终使用 [K] 作为温度单位,因此与 [°C] 之间的转换仅在组件的接口处发生。
这样,我们有:
$$Q_{plant_n} [J] = T_n [K] \cdot 1 \frac{J}{K}$$
$$T_n [K] = \frac{Q_{plant_n} [J]}{1 \frac{J}{K}}$$
这也意味着 Q_plantn [J] = 0 [J] 对应 Tn [K] = 0 [K],即绝对零度。因此 Q_plantn [J] ≥ 0 [J] 应始终成立。
在每个时间步长中,有两个热流:一个从电加热器到被控对象,一个从被控对象到环境。负热流意味着热能从被控对象流出。正热流意味着热能被存储在被控对象中。
在一个时间步长内从电加热器到被控对象的热流 Q_heatern [J] 被认为与该时间步长期间流过被控对象的电流 I_n [mA] 成正比。比例因子是 h_Heater [mA/Js]。当然,被控对象只能被电加热器加热,即"负"电流 I_n 不会冷却被控对象,但会引起与 -I_n 相同的加热。因此我们有:
$$Q_{heater_n} [J] = |I_n| [mA] \cdot h_{Heater} \left[\frac{J}{mAs}\right] \cdot \Delta t [s]$$
被控对象的冷却只能通过第二个热流发生,即从被控对象到环境的热流 Q_envn [J]。一个时间步长内的流量被认为与被控对象的温度(在上一个时间步长期间从存储的热量计算)和环境的温度(在本时间步长内接收,但实际上"测量"于上一个时间步长)之间的差值成正比。使用比例因子 h_Env [J/K],我们有:
$$Q_{env_n} [J] = (T\_env_n [K] - T_{n-1} [K]) \cdot h_{Env} \left[\frac{J}{K}\right] \cdot \Delta t [s]$$
在上一个时间步长中存储在被控对象中的热量 Q_plant(n-1) 现在被这两个热流修改。这导致当前时间步长中存储的热量。设 Q_plant0 [J] = 0 [J],我们有:
$$Q_{plant_n} [J] = Q_{plant_{n-1}} [J] + Q_{heater_n} [J] + Q_{env_n} [J]$$
##### 3.1.1.4 控制器(The Controller)
对于闭环控制,为 Controller 组件选择了 I 控制器(大体上)。这意味着输入信号的放大与误差(即测量变量和设定值之间的偏差)的积分成正比。因为控制器不能主动冷却被控对象的温度,所以对于所有 n,输出 I_n >= 0。
同样,所有温度在组件的接口处与 [°C] 相互转换。所有内部计算都使用 [K] 完成。
当前时间步长期间的误差是 T_SetPoint [K] 和测量变量 T_n [K] 之间的差值:
$$e_n [K] = T_{SetPoint} [K] - T_n [K]$$
控制器的积分部分通过对前几个步长的所有误差求和来计算。设 e_Sum_n [Ks] = 0 [Ks],我们有:
$$e_{Sum_n} [Ks] = e_{Sum_{n-1}} [Ks] + e_n [K] \cdot \Delta t$$
控制器的另一个设计决策是限制积分并在限值处饱和。这具有限制控制器输出的电流 I_n 的好处。此外,它使控制器能够在长时间偏差后更快地做出反应。
下限为 0 [Ks]。因此,如果 e_Sum_n 在时间步长 n 中低于零,我们将 e_Sum_n [Ks] = 0 [Ks]。上限为 L_MaxESum [Ks]。如果 e_Sum_n 在时间步长 n 中超过 L_MaxESum,则我们将 e_Sum_n [Ks] = L_MaxESum [Ks]。
控制器的积分状态 e_Sum_n 然后由 k [mA/Ks] 放大以计算电流 I_n [mA],即控制器的输出:
$$I_n [mA] = e_{Sum_n} [Ks] \cdot k \left[\frac{mA}{Ks}\right]$$
因此 e_Sum_n 的限制保证了:
$$0 [mA] \le I_n [mA] \le L_{MaxESum} [Ks] \cdot k \left[\frac{mA}{Ks}\right]$$
#### 3.1.2 AUTOSAR 建模(AUTOSAR Modeling)
本节简要概述了 AUTOSAR 建模。通过浏览第 3.1.7 节中的超链接表格可以获得更多见解。这些表格是根据此 Show Case 的 AUTOSAR 模型生成的。如果这仍然不够,完整模型以 .arxml 格式在 AUTOSAR_EXP_ModelingShowCases.zip [2] 中提供。
在此 Show Case 中,第 3.1.1.1 节中指定的组件被建模为 ApplicationSwComponentTypes。
- Environment
- Plant
- Controller
为保持示例简单,没有建模 SwcImplementations。对于某些任务,例如为嵌入式控制器生成 MemMap,将需要这些。
ApplicationSwComponentTypes 的输入和输出被建模为 SenderReceiverInterface。内部状态被实现为 implicitInterRunnableVariables。除了说明性方面之外,此设计决策的基本原理是内部状态可能由 ApplicationSwComponentTypes 中的多个可运行实体使用(至少在"入门示例"之外)。
对于只应在 MC 工具中可用于测量的变量,使用 arTypedPerInstanceMemory。对于此用例,不需要实现对变量访问的同步,因此选择了开销最小的方式。
组件规范中的所有参数都放在第四个 SwComponentType 中的 ParameterSwComponentType "Parameters" 中。
为三个 ApplicationSwComponentTypes 中的每一个的参数定义了不同的 ParameterInterface。ParameterSwComponentType 的相应 PPortPrototypes 包含 PortPrototypes 中每个 ParameterDataPrototype 的 initValue。每个值在 ParameterProvideComSpec 聚合的 ValueSpecification 中指定。
组件类型在 CompositionSwComponentType "Composition" 中被实例化。
此 Composition 是 ECU_Extract 的 rootSoftwareComposition 的类型。这也意味着 Composition 的所有 SwComponentPrototypes 都映射到一个 EcuInstance。
有关 FlatMap 的某些信息可以在第 3.1.3.1 节中找到。
#### 3.1.3 RTE 生成、测量与标定(RTE Generation, Measurement and Calibration)
McSupport 文件是 RTE 生成器和 A2L 生成器之间的接口。RTE 生成器为每个可标定或可测量对象提供 McDataInstance。从逻辑视图来看,McSupport 的生成可以分为两个步骤:
1. 为所有参数、测量、组件原型(实例化一次或多次)提供唯一名称。这由所使用的 AUTOSAR 创作工具完成。
2. 生成 McSupport 本身。这通常由 RTE 生成器完成。A2L 仅支持一个全局命名空间,而 AUTOSAR 在每个 ARPackage 内定义自己的命名空间。这意味着,一方面,所有在测量和标定期间可访问的对象(参数、测量、组件原型)需要唯一名称。另一方面,A2L 中将出现的所有其他事物也需要唯一名称,例如 CompuMethods、Units。对于它们,RTE 生成器将创建唯一名称。
AUTOSAR 还指定了 AliasNameSet 以覆盖名称,此处未使用。
请参见 AUTOSAR_EXP_ModelingShowCases.zip [2] 以获取生成的 Rte_McSupportData.arxml 文件。
##### 3.1.3.1 FlatMap
在此 Show Case 中,FlatMap 为以下对象提供唯一名称:
- dataElements
- implicitInterRunnableVariables
- arTypedPerInstanceMemorys
RTE 生成器使用此信息来生成 McSupport 文件以及 .c 和 .h 文件。
FlatMap 由每个 VariableDataPrototypes 实例的 FlatInstanceDescriptor 组成。
此用例的 flat map 可以在 AUTOSAR_EXP_ModelingShowCases.zip [2] 中找到。
##### 3.1.3.2 ECU 文档、测量与标定(ECU Documentation, Measurement and Calibration)
在开发 ECU 时,一个常见的要求是 A2L 中描述的对象可以轻松地在 ECU 文档中找到。这是一个挑战,因为文档是在 SwComponentTypes 的级别上,而 A2L 是在类别 "ECU_EXTRACT" 的 System 的级别上定义的。
- SwComponentPrototypes 的名称可能与 SwComponentTypes 的名称不同
- McDataInstances 的名称可能与 DataPrototypes 的名称不同
如果类型被多次实例化,则挑战变得更大。此问题需要通过适当的架构、建模约定和 FlatMap 的巧妙生成来解决。
在此 Show Case 中,仅通过将 TemperatureSRIF 实例化两次(用于传输 TEnv 的接口和用于传输 T_Plant 的接口)稍微触及此主题。
证明了 FlatMap 可用于解决此问题。然而,我们手动制作了 FlatMap,这在领域中通常是不可能的。FlatMap 通常由可定制的、"智能的"、非标准化的工具自动生成。
#### 3.1.4 A2L 文件(A2L File)
使用 McSupport 文件中的信息生成 A2L 文件。但是,对于此生成,需要变量和特性的内存地址。它们通常从 ECU 可执行文件的链接器输出的映射文件中提取。A2L 文件生成的确切过程和工具未标准化。
示例 A2L 文件在 AUTOSAR_EXP_ModelingShowCases.zip 中提供。
#### 3.1.5 C 语言实现(Implementation in C)
C 语言实现是 AUTOSAR 建模中物理规范的直接实现(参见第 3.1.1.1 和 3.1.2 节)。因此,除了源代码中的注释之外,列表在没有任何进一步解释的情况下呈现。
关于 Environment.c 第 22 行(列表 3.1)生成的(伪)随机数的说明:这些数字没有很好的"伪随机性"特性,但对于此 Show Case 是足够的。选择这种生成方式只是因为它适合一行 C 代码而不会引入对库的依赖。
**列表 3.1:Environment.c**
```c
#include "Rte_Environment.h"
#define envRE_START_SEC_CODE
#include "Environment_MemMap.h"
FUNC (void, Environment_CODE) envRE_func (void)
{
/* read parameters for simulation of the temperature profile */
float32 lLowLimit = Rte_Prm_EnvParamsRPP_env_TLowLimit();
float32 lStepSize = Rte_Prm_EnvParamsRPP_env_TStepSize();
/* retrieve internal state */
uint32 lSeed = Rte_IrvIRead_envRE_Seed();
float32 lTEnv = Rte_IrvIRead_envRE_TEnv();
float32 direction = (float32)(lSeed % 3) - 1.0;
/* calc high limit with parameter, store for measurement */
*Rte_Pim_THighLimit()
= lLowLimit + Rte_Prm_EnvParamsRPP_env_THighLimitDistance();
/* update state for pseudo random number generation */
lSeed = (8253729 * lSeed + 2396403);
/* calculate environment temperature */
lTEnv += lStepSize * direction;
/* saturating environment temperature at the bounds */
if( lTEnv < lLowLimit) { lTEnv = lLowLimit; }
if( lTEnv > *Rte_Pim_THighLimit())
{ lTEnv = *Rte_Pim_THighLimit(); }
/* Store internal state */
Rte_IrvIWrite_envRE_Seed(lSeed);
Rte_IrvIWrite_envRE_TEnv(lTEnv);
/* write output */
Rte_IWrite_envRE_EnvTemperaturePPP_T(lTEnv);
}
#define envRE_STOP_SEC_CODE
#include "Environment_MemMap.h"
```
**列表 3.2:Plant.c**
```c
#include "Rte_Plant.h"
#define plantRE_START_SEC_CODE
#include "Plant_MemMap.h"
FUNC (void, Plant_CODE) plantRE_func (void)
{
/* read input */
float32 lTenv = Rte_IRead_plantRE_EnvTemperatureRPP_T();
float32 lI = Rte_IRead_plantRE_CurrentRPP_I();
/* retrieve internal state */
float32 lQPlant = Rte_IrvIRead_plantRE_QPlant();
/* read parameters */
float32 lDt = Rte_Prm_DtRPP_Dt();
float32 lEFactor = Rte_Prm_PlantParamsRPP_plnt_EnvFactor();
float32 lHFactor = Rte_Prm_PlantParamsRPP_plnt_HeaterFactor();
/* heat capacity of 1 assumed */
float32 lTPlant = lQPlant;
/* calculate heat flows, store in PIM to make them measurable */
*Rte_Pim_QEnv() = (lTenv - lTPlant) * lEFactor * lDt;
*Rte_Pim_QHeater() = lI * lHFactor * lDt;
/* update heat quantity in plant */
lQPlant = lQPlant + *Rte_Pim_QHeater() + *Rte_Pim_QEnv();
/* limit heat quantity to absolute zero */
lQPlant = lQPlant < 0 ? 0 : lQPlant;
/* heat capacity of 1 assumed */
lTPlant = lQPlant;
/* store internal state of plant: stored heat quantity */
Rte_IrvIWrite_plantRE_QPlant(lQPlant);
/* Write output of plant: temerature of plant */
Rte_IWrite_plantRE_PlantTemperaturePPP_T(lTPlant);
}
#define plantRE_STOP_SEC_CODE
#include "Plant_MemMap.h"
```
**列表 3.3:Controller.c**
```c
#include "Rte_Controller.h"
#define ControllerRE_START_SEC_CODE
#include "Controller_MemMap.h"
FUNC (void, Controller_CODE) controllerRE_func (void)
{
/* read input, define output variable */
float32 lT = Rte_IRead_ControllerRE_TemperatureRPP_T();
float32 lI;
/* retrieve internal state: Sum of errors until last time step */
float32 lESum = Rte_IrvIRead_ControllerRE_ESum();
/* read parameters */
float32 lDt = Rte_Prm_DtRPP_Dt();
float32 lSetPoint = Rte_Prm_ControllerParamsRPP_ctrl_SetPoint();
float32 lK = Rte_Prm_ControllerParamsRPP_ctrl_K();
float32 lMaxESum = Rte_Prm_ControllerParamsRPP_ctrl_MaxESum();
/* store current error in PIM to make it measurable */
*Rte_Pim_E() = lSetPoint - lT;
/* update eSum */
lESum += *Rte_Pim_E() * lDt;
/* limit eSum */
if(lESum > lMaxESum) { lESum = lMaxESum; }
if(lESum < 0) { lESum = 0; }
/* Controller equation: Calculation of manipulated variable */
lI = lESum * lK;
/* Store internal state */
Rte_IrvIWrite_ControllerRE_ESum(lESum);
/* Write output of controller */
Rte_IWrite_ControllerRE_CurrentPPP_I(lI);
}
#define ControllerRE_STOP_SEC_CODE
#include "Controller_MemMap.h"
```
#### 3.1.6 T_Plant 在示例中的一次遍历(A walk with T_Plant through the Show Case)
本节重新审视整个 Show Case,但专注于一个物理值:T_Plant。它访问所有产物并突出与 T_Plant 相关的所有位置,以说明所有产物之间的依赖关系。
##### 3.1.6.1 物理系统(Physical System)
我们的旅程从物理系统开始,物理系统外部的值在 ECU 内部与软件值相对应。
###### 组件(Components)
它位于两个架构组件之间的接口处,由 Plant 发送,由 Controller 接收。此外,引入了排序[^3],即在一个时间步长中,Plant 在 Controller 之前计算。
[^3]: 请注意,此排序是一个设计决策。由于从 Plant 到 Controller 也存在数据流,也可以论证另一个计算序列。
###### 方程(Equations)
被控对象的功能行为由方程定义。T_Plant 还被 Controller 组件中的物理方程使用:控制误差在 Controller 中的计算。此外,组件内的计算以开尔文 [K] 完成。与 [°C] 之间的转换在接口级别进行。
##### 3.1.6.2 AUTOSAR 建模(AUTOSAR Modeling)
此架构,即物理系统的布局,在 AUTOSAR 中建模。由方程定义的功能行为稍后将在 C 代码中实现。
###### 物理维度与单位(Physical Dimension and Unit)
定义了一个 PhysicalDimension:T_Plant 是一个温度。
**表 3.1:PhysicalDimension Temperature**
| 通用 PhysicalDimension 属性 | 值 |
|------------------------------|-----|
| shortName | Temperature |
| currentExp | 0 |
| lengthExp | 0 |
| luminousIntensityExp | 0 |
| massExp | 0 |
| molarAmountExp | 0 |
| temperatureExp | 1 |
| timeExp | 0 |
相应的 ARXML 描述是:
**列表 3.4:Temperature 的物理维度**
```xml
Temperature
0
0
0
0
1
0
0
```
T_Plant 应具有单位 DegreeCelsius:
**表 3.2:Unit DegreeCelsius**
| 通用 Unit 属性 | 值 |
|----------------|-----|
| shortName | DegreeCelsius |
| displayName | °C |
| offsetSiToUnit | -273.15 |
| factorSiToUnit | 1.0 |
| physicalDimension | Temperature |
相应的 ARXML 描述是:
**列表 3.5:摄氏度单位**
```xml
DegreeCelsius
°C
1.0
-273.15
/McInt/PhysicalDimensions/Temperature
```
为完整性起见,还呈现以下内容,尽管对于 T_Plant 不是直接需要的。可以将多个单位链接到一个物理维度。因此,在模型中,还有一个单位的定义 Kelvin:
**表 3.3:Unit Kelvin**
| 通用 Unit 属性 | 值 |
|----------------|-----|
| shortName | Kelvin |
| displayName | K |
| offsetSiToUnit | 0.0 |
| factorSiToUnit | 1.0 |
| physicalDimension | Temperature |
相应的 ARXML 代码是:
**列表 3.6:Kelvin 单位**
```xml
Kelvin
K
1.0
0.0
/McInt/PhysicalDimensions/Temperature
```
###### 应用数据类型(Application Data Type)
为摄氏度温度定义了一个新的 ApplicationDataType:
**表 3.4:ApplicationDataType Temperature_C**
| 通用 ApplicationDataType 属性 | 值 |
|--------------------------------|-----|
| shortName | Temperature_C |
| category | VALUE |
| desc | Type for a temperature in [°C] |
| swCalibrationAccess | readOnly |
| unit | DegreeCelsius |
| Range | (无) |
| Conversion category | LINEAR |
| Conversion direction | compuInternalToPhys |
| Conversion desc | -(无下限和上限) |
| Conversion formula | Phys = (-273.15 + 1 * Internal) / 1 |
相应的 ARXML 代码分为 ApplicationDataType 的定义和由 ApplicationDataType 引用的 CompuMethod:
**列表 3.7:数据类型**
```xml
Temperature_C
Type for a temperature in [°C]
VALUE
READ-ONLY
/McInt/CompuMethods/Temperature_C
/McInt/Units/DegreeCelsius
```
以及由 ApplicationDataType 引用的 CompuMethod:
**列表 3.8:转换**
```xml
Temperature_C
Conversion from [°C] to [K]
LINEAR
%.1f
/McInt/Units/DegreeCelsius
-273.15
1
1
```
此 ApplicationDataType 映射到 ImplementationDataType float32。包含此 DataTypeMap 的 DataTypeMappingSet 在稍后介绍的 ApplicationSwComponentTypes 的 SwcInternalBehaviors 内被引用。
**列表 3.9:类型映射**
```xml
DataTypeMappingSet
/McInt/ApplicationDataTypes/Temperature_C
/AUTOSAR_PlatformTypes/ImplementationDataTypes/float32
...
```
为完整性起见,还在此处插入包含 float32 定义的 ARXML:
**列表 3.10:实现类型和基类型**
```xml
AUTOSAR_PlatformTypes
ImplementationDataTypes
float32
VALUE
/AUTOSAR_PlatformTypes/
SwBaseTypes/float32
...
SwBaseTypes
float32
FIXED_LENGTH
32
IEEE754
...
...
```
###### 端口接口(Port Interface)
Temperature_C 用于定义 SenderReceiverInterface,该接口用于在 SwComponentTypes 之间键入摄氏度温度的"传输"。请注意,在 Show Case 中,此 PortInterface 不仅用于键入 T_Plant 的"传输",还用于键入 T_Env 的"传输"。
**表 3.5:SenderReceiverInterface TemperatureSRIF**
| 通用 SenderReceiverInterface 属性 | 值 |
|------------------------------------|-----|
| shortName | TemperatureSRIF |
| desc | Interface type for transferring temperatures in [°C] |
| dataElements 短名 | T |
| dataElements 类型 | Temperature_C |
| dataElements swImplPolicy | standard |
| dataElements swCalibrationAccess | readOnly |
| dataElements swAddrMethod | VAR |
在 ARXML 中:
**列表 3.11:端口接口**
```xml
TemperatureSRIF
Interface type for transferring temperatures in [°C]
false
T
/McInt/SwAddrMethods/
VAR
READ-ONLY
STANDARD
/McInt/
ApplicationDataTypes/Temperature_C
```
为完整性起见,此处还描述了引用的 SwAddrMethod:
**表 3.6:SwAddrMethod VAR**
| 通用 SwAddrMethod 属性 | 值 |
|------------------------|-----|
| shortName | VAR |
| desc | Memory section for variables |
| sectionType | var |
| memoryAllocationKeywordPolicy | addrMethodShortName |
| sectionInitializationPolicy | - |
| option | safetyQM |
在 ARXML 中:
**列表 3.12:软件地址方法**
```xml
VAR
Memory section for variables
```
###### 软件组件(Software Components)
两个 ApplicationSwComponentTypes Controller 和 Plant 正在使用 T_Plant。
在 Plant 中,定义了一个由 TemperatureSRIF 键入的 PPortPrototype,用于发送 T_Plant。此外,将 dataWriteAccess 授予此 ApplicationSwComponentType 中的单个 RunnableEntity。您还会看到 symbol(即实现 C 函数的名称)以及触发 RunnableEntity 执行的 TimingEvent。这两个对于将系统联系在一起是进一步感兴趣的。
**表 3.7:ApplicationSwComponentType Plant**
| 通用 ApplicationSwComponentType 属性 | 值 |
|--------------------------------------|-----|
| shortName | Plant |
| PPortPrototype shortName | PlantTemperaturePPP |
| PPortPrototype desc | Port for sending out the estimated temperature of the plant |
| PPortPrototype providedInterface | TemperatureSRIF |
| internalBehavior | PlantInternalBehavior |
| RunnableEntity shortName | plantRE |
| RunnableEntity symbol | plantRE_func |
| TimingEvent shortName | plant100ms |
| TimingEvent startOnEvent | plantRE |
| TimingEvent period | 0.1 |
在 ARXML 中(列表 3.13:Plant):
```xml
Plant
PlantTemperaturePPP
Port for sending out the estimated temperature of the
plant
/McInt/PortInterfaces/TemperatureSRIF
...
PlantInternalBehavior
/McInt/DataTypeMappings/DataTypeMappingSet
plant100ms
/McInt/SwComponents/Plant/PlantInternalBehavior/plantRE
0.1
...
plantRE
DWA_PlantTemperature
/McInt/SwComponents/Plant/PlantTemperaturePPP
/McInt/PortInterfaces/TemperatureSRIF/T
...
```
在 Controller 中,定义了一个由 TemperatureSRIF 键入的 RPortPrototype,用于接收 T_Plant。此外,将 dataReadAccess 授予此 ApplicationSwComponentType 中的单个 RunnableEntity。您还会看到 symbol(即实现 C 函数的名称)以及触发 RunnableEntity 执行的 TimingEvent。
**表 3.8:ApplicationSwComponentType Controller**
| 通用 ApplicationSwComponentType 属性 | 值 |
|--------------------------------------|-----|
| shortName | Controller |
| RPortPrototype shortName | TemperatureRPP |
| RPortPrototype desc | Port to receive the temperature of the plant |
| RPortPrototype requiredInterface | TemperatureSRIF |
| internalBehavior | ControllerInternalBehavior |
| RunnableEntity shortName | ControllerRE |
| RunnableEntity symbol | controllerRE_func |
| TimingEvent shortName | controller100ms |
| TimingEvent startOnEvent | ControllerRE |
| TimingEvent period | 0.1 |
在 ARXML 中(列表 3.14:Controller):
```xml
Controller
TemperatureRPP
Port to receive the temperature of the plant
/McInt/PortInterfaces/TemperatureSRIF
...
ControllerInternalBehavior
/McInt/DataTypeMappings/DataTypeMappingSet
controller100ms
/McInt/SwComponents/Controller/ControllerInternalBehavior/
ControllerRE
0.1
...
ControllerRE
DRA_temperature
/McInt/SwComponents/Controller/TemperatureRPP
/McInt/PortInterfaces/TemperatureSRIF/T
...
```
然后使用这两个 ApplicationSwComponentTypes 来键入 Composition 中的 SwComponentPrototypes。SwComponentPrototypes 的 PortPrototypes 由 AssemblySwConnector 连接:
**表 3.9:CompositionSwComponentType Composition**
| 通用 CompositionSwComponentType 属性 | 值 |
|--------------------------------------|-----|
| shortName | Composition |
| SwComponentPrototype shortName | CPT_Controller |
| SwComponentPrototype type | Controller |
| SwComponentPrototype shortName | CPT_Plant |
| SwComponentPrototype type | Plant |
在 ARXML 中(列表 3.15:Composition):
```xml
Composition
CPT_Controller
/McInt/SwComponents
/Controller
CPT_Plant
/McInt/SwComponents
/Plant
...
ASC_CPT_Plant_TemperaturePPP_CPT_Controller_TemperatureRPP
SHORT-NAME>
/McInt/
SwComponents/Composition/CPT_Plant
/McInt/SwComponents/
Plant/PlantTemperaturePPP
/McInt/
SwComponents/Composition/CPT_Controller
/McInt/SwComponents/
Controller/TemperatureRPP
...
```
##### 3.1.6.3 系统(System)
在 ECU_Extract 中,即类别为 ECU_EXTRACT 的 System 中,Composition 用于键入 rootSoftwareComposition。Composition 中的所有 SwComponentPrototypes 在此 Show Case 中都映射到单个 EcuInstance。
**列表 3.16:系统和 EcuInstance**
```xml
EcuInstance
EcuExtract
ECU_EXTRACT
SystemMapping
SwcToEcuMapping
/McInt/System/EcuExtract/RootSwCompositionPrototype
/McInt/SwComponents/Composition/CPT_Controller
/McInt/System/EcuExtract/RootSwCompositionPrototype
/McInt/SwComponents/Composition/CPT_Plant
...
/McInt/System/EcuInstance
ECU-INSTANCE-REF>
RootSwCompositionPrototype
/McInt/System/FlatMap
/McInt/SwComponents/Composition
```
ECU_Extract 中引用的 FlatMap 将名称 TPlant 赋予 dataElement(请参见下面的 ecuExtractReference)。稍后将在 MC 工具中显示名称 TPlant。
**列表 3.17:FlatMap**
```xml
FlatMap
TPlant
/McInt/
System/EcuExtract/RootSwCompositionPrototype
/McInt/
SwComponents/Composition/CPT_Plant
/McInt/SwComponents/
Plant/PlantTemperaturePPP
/McInt/PortInterfaces/
TemperatureSRIF/T
...
```
##### 3.1.6.4 ECU 配置(ECU Configuration)
在生成 RTE 和 OS 之前,还需要定义其他内容。例如,调用 RunnableEntitys 的 RTEEvents 的顺序以及分配给 OsTask。这是通过 EcucModuleConfigurationValues 完成的。RTE 配置的有趣部分是:
**列表 3.18:RTE 配置**
```xml
...
controller100ms
.../RteEventToTaskMapping
.../RtePositionInTask
3
...
.../RteMappedToTaskRef
.../OS/OS_CFG/task_100ms
.../RteEventRef
.../controller100ms
...
plant100ms
.../RteEventToTaskMapping
.../RtePositionInTask
2
...
.../RteMappedToTaskRef
.../OS/OS_CFG/task_100ms
.../RteEventRef
.../plant100ms
...
```
此 OS 配置部分定义了 OSTask 的名称,我们稍后将在生成的 C 代码中看到它:
**列表 3.19:OsConfig**
```xml
...
OS
OS_CFG
/AUTOSAR/EcucDefs/Os
DEFINITION-REF>
...
task_100ms
.../OsTask
...
...
```
这些配置通过 EcucValueCollection 绑定到 ECU_Extract:
**列表 3.20:EcuC Value Collection**
```xml
EcucValueCollection
/McInt/System/EcuExtract
/McInt/RTE/RTE_CFG
/McInt/OS/OS_CFG
```
这完成了我们遍历中 AUTOSAR 建模的介绍。
##### 3.1.6.5 RTE 生成(RTE Generation)
下面,呈现了生成的 RTE 的一些片段。但是,它们仅作为示例,如果使用不同的 RTE 生成器可能会有所不同。
除其他外,OsTask 按上面 ECU 配置中的定义生成:
**列表 3.21:Rte.c**
```c
...
#define RTE_START_SEC_VAR
#include "MemMap.h" /*lint !e537 permit multiple inclusion */
...
VAR(float32, RTE_DATA) TPlant;
...
#define RTE_STOP_SEC_VAR
#include "MemMap.h" /*lint !e537 permit multiple inclusion */
...
TASK(task_100ms)
{
...
Rte_ImplicitBufs.isa_1._task_100ms.sbuf1.value = TPlant;
...
plantRE_func();
...
controllerRE_func();
...
TPlant = Rte_ImplicitBufs.isa_1._task_100ms.sbuf1.value;
...
} /* task_100ms */
...
```
还在 Plant 中用于写入 T_Plant 的 MACRO:
**列表 3.22:Rte_Plant.h**
```c
...
#define Rte_IRead_plantRE_EnvTemperatureRPP_T() ((CONST(float32,
RTE_DATA)) Rte_ImplicitBufs.isa_1._task_100ms.sbuf0.value )
...
```
以及在 Controller 中读取 T_Plant 的 MACRO:
**列表 3.23:Rte_Controller.h**
```c
...
#define Rte_IRead_ControllerRE_TemperatureRPP_T() ((CONST(float32,
RTE_DATA)) Rte_ImplicitBufs.isa_1._task_100ms.sbuf1.value )
...
```
已生成。此外,McSupport 文件作为"AUTOSAR 世界"和"A2L 世界"之间的接口生成。如读者所见,这是从前面介绍的 AUTOSAR 模型中所需数据的汇编:
**列表 3.24:McSupportData**
```xml
...
BswImplementations
Rte
...
TPlant
Type for a temperature in [°C]
VALUE
/McInt/
System/FlatMap/TPlant
float32
READ-ONLY
McInt_CompuMethods_Temperature_C
%.1f
McInt_Units_DegreeCelsius
TPlant
...
Units
McInt_Units_DegreeCelsius
°C
1.0
-273.15
McInt_PhysicalDimensions_Temperature
PHYSICAL-DIMENSION-REF>
...
CompuMethods
McInt_CompuMethods_Temperature_C
Conversion from [°C] at an interface to [K] for
internal computations
LINEAR
%f
McInt_Units_DegreeCelsius
-273.15
1
1
...
PhysicalDimensions
McInt_PhysicalDimensions_Temperature
0
0
0
0
1
0
0
...
SwBaseTypes
float32
FIXED_LENGTH
32
IEEE754
...
...
```
##### 3.1.6.6 C 语言实现(Implementation in C)
C 代码中的实现是物理方程的直接实现。Plant 使用 RTE 生成器生成的 MACRO 来写入 T_Plant:
**列表 3.25:Plant**
```c
#include "Rte_Plant.h"
...
FUNC (void, Plant_CODE) plantRE_func (void)
{
...
/* heat capacity of 1 assumed */
float32 lTPlant = lQPlant;
/* calculate heat flows, store in PIM to make them measurable */
*Rte_Pim_QEnv() = (lTenv - lTPlant) * lEFactor * lDt;
...
/* heat capacity of 1 assumed */
lTPlant = lQPlant;
...
/* Write output of plant: temerature of plant */
Rte_IWrite_plantRE_PlantTemperaturePPP_T(lTPlant);
}
```
Controller 使用 RTE 生成器生成的 MACRO 来读取 T_Plant:
**列表 3.26:Controller**
```c
#include "Rte_Controller.h"
...
FUNC (void, Controller_CODE) controllerRE_func (void)
{
/* read input, define output variable */
float32 lT = Rte_IRead_ControllerRE_TemperatureRPP_T();
...
/* store current error in PIM to make it measurable */
*Rte_Pim_E() = lSetPoint - lT;
...
}
```
##### 3.1.6.7 A2L 文件(A2L File)
使用 McSupport 文件和链接器的映射文件,为此 Show Case 生成了一个示例 A2L 文件。下面的片段仅作为示例,如果使用不同的 A2L 文件生成器可能会有所不同:
**列表 3.27:A2L File**
```
...
/begin MEASUREMENT TPlant
"TPlant"
FLOAT32_IEEE
McInt_CompuMethods_Temperature_C
0
0
-1E+32
1E+32
DISPLAY_IDENTIFIER "TPlant"
ECU_ADDRESS 0xe000001c
FORMAT "%.1f"
PHYS_UNIT "°C"
/end MEASUREMENT
...
/begin UNIT McInt_PhysicalDimensions_Temperature
"McInt_PhysicalDimensions_Temperature"
"McInt_PhysicalDimensions_Temperature"
EXTENDED_SI
SI_EXPONENTS 0 0 0 0 1 0 0
/end UNIT
/begin UNIT McInt_Units_DegreeCelsius
"McInt_Units_DegreeCelsius"
"°C"
DERIVED
REF_UNIT McInt_PhysicalDimensions_Temperature
UNIT_CONVERSION 1 -273.15
/end UNIT
/begin COMPU_METHOD McInt_CompuMethods_Temperature_C
"McInt_CompuMethods_Temperature_C"
LINEAR
"%f"
"°C"
COEFFS_LINEAR 1 -273.15
REF_UNIT McInt_Units_DegreeCelsius
/end COMPU_METHOD
...
```
##### 3.1.6.8 测量与标定工具(Measurement and Calibration Tool)
然后 MC 工具使用 A2L 文件来测量 T_Plant。当然,除了 A2L 文件之外,还必须有合适的 ECU 访问[^4] 才能实际使用此 Show Case 的 AUTOSAR 系统进行测量和标定。但是,ECU 访问未在本文中介绍,因为这不是此 Show Case 的重点。
下面是实际测量和标定任务期间 MC 工具的典型屏幕截图。您可以看到以摄氏度测量和显示的 T_Plant。
[^4]: 例如,XCP 之类的测量和标定服务或对微控制器内存的硬件访问。
#### 3.1.7 示例中的 Show Case(Show cases in the Example)
由于本节包含大量重复的模型元素定义表格(CompositionSwComponentType、ParameterSwComponentType、ApplicationSwComponentType、ParameterInterface、ModeSwitchInterface、SenderReceiverInterface、ApplicationDataType、Unit、PhysicalDimension、SwAddrMethod 等),完整翻译请参见以下子节:
##### 3.1.7.1 CompositionSwComponentTypes
**表 3.10:CompositionSwComponentType Composition**
| 通用 CompositionSwComponentType 属性 | 值 |
|--------------------------------------|-----|
| shortName | Composition |
| SwComponentPrototype shortName | CPT_Controller |
| SwComponentPrototype type | Controller |
| SwComponentPrototype shortName | CPT_Parameters |
| SwComponentPrototype type | Parameters |
| SwComponentPrototype shortName | CPT_Plant |
| SwComponentPrototype type | Plant |
| SwComponentPrototype shortName | CPT_Environment |
| SwComponentPrototype type | Environment |
##### 3.1.7.2 ParameterSwComponentTypes
**表 3.11:ParameterSwComponentType Parameters**
| 通用 ParameterSwComponentType 属性 | 值 |
|--------------------------------------|-----|
| shortName | Parameters |
| desc | Type for providing the parameters to the ApplicationSwComponents |
| PPortPrototype shortName | ControllerPPP |
| PPortPrototype desc | Port for providing the parameters for the controller |
| PPortPrototype providedInterface | ControllerPIF |
| PPortPrototype shortName | PlantPPP |
| PPortPrototype desc | Port for providing the parameters for the plant |
| PPortPrototype providedInterface | PlantPIF |
| PPortPrototype shortName | EnvironmentPPP |
| PPortPrototype desc | Port for providing the parameters for the environment |
| PPortPrototype providedInterface | EnvironmentPIF |
| PPortPrototype shortName | DtPPP |
| PPortPrototype desc | Time of one time step |
| PPortPrototype providedInterface | DtPIF |
##### 3.1.7.3 ApplicationSwComponentTypes
**表 3.12:ApplicationSwComponentType Controller**
| 通用 ApplicationSwComponentType 属性 | 值 |
|--------------------------------------|-----|
| shortName | Controller |
| RPortPrototype shortName | TemperatureRPP |
| RPortPrototype desc | Port to receive the temperature of the plant |
| RPortPrototype requiredInterface | TemperatureSRIF |
| PPortPrototype shortName | CurrentPPP |
| PPortPrototype desc | Port for sending out the current output by this controller |
| PPortPrototype providedInterface | CurrentSRIF |
| RPortPrototype shortName | ControllerParamsRPP |
| RPortPrototype desc | Port to get the parameters for the controller |
| RPortPrototype requiredInterface | ControllerPIF |
| RPortPrototype shortName | DtRPP |
| RPortPrototype desc | Port to get delta t, i.e. time of one time step |
| RPortPrototype requiredInterface | DtPIF |
| internalBehavior | ControllerInternalBehavior |
**表 3.13:SwcInternalBehavior ControllerInternalBehavior**
| 通用 SwcInternalBehavior 属性 | 值 |
|-------------------------------|-----|
| shortName | ControllerInternalBehavior |
| implicitInterRunnableVariables 短名 | ESum |
| implicitInterRunnableVariables desc | Internal state of the controller: the sum of control errors |
| implicitInterRunnableVariables type | ESum |
| implicitInterRunnableVariables swImplPolicy | standard |
| implicitInterRunnableVariables swCalibrationAccess | readOnly |
| implicitInterRunnableVariables swAddrMethod | CODE |
| arTypedPerInstanceMemorys 短名 | E |
| arTypedPerInstanceMemorys desc | Measurement point for the control error, the deviation between set point and actual temperature of the plant, in the current time step |
| arTypedPerInstanceMemorys type | Temperature_K |
| arTypedPerInstanceMemorys swImplPolicy | standard |
| arTypedPerInstanceMemorys swCalibrationAccess | readOnly |
| arTypedPerInstanceMemorys swAddrMethod | CODE |
| RunnableEntity shortName | ControllerRE |
| RunnableEntity symbol | controllerRE_func |
| TimingEvent shortName | controller100ms |
| TimingEvent startOnEvent | ControllerRE |
| TimingEvent period | 0.1 |
**表 3.14:ApplicationSwComponentType Plant**
| 通用 ApplicationSwComponentType 属性 | 值 |
|--------------------------------------|-----|
| shortName | Plant |
| RPortPrototype shortName | CurrentRPP |
| RPortPrototype desc | Port to receive the current from the controller |
| RPortPrototype requiredInterface | CurrentSRIF |
| PPortPrototype shortName | PlantTemperaturePPP |
| PPortPrototype desc | Port for sending out the estimated temperature of the plant |
| PPortPrototype providedInterface | TemperatureSRIF |
| RPortPrototype shortName | PlantParamsRPP |
| RPortPrototype desc | Port to get the parameters for the plant |
| RPortPrototype requiredInterface | PlantPIF |
| RPortPrototype shortName | EnvTemperatureRPP |
| RPortPrototype desc | Port to receive the temperature of the environment |
| RPortPrototype requiredInterface | TemperatureSRIF |
| RPortPrototype shortName | DtRPP |
| RPortPrototype desc | Port to get delta t, i.e. time of one time step |
| RPortPrototype requiredInterface | DtPIF |
| internalBehavior | PlantInternalBehavior |
**表 3.15:SwcInternalBehavior PlantInternalBehavior**
| 通用 SwcInternalBehavior 属性 | 值 |
|-------------------------------|-----|
| shortName | PlantInternalBehavior |
| implicitInterRunnableVariables 短名 | QPlant |
| implicitInterRunnableVariables desc | Internal state of the plant: the stored energy quantity in the current time step |
| implicitInterRunnableVariables type | Energy |
| implicitInterRunnableVariables swImplPolicy | standard |
| implicitInterRunnableVariables swCalibrationAccess | readOnly |
| implicitInterRunnableVariables swAddrMethod | CODE |
| arTypedPerInstanceMemorys 短名 | QHeater |
| arTypedPerInstanceMemorys desc | Measurement point for heat flow between the electrical heater and the plant in the current time step. |
| arTypedPerInstanceMemorys type | Energy |
| arTypedPerInstanceMemorys swImplPolicy | standard |
| arTypedPerInstanceMemorys swCalibrationAccess | readOnly |
| arTypedPerInstanceMemorys swAddrMethod | VAR |
| arTypedPerInstanceMemorys 短名 | QEnv |
| arTypedPerInstanceMemorys desc | Measurement point for heat flow between the plant and the environment in the current time step. |
| arTypedPerInstanceMemorys type | Energy |
| arTypedPerInstanceMemorys swImplPolicy | standard |
| arTypedPerInstanceMemorys swCalibrationAccess | readOnly |
| arTypedPerInstanceMemorys swAddrMethod | CODE |
| RunnableEntity shortName | plantRE |
| RunnableEntity symbol | plantRE_func |
| TimingEvent shortName | plant100ms |
| TimingEvent startOnEvent | plantRE |
| TimingEvent period | 0.1 |
**表 3.16:ApplicationSwComponentType Environment**
| 通用 ApplicationSwComponentType 属性 | 值 |
|--------------------------------------|-----|
| shortName | Environment |
| PPortPrototype shortName | EnvTemperaturePPP |
| PPortPrototype desc | Port to send out the temperature of the environment |
| PPortPrototype providedInterface | TemperatureSRIF |
| RPortPrototype shortName | EnvParamsRPP |
| RPortPrototype desc | Port to get the parameters for the environment |
| RPortPrototype requiredInterface | EnvironmentPIF |
| RPortPrototype shortName | DtRPP |
| RPortPrototype desc | Port to get delta t, i.e. time of one time step |
| RPortPrototype requiredInterface | DtPIF |
| internalBehavior | EnvironmentInternalBehavior |
**表 3.17:SwcInternalBehavior EnvironmentInternalBehavior**
| 通用 SwcInternalBehavior 属性 | 值 |
|-------------------------------|-----|
| shortName | EnvironmentInternalBehavior |
| implicitInterRunnableVariables 短名 | Seed |
| implicitInterRunnableVariables desc | Internal state of the environment: the current seed for the (pseudo) random number generation |
| implicitInterRunnableVariables type | uint32 |
| implicitInterRunnableVariables swImplPolicy | standard |
| implicitInterRunnableVariables swCalibrationAccess | notAccessible |
| implicitInterRunnableVariables swAddrMethod | CODE |
| implicitInterRunnableVariables 短名 | TEnv |
| implicitInterRunnableVariables desc | Internal state of the environment: the temperature of the environment |
| implicitInterRunnableVariables type | Temperature_C |
| implicitInterRunnableVariables swImplPolicy | standard |
| implicitInterRunnableVariables swCalibrationAccess | readOnly |
| implicitInterRunnableVariables swAddrMethod | CODE |
| arTypedPerInstanceMemorys 短名 | THighLimit |
| arTypedPerInstanceMemorys desc | Measurement point for the upper limit of the generated temperature profile |
| arTypedPerInstanceMemorys type | Temperature_C |
| arTypedPerInstanceMemorys swImplPolicy | standard |
| arTypedPerInstanceMemorys swCalibrationAccess | readOnly |
| arTypedPerInstanceMemorys swAddrMethod | CODE |
| RunnableEntity shortName | envRE |
| RunnableEntity symbol | envRE_func |
| TimingEvent shortName | env100ms |
| TimingEvent startOnEvent | envRE |
| TimingEvent period | 0.1 |
##### 3.1.7.4 ParameterInterfaces
**表 3.18:ParameterInterface ControllerPIF**
| 通用 ParameterInterface 属性 | 值 |
|------------------------------|-----|
| shortName | ControllerPIF |
| desc | Interface with all parameters for the controller |
| ParameterDataPrototype shortName | ctrl_SetPoint |
| ParameterDataPrototype desc | Set point for the temperature of the plant |
| ParameterDataPrototype type | Temperature_C |
| ParameterDataPrototype swImplPolicy | standard |
| ParameterDataPrototype swCalibrationAccess | readWrite |
| ParameterDataPrototype swAddrMethod | CALIB |
| ParameterDataPrototype shortName | ctrl_K |
| ParameterDataPrototype desc | Amplification factor for the I-controller |
| ParameterDataPrototype type | Amplification |
| ParameterDataPrototype swImplPolicy | standard |
| ParameterDataPrototype swCalibrationAccess | readWrite |
| ParameterDataPrototype swAddrMethod | CALIB |
| ParameterDataPrototype shortName | ctrl_MaxESum |
| ParameterDataPrototype desc | Upper limit of the integral part of the I-controller |
| ParameterDataPrototype type | ESum |
| ParameterDataPrototype swImplPolicy | standard |
| ParameterDataPrototype swCalibrationAccess | readWrite |
| ParameterDataPrototype swAddrMethod | CALIB |
**表 3.19:ParameterInterface PlantPIF**
| 通用 ParameterInterface 属性 | 值 |
|------------------------------|-----|
| shortName | PlantPIF |
| desc | Interface with all parameters for the plant |
| ParameterDataPrototype shortName | plnt_EnvFactor |
| ParameterDataPrototype desc | Proportionality factor for the heat flow between plant and environment |
| ParameterDataPrototype type | EnvFactor |
| ParameterDataPrototype swImplPolicy | standard |
| ParameterDataPrototype swCalibrationAccess | readWrite |
| ParameterDataPrototype swAddrMethod | CALIB |
| ParameterDataPrototype shortName | plnt_HeaterFactor |
| ParameterDataPrototype desc | Proportionality factor for the heat flow between plant and the electrical heater |
| ParameterDataPrototype type | HeaterFactor |
| ParameterDataPrototype swImplPolicy | standard |
| ParameterDataPrototype swCalibrationAccess | readWrite |
| ParameterDataPrototype swAddrMethod | CALIB |
**表 3.20:ParameterInterface EnvironmentPIF**
| 通用 ParameterInterface 属性 | 值 |
|------------------------------|-----|
| shortName | EnvironmentPIF |
| desc | Interface with all parameters for the environment |
| ParameterDataPrototype shortName | env_TLowLimit |
| ParameterDataPrototype desc | Lower limit of the generated temperature profile |
| ParameterDataPrototype type | Temperature_C |
| ParameterDataPrototype swImplPolicy | standard |
| ParameterDataPrototype swCalibrationAccess | readWrite |
| ParameterDataPrototype swAddrMethod | CALIB |
| ParameterDataPrototype shortName | env_TStepSize |
| ParameterDataPrototype desc | The maximal temperature difference of the environment in one time step |
| ParameterDataPrototype type | Temperature_K |
| ParameterDataPrototype swImplPolicy | standard |
| ParameterDataPrototype swCalibrationAccess | readWrite |
| ParameterDataPrototype swAddrMethod | CALIB |
| ParameterDataPrototype shortName | env_THighLimitDistance |
| ParameterDataPrototype desc | Distance of the upper limit from the lower limit for the generated temperature profile. |
| ParameterDataPrototype type | Temperature_K |
| ParameterDataPrototype swImplPolicy | standard |
| ParameterDataPrototype swCalibrationAccess | readWrite |
| ParameterDataPrototype swAddrMethod | CALIB |
**表 3.21:ParameterInterface DtPIF**
| 通用 ParameterInterface 属性 | 值 |
|------------------------------|-----|
| shortName | DtPIF |
| ParameterDataPrototype shortName | Dt |
| ParameterDataPrototype desc | Scheduling time of the components |
| ParameterDataPrototype type | Time |
| ParameterDataPrototype swImplPolicy | standard |
| ParameterDataPrototype swCalibrationAccess | readWrite |
| ParameterDataPrototype swAddrMethod | CALIB |
##### 3.1.7.5 SenderReceiverInterfaces
**表 3.22:SenderReceiverInterface TemperatureSRIF**
| 通用 SenderReceiverInterface 属性 | 值 |
|------------------------------------|-----|
| shortName | TemperatureSRIF |
| desc | Interface type for transferring temperatures in [°C] |
| VariableDataPrototype shortName | T |
| VariableDataPrototype type | Temperature_C |
| VariableDataPrototype swImplPolicy | standard |
| VariableDataPrototype swCalibrationAccess | readOnly |
| VariableDataPrototype swAddrMethod | VAR |
**表 3.23:SenderReceiverInterface CurrentSRIF**
| 通用 SenderReceiverInterface 属性 | 值 |
|------------------------------------|-----|
| shortName | CurrentSRIF |
| desc | Interface type for transferring a current in [mA] |
| VariableDataPrototype shortName | I |
| VariableDataPrototype type | Current |
| VariableDataPrototype swImplPolicy | standard |
| VariableDataPrototype swCalibrationAccess | readOnly |
| VariableDataPrototype swAddrMethod | VAR |
##### 3.1.7.6 ApplicationDataTypes, Category VALUE
**表 3.24:ApplicationDataType Temperature_C**
| 通用 ApplicationDataType 属性 | 值 |
|--------------------------------|-----|
| shortName | Temperature_C |
| category | VALUE |
| desc | Type for a temperature in [°C] |
| swCalibrationAccess | readOnly |
| unit | DegreeCelsius |
| Conversion category | LINEAR |
| Conversion direction | compuInternalToPhys |
| Conversion formula | Phys = (-273.15 + 1 * Internal) / 1 |
**表 3.25:ApplicationDataType Current**
| 通用 ApplicationDataType 属性 | 值 |
|--------------------------------|-----|
| shortName | Current |
| category | VALUE |
| desc | Type for the current in [mA] |
| swCalibrationAccess | readOnly |
| unit | MilliAmpere |
| Conversion category | LINEAR |
| Conversion direction | compuInternalToPhys |
| Conversion formula | Phys = (0 + 1000 * Internal) / 1 |
**表 3.26:ApplicationDataType EnvFactor**
| 通用 ApplicationDataType 属性 | 值 |
|--------------------------------|-----|
| shortName | EnvFactor |
| category | VALUE |
| desc | Type for the environment factor in [J/Ks] |
| swCalibrationAccess | readOnly |
| unit | JoulePerKelvinSecond |
| Conversion category | IDENTICAL |
**表 3.27:ApplicationDataType Temperature_K**
| 通用 ApplicationDataType 属性 | 值 |
|--------------------------------|-----|
| shortName | Temperature_K |
| category | VALUE |
| desc | Type for a temperature in [K] |
| swCalibrationAccess | readOnly |
| unit | Kelvin |
| Conversion category | IDENTICAL |
**表 3.28:ApplicationDataType Amplification**
| 通用 ApplicationDataType 属性 | 值 |
|--------------------------------|-----|
| shortName | Amplification |
| category | VALUE |
| desc | Type for an amplification factor in a controller in [mA/Ks] |
| swCalibrationAccess | readOnly |
| unit | MilliAmperePerKelvinSecond |
| Conversion category | IDENTICAL |
**表 3.29:ApplicationDataType Energy**
| 通用 ApplicationDataType 属性 | 值 |
|--------------------------------|-----|
| shortName | Energy |
| category | VALUE |
| desc | Type for energy [J] |
| swCalibrationAccess | readOnly |
| unit | Joule |
| Conversion category | IDENTICAL |
**表 3.30:ApplicationDataType ESum**
| 通用 ApplicationDataType 属性 | 值 |
|--------------------------------|-----|
| shortName | ESum |
| category | VALUE |
| desc | Type for the sum of control errors of an I controller in [Ks] |
| swCalibrationAccess | readOnly |
| unit | KelvinSecond |
| Conversion category | IDENTICAL |
**表 3.31:ApplicationDataType HeaterFactor**
| 通用 ApplicationDataType 属性 | 值 |
|--------------------------------|-----|
| shortName | HeaterFactor |
| category | VALUE |
| desc | Type of a proportionality factor for the heat flow from an electrical heater to a thermal energy storage in [J/mAs] |
| swCalibrationAccess | readOnly |
| unit | JoulePerMilliAmpereSecond |
| Conversion category | IDENTICAL |
**表 3.32:ApplicationDataType Time**
| 通用 ApplicationDataType 属性 | 值 |
|--------------------------------|-----|
| shortName | Time |
| category | VALUE |
| desc | Type for time in [s] |
| swCalibrationAccess | readOnly |
| unit | Second |
| Conversion category | IDENTICAL |
##### 3.1.7.7 Units
**表 3.33:Unit DegreeCelsius**
| 通用 Unit 属性 | 值 |
|----------------|-----|
| shortName | DegreeCelsius |
| displayName | °C |
| offsetSiToUnit | -273.15 |
| factorSiToUnit | 1.0 |
| physicalDimension | Temperature |
**表 3.34:Unit Kelvin**
| 通用 Unit 属性 | 值 |
|----------------|-----|
| shortName | Kelvin |
| displayName | K |
| offsetSiToUnit | 0.0 |
| factorSiToUnit | 1.0 |
| physicalDimension | Temperature |
**表 3.35:Unit Joule**
| 通用 Unit 属性 | 值 |
|----------------|-----|
| shortName | Joule |
| displayName | J |
| offsetSiToUnit | 0.0 |
| factorSiToUnit | 1.0 |
| physicalDimension | Energy |
**表 3.36:Unit MilliAmpere**
| 通用 Unit 属性 | 值 |
|----------------|-----|
| shortName | MilliAmpere |
| displayName | mA |
| offsetSiToUnit | 0.0 |
| factorSiToUnit | 1000.0 |
| physicalDimension | Current |
**表 3.37:Unit KelvinSecond**
| 通用 Unit 属性 | 值 |
|----------------|-----|
| shortName | KelvinSecond |
| displayName | Ks |
| offsetSiToUnit | 0.0 |
| factorSiToUnit | 1.0 |
| physicalDimension | TemperatureTime |
**表 3.38:Unit JoulePerKelvinSecond**
| 通用 Unit 属性 | 值 |
|----------------|-----|
| shortName | JoulePerKelvinSecond |
| displayName | J/Ks |
| offsetSiToUnit | 0.0 |
| factorSiToUnit | 1.0 |
| physicalDimension | EnergyPerTemperatureTime |
**表 3.39:Unit JoulePerMilliAmpereSecond**
| 通用 Unit 属性 | 值 |
|----------------|-----|
| shortName | JoulePerMilliAmpereSecond |
| displayName | J/mAs |
| offsetSiToUnit | 0.0 |
| factorSiToUnit | 0.001 |
| physicalDimension | EnergyPerCurrentTime |
**表 3.40:Unit MilliAmperePerKelvinSecond**
| 通用 Unit 属性 | 值 |
|----------------|-----|
| shortName | MilliAmperePerKelvinSecond |
| displayName | mA/Ks |
| offsetSiToUnit | 0.0 |
| factorSiToUnit | 1000.0 |
| physicalDimension | CurrentPerTemperatureTime |
**表 3.41:Unit Second**
| 通用 Unit 属性 | 值 |
|----------------|-----|
| shortName | Second |
| displayName | s |
| offsetSiToUnit | 0.0 |
| factorSiToUnit | 1.0 |
| physicalDimension | Time |
##### 3.1.7.8 PhysicalDimensions
**表 3.42:PhysicalDimension Energy**
| 通用 PhysicalDimension 属性 | 值 |
|------------------------------|-----|
| shortName | Energy |
| currentExp | 0 |
| lengthExp | 2 |
| luminousIntensityExp | 0 |
| massExp | 1 |
| molarAmountExp | 0 |
| temperatureExp | 0 |
| timeExp | -2 |
**表 3.43:PhysicalDimension Current**
| 通用 PhysicalDimension 属性 | 值 |
|------------------------------|-----|
| shortName | Current |
| currentExp | 1 |
| lengthExp | 0 |
| luminousIntensityExp | 0 |
| massExp | 0 |
| molarAmountExp | 0 |
| temperatureExp | 0 |
| timeExp | 0 |
**表 3.44:PhysicalDimension CurrentPerTemperatureTime**
| 通用 PhysicalDimension 属性 | 值 |
|------------------------------|-----|
| shortName | CurrentPerTemperatureTime |
| currentExp | 1 |
| lengthExp | 0 |
| luminousIntensityExp | 0 |
| massExp | 0 |
| molarAmountExp | 0 |
| temperatureExp | -1 |
| timeExp | -1 |
**表 3.45:PhysicalDimension EnergyPerCurrentTime**
| 通用 PhysicalDimension 属性 | 值 |
|------------------------------|-----|
| shortName | EnergyPerCurrentTime |
| currentExp | -1 |
| lengthExp | 2 |
| luminousIntensityExp | 0 |
| massExp | 1 |
| molarAmountExp | 0 |
| temperatureExp | 0 |
| timeExp | -3 |
**表 3.46:PhysicalDimension EnergyPerTemperatureTime**
| 通用 PhysicalDimension 属性 | 值 |
|------------------------------|-----|
| shortName | EnergyPerTemperatureTime |
| currentExp | 0 |
| lengthExp | 2 |
| luminousIntensityExp | 0 |
| massExp | 1 |
| molarAmountExp | 0 |
| temperatureExp | -1 |
| timeExp | -3 |
**表 3.47:PhysicalDimension Time**
| 通用 PhysicalDimension 属性 | 值 |
|------------------------------|-----|
| shortName | Time |
| currentExp | 0 |
| lengthExp | 0 |
| luminousIntensityExp | 0 |
| massExp | 0 |
| molarAmountExp | 0 |
| temperatureExp | 0 |
| timeExp | 1 |
**表 3.48:PhysicalDimension Temperature**
| 通用 PhysicalDimension 属性 | 值 |
|------------------------------|-----|
| shortName | Temperature |
| currentExp | 0 |
| lengthExp | 0 |
| luminousIntensityExp | 0 |
| massExp | 0 |
| molarAmountExp | 0 |
| temperatureExp | 1 |
| timeExp | 0 |
**表 3.49:PhysicalDimension TemperatureTime**
| 通用 PhysicalDimension 属性 | 值 |
|------------------------------|-----|
| shortName | TemperatureTime |
| currentExp | 0 |
| lengthExp | 0 |
| luminousIntensityExp | 0 |
| massExp | 0 |
| molarAmountExp | 0 |
| temperatureExp | 1 |
| timeExp | 1 |
##### 3.1.7.9 SwAddrMethods
**表 3.50:SwAddrMethod VAR**
| 通用 SwAddrMethod 属性 | 值 |
|------------------------|-----|
| shortName | VAR |
| desc | Memory section for variables |
| sectionType | var |
| memoryAllocationKeywordPolicy | addrMethodShortName |
| sectionInitializationPolicy | - |
| option | safetyQM |
**表 3.51:SwAddrMethod CALIB**
| 通用 SwAddrMethod 属性 | 值 |
|------------------------|-----|
| shortName | CALIB |
| desc | Memory section for calibration parameters |
| sectionType | var |
| memoryAllocationKeywordPolicy | addrMethodShortName |
| sectionInitializationPolicy | - |
| option | safetyQM |
**表 3.52:SwAddrMethod CODE**
| 通用 SwAddrMethod 属性 | 值 |
|------------------------|-----|
| shortName | CODE |
| desc | Memory section for code |
| sectionType | var |
| memoryAllocationKeywordPolicy | addrMethodShortName |
| sectionInitializationPolicy | - |
| option | safetyQM |
### 3.2 高级示例(Advanced Show Case)
#### 3.2.1 模型结构的一般目标(General Objectives of the Model Structure)
##### 3.2.1.1 Ecu 描述(The Ecu Description)
由于 Show Case 仅关注测量和标定,因此仅提供最小的系统模型。文件 Pprj_EcuDescr_U_SystemNodeStub.arxml 定义类别为 ECU_SYSTEM_DESCRIPTION 的 System SystemU_EcuDescr,其中仅包含 RootSwCompositionPrototype。文件 Pprj_EcuDescr_U.arxml 包含相应的 CompositionSwComponentType,描述了表 SystemURootComposition_EcuDescr 中所示的软件组件的分层顶层组合。
##### 3.2.1.2 Ecu 提取(The Ecu Extract)
文件 Pprj_EcuExtract_U_SystemNodeStub.arxml 定义类别为 ECU_EXTRACT 的 System SystemU_System,其中仅包含引用 ECU Flat Map 和平面顶层组合 SystemU_Root 的 RootSwCompositionPrototype SystemU。文件 Pprj_EcuExtract_U.arxml 包含相应的 CompositionSwComponentType,描述了表 SystemU_Root 中所示的软件组件的平面顶层组合。
请注意,平面顶层组合使用与分层顶层组合相同的软件组件类型。因此,在分层软件组件结构或平面结构中识别组件和数据实例需要从相应的 System 节点进行正确的迭代。
##### The ECU Flat Map
文件 Pprj_EcuExtract_U_FlatMap.arxml 包含 ECU Flat Map。ECU Flat Map 用于为表示测量和特性的所有 DataPrototypes 分配唯一且可理解的名称。这对于标定工程师[^5] 来说很重要。
用于创建 FlatInstanceDescriptor.shortName 的应用策略是当仅使用 DataPrototype 的单个实例时将其简化为 DataPrototype 的 shortName。
[^5]: 此处的标定工程师是指使用测量和标定工具的工程师,例如确定正确的标定参数值以使软件组件中的功能适应车辆中的机械组件。
##### 3.2.1.3 数据类型和数据对象(Data Types and Data Objects)
组件采用自上而下的设计,从物理功能到目标编程语言 C 中的实现。因此,软件组件的接口通常使用 ApplicationDataTypes 进行类型化,以描述 DataPrototypes 的物理含义。唯一的例外是与 AUTOSAR 服务的接口,这些接口由 ImplementationDataTypes 直接类型化,因为它们已标准化。ApplicationPrimitiveDataTypes 主要属于以下类别:
- BOOLEAN
- VALUE
- CURVE
- MAP
- COM_AXIS
最重要的 CompuMethod 类别是:
- LINEAR
- TEXTTABLE
在 LINEAR 转换的情况下,支持区分用于实现计算的 Unit 和 MCD 系统中使用的附加 Unit。这些 Unit 之间的关系用 UnitGroups 表示。
ARElement 的结构方式支持到 PortInterface 级别的接口描述相关元素的常见用法,由多个组件描述使用。这些元素位于文件 Pprj_DataDictionary.arxml 中的 Tier1/ARPlatform1/DataDictionary/ 下。
CompuMethods 和 DataConstrs 专门由一个 ApplicationPrimitiveDataType 使用。AUTOSAR 支持的 ApplicationPrimitiveDataTypes 之间的可能重用在此模型结构中未使用。当定义这样的 ApplicationDataType 时,已经考虑了到合理 ImplementationDataType 的预期映射,以便最佳地使用 ImplementationDataType 的可能范围。尽管如此,几种物理含义不通过定义各个 ImplementationDataType 来反映,而是仅使用标准化的 Platform Types [4] 来描述实现级别上的基元。这导致 RTE API 在基元和基元数组的情况下由标准化的 Platform Types 类型化。只有结构类型在 RTE API 的类型中变得可观察。这种方法允许在数学或插值库中直接使用从 RTE 读取的数据而无需任何类型转换。
数据对象的内存分配由 SwAddrMethods 的使用控制。这些在 PortInterfaces 级别上为 ParameterDataPrototypes 和 VariableDataPrototypes 定义。第 3.2.2.17 章中显示了少量示例,用于标定参数、正常数据和代码等基本用例。
##### 3.2.1.4 轴、曲线和映射(Axis, Curves and Maps)
Show Case 包含在 AUTOSAR 中称为复合基元的轴、曲线和映射的描述。为了理解示例中的结构和已定义的属性,了解这些对象在 AUTOSAR 中的描述方式是有帮助的。为此,有必要查看 ApplicationDataTypes、DataPrototypes、PortPrototypes、SwComponentTypes 和 FlatMap 的层次结构。
##### 3.2.1.5 ApplicationDataType 级别上的轴、曲线和映射
图 3.13 基于 ApplicationPrimitiveDataType Map_Time_Lnr_s_uint16 的示例。它显示了描述以下内容的 ApplicationPrimitiveDataTypes 之间的关系:
- MAP 本身
- 其作为组轴的轴
- 依次是匹配工作点的属性
ApplicationPrimitiveDataType Map_Time_Lnr_s_uint16 为具有组轴的 MAP 定义了一个数据类型。所包含值的物理含义和范围由 ApplicationPrimitiveDataType s_Lnr_0_8191d875_0_FFFF_uint16 描述。它由 valueAxisDataType 属性引用。这意味着它是 0..8191.875 [second] 范围内的值,分辨率为 0.125 [second]。
以 valueAxisDataType 角色引用的 ApplicationPrimitiveDataType 表示复合基元(例如 CURVE、MAP)内值轴的基元数据类型。它取代了 CompuMethod、Unit 和 BaseType。在特定示例中,valueAxisDataType 通过对 ApplicationPrimitiveDataType 的 valueAxisDataType 引用提供了 CURVE 或 MAP 的基元元素的属性。这进而定义以下属性:
- dataConstr
- compuMethod
- displayFormat
- unit
- swCalibrationAccess
因此,尽管已设置,但所引用的 ApplicationDataType 的 swCalibrationAccess 值对使用的 CURVE 和 MAP 而言没有意义。
注意:所引用的数据类型需要是真正的基元(通常是 VALUE 类别。也支持 BOOLEAN 类别)。
CURVE 和 MAP 的 ApplicationPrimitiveDataType 可以另外定义与整个复合基元相关的 SwDataDefProps。目前示例中使用以下属性:
- swCalprmAxisSet
- swRecordLayout
- swCalibrationAccess(但将在 DataPrototype 级别上细化)
进一步,通过使用软件组件的 dataTypeMapping,描述了 ImplementationDataType 和 SwBaseType 的属性。
作为 MAP 的轴,使用了两个组轴。组轴的属性由 COM_AXIS 类别的两个 ApplicationPrimitiveDataTypes 描述。属性 swAxisIndex 指示组轴适用于哪个维度(1 = X,2 = Y)。使用属性 sharedAxisType 定义对描述轴的 ApplicationPrimitiveDataType 的引用。
在示例中,组轴 ComAxis_Temp_Lin_K_uint16 定义了适用的最小和最大轴点数。此外,对 ApplicationPrimitiveDataType K_Celsius_Lnr_0_511d9921875_0_FFFF_uint16 的 inputVariableType 引用定义了轴的输入值的属性。这又对应于存储为轴点的值。组轴 ComAxis_Mass_Lnr_Kg_uint8 同样适用。
请注意,上述属性在 ApplicationDataTypes 级别上定义,到目前为止还不存在实现此类属性的任何数据实例。这需要此类 ApplicationDataTypes 的实例化。
##### 3.2.1.6 DataPrototype 和 SwComponentPrototype 级别上的轴、曲线和映射
###### 3.2.1.6.1 轴、曲线和映射的实例化
图 3.14 显示了 ApplicationPrimitiveDataType ComAxis_Temp_Lin_K_uint16、ComAxis_Mass_Lnr_Kg_uint8 和 Map_Time_Lnr_s_uint16 一直到 CompositionSwComponentType Pcpt_CMscB 的实例化。
因此,ParameterDataPrototypes 由上述 ApplicationPrimitiveDataTypes 类型化。每个 ParameterDataPrototype 由一个 ParameterInterface 拥有。这提供了独立实例化映射和轴的最大灵活性。在 ParameterDataPrototype 级别上还定义了 swCalibrationAccess 和 swAddrMethod。此外,ParameterSwComponentType CMscB_par 定义了由 ParameterInterfaces 类型化的三个 PPortPrototypes。
请注意,曲线或映射的组轴不一定由提供曲线或映射的同一 ParameterSwComponentType 提供。此情况由映射 Arr1dMap_Time_Lnr_s_uint16 来说明,它使用由 CMscD_par 提供的组轴 Arr1dComAxis_Temp_Lin_K_uint16 和由 CMscB_par 提供的 ComAxis_Mass_Lnr_Kg_uint8。
###### 3.2.1.6.2 软件组件对轴、曲线和映射的使用
(参见原文第 73 页)
###### 3.2.1.6.3 将映射和曲线实例链接到其轴实例
考虑使用具有组轴的曲线和映射的软件组件。那么需要表示曲线和映射的哪个实例使用组轴的哪个实例作为横坐标的轴,对于映射,纵坐标的轴也是如此。
AUTOSAR 元模型为此提供了两种可能性:
- RunnableEntity.parameterAccess.swDataDefProps
- 或
- SwcInternalBehavior.instantiationDataDefProps.swDataDefProps
在一个软件组件内,不同的 RunnableEntity 使用具有不同轴的同一曲线或映射的可能性极小(注意这也无法由 ASAM MCD-2MC 表达)。因此,在此 Show Case 中使用了第二个功能。这避免了当多个 RunnableEntity 定义对同一曲线或映射实例的 parameterAccesses 时出现不一致的风险。
相应的 instantiationDataDefProps.parameterInstance 在 SwComponentType 范围内引用映射实例,swDataDefProps.swCalprmAxisSet.swCalprmAxis.swCalprmAxisTypeProps.swCalprmRef 引用应用的组轴与相应的 SwCalprmAxis.swAxisIndex。
**列表 3.28:映射的 InstantiationDataDefProps 示例**
```xml
/Tier1/ARPlatform1/
Pcpt_CMscB/CMscB/R_Map_Time_Lnr_s_uint16
/Tier1
/ARPlatform1/DataDictionary/PortInterfaces/V1_0_0/
Map_Time_Lnr_s_uint16/Map_Time_Lnr_s_uint16
1
/Tier1/
ARPlatform1/Pcpt_CMscB/CMscB/
R_ComAxis_Temp_Lin_K_uint16
/Tier1/ARPlatform1/DataDictionary/
PortInterfaces/V1_0_0/ComAxis_Temp_Lin_K_uint16/
ComAxis_Temp_Lin_K_uint16
2
/Tier1/
ARPlatform1/Pcpt_CMscB/CMscB/
R_ComAxis_Mass_Lnr_Kg_uint8
/Tier1/ARPlatform1/DataDictionary/
PortInterfaces/V1_0_0/ComAxis_Mass_Lnr_Kg_uint8/
ComAxis_Mass_Lnr_Kg_uint8
ARPlatform1
```
###### 3.2.1.6.4 将轴实例链接到其工作点实例
当软件组件使用包含轴的复合基元(例如曲线、映射或组轴)时,指示哪些数据用作相应轴的输入是有益的。这使测量和标定工具能够显示当前工作点。如第 3.2.1.6.3 节所述,此信息可以通过以下方式提供:
- 包含轴的复合基元的 ParameterAccess.swDataDefProps
- 或
- 通过 instantiationDataDefProps.swDataDefProps
在此 Show Case 中,由于第 3.2.1.6.3 节中讨论的相同原因,使用了第二个功能。
相应的 instantiationDataDefProps.parameterInstance 引用 SwComponentType CMscB 范围内的轴实例。swDataDefProps.swCalprmAxisSet.swCalprmAxis.swCalprmAxisTypeProps.swVariableRef 引用应用的工作点变量(在这种情况下,RPortPrototype 中的 dataElement)与相应的 SwCalprmAxis.swAxisIndex。
**列表 3.29:轴的 InstantiationDataDefProps 示例**
```xml
/Tier1/ARPlatform1/
Pcpt_CMscB/CMscB/R_ComAxis_Temp_Lin_K_uint16
/Tier1
/ARPlatform1/DataDictionary/PortInterfaces/V1_0_0/
ComAxis_Temp_Lin_K_uint16/ComAxis_Temp_Lin_K_uint16
1
/Tier1/
ARPlatform1/Pcpt_CMscB/CMscB/
R_PrimData_Temperature_Lin_K_C_uint16
/Tier1/ARPlatform1/DataDictionary/
PortInterfaces/V1_0_0/
PrimData_Temperature_Lin_K_C_uint16/
PrimData_Temperature_Lin_K_C_uint16
```
###### 3.2.1.6.5 ECU Flat Map 中的轴、曲线和映射
ECU Flat Map 包含所有曲线、映射、轴和工作点变量的条目。使用的命名模式在第 3.2.1.2.1 节中描述。
**列表 3.30:映射轴和工作点变量的 FlatInstanceDescriptor 示例**
```xml
Map_Time_Lnr_s_uint16
/Tier1/
ARPlatform1/System/SystemU_System/SystemU
/Tier1/
ARPlatform1/System/CompositionSwComponentTypes/SystemU_Root/
CMscB_par
/Tier1/ARPlatform1/
Pcpt_CMscB/CMscB_par/P_Map_Time_Lnr_s_uint16
/Tier1/ARPlatform1/
DataDictionary/PortInterfaces/V1_0_0/Map_Time_Lnr_s_uint16/
Map_Time_Lnr_s_uint16
ComAxis_Temp_Lin_K_uint16
/Tier1/
ARPlatform1/System/SystemU_System/SystemU
/Tier1/
ARPlatform1/System/CompositionSwComponentTypes/SystemU_Root/
CMscB_par
/Tier1/ARPlatform1/
Pcpt_CMscB/CMscB_par/P_ComAxis_Temp_Lin_K_uint16
/Tier1/ARPlatform1/
DataDictionary/PortInterfaces/V1_0_0/ComAxis_Temp_Lin_K_uint16/
ComAxis_Temp_Lin_K_uint16
PrimData_Temperature_Lin_K_C_uint16
/Tier1/
ARPlatform1/System/SystemU_System/SystemU
/Tier1/
ARPlatform1/System/CompositionSwComponentTypes/SystemU_Root/
CMscA
/Tier1/ARPlatform1/
Pcpt_CMscA/CMscA/P_PrimData_Temperature_Lin_K_C_uint16
/Tier1/ARPlatform1/
DataDictionary/PortInterfaces/V1_0_0/
PrimData_Temperature_Lin_K_C_uint16/
PrimData_Temperature_Lin_K_C_uint16
```
##### 3.2.1.7 映射和轴的数组(Arrays of Maps and Axes)
曲线、映射和立方体的功能通常用于描述特性对其他物理输入值的物理依赖性。因此,每个输入值由正交轴描述。与此相反,数组用于将相同性质的一组值分组,这些值可以由同一算法处理。通常,在这种情况下,算法使用索引迭代数组。尽管如此,每个数组元素可以表示车辆的特定部分,例如特定的气缸或特定的传感器。可以组合这些设计原则。这最终导致需要描述曲线、映射、立方体和相应轴的数组。
Show Case 通过以下元素说明这些对象的模型:
- Arr1dMap_Time_Lnr_s_uint16
- Arr1dComAxis_Temp_Lin_K_uint16
- Arr1dPrimData_Temperature_Lin_K_C_uint16
因此,映射数组 Arr1dMap_Time_Lnr_s_uint16 对 x 轴使用组轴数组 Arr1dComAxis_Temp_Lin_K_uint16,而后者又使用原始值数组作为工作点 Arr1dPrimData_Temperature_Lin_K_C_uint16。在这种情况下,第 n 个映射使用第 n 个 x 轴,而第 n 个 x 轴使用第 n 个值作为工作点。相比之下,映射对 y 轴使用一个组轴 ComAxis_Mass_Lnr_Kg_uint8。在这种情况下,数组中的所有映射都使用相同的 y 轴。
##### 3.2.1.7.1 ECU Flat Map 中的映射和轴数组
在 ECU Flat Map 中,使用对 ApplicationCompositeElementDataPrototypes 的引用来表达数组中映射和组轴的每个数组元素的特定含义。
例如,数组 Arr1dMap_Time_Lnr_s_uint16 中的每个元素都以指示特定含义的方式命名:
- Arr1dMap_Time_Lnr_s_uint16_FrontLeft
- Arr1dMap_Time_Lnr_s_uint16_FrontRight
- Arr1dMap_Time_Lnr_s_uint16_RearLeft
- Arr1dMap_Time_Lnr_s_uint16_RearRight
以下列表显示了一个示例上此类 FlatInstanceDescriptior 的结构:
**列表 3.31:ApplicationCompositeElementDataPrototype 的 FlatInstanceDescriptor 示例**
```xml
Arr1dMap_Time_Lnr_s_uint16_FrontLeft
/Tier1/
ARPlatform1/System/SystemU_System/SystemU
/Tier1/
ARPlatform1/System/CompositionSwComponentTypes/SystemU_Root/
CMscD_par
/Tier1/ARPlatform1/
Pcpt_CMscD/CMscD_par/P_Arr1dMap_Time_Lnr_s_uint16
/Tier1/
ARPlatform1/DataDictionary/PortInterfaces/V1_0_0/
Arr1dMap_Time_Lnr_s_uint16/Arr1dMap_Time_Lnr_s_uint16
/Tier1/
ARPlatform1/DataDictionary/ApplicationDataTypes/
Map_Time_Lnr_s_uint16_ScNoOfWheels/
Map_Time_Lnr_s_uint16_ScNoOfWheels
```
请注意目标引用中 index 属性的使用。
##### 3.2.1.8 模式测量(Measurement of Modes)
##### 3.2.1.8.1 启用模式测量
通过将 ModeDeclarationGroupPrototype.swCalibrationAccess 设置为 readOnly 来启用模式测量。请参见 ModeDirection。
##### 3.2.1.8.2 ECU Flat Map 中的模式
AUTOSAR 支持当前模式、上一个模式和下一个模式的测量。其中后两个在模式测量期间用于识别转换类型(在正在进行的转换期间)非常有用。在此 Show Case 中仅说明了当前模式的测量。为此,FlatMap 包含一个指向要测量的 ModeDeclarationGroupPrototype 的 FlatInstanceDescriptor。FlatInstanceDescriptor 的 role 属性设置为 CURRENT_MODE。
**列表 3.32:ModeDeclarationGroupPrototype 的 FlatInstanceDescriptor 示例**
```xml
ModeDirection
CURRENT_MODE
/Tier1/
ARPlatform1/System/SystemU_System/SystemU
/Tier1/
ARPlatform1/System/CompositionSwComponentTypes/SystemU_Root/
CMscA
/Tier1/ARPlatform1/
Pcpt_CMscA/CMscA/P_ModeDirection
/Tier1/
ARPlatform1/DataDictionary/PortInterfaces/V1_0_0/ModeDirection/
ModeDirection
```
#### 3.2.2 示例中的 Show Case(Show cases in the Example)
由于本节包含大量重复的模型元素定义表格(CompositionSwComponentType、ParameterSwComponentType、ApplicationSwComponentType、ParameterInterface、ModeSwitchInterface、SenderReceiverInterface、ApplicationDataType、Unit、PhysicalDimension、SwAddrMethod 等),翻译重点放在表 3.53 至 3.112 的关键信息上,详细模型元素列于下表。
| 表号 | 名称 | 类型 |
|------|------|------|
| 3.53 | CompositionSwComponentType Pcpt_CMscA | 包含 PPortPrototype:P_ModeDirection、P_PrimCal_Mass_Lnr_Kg、P_PrimData_Mass_Lnr_Kg_uint8、P_PrimData_StepsSpeed_Txt_sint8、P_PrimData_Temperature_Lin_K_C_uint16;RPortPrototype:R_PrimData_StepsSpeed_Txt_sint8;components:CMscA、CMscA_par |
| 3.54 | CompositionSwComponentType SystemU_Root | 包含组件:CMscA、CMscA_par、CMscB、CMscB_par、CMscC_nvm、CMscD、CMscD_par |
| 3.55 | CompositionSwComponentType SystemURootComposition_EcuDescr | 包含组件:CMscC(类型 Pcpt_CMscC) |
| 3.56 | CompositionSwComponentType Pcpt_CMscD | 包含 RPortPrototype:R_ComAxis_Mass_Lnr_Kg_uint8、R_PrimData_MassCorrected_Lnr_Kg_uint8;components:CMscD、CMscD_par |
| 3.57 | CompositionSwComponentType Pcpt_CMscC | 包含 PPortPrototype:P_PrimData_Time_Lnr_s_uint16、P_PrimData_ValidState_Txt_noUnit_boolean;components:CMscA(Pcpt_CMscA)、CMscB(Pcpt_CMscB)、CMscC_nvm、CMscD(Pcpt_CMscD) |
| 3.58 | CompositionSwComponentType Pcpt_CMscB | 包含 PPortPrototype:P_ComAxis_Mass_Lnr_Kg_uint8、P_PrimData_MassCorrected_Lnr_Kg_uint8、P_PrimData_Time_Lnr_s_uint16、P_PrimData_ValidState_Txt_noUnit_boolean;RPortPrototype:R_ModeDirection、R_PrimData_Mass_Lnr_Kg_uint8、R_PrimData_StepsSpeed_Txt_sint8、R_PrimData_Temperature_Lin_K_C_uint16;components:CMscB、CMscB_par |
| 3.59 | ParameterSwComponentType CMscA_par | PPortPrototype:P_PrimCal_Mass_Lnr_Kg |
| 3.60 | ParameterSwComponentType CMscD_par | PPortPrototype:P_Arr1dComAxis_Temp_Lin_K_uint16、P_Arr1dMap_Time_Lnr_s_uint16 |
| 3.61 | ParameterSwComponentType CMscB_par | PPortPrototype:P_ComAxis_Mass_Lnr_Kg_uint8、P_ComAxis_Steps_Txt_sint8、P_ComAxis_Temp_Lin_K_uint16、P_Curve_Mass_Lnr_Kg_uint8、P_Map_Time_Lnr_s_uint16 |
| 3.62 | ApplicationSwComponentType CMscD | PPortPrototype:P_Arr1dPrimData_Temperature_Lin_K_C_uint16;RPortPrototype:R_Arr1dComAxis_Temp_Lin_K_uint16、R_Arr1dMap_Time_Lnr_s_uint16、R_Arr1dPrimData_Temperature_Lin_K_C_uint16、R_ComAxis_Mass_Lnr_Kg_uint8、R_PrimData_MassCorrected_Lnr_Kg_uint8 |
| 3.63 | SwcInternalBehavior CMscD | RunnableEntity:CMscD_Process |
| 3.64 | ApplicationSwComponentType CMscB | PPortPrototype:P_PrimData_MassCorrected_Lnr_Kg_uint8、P_PrimData_Time_Lnr_s_uint16、P_PrimData_ValidState_Txt_noUnit_boolean;RPortPrototype:R_ComAxis_Mass_Lnr_Kg_uint8、R_ComAxis_Steps_Txt_sint8、R_ComAxis_Temp_Lin_K_uint16、R_Curve_Mass_Lnr_Kg_uint8、R_Map_Time_Lnr_s_uint16、R_ModeDirection、R_PrimData_Mass_Lnr_Kg_uint8、R_PrimData_MassCorrected_Lnr_Kg_uint8、R_PrimData_StepsSpeed_Txt_sint8、R_PrimData_Temperature_Lin_K_C_uint16、R_PrimData_Time_Lnr_s_uint16、R_PrimData_ValidState_Txt_noUnit_boolean |
| 3.65 | SwcInternalBehavior CMscB | RunnableEntity:CMscB_Process(cyclic process for calculation) |
| 3.66-3.73 | ParameterInterfaces | Arr1dComAxis_Temp_Lin_K_uint16、Arr1dMap_Time_Lnr_s_uint16、ComAxis_Mass_Lnr_Kg_uint8、ComAxis_Steps_Txt_sint8、ComAxis_Temp_Lin_K_uint16、Curve_Mass_Lnr_Kg_uint8、Map_Time_Lnr_s_uint16、PrimCal_Mass_Lnr_Kg |
| 3.74 | ModeSwitchInterface ModeDirection | modeGroups:ModeDirection;type:Direction;swCalibrationAccess:readOnly |
| 3.75-3.80 | SenderReceiverInterfaces | Arr1dPrimData_Temperature_Lin_K_C_uint16、PrimData_Mass_Lnr_Kg_uint8、PrimData_MassCorrected_Lnr_Kg_uint8、PrimData_Temperature_Lin_K_C_uint16、PrimData_Time_Lnr_s_uint16、PrimData_ValidState_Txt_noUnit_boolean |
| 3.81 | ApplicationDataType DataValidityType | category:BOOLEAN;TEXTTABLE(Invalid, Valid) |
| 3.82-3.88 | ApplicationDataTypes, Category VALUE | K_Celsius_Lnr_0_511d9921875_0_FFFF_uint16、kg_Lnr_0_0d25_0_C8_uint8、NoUnit_Lnr_1_4_1_4_uint8、NoUnit_Lnr_1_65535_1_FFFF_uint16、s_Lnr_0_8191d875_0_FFFF_uint16、speedSteps(TEXTTABLE:Stop、LightSpeed、RidiculousSpeed、LudicrousSpeed)、TxWheelNames(TEXTTABLE:FrontLeft、FrontRight、RearLeft、RearRight) |
| 3.89-3.91 | ApplicationDataTypes, Category COM_AXIS | ComAxis_Temp_Lin_K_uint16、ComAxis_Steps_Txt_sint8、ComAxis_Mass_Lnr_Kg_uint8 |
| 3.92 | ApplicationDataType, Category CURVE | Curve_Mass_Lnr_Kg_uint8(valueAxisDataType:kg_Lnr_0_0d25_0_C8_uint8) |
| 3.93 | ApplicationDataType, Category MAP | Map_Time_Lnr_s_uint16(valueAxisDataType:s_Lnr_0_8191d875_0_FFFF_uint16) |
| 3.94-3.96 | ApplicationArrayDataTypes | ComAxis_Temp_Lin_K_uint16_ScNoOfWheels、K_Celsius_Lnr_0_511d9921875_0_FFFF_uint16_ScNoOfWheels、Map_Time_Lnr_s_uint16_ScNoOfWheels |
| 3.97 | ApplicationRecordDataType CMscC_nvm_NvBlockATyp | STRUCTURE;element:PrimData_StepsSpeed_Txt_sint8(speedSteps) |
| 3.98 | ModeDeclarationGroup Direction | EXPLICIT_ORDER;initialMode:Halt;ModeDeclaration:Backward(2)、Forward(1)、Halt(0) |
| 3.99-3.103 | Units | Celsius(PD_K)、K(PD_K)、kg(PD_kg)、NoUnit(PD_NoUnit)、s(PD_s) |
| 3.104-3.107 | PhysicalDimensions | PD_K、PD_kg、PD_NoUnit、PD_s |
| 3.108-3.112 | SwAddrMethods | CAL(calprm、safetyQM)、CODE_10MS(code、safetyQM)、CONST_SLOW(const、safetyQM)、DATA(var、INIT、safetyQM)、DATA_NVDAT(var、NO-INIT、nvData、safetyQM) |
---
## 附录 A 提到的类表(Mentioned Class Tables)
为完整性起见,本章包含一组类表,表示本文档上下文中提到的元类,但不直接包含在描述特定元模型语义的范围内。原始附录 A 包含约 90 个 AUTOSAR 元类表(ARElement、ARPackage、AliasNameSet、AnyInstanceRef、ApplicationArrayDataType、ApplicationArrayElement、ApplicationCompositeDataType、ApplicationCompositeElementDataPrototype、ApplicationDataType、ApplicationPrimitiveDataType、ApplicationRecordDataType、ApplicationRecordElement、ApplicationSwComponentType、ArraySizeSemanticsEnum、AssemblySwConnector、AtomicSwComponentType、AutosarDataPrototype、CompositionSwComponentType、CompuConstTextContent、CompuMethod、CompuRationalCoeffs、CompuScale、DataConstr、DataConstrRule 等)。
这些元类表为每个类提供以下信息:
- **类(Class)**:类名
- **包(Package)**:类所在的 M2 模型包路径
- **说明(Note)**:类的描述
- **基类(Base)**:继承的父类列表
- **子类(Subclasses)**:派生的子类列表(如果有)
- **属性(Attribute)**:属性表,包含属性名(Type)、多重性(Mul.)、类型种类(Kind)和说明(Note)
这些类表在 AUTOSAR 元模型标准文档 [4] 中已有详细定义,此处重复仅为交叉参考。如需查阅完整的类表元数据,请参阅:
- AUTOSAR_TPS_GenericStructureTemplate - 通用结构模板
- AUTOSAR_TPS_SoftwareComponentTemplate - 软件组件模板
- AUTOSAR_MMOD_MetaModel - AUTOSAR 元模型
---
## 翻译说明
1. **文档结构**:本文档为 AUTOSAR TR(技术报告)类文档,主要通过两个具体示例(入门示例和高级示例)说明测量与标定的建模。
2. **物理符号**:T_Plant、TEnv、IController、TP lant 等物理符号在原文中存在下标记渲染问题,翻译中保留为 T_Plant、TEnv 等形式。
3. **单位符号**:J、K、°C、mA、KJ/s 等单位符号保持原样。
4. **代码示例**:所有 C 代码完整保留并翻译了注释部分。
5. **ARXML 标签**:所有 XML 元素标签保持英文原样,包括 PH
6. **ARXML 标签**:所有 XML 元素标签保持英文原样,包括 PHYSICAL-DIMENSION、UNIT、APPLICATION-PRIMITIVE-DATA-TYPE 等。
7. **UML 类名**:CompositionSwComponentType、ApplicationSwComponentType、ParameterInterface、ModeSwitchInterface 等保持英文。
8. **数据流图与公式**:原图 3.1-3.14 在译文中以"图 X.Y:[描述]"的形式标记;数学公式使用 Markdown 数学公式语法。
9. **附录 A 摘要**:由于附录 A 包含约 90 个高度重复的元类表,翻译中以摘要形式呈现,详细元数据请参考 AUTOSAR 元模型标准文档。