Main Content

addSignal

Add Simulink block signal to AUTOSAR mapping

Since R2020b

Description

addSignal(slMap,slPortHandle) adds the Simulink® block signal associated with outport port handle slPortHandle to AUTOSAR mapping. The signal then can be mapped to an AUTOSAR variable, for example, by using the mapSignal function.

example

Examples

collapse all

In example model autosar_swc_counter:

  1. Create a new default AUTOSAR mapping.

  2. Add Simulink signal equal_to_count, which originates in the RelOpt block, to the AUTOSAR component signal mapping.

  3. Map the signal to AUTOSAR static memory and set ReadWrite calibration access.

hModel = 'autosar_swc_counter';
openExample(hModel);
autosar.api.create(hModel,'default'); % Create default AUTOSAR mapping
slMap = autosar.api.getSimulinkMapping(hModel);

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

mapSignal(slMap,outportHandle,'StaticMemory',...
  'SwCalibrationAccess','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 Simulink block signal to add to AUTOSAR mapping. 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

Version History

Introduced in R2020b