Main Content

Incrementally Update AUTOSAR Mapping After Model Changes

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 model, 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.

  1. Open a mapped AUTOSAR software component model. For this example, create a model named Controller from an ARXML file. The ARXML file is located at matlabroot/examples/autosarblockset/data, 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.

  2. 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 outports.

  3. To configure and map the added inports and outports, call the autosar.api.create function. Use either of these forms.

    autosar.api.create('Controller','incremental');
    autosar.api.create('Controller');

    For more information about function syntax and behavior, see autosar.api.create.

  4. 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.

  5. 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 the model.

See Also

Related Topics