You can model AUTOSAR shared parameters (SharedParameter
s) and
per-instance parameters (PerInstanceParameter
s) 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 SharedParameter
s and
PerInstanceParameter
s for measurement and calibration.
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
Configure Model Workspace Parameters as AUTOSAR Per-Instance Parameters
To model AUTOSAR shared parameters in Simulink:
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
.
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
.
In the AUTOSAR code perspective, open the Code Mappings editor and select
the Parameters tab. In the list of available
parameters, select K
. Selecting a parameter displays the
parameter attributes in the Property Inspector. Use the Property Inspector
to modify the parameter attributes. In the Mapped To
drop-down list, select parameter type
SharedParameter
. 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();
To model AUTOSAR per-instance parameters in Simulink:
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
.
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
.
In the AUTOSAR code perspective, open the Code Mappings editor and select
the Parameters tab. Select parameter
TPSPercent_LkupTbl
. Selecting a parameter displays
the parameter attributes in the Property Inspector. Use the Property
Inspector to modify the parameter attributes. In the Mapped
To drop-down list, select parameter type
PerInstanceParameter
. For more information
about parameter code and calibration attributes, see Map Model Workspace 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));