Main Content

getState

Get AUTOSAR mapping information for Simulink block state

Description

arValue = getState(slMap,slStateOwnerBlock) returns the type of AUTOSAR variable mapped to the Simulink® block state associated with state owner block slStateOwnerBlock. AUTOSAR variable types include ArTypedPerInstanceMemory and StaticMemory.

example

arValue = getState(slMap,slStateOwnerBlock,slState) returns the type of AUTOSAR variable mapped to Simulink state slState associated with state owner block slStateOwnerBlock. Specify a nonempty slState argument only for blocks with multiple states.

arValue = getState(slMap,slStateOwnerBlock,slState,arProperty) returns the value of property arProperty for the AUTOSAR variable to which the Simulink block state is mapped.

Examples

collapse all

Get AUTOSAR mapping and property information for the Simulink block state for Unit Delay block X in example model autosar_swc_counter. The state owner block has one state.

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

mapState(slMap,'autosar_swc_counter/X','','ArTypedPerInstanceMemory',...
    'SwCalibrationAccess','ReadWrite')
arMappedTo = getState(slMap,'autosar_swc_counter/X')
arValue = getState(slMap,'autosar_swc_counter/X','','SwCalibrationAccess')
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

Handle or path to Simulink state owner block to return AUTOSAR mapping information for.

Example: 'autosar_swc_counter/X'

Name of Simulink state associated with state owner block slStateOwnerBlock. Specify a nonempty state name only for blocks with multiple states. If slState is empty, the function returns mapping information for the first state in the block.

Example: ''

Name of AUTOSAR variable property. Valid property names include ShortName, SwAddrMethod, SwCalibrationAccess, DisplayFormat, and LongName. For StaticMemory, you can also specify C type qualifier properties IsVolatile or Qualifier (AUTOSAR additional native type qualifier). For property descriptions, see mapState.

Example: 'SwCalibrationAccess'

Output Arguments

collapse all

Variable that returns either the type of the mapped AUTOSAR variable or the value of a variable property.

Example: arValue

Version History

Introduced in R2018b