Main Content

updateAUTOSARProperties

Update model with ARXML definitions of AUTOSAR elements

Description

example

updateAUTOSARProperties(ar,modelname) updates the specified open model with AUTOSAR elements in the XML files associated with arxml.importer object ar. The update generates a report that details the AUTOSAR elements added to the model. For updateAUTOSARProperties, the associated XML definition files are not required to contain the AUTOSAR software component mapped by the model. (Compare with updateModel, which requires the component.)

By default, the function imports AUTOSAR elements as read-only definitions, which prevents changes. To allow imported elements to be modified, set the ReadOnly property to false.

For each imported AUTOSAR element, the function also imports the element dependencies. For example, importing CompuMethod elements also imports Unit and PhysicalDimension elements.

If you import AUTOSAR numeric or enumeration data types, you can use the createNumericType and createEnumeration functions to create corresponding Simulink® data type objects.

example

updateAUTOSARProperties(ar,modelname,Name,Value) updates the specified open model with AUTOSAR elements by using a Name,Value argument pair to specify a specific element category, package, or path.

Examples

collapse all

Suppose that you are developing an AUTOSAR software component model into which you want to import predefined SwAddrMethod elements that are shared by multiple product lines and teams. This example shows how to import definitions from the example shared descriptions file SwAddrMethods.arxml into the example model autosar_swc and generate an update report.

The ARXML file is located at matlabroot/examples/autosarblockset/data, 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);
### Updating model autosar_swc
### Saving original model as autosar_swc_backup.slx
### Creating HTML report autosar_swc_update_report.html

This example shows the function call syntax to update a model with two AUTOSAR elements, specified by root paths /ExternalElements/CompuMethods/RpmCm and /AUTOSAR_PlatformTypes/ImplementationDataTypes/uint16.

open_system('mySWC')
ar = arxml.importer('ExternalElements.arxml');
updateAUTOSARProperties(ar,'mySWC','RootPath',{'/ExternalElements/CompuMethods/RpmCm',...
                           '/AUTOSAR_PlatformTypes/ImplementationDataTypes/uint16'});

This example shows the function call syntax to import XML definitions of AUTOSAR software address methods as read/write elements. By default, the function imports AUTOSAR elements as read-only definitions, which prevents changes.

open_system('mySWC')
ar = arxml.importer('SwAddressMethods.arxml');
updateAUTOSARProperties(ar,'mySWC','ReadOnly',false);

This example shows the function call syntax to update a model with AUTOSAR elements from package /AUTOSAR_PlatformTypes/CompuMethods.

open_system('mySWC')
ar = arxml.importer('ExternalElements.arxml');
updateAUTOSARProperties(ar,'mySWC','Package',{'/AUTOSAR_PlatformTypes/CompuMethods'});

This example shows the function call syntax to update a model with AUTOSAR elements of category ImplementationDataType. Importing ImplementationDataType elements also imports dependent elements, such as SwBaseType elements.

open_system('mySWC')
ar = arxml.importer('ExternalElements.arxml');
updateAUTOSARProperties(ar,'mySWC','Category',{'ImplementationDataType'});

Input Arguments

collapse all

AUTOSAR information previously imported from XML files, specified as an arxml.importer object handle.

Name of the open model to be updated with definitions of AUTOSAR elements in the XML files associated with an arxml.importer object.

Example: 'mySWC'

Name-Value Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Category',{'ImplementationDataType'} directs the importer to update a model with AUTOSAR elements of category ImplementationDataType.

One or more AUTOSAR element categories from which to import elements.

Example: 'Category',{'ImplementationDataType'}

Paths to one or more AUTOSAR element packages from which to import elements.

Example: 'Package',{'/AUTOSAR_PlatformTypes/CompuMethods'}

To refine a category or package import, you can specify both a category and a package from which to import elements. For example:

'Category',{'ImplementationDataType'}, ...
'Package',{'/AUTOSAR_PlatformTypes/ImplementationDataTypes'}

Specify whether to treat imported elements as read-only (the default), preventing definition changes, or read/write.

Example: 'ReadOnly',false

Root paths to one or more specific AUTOSAR elements to import.

Example: 'RootPath',{'/ExternalElements/CMs/RpmCm','/AUTOSAR_PlatformTypes/IDTs/uint16'}

Paths to one or more AUTOSAR data type mapping sets associated with application data type elements.

Example: {'/AUTOSAR_PlatformTypes/DataTypeMappingSets/MapSet1'}

Introduced in R2019a