When developing an AUTOSAR software component in Simulink®, you can import AUTOSAR packages containing ARXML element definitions that are common to many components. For example, multiple product lines and teams might share elements such as interfaces and SwAddrMethods. Benefits of sharing AUTOSAR element definitions include lower risk of definition conflicts and easier code integration.
After you create an AUTOSAR component model, you can import shared definitions from ARXML files that are dedicated to describing AUTOSAR elements, not components. By default, the imported definitions are read-only, which prevents changes, but you can also import them as read/write. You can then reference the imported elements in your component model.
When you import an element definition, its dependencies are also imported. For example,
CompuMethod definition also imports
PhysicalDimension definitions. Importing an
ImplementationDataType also imports a
When you build the model, exported ARXML code contains references to the shared elements. Their definitions remain in the element description ARXML files from which you imported them. The element description files are exported with their names, file structure, and content preserved.
To set up and reuse AUTOSAR element definitions:
Create one or more ARXML files containing definitions of AUTOSAR elements for components to share. Elements that are supported for reference use in Simulink include:
For each component model that shares a set of definitions, use the
updateAUTOSARProperties to add the element definitions to the model. This
example shows how to import definitions from the example shared descriptions file
SwAddrMethods.arxml into the example model
The ARXML file is located at
which is on the default MATLAB® search path.
addpath(fullfile(matlabroot,'/examples/autosarblockset/main')); % Add path to model modelName = 'autosar_swc'; open_system(modelName); ar = arxml.importer('SwAddrMethods.arxml'); updateAUTOSARProperties(ar,modelName);
Optionally, using property-value pairs, you can specify subsets of elements to import.
For more information, see
The importer generates an HTML report that details the updates applied to the model.
Your model can reference the imported elements in various ways. For example, you can
SwAddrMethod values for AUTOSAR data to group the data
for measurement and calibration. See the example Import AUTOSAR Package into Component Model.
Generate model code. The exported ARXML code contains references to the imported elements. The element description files from which you imported definitions are exported with their names, file structure, and content preserved.