主要内容

Configure AUTOSAR Port Parameters for Communication with Parameter Component

Autosar标准定义了用于参数通信的基于端口的参数。AutoSar参数通信依赖参数软件组件(ParameterSwComponent)和一个或多个需要基于端口的参数数据访问的原子软件组件。这ParameterSwComponentrepresents memory containing AUTOSAR parameters and provides parameter data to connected atomic software components. For information about port-based parameter workflows, see端口参数.

In Simulink®, you can model the receiver side of AUTOSAR port-based parameter communication. To configure an AUTOSAR atomic software component as a parameter receiver:

  1. In an AUTOSAR component model, in the AUTOSAR Dictionary, create an AUTOSAR parameter interface, parameter data elements, and a parameter receiver port.

  2. 在Simuli万博1manbetxnk模型工作区中,创建一个参数,将其标记为参数,并设置一个初始值。您可以使用Simulin万博1manbetxk参数,查找表和断点对象。

  3. Map the Simulink model workspace parameter or lookup table to an AUTOSAR parameter receiver port and parameter interface data element. Use theParameterstab of the Code Mappings editor or themapParameterfunction.

此示例显示了如何将AutoSar软件组件配置为参数通信的接收器。

  1. Open a model configured for AUTOSAR code generation in which the software component requires port-based access to parameter data.

  2. Open the AUTOSAR Dictionary. To add a parameter interface to the model, select theParameter Interfaces查看并单击Addbutton. In the Add Interfaces dialog box, specify the name of the new interface and setNumber of Data Elementsto 1. ClickAdd.

  3. ExpandParameter Interfaces并选择数据元素sview. Examine and modify the properties of the associated data element that you created, including its name.

  4. ExpandAtomicComponents和expand the component. To add a parameter receiver port to the model, go to theParameterReceiverPorts查看并单击Addbutton. In the Add Ports dialog box, specify the name of the new port and setInterfaceto the name of the parameter interface that you created. ClickAdd.

  5. 在Simuli万博1manbetxnk模型工作区中,为参数创建一个数据对象。例如,使用Model Explorer。选择数据对象,设置Name价值fields. To configure the parameter as a model argument (that is, unique to each instance of a multi-instance model), select the争论check box.

    Reference the data object name in the model. For example, enterk1在里面获得参数字段获得block.

  6. 打开代码映射编辑器,然后选择Parameterstab. In theModel Parameter Arguments组,选择您创建的参数数据对象。在里面映射到menu, select AUTOSAR parameter typePortParameter.

  7. 要查看和修改参数的其他代码和校准属性,请单击配置其他代码映射属性的图标icon.

    1. SetPort您在AutoSar字典中配置的参数接收器端口的名称。

    2. Set数据元素to the name of the parameter interface data element that you configured in the AUTOSAR Dictionary.

    For more information, seeMap Model Workspace Parameters to AUTOSAR Component Parameters.

  8. When you generate code for the AUTOSAR component model:

    • 这exported ARXML files contain descriptions of the parameter receiver component, parameter interface, parameter data element, and parameter receiver port.

       myParamInterface false   ParamElement ...   
    • 这generated C code contains AUTOSAR port parameterRtefunction calls.

      /* Model step function */ void mArPortParam_Step(void) { ... Rte_IWrite_mArPortParam_Step_Out2_Out2(Rte_Prm_myParamPort_ParamElement() * Rte_IRead_mArPortParam_Step_In2_In2()); }

    At run time, the software can access the parameter data element as a port-based parameter.

See Also

|

Related Examples

More About