Main Content

mapParameter

Map Simulink model workspace parameter to AUTOSAR component parameter

Description

example

mapParameter(slMap,slParameter,arParamType) maps the Simulink® model workspace parameter slParameter to an AUTOSAR parameter of type arParamType for AUTOSAR run-time calibration. AUTOSAR parameter types include SharedParameter, PerInstanceParameter, ConstantMemory, and PortParameter.

mapParameter(slMap,slParameter,arParamType,Name,Value) specifies additional properties for an AUTOSAR SharedParameter, PerInstanceParameter, ConstantMemory, or PortParameter by using one or more Name,Value pair arguments.

Examples

collapse all

Set AUTOSAR mapping and property information for Simulink model workspace parameters K and INC in example model autosar_swc_counter.

hModel = 'autosar_swc_counter';
addpath(fullfile(matlabroot,'/examples/autosarblockset/main'));
open_system(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);

mapParameter(slMap,'K','SharedParameter')
arMappedTo = getParameter(slMap,'K')
arValue = getParameter(slMap,'K','SwCalibrationAccess')

mapParameter(slMap,'INC','ConstantMemory','SwCalibrationAccess','ReadOnly')
arMappedTo = getParameter(slMap,'INC')
arValue = getParameter(slMap,'INC','SwCalibrationAccess')
arMappedTo =
    'SharedParameter'

arValue =
    'ReadWrite'

arMappedTo =
    'ConstantMemory'

arValue =
    'ReadOnly'

Input Arguments

collapse all

Simulink to AUTOSAR mapping information for a model, previously returned by slMap = autosar.api.getSimulinkMapping(model). model is a handle, character vector, or string scalar representing the model name.

Example: slMap

Name of the Simulink model workspace parameter for which to set AUTOSAR mapping information.

Example: 'INC'

Type of AUTOSAR component parameter to which to map the specified Simulink model workspace parameter. Valid AUTOSAR parameter types include SharedParameter, PerInstanceParameter, ConstantMemory, PortParameter, and Auto. To accept software mapping defaults, specify Auto.

Example: 'SharedParameter'

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'SwCalibrationAccess','ReadOnly' specifies read-only access to the parameter for run-time calibration.

Specify the name of a parameter interface data element configured in the AUTOSAR Dictionary.

Example: 'DataElement','ParamElement1'

Specify display format for the AUTOSAR parameter. AUTOSAR display format specifications control the width and precision display for calibration and measurement data. For more information, see Configure DisplayFormat.

Example: 'DisplayFormat','%2.6f'

Specify whether to include C type qualifier const in generated code for the AUTOSAR parameter.

Example: 'IsConst','true'

Specify whether to include C type qualifier volatile in generated code for the AUTOSAR parameter.

Example: 'IsVolatile','true'

Specify the name of a parameter receiver port configured in the AUTOSAR Dictionary.

Example: 'Port','myParamPort'

Optionally specify an AUTOSAR additional native type qualifier to include in generated code for the AUTOSAR parameter.

Example: 'Qualifier','test_qualifier'

Specify a SwAddrMethod name that is valid for the AUTOSAR parameter. Code generation uses the SwAddrMethod name to group AUTOSAR parameters in a memory section for access by calibration and measurement tools. For a list of valid SwAddrMethod values for the parameter, see the Code Mappings editor, Parameters tab. For more information, see Configure SwAddrMethod.

Example: 'SwAddrMethod','CONST'

Specify how calibration and measurement tools can access the AUTOSAR parameter. Valid access values include ReadOnly, ReadWrite, and NotAccessible. For more information, see Configure SwCalibrationAccess.

Example: 'SwCalibrationAccess','ReadOnly'

Version History

Introduced in R2018b