BSW 模式是一种由 BSW 中的模式管理器控制和标准化的模式。BSW 模式始终是某个 ECU 的本地模式。(The BSW mode is a mode controlled and standardized by the mode manager in BSW. It is always a local mode of an ECU.)
Mode Manager
模式管理器是一个可以由 BSW 模块(也可以由 SW-C)担任的角色。(The mode manager is a role that can be assumed by a BSW module (or by a SW-C).)
Mode Request
模式请求是传达给模式管理器的一些信息,请求模式管理器切换到某种模式。(A mode request is information conveyed to the mode manager, requesting the mode manager to switch to a certain mode.)
Mode User
模式用户是对模式变化做出反应的实体。(A mode user is an entity that responds to mode changes.)
The BSW Mode Manager is the module that implements the BSW-level aspects of the vehicle mode management and application mode management concepts. Its responsibility is to arbitrate mode requests from application layer SW-Cs or other BSW modules according to simple rules and perform operations based on the arbitration results.
BSW 模式管理器基本功能的操作可描述为两个不同的任务:模式仲裁和模式控制。
The operation of its basic functions can be described as two distinct tasks: Mode Arbitration and Mode Control.
Mode Arbitration: initiates mode switching based on the arbitration results of rules for mode requests and mode indications received from SW-Cs or other BSW modules.
模式控制部分通过执行包含其他BSW模块的模式切换操作的动作列表来执行模式切换。
Mode Control: executes the mode switch by performing an action list that include mode switching operations of other BSW modules.
As shown in :ref:fig_BswMarch, the BswM module resides in the System Services layer of the AUTOSAR architecture, where it primarily serves other Basic Software Modules (BSW) and the upper-layer RTE.
Mode Arbitration: initiates mode switching based on the arbitration results of rules for mode requests and mode indications received from SW-Cs or other BSW modules.
模式管理:模式控制部分通过执行包含其他BSW模块的模式切换操作的动作列表来执行模式切换。
Mode Control: executes mode switching by performing an action list that include mode switching operations of other BSW modules.
The mode arbitration performed by BswM is simple and rule-based. The rules for mode arbitration,specified in the module’s configuration, consist of simple Boolean expressions. Therefore, mode arbitration is expected to have little impact on runtime performance.
The BswM enters mode arbitration upon notification from a BSW module or an SW-C. These notifications provide input values from various BSW modules, which are mapped to BswM’s notification ports during configuration. These values can then be combined into logical expressions as required. These expressions, in turn, determine the action list to be executed by BswM, which consists of a sequence of operations targeting interfaces of BSW or RTE modules.
A rule is a logical expression composed of a set of mode request conditions. It is evaluated upon changes to input mode requests and mode indications, or during the execution of the BswM main function. The evaluation result (True or False) determines whether to execute the corresponding list of mode control operations.
The logical expressions comprising the mode arbitration rules can utilize different operators (AND, OR, XOR, NOT, and NAND). Each term within an expression corresponds to a mode request condition.If a condition references a BswMModeRequestPort, it validates whether a requested or indicated mode is equal (or unequal) to a specified mode.
If a condition references a BswMEventRequestPort, it checks whether the request port is SET or CLEAR. An event request differs from a mode request in that the requester does not send a specific mode or value to the BswM for evaluation. Instead, the BswM evaluates only the fact of the event’s occurrence.
The BswMEventRequestPort enters the SET state upon the requester sending or invoking an event. The BswM can then place the port into the CLEAR state by executing the BswMClearEventRequest operation. An example comprising two conditions is shown in Figure :ref:fig_BswM01.
The mode control component of the BswM executes all requisite actions based on the outcome of the mode arbitration. This is accomplished through action lists. An action list constitutes an ordered sequence of operations that the BswM performs when a mode arbitration rule is triggered.
动作列表中的动作可分为三种类型:
The actions in the action list can be divided into three types:
调用其他 BSW 模块或 RTE;
Call other BSW modules or RTE;
链接到要包含在执行中的其他动作列表。
Link to aother action list to be included in the execution.
模式仲裁规则。执行相应的动作列表时,将评估这些规则。
Mode arbitration rules. These rules are evaluated when the corresponding action list is executed.
To reduce design complexity and minimize parameters, the configuration of ModeRequestPorts has been streamlined. Instead of individual port configuration, settings are now managed by category. Consequently, the simplified configuration is centralized within BswMModeInitValue.
The current design employs synchronous execution of values, which does not accommodate priority-based processing. Consequently, configuring BswMActionListPriority is ineffective.
This type identifies the modes that can be requested by BswM Users.
BswM_UserType
uint16
This type identifies a BswM User that makes mode requests to the BswM.
BswM_ConfigType
BswM_PbConfigType
Manager. A pointer to this structure is passed to the BSW Mode Manager initialization function for configuration. This container exists once per partition.
Deinitializes the BSW Mode Manager. After a call of BswM_Deinit, no mode processing shall be performed by BswM even if any mode requests are made or the BswM main function is called.
This API tells the BswM the desired communication status of the available networks. The status will typically be activated via COM I-PDU group switches.
Sync/Async
TRUE
Reentrancy
Reentrant
Parameters
Dir
Name
Description
[in]
NetworkMask
Mask containing one bit for each available network.
The first step is to define the operational logic. For instance, to control a light, its logical states (ON/OFF) and the predefined conditions for each state transition must be specified. Once these conditions are established, they form a complete rule set. In BswM, this rule set is constructed through configuration. The basic procedure is as follows:
Create a Rule with the name: BswM_Rule_XXX, where “Rule” is the rule name, for example: BswM_Rule_LedOnOff.
在该Rule中配置选择仲裁条件以及执行的动作, 条件为真是执行什么动作,条件为假时执行什么动作。
In this Rule, configure the arbitration conditions and corresponding actions. Specify the action to be executed for both the TRUE and FALSE cases of the condition.
通过配置BswMRuleInitState来设置Rule的初始值,
Set the initial value of the Rule by configuring BswMRuleInitState;
通过配置BswMRuleExpressionRef选择Rule的仲裁条件,
Select the arbitration condition of the Rule by configuring BswMRuleExpressionRef;
通过配置BswMRuleFalseActionList选择Rule的仲裁结果为假时执行的动作,
Select the actions to be executed when the arbitration result of the Rule is false by configuring BswMRuleFalseActionList;
通过配置BswMRuleTrueActionList选择Rule的仲裁结果为真时执行的动作。
Select the actions to be executed when the arbitration result of the Rule is true by configuring BswMRuleTrueActionList.
Configure BswMConditionType to select the comparison type: for BSWM_EQUALS and BSWM_EQUALS_NOT, this means comparing the BswMModeRequestPort referenced by BswMConditionMode for equality or inequality with the value in BswMConditionValue; whereas for BSWM_EVENT_IS_SET and BSWM_EVENT_IS_CLEARED, it means checking whether the BswMEventRequestPort referenced by BswMConditionMode is set or cleared (not set).
通过配置BswMConditionMode选择等式左边的对象,
Select the object on the left side of the equation by configuring BswMConditionMode,
When the BswMModeRequestSource of the BswMModeRequestPort referenced by BswMConditionModey is BswMBswModeNotification, BswMSwcModeNotification, or BswMSwcModeRequest, BswMConditionValue is configured as BswMModeDeclaration;
When the BswMModeRequestSource of the BswMModeRequestPort referenced by BswMConditionModey is BswMGenericRequest or BswMJ1939DcmBroadcastStatus, BswMConditionValue is configured as BswMBswRequestedMode under BswMBswMode, which is customized by the user;
When the BswMModeRequestSource of the BswMModeRequestPort referenced by BswMConditionModey is of other types, BswMConditionValue is configured as the BswModeCompareValue drop-down box under BswMBswMode for selection.
Select the source of the mode request by configuring BswMRequestSource. The BswMEventRequestPort is shown in Figure BswMEventRequestSource, and the BswMModeRequestPort is shown in Figure ModeRequestSource.
BswM resides in each partition, with a dedicated BswMConfig instance per partition. In a multi-partition system, users need to configure multiple BswMConfig instances.
As these BswM instances operate in isolation, their configuration data must be shared via the RTE or user-defined global variables. The following figure illustrates the multi-partition configuration:
BswM provides two ways, namely mode management and mode request, to interact with SWC or other basic software modules. BswM can act as both a mode user and a mode provider.
如下图所示应用程序 SW-C 的端口如何连接到 BSW 模式管理器的服务端口。应用程序模式管理器 SW-C 具有模式
请求端口和模式切换 R 端口(名为 modeNotificationPort,以区别于模式切换 P 端口)。第一个端口用于请求其
应用程序模式的更改,后者用于在 BswM 执行模式更改时接收通知。应用程序模式管理器的模式请求端口(modeRequest
Port0)连接到 BSW 模式管理器的相应模式请求端口。
The following figure illustrates the port connections between an Application SW-C and the BSW Mode Manager. The Application Mode Manager SW-C is equipped with a Mode Request Port and a Mode Switch R-Port (named modeNotificationPort to distinguish it from the Mode Switch P-Port). The former is used to request changes to its application mode, while the latter is used to receive notifications when BswM executes a mode change. The Mode Request Port (modeRequestPort0) of the Application Mode Manager is connected to the corresponding Mode Request Port of the BSW Mode Manager.
Mode management with other basic software modules is enabled by configuring BswMConfig->BswMArbitration-> BswMModeRequestPort->BswMModeRequestSource-> BswMBswModeNotification. BswMBswModeNotification references the mode declaration group prototype defined in the description files of other modules.
Mode switching notifications from SWC are received by configuring BswMConfig->BswMArbitration->BswMModeRequestPort-> BswMModeRequestSource-> BswMSwcModeNotification. BswMSwcModeNotificationModeDeclarationGroupPrototypeRef references the mode declaration group prototype defined in the extraction file.
To interact with basic software, configure BswMSchMSwitch (BswMModeControl->BswMAction->BswMAvailableActions-> BswMSchMSwitch ) to perform mode switching.