Main Content

Configure AUTOSAR Port Parameters for Communication with Parameter Component

The AUTOSAR standard defines port-based parameters for parameter communication. AUTOSAR parameter communication relies on a parameter software component (ParameterSwComponent) and one or more atomic software components that require port-based access to parameter data. The ParameterSwComponent represents memory containing AUTOSAR parameters and provides parameter data to connected atomic software components. For information about port-based parameter workflows, see Port Parameters.

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. In the Simulink model workspace, create a parameter, mark it as an argument, and set an initial value. You can use Simulink parameter, lookup table, and breakpoint objects.

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

This example shows how to configure an AUTOSAR software component as a receiver for parameter communication.

  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 the Parameter Interfaces view and click the Add button . In the Add Interfaces dialog box, specify the name of the new interface and set Number of Data Elements to 1. Click Add.

  3. Expand Parameter Interfaces and select the DataElements view. Examine and modify the properties of the associated data element that you created, including its name.

  4. Expand AtomicComponents and expand the component. To add a parameter receiver port to the model, go to the ParameterReceiverPorts view and click the Add button . In the Add Ports dialog box, specify the name of the new port and set Interface to the name of the parameter interface that you created. Click Add.

  5. In the Simulink model workspace, create a data object for the parameter. For example, use Model Explorer. With the data object selected, set the Name and Value fields. To configure the parameter as a model argument (that is, unique to each instance of a multi-instance model), select the Argument check box.

    Reference the data object name in the model. For example, enter k1 in the Gain parameter field of a Gain block.

  6. Open the Code Mappings editor and select the Parameters tab. In the Model Parameter Arguments group, select the parameter data object that you created. In the Mapped To menu, select AUTOSAR parameter type PortParameter.

  7. To view and modify other code and calibration attributes for the parameter, click the Icon to configure additional code mappings properties icon.

    1. Set Port to the name of the parameter receiver port that you configured in the AUTOSAR Dictionary.

    2. Set DataElement to the name of the parameter interface data element that you configured in the AUTOSAR Dictionary.

    For more information, see Map Model Workspace Parameters to AUTOSAR Component Parameters.

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

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

      <PARAMETER-INTERFACE UUID="...">
          <SHORT-NAME>myParamInterface</SHORT-NAME>
          <IS-SERVICE>false</IS-SERVICE>
          <PARAMETERS>
              <PARAMETER-DATA-PROTOTYPE UUID="...">
                  <SHORT-NAME>ParamElement</SHORT-NAME>
              ...
              </PARAMETER-DATA-PROTOTYPE>
          </PARAMETERS>
      </PARAMETER-INTERFACE>
    • The generated C code contains AUTOSAR port parameter Rte function 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