AUTOSAR-BSWM

本文详细介绍了AUTOSAR中的BSWM模块,它负责车辆和应用程序模式管理,通过规则驱动的ModeArbitration进行模式切换决策,以及使用ActionList执行模式控制。讨论了BSWM与EcuM、ComM等模块的关系和关键概念如规则、模式请求和执行列表。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

AUTOSAR的BswM模块详解_autosar bswm-CSDN博客

部分内容为上述链接摘抄,感谢CSDN的无私分享;

一、BSWM介绍

BswM即BSW Mode Manager,它是实现位于 BSW 中的车辆模式管理(Vehicle Mode Management )和应用程序模式管理概念(Application Mode Management )的一部分的模块。

它的职责是根据简单的规则对来自应用层 SW-C 或其他 BSW 模块的模式请求进行仲裁,并根据仲裁结果执行操作。

二、BSWM功能

BswM在AUTOSAR上跟很多模块有关联的,例如EcuM、ComM、OS等等;

BSWM的操作功能可以描述为两部分:Mode Arbitration 和Mode Control

(1)Mode Arbitration部分启动模式切换,SW-C 或其他 BSW 模块接收的模式请求和模式指示基于规则的仲裁会触发模式切换。

(2)Mode Control部分通过执行包含其他 BSW 模块的模式切换操作的Action List来执行模式切换。

BswM 应该被视为一个模式管理框架模块,其中的行为完全由其配置定义;对于Mode Arbitration 和Mode Control,我们可以简单粗暴地理解为前者是条件判断的,后者是动作执行的。

以下内容,我们会接触到以下概念:Rules(规则)、Mode Request(模式请求)、Expression(表达式)、Action List(执行列表)等等,从下图可以看出,这几个东西都是AUTOSAR Configurator的BswM里面配置项。

1. Mode Arbitration 


BswM 执行的Mode Arbitration是基于规则(rule-based)的而且很简单。用于Mode Arbitration的rules在 BSW Mode Manager模块的配置中指定。

这些规则由简单的布尔表达式组成,因此Mode Arbitration对运行时的影响很小。

为了知道要执行哪些Action List,BswM 需要检测来自先前规则评估的Mode Arbitration结果的变化。

(1)Expressions:意为表达式,我理解是模式触发的条件表达式,引用BSWM MC(Mode Conditions);

(2)ModeConditions:意为模式条件,在这里配置条件的与或非,引用 RequestPorts;

(3)ModeRequestPorts:意为模式请求接口,指明请求来自哪里和配置请求类型为immediate还是deferred,我理解immediate和deferred的区别为 请求的模式切换在上下文中进行还是在周期循环中进行;

(4)Rules:指向相应Expressions和AL(Action list),并规定Rule的规则,如下图,若配置为初始值为False,生成的规则代码如下图,评估结果(True or False)用于决定执行相应的模式控制Action List。

2. Mode Control

BswM的Mode Control部分根据Mode Arbitration的结果执行所有必需的操作。这是使用Action List完成的。Action List是由Mode Arbitration触发时BswM执行的动作的有序列表。

Action List中的Action可以分为三种类型:

  1. 调用其他BSW模块或 RTE。

  2. 链接到要包含在执行中的其他Action List。

  3. Mode Arbitration规则。当执行相应的Action List时,将评估这些规则。这样可获得规则的层次结构。

BswM不需要在其执行的操作上存储或响应任何 BSW 模块特定的返回值。因此,BSW 中的不同状态管理器将它们的当前状态给BswM,以用作Mode Arbitration的输入。但是,如果返回错误 (E_NOT_OK),BswM 可以发出 DEM事件和/或取消当前正在执行的Action List。

这块的介绍请参考AUTOSAR的BswM模块详解_autosar bswm-CSDN博客

### AUTOSAR Bswm Code Implementation Details In the context of AUTOSAR (Automotive Open System Architecture), the Basic Software Module Manager (BswM) plays a crucial role in managing and initializing various basic software modules. For understanding or implementing BswM, it's important to consider how different components interact within this framework. The Vendor ID `NVM_VENDOR_ID` being 30 corresponds to Vector-Informatik as per industry standards[^1]. This information can be relevant when dealing with vendor-specific implementations or configurations related to Non-Volatile Memory management which might integrate into broader BswM functionalities. Regarding core IDs used by certain functions like spinlocks, these should start from zero and increment continuously without gaps. Such definitions ensure that each processing unit has a unique identifier facilitating efficient task scheduling and synchronization mechanisms across multiple cores[^2]. For communication between nodes using Network Management (Nm) protocols over channels where several BusNMs may operate simultaneously, there exists a requirement for aggregating operational states prior to notifying Communication Manager (ComM). Specifically, only the most significant state among all active BusNM instances on any given channel gets reported upwards through ComM upon detecting changes in network conditions[^3]. Here’s an example snippet demonstrating initialization aspects typically found within BswM: ```c #include "BswM.h" #include "ComStack_Types.h" void BswM_Init(const BswM_ConfigType* ConfigPtr){ /* Initialize configuration parameters */ // Example pseudo-code showing potential setup steps uint8 i; for(i=0; i<ConfigPtr->ModuleCount; ++i){ switch(ConfigPtr->Modules[i]->TypeId){ case NvM_MODULE_TYPE: // Initialize NvM module considering specific vendor id handling break; default: // Handle other types... break; } // Additional initializations based on CoreIdType constraints if((ConfigPtr->Modules[i]->CoreID >= CORE_ID_MIN) && (ConfigPtr->Modules[i]->CoreID <= CORE_ID_MAX)){ // Proceed with valid core-id range operations }else{ // Error handling logic here } } // Aggregation mechanism for multi-bus NM status reporting } ```
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值