The BSW Mode Manager is a module that implements the part of the vehicle mode management and application mode management concepts residing in the BSW.
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. The operation of the basic functions of the BSW Mode Manager can be described as two distinct tasks: mode arbitration and mode
control. The mode arbitration part initiates mode switching based on the arbitration results of rules for mode requests and mode indications received from
SW-Cs or other BSW modules. The mode control part executes mode switching by performing a list of actions that include mode switching operations of other
BSW modules.
As shown in the BswM architecture diagram, the BswM module is located in the system service layer of the AUTOSAR architecture,
mainly serving other basic software modules and the upper-layer RTE.
Mode Arbitration: The mode arbitration part 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 Management: The mode control part executes mode switching by performing a list of actions that include mode switching operations of other BSW modules.
The mode arbitration performed by BswM is simple and rule-based. The rules used for mode arbitration are specified in the configuration of the BSW Mode Manager module. The rules consist of simple boolean expressions, so mode arbitration is expected to have little impact on runtime.
Either Bsw or SW-C notifies BswM to enter mode arbitration, and different Bsw modules can be configured to match the input values of BswM’s notification ports; these input values can be combined into logical expressions according to specific needs; the logical expressions determine the action list executed by BswM, and the action list is a series of operation interfaces of Bsw or RTE modules.
A rule is a logical expression composed of a set of mode request conditions. The rule is evaluated when changes occur in the input mode requests and mode indications, or during the execution of the BswM main function. The evaluation result (True or False) is used to determine whether to execute the corresponding list of mode control operations.
The logical expressions that make up the mode arbitration rules can use different operators (AND, OR, XOR, NOT, and NAND). Each item in the expression corresponds to a mode request condition. If a mode condition references a BswMModeRequestPort, the condition will verify whether the requested or indicated mode is equal or not equal to a certain mode.
If a condition references a BswMEventRequestPort, the condition will verify whether the request port is SET or CLEAR. The BswMEventRequestPort event request differs from a mode request in that the requester does not send a requested mode/value to BswM, so BswM has no mode condition to evaluate. Instead, only the receipt of the event requires evaluation by BswM.
The BswMEventRequestPort will be in the SET state when the requester sends/calls an event. BswM can then place the BswMEventRequestPort in the CLEAR state by executing the BswMEventRequestPort operation. An example with two conditions is shown in Figure :ref:fig_BswM01.
The mode control part of BswM performs all necessary operations based on the results of mode arbitration. This is accomplished using an operation list. The operation list is an ordered list of operations that BswM executes when triggered by mode arbitration.
动作列表中的动作可分为三种类型:
The actions in the action list can be divided into three types:
调用其他 BSW 模块或 RTE;
Calling other BSW modules or RTE;
链接到要包含在执行中的其他动作列表。
Link to other action lists to be included in the execution.
模式仲裁规则。执行相应的动作列表时,将评估这些规则。
Mode arbitration rules. These rules are evaluated when the corresponding action list is executed.
Due to design requirements, each ModeRequestPort needs to be configured, and it is extracted to be configured by category to reduce parameter configuration. Therefore, the configuration is simplified, and it only needs to be configured in BswMModeInitValue.
Because the currently designed value is executed synchronously, it is not suitable for priority processing, and configuring BswMActionListPriority is invalid.
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.
First, it is necessary to clarify what needs to be done. For example, if we want to control a light, we need to know the logical states of the light (on, off), as well as under what conditions it should be turned on and under what conditions it should be turned off. Once we know these conditions, we can form a set of rules. In BswM, the construction of this set of rules is completed through configuration. The basic steps are 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 selection of arbitration conditions and the actions to be executed, including what action to perform when the condition is true and what action to perform when the condition is false.
通过配置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.
Select the comparison type of both sides of the equation by configuring BswMConditionType. (For BSWM_EQUALS and BSWM_EQUALS_NOT, the BswMModeRequestPort referenced by BswMConditionMode is compared for equality or inequality with the value configured in BswMConditionValue. For BSWM_EVENT_IS_SET and BSWM_EVENT_IS_CLEARED, the BswMEventRequestPort referenced by BswMConditionMode is checked to see if it 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 BswMConditionMode is BswMBswModeNotification, BswMSwcModeNotification, or BswMSwcModeRequest, BswMConditionValue is configured as BswMModeDeclaration;
When the BswMModeRequestSource of the BswMModeRequestPort referenced by BswMConditionMode 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 BswMConditionMode is of other types, BswMConditionValue is configured by selecting from the BswModeCompareValue drop-down box under BswMBswMode.
The source of the mode request is selected by configuring BswMRequestSource. The BswMEventRequestPort is shown in Figure BswMEventRequestSource, and the BswMModeRequestPort is shown in Figure ModeRequestSource.
When functions not provided as standard need to be executed, user non-standard code can be executed by configuring BswMUserCallout (only parameterless functions are supported)
多核多分区配置说明(Configuration Instructions for Multi-Core and Multi-Partition)¶
BswM exists in each partition, and each partition has a separate BswMConfig instance. In a multi-partition system, users need to configure multiple BswMConfig instances.
Each BswM instance is isolated from each other, and the configuration information of the BswM instance needs to be passed to other BswM instances through Rte or user-defined global variables.
Configure multiple partitions as shown in the following figure:
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 模式管理器的相应模式请求端口。
As shown in the following figure, how the ports of the application SW-C are connected to the service ports of the BSW Mode Manager. The application mode manager SW-C has a mode request port and a mode switch R port (named modeNotificationPort to distinguish it from the mode switch P port). The first port is used to request a change in its application mode, and the latter is used to receive notifications when the BswM executes a mode change. The mode request port (modeRequest Port0) 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 performed by configuring BswMConfig->BswMArbitration-> BswMModeRequestPort->BswMModeRequestSource-> BswMBswModeNotification . BswMBswModeNotification references the mode declaration group prototype in the description files of other modules.
Notifications of mode switching from SWC are received by configuring BswMConfig->BswMArbitration->BswMModeRequestPort-> BswMModeRequestSource-> BswMSwcModeNotification . BswMSwcModeNotificationModeDeclarationGroupPrototypeRef references the mode declaration group prototype in the extraction file.
To interact with SWC, it is necessary to configure BswMRteSwitch (BswMModeControl->BswMAction->BswMAvailableActions-> BswMRteSwitch ) to perform mode switching.
To interact with basic software, it is necessary to configure BswMSchMSwitch (BswMModeControl->BswMAction-> BswMAvailableActions-> BswMSchMSwitch ) to perform mode switching.