In Simulink®, as an alternative to graphical configuration, you can programmatically configure an AUTOSAR software component. The AUTOSAR property and map functions allow you to get, set, add, and remove the same component properties and mapping information displayed in the AUTOSAR Dictionary and Code Mappings editor views of the AUTOSAR component model.
You can use AUTOSAR property and map functions to programmatically configure the Simulink representation of an AUTOSAR software component. For example:
Use the AUTOSAR property functions to add AUTOSAR elements, find elements, get and set properties of elements, delete elements, and define ARXML packaging of elements.
Use the AUTOSAR map functions to map Simulink model elements to AUTOSAR elements and return AUTOSAR mapping information for model elements.
The AUTOSAR property and map functions also validate syntax and semantics for requested AUTOSAR property and mapping changes.
For a complete list of property and map functions, see the functions listed for Component Development.
For example scripts, see AUTOSAR Property and Map Function Examples.
For information about functions for creating or importing an AUTOSAR software component, see Component Creation.
The following tree view of an AUTOSAR configuration shows the types of AUTOSAR
elements to which you can apply AUTOSAR property and map functions. This view
corresponds with the AUTOSAR Dictionary tree display, but includes elements that
might not be present in every configuration. Names shown in
italics are user-selected.
The following table lists properties that are associated with AUTOSAR elements.
|AUTOSAR Element Class||Properties|
The AUTOSAR property functions typically require you to specify the name and location of an element. The location of an AUTOSAR element within a hierarchy of AUTOSAR packages and objects can be uniquely specified using a fully qualified path. A fully qualified path might include a package hierarchy and the element location within the object hierarchy, for example:
For AUTOSAR property functions other than
addPackageableElement, you can specify a
partially-qualified path that does not include the package hierarchy, for
The following code sets the
IsService property for the
Sender-Receiver Interface located at path
Interface1 in the
this case, specifying the name
Interface1 is enough to locate the
hModel = 'autosar_swc_expfcns'; addpath(fullfile(matlabroot,'/examples/autosarblockset/main')); open_system(hModel); arProps = autosar.api.getAUTOSARProperties(hModel); set(arProps,'Interface1','IsService',true);
Here is the resulting display in the S-R Interfaces view in the AUTOSAR Dictionary.
If you added a Sender-Receiver Interface to a component package, you would specify a fully qualified path, for example:
hModel = 'autosar_swc_expfcns'; addpath(fullfile(matlabroot,'/examples/autosarblockset/main')); open_system(hModel); arProps = autosar.api.getAUTOSARProperties(hModel); addPackageableElement(arProps,'SenderReceiverInterface','/pkg/if','Interface3',... 'IsService',true);
A potential advantage of using a partially qualified path rather than a
fully-qualified path is that it is easier to construct a partially qualified path
from looking at the AUTOSAR Dictionary view of the AUTOSAR component. A potential
disadvantage is that a partially qualified path could refer to more than one element
in the AUTOSAR configuration. For example, the path
conceivably might designate both a data element of a Sender-Receiver Interface and a
runnable of a component. When a conflict occurs, the software displays an error and
lists the fully-qualified paths.
Most AUTOSAR elements have properties that are made up of multiple parts
(composite). For example, an atomic software component has composite properties such
InternalBehavior. For elements that have composite
properties that you can manipulate, such as property
ReceiverPorts of a component, child elements are named and
are uniquely defined within the parent element. To locate a child element within a
composite property, use the parent element path and the child name, without the
property name. For example, if the qualified path of a parent atomic software
/A/B/SWC, and a child receiver port is named
RPort1, the location of the receiver port is