Main Content

Configure AUTOSAR Shared or Per-Instance Parameters

You can model AUTOSAR shared parameters (SharedParameters) and per-instance parameters (PerInstanceParameters) for use in AUTOSAR software components that potentially are instantiated multiple times. Shared parameter values are shared among all instances of a component. Per-instance parameter values are unique and private to each component instance. In the AUTOSAR run-time environment, calibration tools can access SharedParameters and PerInstanceParameters for calibration and measurement.

To model AUTOSAR shared or per-instance parameters, import parameter definitions from ARXML files or create parameter content in Simulink®. For information about the high-level shared and per-instance parameters workflow, see Shared and Per-Instance Parameters.

To model AUTOSAR parameters in Simulink, you use model workspace parameters.

Configure Model Workspace Parameters as AUTOSAR Shared Parameters

To model AUTOSAR shared parameters in Simulink:

  1. Open an AUTOSAR model that contains a model workspace parameter for which you want to generate an AUTOSAR SharedParameter. This example uses model autosar_swc_counter.

  2. To model an AUTOSAR shared parameter in Simulink, configure a model workspace parameter that is not a model argument (that is, not unique to each instance of a multi-instance model). For example, in the Model Explorer view of the parameter, clear the Argument property. In example model autosar_swc_counter, clear the Argument property for parameter K. Leave the parameter StorageClass set to Auto.

  3. In the AUTOSAR Code perspective, open the Code Mappings editor and select the Parameters tab. In the list of available parameters, select K. In the Mapped To drop-down list, select parameter type SharedParameter. To view and modify AUTOSAR attributes for the shared parameter, click the Icon to configure additional code mappings properties icon. For more information about parameter code and calibration attributes, see Map Model Workspace Parameters to AUTOSAR Component Parameters.

When you generate code:

  • Exported ARXML files contain SHARED-PARAMETERS descriptions for parameters that you configured as SharedParameter.

  • Generated C code contains Rte_CData calls where shared parameters are used.

    autosar_swc_counter_B.Gain = Rte_CData_K() *
      Rte_IRead_Runnable_Step_RPort_InData();

Configure Model Workspace Parameters as AUTOSAR Per-Instance Parameters

To model AUTOSAR per-instance parameters in Simulink:

  1. Open an AUTOSAR model that contains a model workspace parameter for which you want to generate an AUTOSAR PerInstanceParameter. This example uses model autosar_swc_throttle_sensor. This model is part of AUTOSAR composition model autosar_composition, which contains two instances of autosar_swc_throttle_sensor.

  2. To model an AUTOSAR per-instance parameter in Simulink, configure a model workspace parameter that is a model argument (that is, unique to each instance of a multi-instance model). For example, in the Model Explorer view of the parameter, select the Argument property. In example model autosar_swc_throttle_sensor, select the Argument property for parameter TPSPercent_LkupTbl. Leave the parameter StorageClass set to Auto.

  3. In the AUTOSAR Code perspective, open the Code Mappings editor and select the Parameters tab. Select parameter TPSPercent_LkupTbl. In the Mapped To drop-down list, select parameter type PerInstanceParameter. To view and modify AUTOSAR attributes for the per-instance parameter, click the Icon to configure additional code mappings properties icon. For more information about parameter code and calibration attributes, see Map Model Workspace Parameters to AUTOSAR Component Parameters. If you are mapping parameters in a submodel referenced by a component, see Map Submodel Parameters to AUTOSAR Component Parameters.

AUTOSAR example model autosar_composition is a composition model that contains several components, including two instances of component model autosar_swc_throttle_sensor.

If you open autosar_composition, you can right-click the Model blocks that represent instances of autosar_swc_throttle_sensor. If you open up each Model block dialog box, Instance Parameters tab, and view them together, notice that each Model block uses a different value for the per-instance parameter.

When you generate code:

  • Exported ARXML files contain PER-INSTANCE-PARAMETERS descriptions for parameters that you configured as PerInstanceParameter.

  • Generated C code contains Rte_CData calls where per-instance parameters are used.

    Rte_IWrite_Runnable_Step_TPS_Percent_Value(self, look1_iflf_linlcpw((float32)
      rtb_DataTypeConversion, (Rte_CData_TPSPercent_LkupTbl(self))->BP1,
      (Rte_CData_TPSPercent_LkupTbl(self))->Table, 10U));

See Also

|

Related Examples

More About