Main Content

mapSignal

Map Simulink block signal to AUTOSAR variable

Description

mapSignal(slMap,slPortHandle,arVarType) maps the named or test-pointed Simulink® block signal associated with outport port handle slPortHandle to an AUTOSAR variable of type arVarType for AUTOSAR run-time calibration. AUTOSAR variable types include ArTypedPerInstanceMemory and StaticMemory.

example

mapSignal(slMap,slPortHandle,arVarType,Name,Value) specifies additional properties for an AUTOSAR ArTypedPerInstanceMemory or StaticMemory variable by using one or more Name,Value pair arguments.

Examples

collapse all

Set AUTOSAR mapping and property information for the Simulink block signals for blocks RelOpt and Sum in example model autosar_swc_counter.

hModel = 'autosar_swc_counter';
openExample(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);

portHandles = get_param('autosar_swc_counter/RelOpt','portHandles');
outportHandle = portHandles.Outport;
mapSignal(slMap,outportHandle,'StaticMemory')
arMappedTo = getSignal(slMap,outportHandle)
arValue = getSignal(slMap,outportHandle,'SwCalibrationAccess')

portHandles = get_param('autosar_swc_counter/Sum','portHandles');
outportHandle = portHandles.Outport;
mapSignal(slMap,outportHandle,'ArTypedPerInstanceMemory',...
    'SwCalibrationAccess','ReadWrite')
arMappedTo = getSignal(slMap,outportHandle)
arValue = getSignal(slMap,outportHandle,'SwCalibrationAccess')
arMappedTo =
    'StaticMemory'

arValue =
    'ReadOnly'

arMappedTo =
    'ArTypedPerInstanceMemory'

arValue =
    'ReadWrite'

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

Outport port handle for a named or test-pointed Simulink block signal to set AUTOSAR mapping information for. Use MATLAB® commands to construct the outport port handle. For example, for a Relational Operator block named RelOpt:

portHandles = get_param('autosar_swc_counter/RelOpt','portHandles');
outportHandle = portHandles.Outport;

Example: outportHandle

Type of AUTOSAR variable to map the specified Simulink block signal to. Valid AUTOSAR variable types include ArTypedPerInstanceMemory, StaticMemory, and Auto. To accept software mapping defaults, specify Auto.

Example: 'StaticMemory'

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','ReadWrite' specifies read-write access to the variable for run-time calibration.

Specify display format for the AUTOSAR variable. 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 volatile in generated code for the AUTOSAR variable.

Example: 'IsVolatile','true'

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

Example: 'Qualifier','test_qualifier'

Specify a short name for the AUTOSAR variable. If unspecified, ARXML export generates a short name, which can differ from the signal name.

Example: 'ShortName','SM_equal_to_count'

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

Example: 'SwAddrMethod','VAR'

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

Example: 'SwCalibrationAccess','ReadWrite'

Specify a headline for the AUTOSAR variable.

Example: 'LongName','Position of Engine Throttle'

Version History

Introduced in R2018b