While developing an AUTOSAR software component model, you can use function
autosar.api.create to incrementally configure and map Simulink® elements as you add them to your model. When used with a mapped AUTOSAR
autosar.api.create does not recreate or replace the current
Simulink to AUTOSAR mapping. Instead, the function updates the mapping to reflect
your model changes. The function:
Preserves current model configuration and mapping.
Finds and maps unmapped model elements.
Updates the AUTOSAR Dictionary for deleted model elements.
In this example, you add inports and outports to a mapped AUTOSAR software component
model. Then you use
autosar.api.create to create and map
corresponding AUTOSAR elements with default naming and properties. After the incremental
update, you can edit the default naming and properties as you require.
Open a mapped AUTOSAR software component model. For this example, create a
Controller from an ARXML file. The ARXML file is
which is on the default MATLAB® search path. Use these commands.
ar = arxml.importer('ThrottlePositionControlComposition.arxml'); createComponentAsModel(ar,'/Company/Components/Controller',... 'ModelPeriodicRunnablesAs','AtomicSubsystem');
In the Code Mappings editor, Inports and Outports tabs, here is the initial Simulink to AUTOSAR mapping of Simulink inports and outports in the model.
Add an inport and an outport to subsystem block
Runnable_Step_sts, and a corresponding inport and outport
inside the subsystem. For example, inside the subsystem, add inport
Ctrl_Override_read and outport
ThrCommand_Override_write. At the top level, add inport
Ctrl_Override and outport
ThrCommand_Override. Connect the inports and
To configure and map the added inports and outports, call the
autosar.api.create function. Use either of these
For more information about function syntax and behavior, see
In the Code Mappings editor, Inports and Outports tabs,here is the updated Simulink to AUTOSAR mapping of Simulink inports and outports in the model. Notice that the added inport and outport are each mapped to an AUTOSAR port and data element, which the function created in the AUTOSAR Dictionary. The function also created the S-R interfaces that own each data element.
The function provided default naming and properties for the AUTOSAR ports, S-R
interfaces, and data elements created in the AUTOSAR Dictionary. You can edit
the naming and properties to correspond with peer elements or match your design
requirements. For example, you can rename the created data elements to
Value to match the other S-R interface data elements in