Autosar Ref
Autosar Ref
Autosar Ref
Reference
R2023b
How to Contact MathWorks
Phone: 508-647-7000
Functions
1
Blocks
2
Apps
3
Tools
4
iii
1
Functions
1 Functions
add
Package: autosar.api
Syntax
add(arProps,parentPath,property,name)
add(arProps,parentPath,property,name,childproperty,value)
Description
add(arProps,parentPath,property,name) adds a composite child element with the specified
name to the AUTOSAR element at parentPath, under the specified property.
Examples
Using a fully qualified path, add a mode-switch interface and set the IsService property to true.
Add mode group mgModes to the mode-switch interface using the composite property ModeGroup.
hModel = 'mAutosarMsConfigAfter';
open_system(hModel);
arProps=autosar.api.getAUTOSARProperties(hModel);
addPackageableElement(arProps,'ModeSwitchInterface','/pkg/if','Interface3',...
'IsService',true);
ifPaths = find(arProps,[],'ModeSwitchInterface','PathType','FullyQualified')
1-2
add
add(arProps,'/pkg/if/Interface3','ModeGroup','mgModes');
get(arProps,'Interface3','ModeGroup')
ans =
'Interface3/mgModes'
Input Arguments
arProps — AUTOSAR properties information for a model
handle
Path to a parent AUTOSAR element to which to add a specified child property element.
Example: 'Input'
Type of property to add, among valid properties for the AUTOSAR element.
Example: 'DataElements'
Child property to set, and its value. Table “Properties of AUTOSAR Elements” lists properties that are
associated with AUTOSAR elements.
Example: 'Name','event1'
Version History
Introduced in R2013b
See Also
autosar.api.getAUTOSARProperties | delete
Topics
“AUTOSAR Property and Map Function Examples”
1-3
1 Functions
1-4
addBSWService
addBSWService
Package: autosar.arch
Syntax
bswBlock = addBSWService(archCM,bswKind)
Description
bswBlock = addBSWService(archCM,bswKind) adds a Basic Software (BSW) service component
block of type bswKind to a classic composition or architecture model archCM. Valid values for
bswKind are 'dem' for Diagnostic Event Manager and 'nvm' for NVRAM Manager (not case-
sensitive). The archCM argument is a composition or architecture model handle returned by a
previous call to addComposition, autosar.arch.createModel, or autosar.arch.loadModel.
The bswBlock output argument returns a block handle.
Examples
Add BSW Service Component Blocks to AUTOSAR Classic Architecture Model Top Level
Add NVRAM Service Component and Diagnostic Service Component blocks to the top level of an
AUTOSAR architecture model.
% Create AUTOSAR classic architecture model
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
Input Arguments
archCM — Classic composition or architecture model
handle
AUTOSAR composition or architecture model to which to add a BSW component. The argument is a
classic composition or architecture model handle returned by a previous call to addComposition,
autosar.arch.createModel, or autosar.arch.loadModel.
Example: archModel
1-5
1 Functions
Type of AUTOSAR BSW service component block to add to the specified classic composition or
architecture model. Valid values are 'dem' for Diagnostic Event Manager and 'nvm' for NVRAM
Manager (not case-sensitive).
Example: 'dem'
Output Arguments
bswBlock — BSW block
handle
Version History
Introduced in R2020a
See Also
Diagnostic Service Component | NVRAM Service Component | layout
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Configure AUTOSAR Scheduling and Simulation”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-6
addComponent
addComponent
Package: autosar.arch
Syntax
components = addComponent(archCM,compNames)
components = addComponent(archCM,compNames,'Kind',value)
Description
components = addComponent(archCM,compNames) adds one or more components specified in
the compNames argument to composition or architecture model archCM.
The archCM argument is a composition or architecture model handle returned by a previous call to
addComposition, autosar.arch.createModel, or autosar.arch.loadModel. The
components output argument returns one or more component handles, which are
autosar.arch.Component objects.
Examples
1 Add a composition named Sensors and, inside the composition, add AUTOSAR sensor-actuator
components named PedalSnsr and ThrottleSnsr.
2 At the top level of the model, add an application component named Controller1 and a sensor-
actuator component named Actuator.
% Create AUTOSAR classic architecture model
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
% Add a composition
composition = addComposition(archModel,'Sensors');
1-7
1 Functions
1 Add a composition named Sensors and, inside the composition, add two sensor adaptive
application components named Sensor1 and Sensor2.
2 At the top level of the model, add an adaptive application component named Filter.
% Create AUTOSAR adaptive architecture model
modelName = 'myArchAdaptive';
archModel = autosar.arch.createModel(modelName,'platform','Adaptive');
% Add a composition
composition = addComposition(archModel,'Sensors');
Input Arguments
archCM — Composition or architecture model
handle
AUTOSAR composition or architecture model to which to add one or more components. The argument
is a composition or architecture model handle returned by a previous call to addComposition,
autosar.arch.createModel, or autosar.arch.loadModel.
Example: archModel
Type of AUTOSAR components to add to the specified composition or architecture model. The
specified type applies to all added components.
1-8
addComponent
Valid classic component types are Application (the default for classic modeling),
SensorActuator, ComplexDeviceDriver, EcuAbstraction, and ServiceProxy. The valid
adaptive component type is AdaptiveApplication (the default for adaptive modeling).
Example: 'Kind','SensorActuator'
Output Arguments
components — Added components
handle | array of handles
Returns one or more AUTOSAR component handles, which are autosar.arch.Component objects,
with component properties.
Version History
Introduced in R2020a
R2023a introduces AUTOSAR architecture modeling for the Adaptive Platform and
AdaptiveApplication components for modeling adaptive architectures.
See Also
Classic Component | Adaptive Component | addComposition | addPort | connect | destroy |
importFromARXML | layout
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Add and Connect AUTOSAR Classic Components and Compositions”
“Add and Connect AUTOSAR Adaptive Components and Compositions”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-9
1 Functions
addComposition
Package: autosar.arch
Syntax
compositions = addComposition(archCM,compNames)
Description
compositions = addComposition(archCM,compNames) adds one or more compositions
specified in the compNames argument to composition or architecture model archCM.
The archCM argument is a composition or architecture model handle returned by a previous call to
addComposition, autosar.arch.createModel, or autosar.arch.loadModel. The
compositions output argument returns one or more composition handles, which are
autosar.arch.Composition objects.
Examples
In an AUTOSAR classic architecture model, add a composition named Sensors. Inside the
composition, add AUTOSAR sensor-actuator components named PedalSnsr and ThrottleSnsr.
% Create AUTOSAR architecture model
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
% Add a composition
composition = addComposition(archModel,'Sensors');
In an AUTOSAR adaptive architecture model, add a composition named Sensors. Inside the
composition, add two AUTOSAR adaptive application components named Sensor1 and Sensor2.
% Create AUTOSAR adaptive architecture model
modelName = 'myArchAdaptive';
archModel = autosar.arch.createModel(modelName,'platform','Adaptive');
1-10
addComposition
% Add a composition
composition = addComposition(archModel,'Sensors');
Input Arguments
archCM — Composition or architecture model
handle
AUTOSAR composition or architecture model to which to add one or more compositions. The
argument is a composition or architecture model handle returned by a previous call to
addComposition, autosar.arch.createModel, or autosar.arch.loadModel.
Example: archModel
Output Arguments
compositions — Added compositions
handle | array of handles
Version History
Introduced in R2020a
R2023a introduces AUTOSAR architecture modeling for the Adaptive Platform and
AdaptiveApplication components for modeling adaptive architectures.
See Also
Software Composition | addComponent | addPort | connect | destroy | importFromARXML |
layout
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Add and Connect AUTOSAR Classic Components and Compositions”
1-11
1 Functions
1-12
addPackageableElement
addPackageableElement
Package: autosar.api
Syntax
addPackageableElement(arProps,category,package,name)
addPackageableElement(arProps,category,package,name,property,value)
Description
addPackageableElement(arProps,category,package,name) adds element name of the
specified category to the specified AUTOSAR package in a model configured for AUTOSAR.
Examples
Using a fully qualified path, add a sender-receiver interface to an interface package and set the
IsService property to true.
hModel = 'autosar_swc_expfcns';
openExample(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
addPackageableElement(arProps,'SenderReceiverInterface','/pkg/if','Interface3',...
'IsService',true);
ifPaths = find(arProps,[],'SenderReceiverInterface',...
'IsService',true,'PathType','FullyQualified')
ifPaths =
1×1 cell array
{'/pkg/if/Interface3'}
Input Arguments
arProps — AUTOSAR properties information for a model
handle
1-13
1 Functions
Property/value pairs for setting values of element properties. Table “Properties of AUTOSAR
Elements” lists properties that are associated with AUTOSAR elements.
Example: 'IsService',true
Version History
Introduced in R2014b
See Also
autosar.api.getAUTOSARProperties | delete
Topics
“AUTOSAR Property and Map Function Examples”
“Configure and Map AUTOSAR Component Programmatically”
“AUTOSAR Component Configuration”
1-14
addPort
addPort
Package: autosar.arch
Syntax
ports = addPort(archCCM,portKind,portNames)
Description
ports = addPort(archCCM,portKind,portNames) adds one or more ports of type portKind to
component, composition, or architecture model archCCM.
For classic architectures, valid values for portKind are 'Receiver' and 'Sender'. For adaptive
architectures, valid values for portKind are 'Receiver', 'Sender', 'Client', and 'Server'.
The portNames argument specifies the names of one or more ports to add.
Examples
% Add a composition
composition = addComposition(archModel,'Sensors');
1-15
1 Functions
addComponent(archModel,'Controller1');
actuator = addComponent(archModel,'Actuator');
set(actuator,'Kind','SensorActuator');
% Add a composition
composition = addComposition(archModel,'Sensors');
1-16
addPort
filter = find(archModel,'Component','Name','Filter');
addPort(filter,'Server','Filter_CSPort');
layout(archModel); % Auto-arrange layout
Mixing classic and adaptive components in the same architecture model is not supported.
Input Arguments
archCCM — Component, composition, or architecture model
handle
AUTOSAR component, composition, or architecture model to which to add one or more ports. The
argument is a component, composition, or architecture model handle returned by a previous call to
addComponent, addComposition, autosar.arch.createModel, or autosar.arch.loadModel.
Example: archModel
Type of AUTOSAR ports to add to the specified component, composition, or architecture model. The
specified type applies to all added ports.
For classic architectures, valid values for portKind are 'Receiver' and 'Sender'.
For adaptive architectures, valid values for portKind are 'Receiver', 'Sender', 'Client', and
'Server'.
Example: 'Receiver'
Names of the ports to add to the specified component, composition, or architecture model.
Example: {'TPS_Hw','APP_Hw'}
Output Arguments
ports — Added ports
handle | array of handles
Version History
Introduced in R2020a
R2023a: Client and Server ports for modeling method communication in AUTOSAR Adaptive
Architectures
R2023a introduces AUTOSAR architecture modeling for the Adaptive Platform. Client and Server
ports are added to the available portKind ports and supported for modeling method communication
in an AUTOSAR adaptive architecture.
1-17
1 Functions
See Also
addComponent | addComposition | connect | destroy | importFromARXML | layout
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Add and Connect AUTOSAR Classic Components and Compositions”
“Add and Connect AUTOSAR Adaptive Components and Compositions”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-18
addSignal
addSignal
Package: autosar.api
Syntax
addSignal(slMap,slPortHandle)
Description
addSignal(slMap,slPortHandle) adds the Simulink® block signal associated with outport port
handle slPortHandle to AUTOSAR mapping. The signal then can be mapped to an AUTOSAR
variable, for example, by using the mapSignal function.
Examples
portHandles = get_param('autosar_swc_counter/RelOpt','portHandles');
outportHandle = portHandles.Outport;
addSignal(slMap,outportHandle)
mapSignal(slMap,outportHandle,'StaticMemory',...
'SwCalibrationAccess','ReadWrite');
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-19
1 Functions
Outport port handle for a Simulink block signal to add to AUTOSAR mapping. Use MATLAB®
commands to construct the outport port handle. For example, for a Relational Operator block named
RelOpt:
portHandles = get_param('autosar_swc_counter/RelOpt','portHandles');
outportHandle = portHandles.Outport;
Example: outportHandle
Version History
Introduced in R2020b
See Also
autosar.api.getSimulinkMapping | getSignal | mapSignal | removeSignal
Topics
“Map Block Signals and States to AUTOSAR Variables”
“Map Submodel Signals and States to AUTOSAR Variables”
“Configure AUTOSAR Per-Instance Memory”
“Configure AUTOSAR Static Memory”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-20
arxml.importer
arxml.importer
Import AUTOSAR XML descriptions of software components, compositions, or packages
Description
Use arxml.importer functions to import AUTOSAR software components, compositions, or
packages of shared elements from ARXML files into Simulink. For example, you can parse an
AUTOSAR software component description XML file exported by an AUTOSAR authoring tool, and
then import the component into a Simulink model. After importing the component, you can use the
Simulink representation of the component for further configuration, algorithm development, C/C++
code generation, and ARXML export.
For a list of schema versions supported for ARXML import and export, see “Select AUTOSAR Classic
Schema” or “Select AUTOSAR Adaptive Schema”.
Creation
Syntax
ar = arxml.importer(filename)
ar = arxml.importer({filename1,filename2,...,filenameN})
Description
Tip If you enter the arxml.importer function call without a terminating semicolon (;), the importer
lists the AUTOSAR content of the specified XML file or files. The information includes paths to
software components in the AUTOSAR package structure, which you can specify in calls to
createComponentAsModel and createCompositionAsModel.
Input Arguments
1-21
1 Functions
Object Functions
createComponentAsModel Create Simulink representation of AUTOSAR ARXML atomic software
component
createCompositionAsModel Create Simulink representation of AUTOSAR ARXML software
composition
getComponentNames Get AUTOSAR software component names from ARXML files
updateAUTOSARProperties Update model with ARXML definitions from AUTOSAR element
packages
updateModel Update AUTOSAR model with ARXML changes
Examples
Call the arxml.importer function to create object ar, which represents the AUTOSAR information
in XML file mySWC.arxml. Use the returned object to import AUTOSAR software
component /pkg/swc and create an initial Simulink representation of the component.
ar = arxml.importer('mySWC.arxml')
createComponentAsModel(ar,'/pkg/swc','ModelPeriodicRunnablesAs','AtomicSubsystem')
Call the arxml.importer function to create object ar, which represents the AUTOSAR information
in XML files mySWC.arxml, DataTypes.arxml, and MiscDefs.arxml. Use the returned object to
import AUTOSAR software component /pkg/swc and create an initial Simulink representation of the
component.
ar = arxml.importer({'mySWC.arxml','DataTypes.arxml','MiscDefs.arxml'})
createComponentAsModel(ar,'/pkg/swc','ModelPeriodicRunnablesAs','AtomicSubsystem')
Version History
Introduced in R2008a
See Also
Topics
“Import AUTOSAR XML Descriptions Into Simulink”
“Import AUTOSAR Component to Simulink”
“Import AUTOSAR Composition to Simulink”
“Import AUTOSAR Software Component Updates”
“Import and Reference Shared AUTOSAR Element Definitions”
“Import AUTOSAR Package into Component Model”
“Import AUTOSAR Adaptive Software Descriptions”
“Import AUTOSAR Adaptive Components to Simulink”
1-22
arxml.importer
1-23
1 Functions
autosar.api.create
Create or update mapped AUTOSAR component model
Syntax
autosar.api.create(model)
autosar.api.create(model,mode)
autosar.api.create(model,mode,Name,Value)
Description
autosar.api.create(model) creates or updates mapped AUTOSAR software component model
model. The default function behavior depends on the mapping state of the model.
• If the model is not mapped to an AUTOSAR software component, the function creates a Simulink
to AUTOSAR mapping in default mode. In this mapping, Simulink inports and outports are
mapped to AUTOSAR ports with default AUTOSAR properties.
• If the model is already mapped to an AUTOSAR software component, the function updates the
existing mapping in incremental mode. The function finds and maps unmapped model elements,
and updates the AUTOSAR Dictionary for deleted model elements.
Examples
Create AUTOSAR properties and Simulink to AUTOSAR mapping for an Embedded Coder® model in
which the model configuration parameter System target file has been changed from ert.tlc to
autosar.tlc or autosar_adaptive.tlc. Map model inports and outports to AUTOSAR ports with
default AUTOSAR properties.
openExample('CounterModel');
set_param('CounterModel','SystemTargetFile','autosar.tlc');
autosar.api.create('CounterModel');
For a mapped AUTOSAR software component model, update the mapping to account for incremental
model changes. Find and map unmapped model elements and update the AUTOSAR Dictionary for
deleted model elements.
1-24
autosar.api.create
open_system('my_autosar_swc');
autosar.api.create('my_autosar_swc','incremental');
Create AUTOSAR properties and Simulink to AUTOSAR mapping for a submodel referenced from an
AUTOSAR component model.
openExample('autosar_subcomponent');
autosar.api.create('autosar_subcomponent','default','ReferencedFromComponentModel',true);
Input Arguments
model — Model for which to create or update AUTOSAR properties and mapping
handle | character vector | string scalar
Model for which to create or update AUTOSAR properties and Simulink to AUTOSAR mapping,
specified as a handle, character vector, or string scalar representing the model name.
Example: 'my_model'
The default mode value depends on the mapping state of the model — default for an unmapped
model or incremental for a mapped model.
Specify default to create AUTOSAR properties and Simulink to AUTOSAR mapping for a model. As
part of the mapping, the function maps model inports and outports to AUTOSAR ports with default
AUTOSAR properties. If the model is already mapped, the function overwrites the existing mapping.
Specify init to create AUTOSAR properties and Simulink to AUTOSAR mapping for a model. As part
of the mapping, the function does not map model inports and outports. If the model is already
mapped, the function overwrites the existing mapping.
Specify incremental to update the existing mapping in a mapped AUTOSAR software component
model. The function finds and maps unmapped model elements and updates the AUTOSAR Dictionary
for deleted model elements.
Example: 'default'
Before R2021a, use commas to separate each name and value, and enclose Name in quotes.
Example: 'ReferencedFromComponentModel',true maps a model as a referenced submodel.
1-25
1 Functions
Specify whether the model is a submodel referenced from an AUTOSAR software component model.
In a mapped submodel, you can use the Code Mappings editor to configure the submodel internal
data for calibration.
Example: 'ReferencedFromComponentModel',true
Version History
Introduced in R2013b
See Also
autosar_ui_launch | autosar.api.delete | updateAUTOSARProperties
Topics
“Incrementally Update AUTOSAR Mapping After Model Changes”
“Map Calibration Data for Submodels Referenced from AUTOSAR Component Models”
“Configure and Map AUTOSAR Component Programmatically”
“AUTOSAR Component Configuration”
1-26
autosar.api.delete
autosar.api.delete
Delete AUTOSAR properties and mapping for Simulink model
Syntax
autosar.api.delete(model)
Description
autosar.api.delete(model) deletes AUTOSAR properties and Simulink to AUTOSAR mapping
for model. The resulting model does not represent and map an AUTOSAR software component.
Examples
Input Arguments
model — Model for which to delete AUTOSAR properties and mapping
handle | character vector | string scalar
Model for which to delete AUTOSAR properties and Simulink to AUTOSAR mapping, specified as a
handle, character vector, or string scalar representing the model name.
Example: 'my_model'
Version History
Introduced in R2017b
See Also
autosar.api.create
Topics
“AUTOSAR Component Configuration”
1-27
1 Functions
autosar.api.getAUTOSARProperties
Configure AUTOSAR software component elements and properties
Description
In an AUTOSAR software component model, use AUTOSAR property functions to configure AUTOSAR
elements from an AUTOSAR component perspective. You can add AUTOSAR elements, find elements,
get and set properties of elements, delete elements, and define ARXML packaging of elements.
Creation
Syntax
arProps = autosar.api.getAUTOSARProperties(model)
Description
Input Arguments
Model for which to create AUTOSAR properties object, specified as a handle, character vector, or
string scalar representing the model name.
Example: 'my_model'
Object Functions
add Add property to AUTOSAR element
addPackageableElement Add element to AUTOSAR package in model
createEnumeration Create Simulink enumeration data type definition from imported
AUTOSAR data elements
createManifest Create manifest file for AUTOSAR adaptive model
createNumericType Create Simulink numeric data type definition from imported
AUTOSAR data elements
delete Delete AUTOSAR element
deleteUnmappedComponents Delete unmapped AUTOSAR components from model
find Find AUTOSAR elements
get Get property of AUTOSAR element
set Set property of AUTOSAR element
Examples
1-28
autosar.api.getAUTOSARProperties
isService =
logical
1
Version History
Introduced in R2013b
See Also
Topics
“Configure and Map AUTOSAR Component Programmatically”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-29
1 Functions
autosar.api.getSimulinkMapping
Map Simulink elements to AUTOSAR elements
Description
In an AUTOSAR software component model, use AUTOSAR map functions to map model elements to
AUTOSAR component elements from a Simulink model perspective. In an AUTOSAR adaptive model,
use AUTOSAR map functions to configure generated C++ class names and namespaces for your
adaptive application. For example, you can:
• Map a Simulink entry-point function to an AUTOSAR runnable and optional software address
methods.
• Map a Simulink inport or outport to an AUTOSAR receiver or sender port and a sender-receiver
data element.
• Map a Simulink model workspace parameter to an AUTOSAR component parameter.
• Map a Simulink data store to an AUTOSAR variable.
• Add or remove Simulink block signals from AUTOSAR component mapping.
• Map a Simulink block signal or state to an AUTOSAR variable.
• Set the default data packaging for Simulink internal data stores, signals, and states in AUTOSAR
generated code.
• Map a Simulink data transfer line to an AUTOSAR inter-runnable variable (IRV).
• Map a Simulink function caller to an AUTOSAR client port and a client-server operation.
• Control generated C++ class name or namespace for adaptive applications.
Creation
Syntax
slMap = autosar.api.getSimulinkMapping(model)
Description
Input Arguments
Model for which to create AUTOSAR mapping object, specified as a handle, character vector, or
string scalar representing the model name.
Example: 'my_model'
1-30
autosar.api.getSimulinkMapping
Object Functions
addSignal Add Simulink block signal to AUTOSAR mapping
find Find AUTOSAR elements
getClassName Get class name of model
getClassNamespace Get class namespace for a model
getDataStore Get AUTOSAR mapping information for Simulink data store
getDataTransfer Get AUTOSAR mapping information for Simulink data transfer
getFunction Get AUTOSAR mapping information for Simulink entry-point function
getFunctionCaller Get AUTOSAR mapping information for Simulink function-caller block
getInport Get AUTOSAR mapping information for Simulink inport
getInternalDataPackaging Get default internal data packaging for AUTOSAR component model
getOutport Get AUTOSAR mapping information for Simulink outport
getParameter Get AUTOSAR mapping information for Simulink model workspace
parameter
getSignal Get AUTOSAR mapping information for Simulink block signal
getState Get AUTOSAR mapping information for Simulink block state
mapDataStore Map Simulink data store to AUTOSAR variable
mapDataTransfer Map Simulink data transfer to AUTOSAR inter-runnable variable
mapFunction Map Simulink entry-point function to AUTOSAR runnable and software
address methods
mapFunctionCaller Map Simulink function-caller block to AUTOSAR client port and
operation
mapInport Map Simulink inport to AUTOSAR port
mapOutport Map Simulink outport to AUTOSAR port
mapParameter Map Simulink model workspace parameter to AUTOSAR component
parameter
mapSignal Map Simulink block signal to AUTOSAR variable
mapState Map Simulink block state to AUTOSAR variable
removeSignal Remove Simulink block signal from AUTOSAR mapping
setClassName Set class name of model
setClassNamespace Set class namespace of model
setInternalDataPackaging Set default internal data packaging for AUTOSAR component model
Examples
Create AUTOSAR Mapping Object and Map Entry-Point Function to AUTOSAR Runnable
arRunnableName =
'Runnable_Init'
Version History
Introduced in R2013b
1-31
1 Functions
See Also
Topics
“Configure and Map AUTOSAR Component Programmatically”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-32
autosar.api.syncModel
autosar.api.syncModel
Update Simulink to AUTOSAR mapping of model with Simulink modifications
Syntax
autosar.api.syncModel(model)
Description
autosar.api.syncModel(model) updates the Simulink to AUTOSAR mapping of model with
modifications made to Simulink elements, such as data transfers, entry-point functions, and function
callers.
This function is equivalent to using the Update button in the Code Mappings editor view of an
AUTOSAR component model.
Examples
When you create or modify an AUTOSAR model, Simulink to AUTOSAR mapping potentially is not
current with the model content. For example, the Update button in this Code Mappings editor
display indicates that Simulink elements need loading or updating.
This example opens and updates a model. After calling autosar.api.syncModel, the Simulink to
AUTOSAR mapping reflects the current model content.
1-33
1 Functions
hModel = 'autosar_swc';
openExample(hModel);
autosar.api.syncModel(hModel)
Input Arguments
model — Model to update
handle | character vector | string scalar
Loaded or open model for which to update Simulink to AUTOSAR mapping with model changes,
specified as a handle, character vector, or string scalar representing the model name.
Example: 'my_model'
Version History
Introduced in R2016a
See Also
autosar.api.validateModel
Topics
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-34
autosar.api.validateModel
autosar.api.validateModel
Validate AUTOSAR properties and mapping of Simulink model
Syntax
autosar.api.validateModel(model)
Description
autosar.api.validateModel(model) validates the AUTOSAR properties and Simulink to
AUTOSAR mapping of model.
If Simulink Coder™ and Embedded Coder are not licensed on your system, the function validates only
the Simulink to AUTOSAR mapping of model.
This function is equivalent to using the Validate button in the Code Mappings editor view of an
AUTOSAR component model.
Examples
This example opens a model in which a Simulink inport is not mapped to an AUTOSAR port and data
element. Initial validation reports the error and fails. After the inport is mapped, validation succeeds.
hModel = 'autosar_model_with_unmapped_port';
load_system(hModel);
Input Arguments
model — Model to validate
handle | character vector | string scalar
Loaded or open model for which to validate AUTOSAR properties and Simulink to AUTOSAR
mapping, specified as a handle, character vector, or string scalar representing the model name.
Example: 'my_model'
1-35
1 Functions
Version History
Introduced in R2016a
See Also
autosar.api.syncModel
Topics
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-36
autosar.arch.createModel
autosar.arch.createModel
Create AUTOSAR architecture model
Syntax
archModel = autosar.arch.createModel(modelName)
archModel = autosar.arch.createModel(modelName,openFlag)
archModel = autosar.arch.createModel(modelName,"platform",platformKind)
Description
archModel = autosar.arch.createModel(modelName) creates and opens AUTOSAR
architecture model modelName in the editor. The output argument archModel returns a model
handle, which is an autosar.arch.Model object. The platform kind when using this syntax is set to
the AUTOSAR Classic Platform by default.
Examples
Create an AUTOSAR classic architecture model named myArchModel, open the model in the editor,
and return model properties.
archModel =
Name: 'myArchModel'
SimulinkHandle: 1.2207e-04
Components: [0×0 autosar.arch.Component]
Compositions: [0×0 autosar.arch.Composition]
Ports: [0×0 autosar.arch.PortBase]
Connectors: [0×0 autosar.arch.Connector]
Interfaces: [0×0 Simulink.interface.dictionary.PortInterface]
1-37
1 Functions
Create an AUTOSAR classic architecture model without opening it in the editor, and return model
properties. By default, autosar.arch.createModel creates an architecture model for the Classic
Platform.
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName,false)
archModel =
Name: 'myArchModel'
SimulinkHandle: 2.4414e-04
Components: [0×0 autosar.arch.Component]
Compositions: [0×0 autosar.arch.Composition]
Ports: [0×0 autosar.arch.PortBase]
Connectors: [0×0 autosar.arch.Connector]
Interfaces: [0×0 Simulink.interface.dictionary.PortInterface]
archModel =
Name: 'myArchModel'
SimulinkHandle: 3.6621e-04
Components: [0×0 autosar.arch.Component]
Compositions: [0×0 autosar.arch.Composition]
Ports: [0×0 autosar.arch.PortBase]
Connectors: [0×0 autosar.arch.Connector]
Interfaces: [0×0 Simulink.interface.dictionary.PortInterface]
For an AUTOSAR component in an architecture model, create an architecture model containing only
the specified component.
sensorComposition =
Name: 'Sensors'
SimulinkHandle: 169.0001
Parent: [1×1 autosar.arch.Model]
Components: [4×1 autosar.arch.Component]
Compositions: [0×0 autosar.arch.Composition]
1-38
autosar.arch.createModel
Input Arguments
modelName — Architecture model name
character vector | string scalar
Name of the AUTOSAR architecture model to create, specified as a character vector or string scalar.
Example: 'myArchModel'
Flag to indicate whether the model is opened in the editor when created, specified as a Boolean.
Specify false to create an architecture model without opening it in the editor.
Example: false
Specify "Adaptive" to create an architecture model for the Adaptive Platform. Specify "Classic"
to create an architecture model for the Classic Platform.
Output Arguments
archModel — Architecture model
handle
Version History
Introduced in R2020a
See Also
autosar.arch.loadModel | close | open | save
1-39
1 Functions
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Create AUTOSAR Architecture Models”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-40
linkDictionary
linkDictionary
Package: autosar.arch
Syntax
linkDictionary(archModel,dictionaryName)
Description
linkDictionary(archModel,dictionaryName) links a Simulink data dictionary,
dictionaryName, to an AUTOSAR architecture model, specified as autosar.arch.Model object
archModel.
Examples
dictName = 'MyInterfaces.sldd';
dictAPI = Simulink.dictionary.archdata.open(dictName);
Input Arguments
archModel — AUTOSAR architecture model handle
autosar.arch.Model object
Name of data dictionary, specified as a character vector or string scalar. The name must include
the .sldd extension and must be a valid MATLAB identifier.
Example: "new_dictionary.sldd"
Version History
Introduced in R2023a
1-41
1 Functions
See Also
Simulink.dictionary.ArchitecturalData | Simulink.dictionary.archdata.create |
Simulink.dictionary.archdata.open | autosar.arch.createModel
1-42
autosar.arch.loadModel
autosar.arch.loadModel
Load AUTOSAR architecture model
Syntax
archModel = autosar.arch.loadModel(modelName)
Description
archModel = autosar.arch.loadModel(modelName) loads AUTOSAR architecture model
modelName into memory without opening the model in the editor. The output argument archModel
returns a model handle, which is an autosar.arch.Model object. After you load a model into
memory, you can work with it by using architecture functions or open the model in the editor by using
the open function. Save changes by using the save function.
Examples
Load an AUTOSAR architecture model into memory without opening the model in the editor, and
return model properties.
modelName = 'autosar_tpc_composition';
archModel = autosar.arch.loadModel(modelName)
archModel =
Model with properties:
Name: 'autosar_tpc_composition'
SimulinkHandle: 0.0057
Components: [2x1 autosar.arch.Component]
Compositions: [1x1 autosar.arch.Composition]
Ports: [4x1 autosar.arch.ArchPort]
Connectors: [7x1 autosar.arch.Connector]
Interfaces: [0x0 Simulink.dictionary.archdata.PortInterface]
Platform: 'Classic'
Input Arguments
modelName — Architecture model name
character vector | string scalar
1-43
1 Functions
Output Arguments
archModel — Architecture model
handle
Version History
Introduced in R2020a
See Also
autosar.arch.createModel | close | open | save
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Create AUTOSAR Architecture Models”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-44
autosar_ui_close
autosar_ui_close
Close AUTOSAR Dictionary dialog box
Syntax
autosar_ui_close(model)
Description
autosar_ui_close(model) closes the AUTOSAR Dictionary dialog box for the specified open
model.
Examples
Open the AUTOSAR Dictionary dialog box with settings for an AUTOSAR example model, and then
close the dialog box.
hModel = 'autosar_swc';
openExample(hModel)
autosar_ui_launch(hModel)
autosar_ui_close(hModel)
Input Arguments
model — Model for which to close the AUTOSAR Dictionary dialog box
handle | character vector | string scalar
Model for which to close the AUTOSAR Dictionary dialog box, specified as a handle, character vector,
or string scalar representing the model name.
Example: 'autosar_swc'
Version History
Introduced in R2014b
See Also
autosar_ui_launch | autosar.api.create
Topics
“AUTOSAR Component Configuration”
1-45
1 Functions
autosar_ui_launch
Open AUTOSAR Dictionary dialog box
Syntax
autosar_ui_launch(model)
Description
autosar_ui_launch(model) opens the AUTOSAR Dictionary dialog box with settings for the
specified open model.
Examples
Open the AUTOSAR Dictionary dialog box with settings for an AUTOSAR example model.
hModel = 'autosar_swc';
openExample(hModel)
autosar_ui_launch(hModel)
Input Arguments
model — Model for which to open the AUTOSAR Dictionary dialog box
handle | character vector | string scalar
Model for which to open the AUTOSAR Dictionary dialog box, specified as a handle, character vector,
or string scalar representing the model name.
Example: 'autosar_swc'
Version History
Introduced in R2013b
See Also
autosar.api.create | autosar_ui_close
Topics
“AUTOSAR Component Configuration”
1-46
close
close
Package: autosar.arch
Syntax
close(archModel)
close(archModel,'Force')
Description
close(archModel) closes architecture model archModel. The archModel argument is a model
handle returned by a previous call to autosar.arch.createModel or autosar.arch.loadModel.
The model must be open or loaded with no unsaved changes.
Examples
Create an AUTOSAR architecture model, add a composition, save the change, and close the model.
% Create AUTOSAR architecture model
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
% Add a composition
composition = addComposition(archModel,'Sensors2');
Input Arguments
archModel — Architecture model
handle
AUTOSAR architecture model to close. The argument is a model handle returned by a previous call to
autosar.arch.createModel or autosar.arch.loadModel. The model must be open or loaded
with no unsaved changes.
Example: archModel
Version History
Introduced in R2020a
1-47
1 Functions
See Also
autosar.arch.createModel | autosar.arch.loadModel | open | save
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Create AUTOSAR Architecture Models”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-48
connect
connect
Package: autosar.arch
Syntax
connectors = connect(archModel,comp1,comp2)
connectors = connect(archCM,[],comp2)
connectors = connect(archCM,comp1,[])
connectors = connect(archModel,port1,port2)
Description
connectors = connect(archModel,comp1,comp2) connects the output ports of component or
composition comp1 to the input ports of component or composition comp2, based on matching port
names. The archModel argument is a model handle returned by a previous call to
autosar.arch.createModel or autosar.arch.loadModel. The comp1 and comp2 arguments
are component or composition handles returned by previous calls to addComponent,
addComposition, or find. The connectors output argument returns one or more connector
handles, which are autosar.arch.Connector objects.
Examples
This example shows how to connect ports in an AUTOSAR classic architecture model.
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
1-49
1 Functions
At the top level of the model, add a composition, an application component, and a sensor-actuator
component.
composition = addComposition(archModel,'Sensors');
addComponent(archModel,'Controller1');
actuator = addComponent(archModel,'Actuator');
set(actuator,'Kind','SensorActuator');
For the architecture model, add two receiver (input) ports and a sender (output) port. The ports
appear at the architecture model boundary.
addPort(archModel,'Receiver',{'TPS_Hw','APP_Hw'});
addPort(archModel,'Sender','ThrCmd_Hw');
For the composition block, add two receiver ports and two sender ports. The composition receiver
port names match the names of the architecture model receiver ports to which they connect.
addPort(composition,'Receiver',{'TPS_Hw','APP_Hw'});
addPort(composition,'Sender',{'TPS_Perc','APP_Perc'});
For the component blocks, add receiver and sender ports. The component receiver and sender port
names match the names of the component, composition, or architecture model ports to which they
connect.
controller = find(archModel,'Component','Name','Controller1');
addPort(controller,'Receiver',{'TPS_Perc','APP_Perc'});
addPort(controller,'Sender','ThrCmd_Perc');
addPort(actuator,'Receiver','ThrCmd_Perc');
addPort(actuator,'Sender','ThrCmd_Hw');
At the top level of the model, connect the composition and the components based on matching port
names.
connect(archModel,composition,controller);
connect(archModel,controller,actuator);
% Connect specified arch root ports to specified composition and component ports
connect(archModel,archModel.Ports(1),composition.Ports(1));
Connect the architecture root ports to composition and component ports. Rather than relying on
matching port names to make connections, use port handles to identify specific architecture,
composition, and component ports.
connect(archModel,...
find(archModel,'Port','Name','APP_Hw'),...
find(composition,'Port','Name','APP_Hw'));
connect(archModel,actuator.Ports(2),archModel.Ports(3));
% ALTERNATIVELY, connect architecture root ports based on matching port names
% connect(archModel,[],composition);
% connect(archModel,actuator,[]);
Inside the Sensors composition, add sensor-actuator components named PedalSnsr and
ThrottleSnsr.
names = {'PedalSnsr','ThrottleSnsr'};
sensorSWCs = addComponent(composition,names,'Kind','SensorActuator');
For the component blocks, add receiver and sender ports. The component receiver and sender port
names match the names of the composition root ports to which they connect.
1-50
connect
pSnsr = find(composition,'Component','Name','PedalSnsr');
tSnsr = find(composition,'Component','Name','ThrottleSnsr');
addPort(pSnsr,'Receiver','APP_Hw');
addPort(pSnsr,'Sender','APP_Perc');
addPort(tSnsr,'Receiver','TPS_Hw');
addPort(tSnsr,'Sender','TPS_Perc');
Connect the Sensors composition root ports to component ports based on matching port names.
connect(composition,[],pSnsr);
connect(composition,pSnsr,[]);
connect(composition,[],tSnsr);
connect(composition,tSnsr,[]);
This example shows how to connect ports in an AUTOSAR adaptive architecture model.
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName,'platform','Adaptive');
At the top level of the model, add a composition and an adaptive application component.
composition = addComposition(archModel,'Sensors');
addComponent(archModel,'Filter');
For the architecture model, add two receiver (input) ports and two sender (output) ports. The ports
appear at the architecture model boundary.
addPort(archModel,'Receiver',{'Data_Snsr1','Data_Snsr2'});
addPort(archModel,'Sender',{'FilteredData_Snsr1','unFilteredData_Snsr2'});
For the composition block, add two receiver ports and two sender ports. The composition receiver
and sender port names match the names of the architecture model receiver and sender ports to
which they connect.
addPort(composition,'Receiver',{'Data_Snsr1','Data_Snsr2'});
addPort(composition,'Sender',{'FilteredData_Snsr1','unFilteredData_Snsr2'});
At the top level of the model, connect the architecture root input ports to composition ports, relying
on matching port names to make connections.
connect(archModel,[],composition);
Connect the architecture root output ports to composition ports, relying on matching port names to
make connections.
connect(archModel,composition,[]);
addPort(composition,'Client','Filter_RPort');
1-51
1 Functions
filter = find(archModel,'Component','Name','Filter');
addPort(filter,'Server','Filter_PPort');
layout(archModel);
Connect the composition and the component client-server ports. Use port handles to identify specific
composition and component ports.
connect(archModel,...
find(filter,'Port','Name','Filter_PPort'),...
find(composition,'Port','Name','Filter_RPort'));
Input Arguments
archModel — Architecture model
handle
AUTOSAR architecture model in which to connect ports. The argument is a model handle returned by
a previous call to autosar.arch.createModel or autosar.arch.loadModel.
Example: archModel
AUTOSAR composition or architecture model in which to connect parent and child ports based on
matching port names. The argument is a composition or architecture model handle returned by a
previous call to addComposition, autosar.arch.createModel, or autosar.arch.loadModel.
Example: archModel
Component or composition for which to connect output ports based on matching port names. The
argument is a component or composition handle returned by a previous call to addComponent,
addComposition, or find.
Example: composition
Component or composition for which to connect input ports based on matching port names. The
argument is a component or composition handle returned by a previous call to addComponent,
addComposition, or find.
Example: controller
Component, composition, or root architecture port to connect to another specified port. The
argument is a port handle returned by a previous call to addPort or find.
Example: archModel.Ports(1)
1-52
connect
Component, composition, or root architecture port to connect to another specified port. The
argument is a port handle returned by a previous call to addPort or find.
Example: composition.Ports(1)
Output Arguments
connectors — Added connectors
handle | array of handles
Returns one or more AUTOSAR connector handles, which are autosar.arch.Connector objects,
with connector properties.
Version History
Introduced in R2020a
See Also
addComponent | addComposition | addPort | destroy | find | importFromARXML | layout
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Add and Connect AUTOSAR Classic Components and Compositions”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-53
1 Functions
createComponentAsModel
Package: arxml
Syntax
createComponentAsModel(ar,ComponentName)
[mdl, sts] = createComponentAsModel(ar,ComponentName,Name,Value)
Description
createComponentAsModel(ar,ComponentName) creates a Simulink model corresponding to
AUTOSAR atomic software component ComponentName. The component description is part of
AUTOSAR information previously imported from AUTOSAR XML files, which is represented by
arxml.importer object ar.The importer creates an initial Simulink representation of the imported
AUTOSAR component, with an initial, default mapping of Simulink model elements to AUTOSAR
component elements. The initial representation provides a starting point for further AUTOSAR
configuration and Model-Based Design. For more information, see “AUTOSAR ARXML Importer”.
The initial representation of AUTOSAR component behavior in the created model depends on the
XML description:
• If the XML description of the component does not describe component behavior, the importer
creates a model with a default representation of AUTOSAR runnables and ports.
• If the XML description of the component describes component behavior, the importer creates a
model based on AUTOSAR elements that are accessed in the component.
For example, AUTOSAR ports must be accessed by runnables in order to generate the
corresponding Simulink elements. If a sender-receiver or client-server port in XML code is not
accessed by a runnable, the importer does not create the corresponding inports, outports, or
Simulink functions.
Examples
Import AUTOSAR software component /pkg/swc from XML file mySWC.arxml and create an initial
Simulink representation of the component. Model AUTOSAR periodic runnables as atomic
subsystems with periodic rates.
1-54
createComponentAsModel
ar = arxml.importer('mySWC.arxml')
createComponentAsModel(ar,'/pkg/swc','ModelPeriodicRunnablesAs','AtomicSubsystem')
Import AUTOSAR software component /pkg/swc from XML file mySWC.arxml and create an initial
Simulink representation of the component. Model AUTOSAR periodic runnables as function-call
subsystems with periodic rates.
ar = arxml.importer('mySWC.arxml')
createComponentAsModel(ar,'/pkg/swc','ModelPeriodicRunnablesAs','FunctionCallSubsystem')
Import AUTOSAR software component /pkg/swc from XML file mySWC.arxml and create an initial
Simulink representation of the component. Place Simulink data objects corresponding to AUTOSAR
data types into data dictionary ardata.sldd.
ar = arxml.importer('mySWC.arxml')
createComponentAsModel(ar,'/pkg/swc','ModelPeriodicRunnablesAs','AtomicSubsystem',...
'DataDictionary','ardata.sldd')
Import AUTOSAR software component /pkg/swc from XML file mySWC.arxml and create an initial
Simulink representation of the component. Configure AUTOSAR runnable Runnable_Init as the
initialization runnable for the component.
ar = arxml.importer('mySWC.arxml')
createComponentAsModel(ar,'/pkg/swc','ModelPeriodicRunnablesAs','AtomicSubsystem',...
'InitializationRunnable','Runnable_Init')
Import AUTOSAR software component /pkg/swc from XML file mySWC.arxml and create an initial
Simulink representation of the component. Use PredefinedVariant Senior to resolve variation
points in the component at model creation time.
ar = arxml.importer('mySWC.arxml')
createComponentAsModel(ar,'/pkg/swc','ModelPeriodicRunnablesAs','AtomicSubsystem',...
'PredefinedVariant','/pkg/body/Variants/Senior');
Import AUTOSAR software component /pkg/swc from XML file mySWC.arxml and create an initial
Simulink representation of the component. Use SwSystemconstantValueSets A and B to resolve
variation points in the component at model creation time.
ar = arxml.importer('mySWC.arxml')
createComponentAsModel(ar,'/pkg/swc','ModelPeriodicRunnablesAs','AtomicSubsystem',...
'SystemConstValueSets',{'/pkg/body/SystemConstantValues/A','/pkg/body/SystemConstantValues/B'});
Input Arguments
ar — arxml.importer object
handle
AUTOSAR information previously imported from XML files, specified as an arxml.importer object
handle.
1-55
1 Functions
Before R2021a, use commas to separate each name and value, and enclose Name in quotes.
Example: 'ModelPeriodicRunnablesAs','AtomicSubsystem' directs the importer to model
AUTOSAR periodic runnables as atomic subsystems with periodic rates.
Simulink data dictionary into which to import data objects corresponding to AUTOSAR data types in
the XML file. If the specified dictionary does not already exist, the importer creates it. The model is
then associated with that data dictionary.
Example: 'DataDictionary','ardata.sldd'
Name of an existing AUTOSAR runnable to select as the initialization runnable for the component.
Example: 'InitializationRunnable','Runnable_Init'
If you specify Auto, the importer attempts to model periodic runnables as atomic subsystems. If
conditions prevent use of atomic subsystems, the importer models periodic runnables as function-call
subsystems.
For more information, see “Import AUTOSAR Software Component with Multiple Runnables”.
Example: 'ModelPeriodicRunnablesAs','AtomicSubsystem'
1-56
createComponentAsModel
AUTOSAR software component. Use this argument to resolve variation points in the AUTOSAR
software component at model creation time. If specified, the importer uses the PredefinedVariant
to initialize SwSystemconst data that serves as input to control variation points.
For more information, see “Control AUTOSAR Variants with Predefined Value Combinations”.
Example: 'PredefinedVariant','/pkg/body/Variants/Senior'
For more information, see “Control AUTOSAR Variants with Predefined Value Combinations”.
Example: 'SystemConstValueSets','{'/pkg/body/SystemConstantValues/A','/pkg/
body/SystemConstantValues/B'}'
Whether to use bus element ports in place of Simulink inports and outports for port-based sender-
receiver communication.
Example: 'UseBusElementPorts',true
Data Types: logical
Output Arguments
mdl — Model handle
handle
Variable that returns true if the import is successful. Otherwise, returns false.
Tips
• If you enter the arxml.importer object function call without a terminating semicolon (;), the
importer lists the AUTOSAR content of the specified XML file or files. The information includes
paths to software components in the AUTOSAR package structure, which you can specify in calls
to createComponentAsModel and createCompositionAsModel.
• When importing an AUTOSAR software component into a model, it is recommended that you
explicitly specify the 'ModelPeriodicRunnablesAs' argument. This argument determines how
the importer models AUTOSAR periodic runnables in the created model. See the argument
description under “Name-Value Arguments” on page 1-56.
1-57
1 Functions
Version History
Introduced in R2008a
createComponentAsModel supports creating AUTOSAR Basic Software (BSW) caller blocks for
ARXML-imported software components that access Diagnostic Event Manager (Dem), NVRAM
Manager (NvM), or Function Inhibition Manager (FiM) services through client-server calls.
Starting in R2023b a new name-value pair 'UseBusElementPorts' is supported which allows bus
element ports to be used in place of Simulink inports and outports for port-based server
communication.
See Also
arxml.importer | getComponentNames
Topics
“Import AUTOSAR XML Descriptions Into Simulink”
“Import AUTOSAR Component to Simulink”
“Import AUTOSAR Adaptive Software Descriptions”
“Import AUTOSAR Adaptive Components to Simulink”
“AUTOSAR ARXML Importer”
“Control AUTOSAR Variants with Predefined Value Combinations”
1-58
createCompositionAsModel
createCompositionAsModel
Package: arxml
Syntax
createCompositionAsModel(ar,CompositionName)
[mdl, sts] = createCompositionAsModel(ar,CompositionName,Name,Value)
Description
createCompositionAsModel(ar,CompositionName) creates a Simulink model corresponding to
AUTOSAR software composition CompositionName. The composition description is part of
AUTOSAR information previously imported from AUTOSAR XML files, which is represented by
arxml.importer object ar.The importer creates an initial Simulink representation of the imported
AUTOSAR composition. The initial representation provides a starting point for further AUTOSAR
configuration and Model-Based Design. For more information, see “AUTOSAR ARXML Importer”.
Examples
names =
1×1 cell array
{'/Company/Components/ThrottlePositionControlComposition'}
createCompositionAsModel(ar,'/Company/Components/ThrottlePositionControlComposition');
Import AUTOSAR software composition /pkg/rootComposition from XML file mySWCs.arxml and
create an initial Simulink representation of the composition. For components mySwc1 and mySwc2
contained within the composition, use existing Simulink component models rather than creating new
ones.
1-59
1 Functions
ar = arxml.importer('mySWCs.arxml')
createCompositionAsModel(ar,'/pkg/rootComposition','ComponentModels',{'mySwc1','mySwc2'})
Import AUTOSAR software composition /pkg/rootComposition from XML file mySWCs.arxml and
create an initial Simulink representation of the composition. Place Simulink data objects
corresponding to AUTOSAR data types into data dictionary ardata.sldd.
ar = arxml.importer('mySWCs.arxml')
createCompositionAsModel(ar,'/pkg/rootComposition','DataDictionary','ardata.sldd')
For each imported component, the importer stores sharable AUTOSAR properties, such as interfaces
and data types, in data dictionary ardata.sldd. Components within the composition can then share
the stored properties.
ar = arxml.importer('ThrottlePositionControlComposition.arxml')
createCompositionAsModel(ar,'/Company/Components/ThrottlePositionControlComposition',...
'ModelPeriodicRunnablesAs','Auto',...
'DataDictionary','ardata.sldd','ShareAUTOSARProperties',true);
To view the shared properties, open the AUTOSAR dictionary for a component model. This example
opens ThrottlePositionSensor. Expand the AUTOSAR dictionary node ardata.sldd. You can
view read-only properties, such as shared component interfaces, and modify XML options for
composition and component export.
autosar_ui_launch('ThrottlePositionSensor')
1-60
createCompositionAsModel
Import AUTOSAR software composition /pkg/rootComposition from XML file mySWCs.arxml and
create an initial Simulink representation of the composition. Model AUTOSAR periodic runnables as
function-call subsystems with periodic rates.
ar = arxml.importer('mySWCs.arxml')
createCompositionAsModel(ar,'/pkg/rootComposition',...
'ModelPeriodicRunnablesAs','FunctionCallSubsystem')
Import AUTOSAR software composition /pkg/rootComposition from XML file mySWCs.arxml and
create an initial Simulink representation of the composition. Use PredefinedVariant Senior to
resolve variation points in components at model creation time.
ar = arxml.importer('mySWCs.arxml')
createCompositionAsModel(ar,'/pkg/rootComposition',...
'PredefinedVariant','/pkg/body/Variants/Senior');
Import AUTOSAR software composition /pkg/rootComposition from XML file mySWCs.arxml and
create an initial Simulink representation of the composition. Use SwSystemconstantValueSets A
and B to resolve variation points in components at model creation time.
1-61
1 Functions
ar = arxml.importer('mySWCs.arxml')
createCompositionAsModel(ar,'/pkg/rootComposition',...
'SystemConstValueSets',{'/pkg/body/SystemConstantValues/A','/pkg/body/SystemConstantValues/B'});
Input Arguments
ar — arxml.importer object
handle
AUTOSAR information previously imported from XML files, specified as an arxml.importer object
handle.
Before R2021a, use commas to separate each name and value, and enclose Name in quotes.
Example: 'ModelPeriodicRunnablesAs','AtomicSubsystem' directs the importer to model
AUTOSAR periodic runnables as atomic subsystems with periodic rates.
Names of existing atomic software component models to use when creating a Simulink representation
of the composition. The function incorporates the specified existing component models in the
composition model instead of creating new ones.
Example: 'ComponentModels',{'mySwc1','mySwc2'}
Simulink data dictionary into which to import data objects corresponding to AUTOSAR data types in
the XML file. If the specified dictionary does not already exist, the importer creates it. The model is
then associated with that data dictionary.
If you specify true for the 'ShareAUTOSARProperties' argument, the specified data dictionary
also stores sharable AUTOSAR properties, such as interfaces and data types, for sharing among
components in the composition.
Example: 'DataDictionary','ardata.sldd'
1-62
createCompositionAsModel
of atomic subsystems, the function models the periodic runnables as function-call subsystems with
periodic rates.
For more information, see “Import AUTOSAR Software Component with Multiple Runnables”.
Example: 'ModelPeriodicRunnablesAs','AtomicSubsystem'
For more information, see “Control AUTOSAR Variants with Predefined Value Combinations”.
Example: 'PredefinedVariant','/pkg/body/Variants/Senior'
For compositions containing more than 20 software components, sharing AUTOSAR properties
among components can significantly improve performance for composition workflows, including
import, dictionary navigation, AUTOSAR validation, and code generation. Limiting property
replication among components can reduce component model file sizes.
The shared AUTOSAR dictionary provides a central location for viewing and configuring AUTOSAR
composition and component properties. You can view read-only properties, such as shared component
interfaces, and modify XML options for composition and component export.
To share AUTOSAR properties, specify true. For each imported component, the function stores
sharable AUTOSAR properties, such as interfaces and data types, in the Simulink data dictionary
specified by the 'DataDictionary' argument. The 'DataDictionary' argument must be
specified.
For more information, see “Import AUTOSAR Composition and Share AUTOSAR Dictionary” on page
1-60.
Example: 'ShareAUTOSARProperties',true
1-63
1 Functions
components. Use this argument to resolve variation points in AUTOSAR software components at
model creation time. If specified, the importer uses the SystemConstValueSets to initialize
SwSystemconst data that serves as input to control variation points.
For more information, see “Control AUTOSAR Variants with Predefined Value Combinations”.
Example: 'SystemConstValueSets','{'/pkg/body/SystemConstantValues/A','/pkg/
body/SystemConstantValues/B'}'
Whether to use bus element ports in place of Simulink inports and outports for port-based sender-
receiver communication.
Example: 'UseBusElementPorts',true
Data Types: logical
Output Arguments
mdl — Model handle
handle
Variable that returns true if the import is successful. Otherwise, returns false.
Tip
If you enter the arxml.importer object function call without a terminating semicolon (;), the
importer lists the AUTOSAR content of the specified XML file or files. The information includes paths
to software components in the AUTOSAR package structure, which you can specify in calls to
createCompositionAsModel and createComponentAsModel.
Version History
Introduced in R2017b
See Also
arxml.importer | getComponentNames
Topics
“Import AUTOSAR XML Descriptions Into Simulink”
1-64
createCompositionAsModel
1-65
1 Functions
createEnumeration
Package: autosar.api
Create Simulink enumeration data type definition from imported AUTOSAR data elements
Syntax
createEnumeration(arProps,name,applicationDataTypePath)
createEnumeration(arProps,name,compuMethodPath,implementationDataTypePath)
createEnumeration(arProps,compuMethodPath)
Description
createEnumeration(arProps,name,applicationDataTypePath) creates a Simulink
enumeration type from an AUTOSAR application data type. The function can be used to work with
AUTOSAR elements that you imported by using updateAUTOSARProperties.
createEnumeration(arProps,name,compuMethodPath,implementationDataTypePath)
creates a Simulink enumeration type from an AUTOSAR implementation data type and
CompuMethod.
Examples
Create a Simulink enumeration data type definition with the name myEnum from the AUTOSAR
application data type at path /AUTOSAR_PlatformTypes/ApplicationDataTypes/MyAppType.
dataObj = autosar.api.getAUTOSARProperties(mdlName);
createEnumeration(dataObj,'myEnum',...
'/AUTOSAR_PlatformTypes/ApplicationDataTypes/MyAppType');
Create Enumeration Data Type from AUTOSAR Implementation Data Type and
CompuMethod
Create a Simulink enumeration data type definition with the name myEnum from the AUTOSAR
implementation data type at path /AUTOSAR_PlatformTypes/ImplementationDataTypes/
uint16 by using the computation method from path /a/b/myCM.
1-66
createEnumeration
dataObj = autosar.api.getAUTOSARProperties(mdlName);
createEnumeration(dataObj,'myEnum','/a/b/myCM',...
'/AUTOSAR_PlatformTypes/ImplementationDataTypes/uint16');
Input Arguments
arProps — AUTOSAR properties information for a model
handle (default)
Name of enumeration data type created for Simulink representation of an AUTOSAR element.
In the Simulink environment, this enumeration data type is mapped to both an application data type
and an implementation data type. The application data type for the enumeration provides application-
level physical attributes such as real-world range of values, data structure, and physical semantics.
The implementation data type provides implementation-level attributes, such as stored-integer
minimum and maximum specifications and primitive type (for example, integer).
Example: 'myEnum'
Data Types: char | string
Path to AUTOSAR application data type for created Simulink enumeration data type. The application
data type provides application-level physical attributes such as real-world range of values, data
structure, and physical semantics. The application data type is used in simulation.
Example: '/AUTOSAR_PlatformTypes/ApplicationDataTypes/MyAppType'
Data Types: char | string
Path to the AUTOSAR CompuMethod, which is used to translate between the enumeration
implementation data type and the enumeration application data type.
Example: '/a/b/myCM'
Data Types: char | string
Path to AUTOSAR implementation data type for created Simulink enumeration data type. The
implementation data type provides implementation-level attributes, such as stored-integer minimum
1-67
1 Functions
and maximum specifications and primitive type (for example, integer). Implementation data types are
used in code generation.
Example: '/AUTOSAR_PlatformTypes/ImplementationDataTypes/uint16'
Data Types: char | string
Version History
Introduced in R2019a
See Also
autosar.api.getAUTOSARProperties | updateAUTOSARProperties | createNumericType
Topics
“AUTOSAR Property and Map Function Examples”
“Configure and Map AUTOSAR Component Programmatically”
“AUTOSAR Component Configuration”
“Model AUTOSAR Data Types”
1-68
createManifest
createManifest
Package: autosar.api
Syntax
createManifest(arProps)
Description
createManifest(arProps) creates an execution manifest JSON file for the adaptive application.
The manifest file modifies the default logging behavior of the adaptive application Linux® executable,
providing properties such as the logging mode and verbosity level.
Examples
Input Arguments
arProps — AUTOSAR properties information for a model
handle (default)
Version History
Introduced in R2021a
See Also
autosar.api.getAUTOSARProperties
1-69
1 Functions
Topics
“Configure Run-Time Logging for AUTOSAR Adaptive Executables”
1-70
createModel
createModel
Package: autosar.arch
Syntax
createModel(component,modelName)
createModel(composition,modelName)
Description
createModel(component,modelName) creates Simulink implementation model modelName with
the same interface as the specified AUTOSAR architecture component and links the component to the
implementation model. The component argument is a component handle returned by a previous call
to addComponent. If not specified, modelName defaults to the name of the component.
Examples
For an AUTOSAR component in an architecture model, create a Simulink implementation model with
a matching interface. The function call links the component to the implementation model. By default,
the implementation model has the same name as the component.
% Create AUTOSAR architecture model
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
For an AUTOSAR composition in an architecture model, create a Simulink implementation model with
a matching interface. The function call links the composition to the implementation model. By default,
the implementation model has the same name as the composition.
% Create AUTOSAR architecture model
modelName = 'myNewArchModel';
1-71
1 Functions
archModel = autosar.arch.createModel(modelName);
Input Arguments
component — Architecture component
handle
AUTOSAR architecture component from which to create a matching Simulink implementation model.
The argument is a component handle returned by a previous call to addComponent.
Example: component
AUTOSAR architecture composition from which to create a matching Simulink implementation model.
The argument is a component handle returned by a previous call to addComposition.
Example: composition
Name of the Simulink implementation model to create, based on the specified AUTOSAR architecture
component or composition. If not specified, modelName defaults to the name of the component or
composition.
Example: 'SWC1'
Version History
Introduced in R2020a
See Also
linkToModel | addComponent | addComposition | importFromARXML
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Define AUTOSAR Component Behavior by Creating or Linking Models”
“Define AUTOSAR Compositions by Creating or Linking Models”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-72
createNumericType
createNumericType
Package: autosar.api
Create Simulink numeric data type definition from imported AUTOSAR data elements
Syntax
createNumericType(arProps,name,applicationDataTypePath)
createNumericType(arProps,name,compuMethodPath,implementationDataTypePath)
Description
createNumericType(arProps,name,applicationDataTypePath) creates a
Simulink.NumericType object from an AUTOSAR application data type. The function can be used
to work with AUTOSAR elements that you imported by using updateAUTOSARProperties.
createNumericType(arProps,name,compuMethodPath,implementationDataTypePath)
creates a Simulink.NumericType object from an AUTOSAR implementation data type and
CompuMethod.
Examples
Create a Simulink numeric data type with the name myDataType from the AUTOSAR application
data type at path /AUTOSAR_PlatformTypes/ApplicationDataTypes/MyAppType.
dataObj = autosar.api.getAUTOSARProperties(mdlName);
createNumericType(dataObj,'myDataType',...
'/AUTOSAR_PlatformTypes/ApplicationDataTypes/MyAppType');
Create Numeric Data Type from AUTOSAR Implementation Data Type and CompuMethod
Create a Simulink numeric data type with the name myDataType from the AUTOSAR implementation
data type at path /AUTOSAR_PlatformTypes/ImplementationDataTypes/uint32 by using the
computation method from path /a/b/myCM.
dataObj = autosar.api.getAUTOSARProperties(mdlName);
createNumericType(dataObj,'myDataType','/a/b/myCM', ...
'/AUTOSAR_PlatformTypes/ImplementationDataTypes/uint32');
Input Arguments
arProps — AUTOSAR properties information for a model
handle (default)
1-73
1 Functions
Example: arProps
Data Types: function_handle
Name of numeric data type created for Simulink representation of an AUTOSAR element.
In the Simulink environment, this numeric data type is mapped to both an application data type and
an implementation data type. The application data type provides application-level physical attributes
such as real-world range of values, data structure, and physical semantics. The implementation data
type provides implementation-level attributes, such as stored-integer minimum and maximum
specifications and primitive type (for example, integer).
Example: 'myDataType'
Data Types: char | string
Path to AUTOSAR application data type for created Simulink numeric data type. The application data
type provides application-level physical attributes such as real-world range of values, data structure,
and physical semantics. The application data type is used in simulation.
Example: '/AUTOSAR_PlatformTypes/ApplicationDataTypes/MyAppType'
Data Types: char | string
Path to the AUTOSAR CompuMethod, which is used to translate between the numeric implementation
data type and the numeric application data type.
Example: '/a/b/myCM'
Data Types: char | string
Path to AUTOSAR implementation data type for created Simulink numeric data type. The
implementation data type provides implementation-level attributes, such as stored-integer minimum
and maximum specifications and primitive type (for example, integer). Implementation data types are
used in code generation.
Example: '/AUTOSAR_PlatformTypes/ImplementationDataTypes/uint32'
Data Types: char | string
Version History
Introduced in R2019a
See Also
autosar.api.getAUTOSARProperties | updateAUTOSARProperties | createEnumeration
1-74
createNumericType
Topics
“AUTOSAR Property and Map Function Examples”
“Configure and Map AUTOSAR Component Programmatically”
“AUTOSAR Component Configuration”
“Model AUTOSAR Data Types”
1-75
1 Functions
delete
Package: autosar.api
Syntax
delete(arProps,elementPath)
Description
delete(arProps,elementPath) deletes the AUTOSAR element at elementPath.
Examples
Delete the sender-receiver interface Interface1 from the AUTOSAR configuration for a model.
hModel = 'autosar_swc_expfcns';
openExample(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
% Add Interface3
addPackageableElement(arProps,'SenderReceiverInterface','/pkg/if','Interface3');
ifPaths = find(arProps,[],'SenderReceiverInterface','PathType','FullyQualified')
ifPaths =
1×3 cell array
{'/pkg/if/Interface1'} {'/pkg/if/Interface2'} {'/pkg/if/Interface3'}
% Find AUTOSAR DataReceiverPort and change its interface from Interface1 to Interface3
arPortType = 'DataReceiverPort';
aswcPath = find(arProps,[],'AtomicComponent','PathType','FullyQualified');
rPorts = find(arProps,aswcPath{1},arPortType,'PathType','FullyQualified');
rPort = rPorts{1};
set(arProps,rPort,'Interface','Interface3')
% Delete Interface1
delete(arProps,'Interface1');
ifPaths = find(arProps,[],'SenderReceiverInterface','PathType','FullyQualified')
ifPaths =
1×2 cell array
{'/pkg/if/Interface2'} {'/pkg/if/Interface3'}
Input Arguments
arProps — AUTOSAR properties information for a model
handle
1-76
delete
Version History
Introduced in R2013b
See Also
autosar.api.getAUTOSARProperties | add
Topics
“AUTOSAR Property and Map Function Examples”
“Configure and Map AUTOSAR Component Programmatically”
“AUTOSAR Component Configuration”
1-77
1 Functions
deleteUnmappedComponents
Package: autosar.api
Syntax
deleteUnmappedComponents(arProps)
Description
deleteUnmappedComponents(arProps) deletes atomic software components that are not mapped
to the model. Use this to remove unused imported components that you do not want preserved in the
model and exported in ARXML code. This function does not remove calibration components.
Examples
After importing AUTOSAR information from ARXML files and configuring a model for AUTOSAR,
remove atomic software components that were imported but are not mapped to the model. This
prevents unmapped components from being exported back to ARXML.
arProps = autosar.api.getAUTOSARProperties('my_autosar_model');
deleteUnmappedComponents(arProps);
Input Arguments
arProps — AUTOSAR properties information for a model
handle
Version History
Introduced in R2014b
See Also
autosar.api.getAUTOSARProperties | arxml.importer
Topics
“AUTOSAR Property and Map Function Examples”
“Configure and Map AUTOSAR Component Programmatically”
“Import AUTOSAR XML Descriptions Into Simulink”
1-78
deleteUnmappedComponents
1-79
1 Functions
destroy
Package: autosar.arch
Syntax
destroy(archElement)
Description
destroy(archElement) removes and deletes architecture element archElement from an
architecture model. The archElement argument is a component, composition, port, or connector
handle returned by a previous call to addComponent, addComposition, addPort, connect, or
find.
Examples
% Add a composition
addComposition(archModel,'Sensors2');
Input Arguments
archElement — Architecture element
handle
Component, composition, port, or connector element to remove and delete. The argument is a
component, composition, port, or connector handle returned by a previous call to addComponent,
addComposition, addPort, connect, or find.
Example: composition
Version History
Introduced in R2020a
See Also
addComponent | addComposition | addPort | connect | find | importFromARXML | layout
1-80
destroy
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Add and Connect AUTOSAR Classic Components and Compositions”
“Add and Connect AUTOSAR Adaptive Components and Compositions”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-81
1 Functions
export
Package: autosar.arch
Export AUTOSAR architecture model ARXML, ASAP2 file, and generate component code
Syntax
export(archCCM)
export(archCCM,Name,Value)
Description
export(archCCM) exports ARXML descriptions from AUTOSAR component, composition, or
architecture model archCCM. The function also generates code for Simulink implementation models
linked by AUTOSAR components within the export scope and exports ASAP2 file for the component
models. The containing architecture model must be open or loaded. The archCCM argument is a
component, composition, or architecture model handle returned by a previous call to addComponent,
addComposition, autosar.arch.createModel, or autosar.arch.loadModel.
Examples
Export composition XML descriptions and generate component code for an AUTOSAR architecture
model.
modelName = 'autosar_tpc_composition';
archModel = autosar.arch.loadModel(modelName);
export(archModel);
Build Summary
1-82
export
Build Summary
Build Summary
Build Summary
Build Summary
1-83
1 Functions
=================================================================================================
autosar_tpc_throttle_sensor1 Code generated. Code generation information file does not exist.
Build Summary
Export XML descriptions and generate component code for a composition nested in an AUTOSAR
architecture model.
modelName = 'autosar_tpc_composition';
archModel = autosar.arch.loadModel(modelName);
export(archModel.Compositions(1));
Build Summary
1-84
export
Build Summary
Build Summary
Build Summary
Export XML descriptions and generate component code for an AUTOSAR architecture model. In the
PackageCodeAndArxml value argument, specify the name of a ZIP file in which to package the
generated files.
1-85
1 Functions
modelName = 'autosar_tpc_composition';
archModel = autosar.arch.loadModel(modelName);
export(archModel,'PackageCodeAndARXML','myArchModel.zip');
Build Summary
Build Summary
Build Summary
Build Summary
1-86
export
Build Summary
Build Summary
Export composition XML descriptions and generate component code for an AUTOSAR architecture
model. As part of composition XML export, generate an ECU extract into the file System.arxml,
which is located in the composition folder. The ECU extract for example model
autosar_tpc_composition maps software components from both the top-level composition and a
nested Sensors composition to one ECU.
1-87
1 Functions
export(archModel,'ExportECUExtract',true);
Build Summary
Build Summary
Build Summary
Build Summary
1-88
export
Build Summary
Build Summary
Export composition XML descriptions and generate component code for or an AUTOSAR architecture
model. As part of composition XML export, export ASAP2 file for the referenced component models
and save them in a folder with name asap2.
open_system('autosar_tpc_composition');
autosar.api.export(hModel,'ExportASAP2File',true);
Input Arguments
archCCM — Component, composition, or architecture model
handle
1-89
1 Functions
AUTOSAR component, composition, or architecture model for which to export ARXML descriptions
and generate component code. The argument is a component, composition, or architecture model
handle returned by a previous call to addComponent, addComposition,
autosar.arch.createModel, or autosar.arch.loadModel.
Example: archModel
Before R2021a, use commas to separate each name and value, and enclose Name in quotes.
Example: 'PackageCodeAndARXML','SensorsComposition.zip' specifies the name of a ZIP file
that packages the generated files.
As part of XML export, generate an ECU extract into the file System.arxml, which is located in the
composition folder. The ECU extract for a classic composition or architecture model maps software
components from the top composition and any nested compositions to one ECU. For more
information, see “Export Composition ECU Extract”.
Example: 'ExportECUExtract',true
Enable code generation of client-server connectors that describe the calls between function callers
and global Simulink functions across components in an AUTOSAR architecture model.
Example: 'ExportUnmodeledClientServerConnectors', true
Data Types: logical
Name of a ZIP file in which to package the generated files, including generated code and exported
ARXML descriptions.
Example: 'PackageCodeAndARXML','SensorsComposition.zip'
Export ASAP2 file while exporting the ARXML and generating component code. The exported ASAP2
file is packed into a folder named asap2. For more information, see “Generate and Pack ASAP2 File”.
1-90
export
Example: 'ExportASAP2File',true
Version History
Introduced in R2020a
Additional Name-value argument ExportASAP2File is added to export ASAP2 file for the
architecture model while exporting ARXML descriptions and generating component code.
See Also
getXmlOptions | setXmlOptions
Topics
“Generate ASAP2 File for AUTOSAR Architecture Models”
“Configure AUTOSAR Architecture Model Programmatically”
“Generate and Package AUTOSAR Composition XML Descriptions and Component Code”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-91
1 Functions
find
Package: autosar.api
Syntax
paths = find(arProps,rootPath,category)
paths = find(arProps,rootPath,category,'PathType',value)
paths = find(arProps,rootPath,category,property,value)
Description
paths = find(arProps,rootPath,category) returns paths to AUTOSAR elements matching
category, starting at path rootPath.
Examples
For a model, find sender-receiver interfaces for which the property IsService is false and return
fully qualified paths.
hModel = 'autosar_swc_expfcns';
open_system(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
ifPaths = find(arProps,[],'SenderReceiverInterface',...
'IsService',false,'PathType','FullyQualified')
For a model, add a mode-switch interface and then use find to list paths for mode-switch interfaces
in the model.
hModel = 'mAutosarMsConfigAfter';
open_system(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
addPackageableElement(arProps,'ModeSwitchInterface','/pkg/if','Interface3',...
1-92
find
'IsService',true);
ifPaths = find(arProps,[],'ModeSwitchInterface','PathType','FullyQualified')
Input Arguments
arProps — AUTOSAR properties information for a model
handle
Path specifying the starting point at which to look for the specified type of AUTOSAR elements. []
indicates the root of the component.
Example: []
'PathType',value — Whether the returned paths are fully qualified or partially qualified
'PartiallyQualified' (default) | 'FullyQualified'
Valid property of the specified category of elements, and a value to match for that property in the
search. Table “Properties of AUTOSAR Elements” lists properties that are associated with AUTOSAR
elements.
Example: 'IsService',true
Output Arguments
paths — Paths to AUTOSAR elements
cell array of character vectors
1-93
1 Functions
Example: ifPaths
Version History
Introduced in R2013b
See Also
autosar.api.getAUTOSARProperties | add | delete | get | set
Topics
“AUTOSAR Property and Map Function Examples”
“Configure and Map AUTOSAR Component Programmatically”
“AUTOSAR Component Configuration”
1-94
find
find
Package: autosar.arch
Syntax
archElements = find(archCCM,category)
archElements = find(archCCM,category,'AllLevels',value)
archElements = find(archCCM,category,property,value)
Description
archElements = find(archCCM,category) searches AUTOSAR component, composition, or
architecture model archCCM for architecture elements that match the specified category. The
archElements output argument returns handles for the architecture elements found. Valid values
for category are Component, Composition, Port, or Connector. The archCCM argument is a
component, composition, or architecture model handle returned by a previous call to addComponent,
addComposition, autosar.arch.createModel, or autosar.arch.loadModel. The default
scope of find is the top level of the specified composition or architecture model, not all levels of the
model hierarchy.
Examples
• Find components that are located only in the architecture model top level.
• Find components located in all levels of the model hierarchy.
• Find composition block ports and list their Kind and Name values.
% Create AUTOSAR architecture model
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
% Add a composition
composition = addComposition(archModel,'Sensors');
1-95
1 Functions
% At top level, connect composition and components based on matching port names
connect(archModel,composition,controller);
connect(archModel,controller,actuator);
% Connect specified arch root ports to specified composition and component ports
connect(archModel,archModel.Ports(1),composition.Ports(1));
% Use find to construct port specifications
connect(archModel,...
find(archModel,'Port','Name','APP_Hw'),...
find(composition,'Port','Name','APP_Hw'));
connect(archModel,actuator.Ports(2),archModel.Ports(3));
components_in_arch_top_level =
2×1 Component array with properties:
Name
Kind
Ports
ReferenceName
Parent
SimulinkHandle
components_in_all_hierarchy =
4×1 Component array with properties:
Name
Kind
Ports
ReferenceName
Parent
SimulinkHandle
composition_ports =
4×1 CompPort array with properties:
Kind
Connected
Name
1-96
find
Parent
SimulinkHandle
Input Arguments
archCCM — Component, composition, or architecture model
handle
Type of AUTOSAR architecture element to find. Valid categories are Component, Composition,
Port, or Connector.
Example: 'Component'
Specify true to search all levels of an AUTOSAR composition or architecture model hierarchy for the
specified architecture elements. The default scope of find is the top level of the specified
composition or architecture model, not all levels of the model hierarchy.
Example: 'AllLevels',true
Valid property of the specified category of architecture elements, and a value to match for that
property in the search.
Example: 'Name','APP_Hw'
Output Arguments
archElements — Elements found
handle | array of handles
Version History
Introduced in R2020a
1-97
1 Functions
See Also
get | set
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-98
find
find
Package: autosar.api
Syntax
modelElementsFound = find(slMap,category)
Description
modelElementsFound = find(slMap,category) returns an array of handles, paths, or names of
model elements of type category.
Examples
In the Simulink® code mappings of the model autosar_swc, find model workspace parameters.
open_system("autosar_swc");
mapObj = autosar.api.getSimulinkMapping("autosar_swc");
states = find(mapObj,"States")
states =
"autosar_swc/Integrator"
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
SimulinkMapping object
Category of model elements that you search for in the model code mappings, as specified as one of
the values listed in this table:
1-99
1 Functions
Category Description
"Inports" An array of block handles of Inports present
within the specified model
"Outports" An array of block handles of Outports present
within the specified model
"Signals" An array of block handles of Signals present
within the specified model
"States" A cell array containing the path handle(s) of all
States present in the specified model
"DataStores" An array containing the path handle(s) of all Data
Stores present in the specified model
"DataTransfers" A cell array containing the block handles of all
Data Transfers present in the specified model
"Functions" A string array of the Function names present in
the specified model
"FunctionCallers" A cell array containing the block handle(s) of all
Function Caller blocks present in the specified
model
"ModelParameterArguments" A cell array containing the model parameter
argument names present in the specified model
Output Arguments
modelElementsFound — Model elements found
array | string vector
Model elements found, returned as an array of objects, or string vector of object paths or names.
Each object or string identifies a model element of the specified category.
Version History
Introduced in R2023a
See Also
autosar.api.getSimulinkMapping
1-100
get
get
Package: autosar.api
Syntax
pValue = get(arProps,elementPath,property)
Description
pValue = get(arProps,elementPath,property) returns the value of the specified property of
the AUTOSAR element at elementPath.
Examples
For a model, get the value of the IsService property for the sender-receiver interface Interface1.
The variable IsService returns false (0), indicating that the sender-receiver interface is not a
service.
hModel = 'autosar_swc_expfcns';
openExample(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
isService = get(arProps,'Interface1','IsService')
isService =
logical
0
For an AUTOSAR model, to prepare for setting the symbol property for runnable Runnable1 to
test_symbol, get the AUTOSAR component qualified name and the existing runnable symbol name.
hModel = 'autosar_swc_expfcns';
openExample(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
compQName = get(arProps,'XmlOptions','ComponentQualifiedName');
runnables = find(arProps,compQName,'Runnable','PathType','FullyQualified');
runnables(2)
ans =
1×1 cell array
{'/pkg/swc/ASWC/IB/Runnable1'}
get(arProps,runnables{2},'symbol')
ans =
'Runnable1'
set(arProps,runnables{2},'symbol','test_symbol')
get(arProps,runnables{2},'symbol')
1-101
1 Functions
ans =
'test_symbol'
Input Arguments
arProps — AUTOSAR properties information for a model
handle
Path to the AUTOSAR element for which to return the value of a property.
Example: 'Input'
Property for which to return a value, among valid properties of the AUTOSAR element.
Example: 'IsService'
Output Arguments
pValue — Property value or path
value of property | path to composite property or property that references other properties
Variable that returns the value of the specified AUTOSAR property. For composite properties or
properties that reference other properties, the return value is the path to the property.
Example: ifPaths
Version History
Introduced in R2013b
See Also
autosar.api.getAUTOSARProperties | set | autosar.api.getAUTOSARProperties XML Options
Settings
Topics
“AUTOSAR Property and Map Function Examples”
“Configure and Map AUTOSAR Component Programmatically”
“AUTOSAR Component Configuration”
1-102
get
get
Package: autosar.arch
Syntax
pValue = get(archElement,property)
Description
pValue = get(archElement,property) returns the current value pValue of the specified
property for AUTOSAR architecture element archElement. The archElement argument is a
component, composition, port, or connector handle returned by a previous call to addComponent,
addComposition, addPort, connect, or find.
Examples
In an AUTOSAR architecture model, find ports located in all levels of the model hierarchy. Get and list
their Kind and Name property values.
% Create AUTOSAR architecture model
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
% Set properties
set(composition.Ports(1),'Name','NewPortName1'); % Rename 2 composition ports
set(composition.Ports(3),'Name','NewPortName2');
set(find(controller,'Port','Name','TPS_Perc'),...
'Name','NewPortName3'); % Rename port for Controller1 component & implementation
set(controller,'Kind','ServiceProxy'); % Component type for Controller1 component
set(controller,'Name','Instance1'); % Name for Controller1 component
1-103
1 Functions
ports_in_hierarchy =
7×1 CompPort array with properties:
Kind
Connected
Name
Parent
SimulinkHandle
Input Arguments
archElement — Architecture element
handle
AUTOSAR architecture element for which to return the current value of a property. The argument is a
component, composition, port, or connector handle returned by a previous call to addComponent,
addComposition, addPort, connect, or find.
Example: port
Property for which to return a value, among valid properties of the AUTOSAR architecture element.
Example: 'Name'
Output Arguments
pValue — Property value
value of property
Returns the value of the specified property of the specified AUTOSAR architecture element.
Version History
Introduced in R2020a
See Also
find | set
Topics
“Configure AUTOSAR Architecture Model Programmatically”
1-104
get
1-105
1 Functions
getClassName
Get class name of model
Syntax
name = getClassName(slMap)
Description
name = getClassName(slMap) returns the class name of the model.
Examples
Open the model. To access the mapping information associated with the model, slMap, use the
autosar.api.getSimulinkMapping function.
%% Open an adaptive AUTOSAR model
hModel = 'autosar_LaneGuidance';
openExample(hModel);
To access the class name of the model, use the getClassName function. If you did not specify a class
name for the model, the getClassName function returns an empty character vector and the class
name in the generated code uses the model name as the default class name.
name = getClassName(slMap)
name =
Specify a class name for the model by using the setClassName function.
setClassName(slMap, 'myClassName');
name =
'myClassName'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-106
getClassName
Output Arguments
name — Class name of model
character vector
Class name of model returned as a character vector. If you do not specify a class name, the class
name in the generated code uses the model name as the default class name.
Version History
Introduced in R2021a
See Also
autosar.api.getSimulinkMapping | setClassName | getClassNamespace | setClassName
Topics
“Configure AUTOSAR Adaptive Code Generation”
1-107
1 Functions
getClassNamespace
Get class namespace for a model
Syntax
namespace = getClassNamespace(slMap)
Description
namespace = getClassNamespace(slMap) returns the class namespace specified for the model.
Class namespaces can help to prevent name conflicts in large projects.
Examples
Open the model. To access the mapping information associated with the model, slMap, use the
autosar.api.getSimulinkMapping function.
%% Open an adaptive AUTOSAR model
hModel = 'autosar_LaneGuidance';
openExample(hModel);
To access the namespace of the model, use the getClassNamespace function. If you did not specify
a namespace for the model, the getClassNamespace function returns an empty character vector.
name = getClassNamespace(slMap)
name =
name =
'myClassNamespace'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-108
getClassNamespace
Output Arguments
namespace — Class namespace of model
character vector
Class namespace of model returned as a character vector. If you did not specify a namespace for the
model, the getClassNamespace function returns an empty character vector.
Version History
Introduced in R2021a
See Also
autosar.api.getSimulinkMapping | setClassNamespace | getClassName | setClassName
Topics
“Configure AUTOSAR Adaptive Code Generation”
1-109
1 Functions
getComponentNames
Package: arxml
Syntax
names = getComponentNames(ar)
names = getComponentNames(ar,compKind)
Description
names = getComponentNames(ar) returns the names of AUTOSAR software components found in
the XML files associated with arxml.importer object ar. By default, the function returns the names
of atomic software components, including application, sensor/actuator, complex device driver, ECU
abstraction, and service proxy software components.
Examples
Get the names of AUTOSAR atomic software components present in an ARXML file. The ARXML file is
located at matlabroot/examples/autosarblockset/data, which is on the default MATLAB
search path.
names =
5×1 cell array
{'/Company/Components/Controller' }
{'/Company/Components/ThrottlePositionMonitor' }
{'/Company/Components/AccelerationPedalPositionSensor'}
{'/Company/Components/ThrottlePositionActuator' }
{'/Company/Components/ThrottlePositionSensor' }
createComponentAsModel(ar,'/Company/Components/Controller',...
'ModelPeriodicRunnablesAs','AtomicSubsystem');
Get the names of AUTOSAR sensor-actuator software components present in an ARXML file. The
ARXML file is located at matlabroot/examples/autosarblockset/data, which is on the default
MATLAB search path.
1-110
getComponentNames
ar = arxml.importer('ThrottlePositionControlComposition.arxml');
names = getComponentNames(ar,'SensorActuator')
names =
3×1 cell array
{'/Company/Components/AccelerationPedalPositionSensor'}
{'/Company/Components/ThrottlePositionActuator' }
{'/Company/Components/ThrottlePositionSensor' }
Get the names of AUTOSAR software compositions present in an ARXML file. The ARXML file is
located at matlabroot/examples/autosarblockset/data, which is on the default MATLAB
search path.
names =
1×1 cell array
{'/Company/Components/ThrottlePositionControlComposition'}
createCompositionAsModel(ar,'/Company/Components/ThrottlePositionControlComposition');
Input Arguments
ar — arxml.importer object
handle
AUTOSAR information previously imported from XML files, specified as an arxml.importer object
handle.
Output Argument
names — Names array
cell array of character vectors
Variable that returns an array of component names. Each array element is the absolute short-name
path of an AUTOSAR software component.
Example: {'/pkg/swc/tpSensor','/pkg/swc/tpActuator'}
Version History
Introduced in R2008a
See Also
arxml.importer | createComponentAsModel | createCompositionAsModel
1-111
1 Functions
Topics
“Import AUTOSAR XML Descriptions Into Simulink”
“AUTOSAR ARXML Importer”
1-112
getDataDefaults
getDataDefaults
Get default end-to-end (E2E) protection method for AUTOSAR component model
Syntax
e2eMethod = getDataDefaults(slMap,elementCategory,property)
Description
e2eMethod = getDataDefaults(slMap,elementCategory,property) returns the default
setting for the end-to-end (E2E) protection method property in the modeling element category inports
and outports of an AUTOSAR component model.
Use E2E protection to optionally configure sender and receiver ports to securely transmit data
between AUTOSAR components. The default end-to-end protection method sets which end-to-end
protection method is used for root-level inports and outports in the generated code.
Supported protection methods are E2E Transformer and E2E Protection Wrapper.
The protection method is applied to AUTOSAR inports that are configured in the code mappings as
EndToEndRead and AUTOSAR outports that are configured as EndToEndWrite.
Examples
Get Default E2E Protection Setting for Root-Level Inports and Outports
Return the default end-to-end protection method setting for the AUTOSAR component model.
slMap = autosar.api.getSimulinkMapping(hModel);
e2eMethod = getDataDefaults(slMap, ...
'InportsOutports', 'EndToEndProtectionMethod');
e2eMethod =
'ProtectionWrapper'
Set and then read back the default E2E protection method.
setDataDefaults(slMap,'InportsOutports', ...
'EndToEndProtectionMethod', 'TransformerError');
e2eMethod = getDataDefaults(slMap,...
'InportsOutports', 'EndToEndProtectionMethod');
e2eMethod =
'TransformerError'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-113
1 Functions
Simulink to AUTOSAR mapping information for a model, specified as a function handle. Obtain this
information using autosar.api.getSimulinkMapping(model), where model is a handle,
character vector, or string scalar representing the model name.
Example: slMap
Category of model data elements that apply the end-to-end protection property, specified as
'InportsExports'. The only supported modeling element is inports and outports.
Default end-to-end protection method property that you return a value for, specified as
'EndToEndProtectionMethod'. The only supported property is E2E protection method.
Output Arguments
e2eMethod — Name of the default E2E protection method parameter
'ProtectionWrapper' | 'TransformerError'
Name of the default E2E protection method parameter, returned as one of the following:
• 'ProtectionWrapper':
E2E Protection Wrapper, which uses an E2E protection wrapper in the generated code in support
of end-to-end data consistency checks.
E2E Transformer, which configures RTE calls to use a transformer error argument in the
generated code.
Version History
Introduced in R2022b
See Also
autosar.api.getSimulinkMapping | setDataDefaults
Topics
“Configure AUTOSAR S-R Interface Port for End-To-End Protection”
1-114
getDataStore
getDataStore
Package: autosar.api
Syntax
arValue = getDataStore(slMap,slBlockHandle)
arValue = getDataStore(slMap,slBlockHandle,arProperty)
Description
arValue = getDataStore(slMap,slBlockHandle)returns the type of AUTOSAR variable
mapped to Simulink data store memory block slBlockHandle. AUTOSAR variable types include
ArTypedPerInstanceMemory and StaticMemory for classic models and Persistency for
adaptive models.
Examples
Get AUTOSAR mapping and property information for the Simulink data store memory block Data
Store Memory in example model autosar_bsw_sensor1.
hModel = 'autosar_bsw_sensor1';
hBlock = 'autosar_bsw_sensor1/Data Store Memory';
openExample(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);
mapDataStore(slMap,hBlock,'ArTypedPerInstanceMemory','NeedsNVRAMAccess','true');
arMappedTo = getDataStore(slMap,hBlock)
arNvram = getDataStore(slMap,hBlock,'NeedsNVRAMAccess')
arMappedTo =
'ArTypedPerInstanceMemory'
arNvram =
'true'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-115
1 Functions
Name or handle of Simulink data store memory block for which to return AUTOSAR mapping
information.
Example: 'autosar_bsw_sensor1/Data Store Memory'
For AUTOSAR classic models, valid property names include ShortName, SwAddrMethod,
SwCalibrationAccess, DisplayFormat, and LongName. For ArTypedPerInstancememory, you
can specify NeedsNVRAMAccess. For StaticMemory, you can specify C type qualifier properties
IsVolatile or Qualifier (AUTOSAR additional native type qualifier).
For AUTOSAR adaptive models, valid property names include Port and DataElement.
Output Arguments
arValue — Value of AUTOSAR variable type or property
character vector
Variable that returns either the type of the mapped AUTOSAR variable or the value of a variable
property.
Example: arValue
Version History
Introduced in R2019a
See Also
autosar.api.getSimulinkMapping | mapDataStore | Data Store Memory
Topics
“Map Data Stores to AUTOSAR Variables”
“Map Submodel Data Stores to AUTOSAR Variables”
“Map Data Stores to AUTOSAR Persistent Memory Ports and Data Elements”
“Configure AUTOSAR Per-Instance Memory”
“Configure AUTOSAR Static Memory”
“Model AUTOSAR Adaptive Persistent Memory”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-116
getDataTransfer
getDataTransfer
Package: autosar.api
Syntax
[arIrvName,arDataAccessMode] = getDataTransfer(slMap,slDataTransfer)
Description
[arIrvName,arDataAccessMode] = getDataTransfer(slMap,slDataTransfer) returns the
values of the AUTOSAR inter-runnable variable arIrvName and AUTOSAR data access mode
arDataAccessMode that are mapped to Simulink data transfer line or Rate Transition block
slDataTransfer.
Examples
Get AUTOSAR mapping information for a data transfer line in the example model
autosar_swc_expfcns. The model has data transfer lines named irv1, irv2, irv3, and irv4.
hModel = 'autosar_swc_expfcns';
open_system(hModel);
slMap=autosar.api.getSimulinkMapping(hModel);
[arIrvName,arDataAccessMode]=getDataTransfer(slMap,'irv4')
arIrvName =
'IRV4'
arDataAccessMode =
'Implicit'
Get AUTOSAR mapping information for a Rate Transition block in the example model
mMultitasking_4rates. The model has Rate Transition blocks named RateTransition,
RateTransition1, and RateTransition2, which are located at the top level of the model.
hModel = 'mMultitasking_4rates';
open_system(hModel);
slMap=autosar.api.getSimulinkMapping(hModel);
[arIrvName,arDataAccessMode]=getDataTransfer(slMap,'mMultitasking_4rates/RateTransition')
arIrvName =
'IRV1'
1-117
1 Functions
arDataAccessMode =
'Implicit'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
slDataTransfer — Simulink data transfer line name or Rate Transition full block path
character vector | string scalar
Name of the Simulink data transfer line or full block path to the Rate Transition block for which to
return AUTOSAR mapping information.
Example: 'irv4'
Example: 'myModel/RateTransition2'
Output Arguments
arIrvName — Name of AUTOSAR inter-runnable variable
character vector
Variable that returns the name of AUTOSAR inter-runnable variable mapped to the specified Simulink
data transfer.
Example: arIrvName
Variable that returns the value of the AUTOSAR data access mode mapped to the specified Simulink
data transfer. The value is Implicit or Explicit.
Example: arDataAccessMode
Version History
Introduced in R2013b
See Also
autosar.api.getSimulinkMapping | mapDataTransfer
Topics
“Map Data Transfers to AUTOSAR Inter-Runnable Variables”
“Model AUTOSAR Component Behavior”
“AUTOSAR Property and Map Function Examples”
1-118
getDataTransfer
1-119
1 Functions
getFunction
Package: autosar.api
Syntax
arRunnableName = getFunction(slMap,slEntryPointFunction)
[arRunnableName,arRunnableSwAddrMethod,arInternalDataSwAddrMethod] =
getFunction(slMap,slEntryPointFunction)
Description
arRunnableName = getFunction(slMap,slEntryPointFunction) returns the name of the
AUTOSAR runnable arRunnableName mapped to Simulink entry-point function
slEntryPointFunction.
[arRunnableName,arRunnableSwAddrMethod,arInternalDataSwAddrMethod] =
getFunction(slMap,slEntryPointFunction) returns the names of function and internal data
software address methods (SwAddrMethods) defined for the mapped AUTOSAR runnable. If a
SwAddrMethod is not defined, the function returns '<None>'.
Examples
Get the name of the AUTOSAR runnable mapped to a Simulink entry-point function in the example
model autosar_swc. The model has an initialize entry-point function named Runnable_Init and
periodic entry-point functions named Runnable_1s and Runnable_2s.
hModel = 'autosar_swc';
openExample(hModel);
slMap=autosar.api.getSimulinkMapping(hModel);
arRunnableName=getFunction(slMap,'Initialize')
arRunnableName =
'Runnable_Init'
Get AUTOSAR SwAddrMethod names for a Simulink entry-point function in the example model
autosar_swc_counter. The model has a single-tasking periodic entry-point function.
hModel = 'autosar_swc_counter';
openExample(hModel);
1-120
getFunction
swAddrPaths = find(arProps,[],'SwAddrMethod','PathType','FullyQualified',...
'SectionType','Code')
addPackageableElement(arProps,'SwAddrMethod',...
'/Company/Powertrain/DataTypes/SwAddrMethods','myVAR',...
'SectionType','Var')
swAddrPaths = find(arProps,[],'SwAddrMethod','PathType','FullyQualified',...
'SectionType','Var')
% Map periodic function and internal data to myCODE and myVAR SwAddrMethods
slMap = autosar.api.getSimulinkMapping(hModel);
mapFunction(slMap,'Periodic','Runnable_Step',...
'SwAddrMethod','myCODE','SwAddrMethodForInternalData','myVAR')
swAddrPaths =
1×2 cell array
{'/Company/Powertrain/DataTypes/SwAddrMethods/CODE'}
{'/Company/Powertrain/DataTypes/SwAddrMethods/myCODE'}
swAddrPaths =
1×2 cell array
{'/Company/Powertrain/DataTypes/SwAddrMethods/VAR'}
{'/Company/Powertrain/DataTypes/SwAddrMethods/myVAR'}
arRunnableName =
'Runnable_Step'
arRunnableSwAddrMethod =
'myCODE'
arInternalDataSwAddrMethod =
'myVAR'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
Simulink entry-point function for which to return AUTOSAR mapping information. The value format is
based on the function type.
1-121
1 Functions
Example: 'Periodic:D1'
Output Arguments
arRunnableName — Name of AUTOSAR runnable
character vector
Variable that returns the name of the AUTOSAR runnable mapped to the specified Simulink entry-
point function object.
Example: arRunnableName
Variable that returns the name of the SwAddrMethod defined for the AUTOSAR runnable function.
Example: arRunnableSwAddrMethod
Variable that returns the name of the SwAddrMethod defined for the AUTOSAR runnable internal
data.
Example: arInternalDataSwAddrMethod
Version History
Introduced in R2013b
1-122
getFunction
See Also
autosar.api.getSimulinkMapping | mapFunction
Topics
“Map Entry-Point Functions to AUTOSAR Runnables”
“Configure AUTOSAR Runnables and Events”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-123
1 Functions
getFunctionCaller
Package: autosar.api
Syntax
[arPortName,arOperationName] = getFunctionCaller(slMap,slFcnName)
Description
[arPortName,arOperationName] = getFunctionCaller(slMap,slFcnName) returns the
value of the AUTOSAR client port arPortName and AUTOSAR operation arOperationName mapped
to the Simulink function caller block for Simulink function slFcnName.
Examples
Get AUTOSAR mapping information for a function-caller block in a model in which AUTOSAR client
function invocation is being modeled. The model has a function-caller block for Simulink® function
readData.
hModel = 'mControllerWithInterface_client';
open_system(hModel);
slMapC = autosar.api.getSimulinkMapping(hModel);
mapFunctionCaller(slMapC,'readData','cPort','readData');
[arPort,arOp] = getFunctionCaller(slMapC,'readData')
arPort =
'cPort'
arOp =
'readData'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-124
getFunctionCaller
Name of the Simulink function for the function-caller block for which to return AUTOSAR mapping
information.
Example: 'readData'
Output Arguments
arPortName — Name of AUTOSAR client port
character vector
Variable that returns the name of the AUTOSAR client port mapped to the specified function-caller
block.
Example: arPort
Variable that returns the name of the AUTOSAR operation mapped to the specified function-caller
block.
Example: arOp
Version History
Introduced in R2014b
See Also
autosar.api.getSimulinkMapping | mapFunctionCaller
Topics
“Map Function Callers to AUTOSAR Client-Server Ports and Operations”
“Configure AUTOSAR Client-Server Communication”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-125
1 Functions
getInport
Package: autosar.api
Syntax
[arPortName,arDataElementName,arDataAccessMode] = getInport(slMap,slPortName)
Description
[arPortName,arDataElementName,arDataAccessMode] = getInport(slMap,slPortName)
returns the values of the AUTOSAR port arPortName, AUTOSAR data element
arDataElementName, and AUTOSAR data access mode arDataAccessMode mapped to Simulink
inport slPortName.
Examples
Get AUTOSAR mapping information for a model inport in the example model
autosar_swc_expfcns. The model has an inport named RPort_DE1.
hModel = 'autosar_swc_expfcns';
openExample(hModel);
slMap=autosar.api.getSimulinkMapping(hModel);
[arPortName,arDataElementName,arDataAccessMode]=getInport(slMap,'RPort_DE1')
arPortName =
RPort
arDataElementName =
DE1
arDataAccessMode =
ImplicitReceive
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
Name of the model inport for which to return AUTOSAR mapping information.
1-126
getInport
Example: 'Input'
Output Arguments
arPortName — Name of AUTOSAR port
character vector
Variable that returns the name of the AUTOSAR port mapped to the specified Simulink inport.
Example: arPortName
Variable that returns the name of the AUTOSAR data element mapped to the specified Simulink
inport.
Example: arDataElementName
Variable that returns the value of the AUTOSAR data access mode mapped to the specified Simulink
inport. The value can be ImplicitReceive, ExplicitReceive, QueuedExplicitReceive,
ErrorStatus, ModeReceive, IsUpdated, EndToEndRead, or ExplicitReceiveByVal
Example: arDataAccessMode
Version History
Introduced in R2013b
See Also
autosar.api.getSimulinkMapping | mapInport
Topics
“Map Inports and Outports to AUTOSAR Sender-Receiver Ports and Data Elements”
“Configure AUTOSAR Sender-Receiver Communication”
“Configure AUTOSAR Queued Sender-Receiver Communication”
“Map Inports and Outports to AUTOSAR Service Ports and Events”
“Model AUTOSAR Adaptive Service Communication”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-127
1 Functions
getInternalDataPackaging
Package: autosar.api
Syntax
pkgSetting = getInternalDataPackaging(slMap)
Description
pkgSetting = getInternalDataPackaging(slMap) returns the data packaging setting
pkgSetting, which specifies the default packaging for internal data stores, signals, and states in the
generated code for an AUTOSAR component model.
Packaging options differ depending on whether the component model instantiates an AUTOSAR
software component once or multiple times. Multi-instance software components can generate
reentrant, reusable functions. See “Multi-Instance Components” for more information.
• Default — Accept the default internal data packaging provided by the software. Use Default
for submodels referenced from AUTOSAR component models.
• PrivateGlobal — Package internal variable data without a struct object and make it
private (visible only to model.c).
• PrivateStructure — Package internal variable data in a struct object and make it private
(visible only to model.c).
• PublicGlobal — Package internal variable data without a struct object and make it public
(extern declaration in model.h).
• PublicStructure — Package internal variable data in a struct object and make it public
(extern declaration in model.h).
• For multi-instance models:
• Default — Accept the default internal data packaging provided by the software. Use Default
for submodels referenced from AUTOSAR component models.
• CTypedPerInstanceMemory — Package internal variable data for each instance of an
AUTOSAR software component to use C-typed per-instance memory in a struct object and
make it public (declaration in model.h).
• ArTypedPerInstanceMemory — Package internal variable data for each instance of an
AUTOSAR software component to use AUTOSAR-typed per-instance memory in a struct
object and make it public (declaration in Rte_Type.h). Setting ArTypedPerInstanceMemory
is not supported for models that contain model references.
When the data packaging setting is ArTypedPerInstanceMemory, code generation does not
support bitfield optimizations. If you configure ArTypedPerInstanceMemory, configuration
parameters BooleansAsBitfields, StateBitsets, and DataBitsets must be disabled.
1-128
getInternalDataPackaging
If the model configuration option Generate separate internal data per entry-point function is set
for the AUTOSAR model, task-based internal data grouping overrides the AUTOSAR internal data
packaging setting. However, the AUTOSAR setting determines the public or private visibility of the
generated internal data groups.
Examples
Return and modify the default data packaging setting used for internal variables in the generated
code for the AUTOSAR component model.
hModel = 'autosar_swc';
openExample(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);
pkgSetting1 = getInternalDataPackaging(slMap)
setInternalDataPackaging(slMap,'PrivateStructure')
pkgSetting2 = getInternalDataPackaging(slMap)
pkgSetting1 =
'Default'
pkgSetting2 =
'PrivateStructure'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for model
handle
Output Arguments
pkgSetting — Default internal data packaging setting
'Default' (default) | 'PrivateGlobal' | 'PrivateStructure' | 'PublicGlobal' |
'PublicStructure' | 'CTypedPerInstanceMemory' | 'ArTypedPerInstanceMemory'
Default internal data packaging setting used for internal variables in the generated code for the
AUTOSAR component model, returned as character vector. Values for single-instance models can be
'Default', 'PrivateGlobal', 'PrivateStructure', 'PublicGlobal', and
'PublicStructure'. Valid values for multi-instance models are 'Default',
'CTypedPerInstanceMemory', and 'ArTypedPerInstanceMemory'.
Version History
Introduced in R2021a
1-129
1 Functions
R2023b: Support for AUTOSAR-typed per-instance memory default for internal data
packaging
See Also
setInternalDataPackaging | autosar.api.getSimulinkMapping
Topics
“Map AUTOSAR Elements for Code Generation”
“AUTOSAR Component Configuration”
1-130
getOutport
getOutport
Package: autosar.api
Syntax
[arPortName,arDataElementName,arDataAccessMode] = getOutport(slMap,
slPortName)
Description
[arPortName,arDataElementName,arDataAccessMode] = getOutport(slMap,
slPortName) returns the values of the AUTOSAR provider port arPortName, AUTOSAR data
element arDataElementName, and AUTOSAR data access mode arDataAccessMode mapped to
Simulink outport slPortName.
Examples
Get AUTOSAR mapping information for a model outport in the example model
autosar_swc_expfcns. The model has an outport named PPort_DE1.
hModel = 'autosar_swc_expfcns';
openExample(hModel);
slMap=autosar.api.getSimulinkMapping(hModel);
[arPortName,arDataElementName,arDataAccessMode]=getOutport(slMap,'PPort_DE1')
arPortName =
PPort
arDataElementName =
DE1
arDataAccessMode =
ImplicitSend
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
Name of the model outport for which to return AUTOSAR mapping information.
1-131
1 Functions
Example: 'Output'
Output Arguments
arPortName — Name of AUTOSAR port
character vector
Variable that returns the name of the AUTOSAR port mapped to the specified Simulink outport.
Example: arPortName
Variable that returns the name of the AUTOSAR data element mapped to the specified Simulink
outport.
Example: arDataElementName
Variable that returns the value of the AUTOSAR data access mode mapped to the specified Simulink
outport. The value can be ImplicitSend, ImplicitSendByRef, ExplicitSend, EndToEndWrite,
ModeSend, or QueuedExplicitSend.
Example: arDataAccessMode
Version History
Introduced in R2013b
See Also
autosar.api.getSimulinkMapping | mapOutport
Topics
“Map Inports and Outports to AUTOSAR Sender-Receiver Ports and Data Elements”
“Configure AUTOSAR Sender-Receiver Communication”
“Configure AUTOSAR Queued Sender-Receiver Communication”
“Map Inports and Outports to AUTOSAR Service Ports and Events”
“Model AUTOSAR Adaptive Service Communication”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-132
getParameter
getParameter
Package: autosar.api
Syntax
arValue = getParameter(slMap,slParameter)
arValue = getParameter(slMap,slParameter,arProperty)
Description
arValue = getParameter(slMap,slParameter) returns the type of AUTOSAR parameter
mapped to Simulink model workspace parameter slParameter. AUTOSAR parameter types include
SharedParameter, PerInstanceParameter, ConstantMemory, and PortParameter.
Examples
Get AUTOSAR mapping and property information for Simulink model workspace parameters K and
INC in example model autosar_swc_counter.
hModel = 'autosar_swc_counter';
openExample(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);
mapParameter(slMap,'K','SharedParameter')
arMappedTo = getParameter(slMap,'K')
arValue = getParameter(slMap,'K','SwCalibrationAccess')
mapParameter(slMap,'INC','ConstantMemory','SwCalibrationAccess','ReadOnly')
arMappedTo = getParameter(slMap,'INC')
arValue = getParameter(slMap,'INC','SwCalibrationAccess')
arMappedTo =
'SharedParameter'
arValue =
'ReadWrite'
arMappedTo =
'ConstantMemory'
arValue =
'ReadOnly'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-133
1 Functions
Name of Simulink model workspace parameter for which to return AUTOSAR mapping information.
Example: 'INC'
Output Arguments
arValue — Value of AUTOSAR parameter type or property
character vector
Variable that returns either the type of the mapped AUTOSAR component parameter or the value of a
parameter property.
Example: arValue
Version History
Introduced in R2018b
See Also
autosar.api.getSimulinkMapping | mapParameter
Topics
“Map Model Workspace Parameters to AUTOSAR Component Parameters”
“Map Submodel Parameters to AUTOSAR Component Parameters”
“Configure AUTOSAR Constant Memory”
“Configure AUTOSAR Shared or Per-Instance Parameters”
“Configure AUTOSAR Port Parameters for Communication with Parameter Component”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-134
getSignal
getSignal
Package: autosar.api
Syntax
arValue = getSignal(slMap,slPortHandle)
arValue = getSignal(slMap,slPortHandle,arProperty)
Description
arValue = getSignal(slMap,slPortHandle) returns the type of AUTOSAR variable mapped to
the named or test-pointed Simulink block signal associated with outport port handle slPortHandle.
AUTOSAR variable types include ArTypedPerInstanceMemory and StaticMemory.
Examples
Get AUTOSAR mapping and property information for the Simulink block signals for blocks RelOpt
and Sum in example model autosar_swc_counter.
hModel = 'autosar_swc_counter';
openExample(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);
portHandles = get_param('autosar_swc_counter/RelOpt','portHandles');
outportHandle = portHandles.Outport;
mapSignal(slMap,outportHandle,'StaticMemory')
arMappedTo = getSignal(slMap,outportHandle)
arValue = getSignal(slMap,outportHandle,'SwCalibrationAccess')
portHandles = get_param('autosar_swc_counter/Sum','portHandles');
outportHandle = portHandles.Outport;
mapSignal(slMap,outportHandle,'ArTypedPerInstanceMemory',...
'SwCalibrationAccess','ReadWrite')
arMappedTo = getSignal(slMap,outportHandle)
arValue = getSignal(slMap,outportHandle,'SwCalibrationAccess')
arMappedTo =
'StaticMemory'
arValue =
'ReadOnly'
arMappedTo =
'ArTypedPerInstanceMemory'
1-135
1 Functions
arValue =
'ReadWrite'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
Outport port handle for a named or test-pointed Simulink block signal to return AUTOSAR mapping
information for. Use MATLAB commands to construct the outport port handle. For example, for a
Relational Operator block named RelOpt:
portHandles = get_param('autosar_swc_counter/RelOpt','portHandles');
outportHandle = portHandles.Outport;
Example: outportHandle
Name of AUTOSAR variable property. Valid property names include ShortName, SwAddrMethod,
SwCalibrationAccess, DisplayFormat, and LongName. For StaticMemory, you can also specify
C type qualifier properties IsVolatile or Qualifier (AUTOSAR additional native type qualifier).
For property descriptions, see mapSignal.
Example: 'SwCalibrationAccess'
Output Arguments
arValue — Value of AUTOSAR variable type or property
character vector
Variable that returns either the type of the mapped AUTOSAR variable or the value of a variable
property.
Example: arValue
Version History
Introduced in R2018b
See Also
autosar.api.getSimulinkMapping | addSignal | mapSignal | removeSignal
Topics
“Map Block Signals and States to AUTOSAR Variables”
1-136
getSignal
1-137
1 Functions
getState
Package: autosar.api
Syntax
arValue = getState(slMap,slStateOwnerBlock)
arValue = getState(slMap,slStateOwnerBlock,slState)
arValue = getState(slMap,slStateOwnerBlock,slState,arProperty)
Description
arValue = getState(slMap,slStateOwnerBlock) returns the type of AUTOSAR variable
mapped to the Simulink block state associated with state owner block slStateOwnerBlock.
AUTOSAR variable types include ArTypedPerInstanceMemory and StaticMemory.
Examples
Get AUTOSAR mapping and property information for the Simulink block state for Unit Delay block X
in example model autosar_swc_counter. The state owner block has one state.
hModel = 'autosar_swc_counter';
openExample(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);
mapState(slMap,'autosar_swc_counter/X','','ArTypedPerInstanceMemory',...
'SwCalibrationAccess','ReadWrite')
arMappedTo = getState(slMap,'autosar_swc_counter/X')
arValue = getState(slMap,'autosar_swc_counter/X','','SwCalibrationAccess')
arMappedTo =
'ArTypedPerInstanceMemory'
arValue =
'ReadWrite'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-138
getState
Handle or path to Simulink state owner block to return AUTOSAR mapping information for.
Example: 'autosar_swc_counter/X'
Name of Simulink state associated with state owner block slStateOwnerBlock. Specify a nonempty
state name only for blocks with multiple states. If slState is empty, the function returns mapping
information for the first state in the block.
Example: ''
Name of AUTOSAR variable property. Valid property names include ShortName, SwAddrMethod,
SwCalibrationAccess, DisplayFormat, and LongName. For StaticMemory, you can also specify
C type qualifier properties IsVolatile or Qualifier (AUTOSAR additional native type qualifier).
For property descriptions, see mapState.
Example: 'SwCalibrationAccess'
Output Arguments
arValue — Value of AUTOSAR variable type or property
character vector
Variable that returns either the type of the mapped AUTOSAR variable or the value of a variable
property.
Example: arValue
Version History
Introduced in R2018b
See Also
autosar.api.getSimulinkMapping | mapState
Topics
“Map Block Signals and States to AUTOSAR Variables”
“Map Submodel Signals and States to AUTOSAR Variables”
“Configure AUTOSAR Per-Instance Memory”
“Configure AUTOSAR Static Memory”
“AUTOSAR Property and Map Function Examples”
1-139
1 Functions
1-140
getXmlOptions
getXmlOptions
Package: autosar.arch
Syntax
pValue = getXmlOptions(archModel,property)
Description
pValue = getXmlOptions(archModel,property) returns the current value pValue of XML
option property in architecture model archModel. The archModel argument is a model handle
returned by a previous call to autosar.arch.createModel or autosar.arch.loadModel. For
more information about XML options, see “Configure AUTOSAR XML Options” for classic
architecture modeling and “Configure AUTOSAR Adaptive XML Options” for adaptive architecture
modeling.
Examples
For a new AUTOSAR architecture model, get the initial value of the AUTOSAR XML data type
package path.
archModel = autosar.arch.createModel('MyArchModel');
pValue = getXmlOptions(archModel,'DataTypePackage')
pValue =
'/DataTypes'
Input Arguments
archModel — Architecture model
handle
AUTOSAR architecture model for which to return the current value of an XML option value. The
argument is a model handle returned by a previous call to autosar.arch.createModel or
autosar.arch.loadModel.
Example: archModel
For more information about XML options, see “Configure AUTOSAR XML Options” for classic
architecture modeling and “Configure AUTOSAR Adaptive XML Options” for adaptive architecture
modeling..
1-141
1 Functions
Example: 'DataTypePackage'
Output Arguments
pValue — XML option value
value of option
Returns the value of the specified XML option of the specified AUTOSAR architecture model.
Version History
Introduced in R2020a
See Also
export | setXmlOptions
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Generate and Package AUTOSAR Composition XML Descriptions and Component Code”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-142
importFromARXML
importFromARXML
Package: autosar.arch.composition
Syntax
importFromARXML(archModel,arxmlInput,compQName)
importFromARXML(archModel,arxmlInput,compQName,Name,Value)
Description
importFromARXML(archModel,arxmlInput,compQName) imports composition compQName from
arxmlInput into architecture model archModel. The archModel argument is an architecture
model handle returned by a previous call to autosar.arch.createModel or
autosar.arch.loadModel. Composition import requires an open AUTOSAR architecture model
with no functional content.
Examples
This example:
1-143
1 Functions
importFromARXML(archModel,importerObj,...
"/Company/Components/ThrottlePositionControlComposition");
% Import composition from ARXML file and link existing component models
importFromARXML(archModel,'mySWCs.arxml','/pkg/rootComposition',...
'ComponentModels',{'mySwc1','mySwc2'})
% Import composition from ARXML file and use PredefinedVariant for components
importerObj = arxml.importer("MyComposition.arxml"); % Import AUTOSAR information
importFromARXML(archModel,importerObj,"/CompositionType/myComposition",...
"PredefinedVariant","/pkg/body/Variants/Senior"););
Input Arguments
archModel — Architecture model
handle
1-144
importFromARXML
AUTOSAR architecture model into which to import the specified composition. The argument is an
architecture model handle returned by a previous call to autosar.arch.createModel or
autosar.arch.loadModel.
Example: archModel
ARXML files from which to import the specified composition, specified as one of the following:
Absolute short-name path (qualified name) of the composition to import into the specified composition
or architecture model.
Example: "/CompositionType/myComposition"
Before R2021a, use commas to separate each name and value, and enclose Name in quotes.
Example: 'DataDictionary','ardata.sldd' directs the importer to place data objects
corresponding to imported AUTOSAR data types in the specified Simulink data dictionary.
Names of existing atomic software component models to link when creating a Simulink
representation of the composition. For components contained within the composition, link the
specified component behavior models instead of creating new ones.
Example: 'ComponentModels',{'mySwc1','mySwc2'}
Simulink data dictionary in which to place data objects corresponding to imported AUTOSAR data
types. If the specified dictionary does not exist, the importer creates it. The composition and its
components are then associated with that data dictionary.
Example: 'DataDictionary','ardata.sldd'
1-145
1 Functions
Specify whether to allow (default) or suppress the import of software components that define the
behavior of the composition. If component import is suppressed (true), the import still links models
specified by the ComponentModels argument.
Example: 'ExcludeInternalBehavior',true
If you specify Auto, the importer attempts to model periodic runnables as atomic subsystems. If
conditions prevent use of atomic subsystems, the importer models periodic runnables as function-call
subsystems.
For more information, see “Import AUTOSAR Software Component with Multiple Runnables”.
Example: 'ModelPeriodicRunnablesAs','AtomicSubsystem'
For more information, see “Control AUTOSAR Variants with Predefined Value Combinations”.
Example: 'PredefinedVariant','/pkg/body/Variants/Senior'
For more information, see “Control AUTOSAR Variants with Predefined Value Combinations”.
Example: 'SystemConstValueSets','{'/pkg/body/SystemConstantValues/A','/pkg/
body/SystemConstantValues/B'}'
1-146
importFromARXML
Version History
Introduced in R2020b
See Also
addComponent | addComposition | addPort | connect | destroy | layout
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Import AUTOSAR Composition from ARXML”
“Import AUTOSAR Composition into Architecture Model”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-147
1 Functions
layout
Package: autosar.arch
Syntax
layout(archCM)
Description
layout(archCM) automatically arranges the modeling elements inside composition or architecture
model archCM based on a set of heuristics. The archM argument is a composition or architecture
model handle returned by a previous call to addComposition, autosar.arch.createModel, or
autosar.arch.loadModel.
Examples
In an AUTOSAR architecture model, add AUTOSAR components, and then update the arrangement of
elements in the model layout.
% Create AUTOSAR architecture model
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
Input Arguments
archCM — Composition or architecture model
handle
AUTOSAR composition or architecture model in which to arrange modeling elements based on a set
of heuristics. The argument is a composition or architecture model handle returned by a previous call
to addComposition, autosar.arch.createModel, or autosar.arch.loadModel.
Example: archModel
Version History
Introduced in R2020a
See Also
addComponent | addComposition | addPort | connect | destroy | importFromARXML
1-148
layout
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Add and Connect AUTOSAR Classic Components and Compositions”
“Add and Connect AUTOSAR Adaptive Components and Compositions”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-149
1 Functions
linkToModel
Package: autosar.arch
Syntax
linkToModel(component,modelName)
linkToModel(composition,modelName)
Description
linkToModel(component,modelName) links the specified AUTOSAR architecture component to
existing Simulink implementation model modelName. The component inherits the interface of the
linked implementation model. The component argument is a component handle returned by a
previous call to addComponent.
Examples
Create AUTOSAR architecture model and add component inside the architecture model
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
component = addComponent(archModel,'SWC1');
Load 'autosar_tpc_controller' model and programmatically set the XML Options Source to 'Inherit'.
load_system('autosar_tpc_controller.slx');
arProps = autosar.api.getAUTOSARProperties('autosar_tpc_controller');
set(arProps,'XmlOptions','XmlOptionsSource','Inherit');
linkToModel(component,'autosar_tpc_controller');
1-150
linkToModel
Create AUTOSAR architecture model and add a composition inside the architecture model.
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
composition = addComposition(archModel,'Referenced_Sensors');
openExample('autosar_tpc_composition');
linkToModel(composition, 'autosar_tpc_composition');
Input Arguments
component — Architecture component
handle
AUTOSAR architecture component to link to the specified Simulink implementation model. The
argument is a component handle returned by a previous call to addComponent.
Example: component
AUTOSAR architecture composition to link to the specified Simulink implementation model. The
argument is a composition handle returned by a previous call to addComposition.
Example: composition
Name of the Simulink implementation model to create, based on the specified AUTOSAR architecture
component or composition. If not specified, modelName defaults to the name of the component or
composition.
Example: 'SWC1'
Version History
Introduced in R2020a
See Also
createModel | addComponent | addComposition | importFromARXML
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Define AUTOSAR Component Behavior by Creating or Linking Models”
“Define AUTOSAR Compositions by Creating or Linking Models”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-151
1 Functions
mapDataStore
Package: autosar.api
Syntax
mapDataStore(slMap,slBlockHandle,arVarType)
mapDataStore(slMap,slBlockHandle,arVarType,Name,Value)
Description
mapDataStore(slMap,slBlockHandle,arVarType) maps Simulink data store memory block
slBlockHandle to an AUTOSAR variable of type arVarType for AUTOSAR run-time calibration.
AUTOSAR variable types include ArTypedPerInstanceMemory and StaticMemory for classic
models and Persistency for adaptive models.
Examples
Set AUTOSAR mapping and property information for the Simulink data store memory block Data
Store Memory in example model autosar_bsw_sensor1.
hModel = 'autosar_bsw_sensor1';
hBlock = 'autosar_bsw_sensor1/Data Store Memory';
openExample(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);
mapDataStore(slMap,hBlock,'ArTypedPerInstanceMemory','NeedsNVRAMAccess','true');
arMappedTo = getDataStore(slMap,hBlock)
arNvram = getDataStore(slMap,hBlock,'NeedsNVRAMAccess')
arMappedTo =
'ArTypedPerInstanceMemory'
arNvram =
'true'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-152
mapDataStore
Name or handle of Simulink data store memory block that you set AUTOSAR mapping information for.
Example: 'autosar_bsw_sensor1/Data Store Memory'
Type of AUTOSAR variable that you want to map the specified Simulink data store to. Valid AUTOSAR
variable types include ArTypedPerInstanceMemory, StaticMemory, and Auto for classic models.
Valid AUTOSAR variable types include Persistency and Auto for adaptive models. To accept
software mapping defaults, specify Auto.
Example: 'StaticMemory'
Before R2021a, use commas to separate each name and value, and enclose Name in quotes.
Example: 'SwCalibrationAccess','ReadWrite' specifies read-write access to the variable for
run-time calibration.
Specify the data element of the persistency port associated with the AUTOSAR adaptive variable.
DataElement can be set with Port only.
Example: 'Port','Perport','DataElement','Delement1'
Specify display format for the AUTOSAR variable. AUTOSAR display format specifications control the
width and precision display for calibration and measurement data. For more information, see
“Configure DisplayFormat”.
Example: 'DisplayFormat','%2.6f'
Specify whether to include C type qualifier volatile in generated code for the AUTOSAR variable.
Example: 'IsVolatile','true'
Specify whether the AUTOSAR variable requires access to nonvolatile RAM on a processor. Specify
true to configure the per-instance memory to be a mirror block for a specific NVRAM block. Specify
1-153
1 Functions
RestoreAtStart to true to read data from memory at the beginning of a program. Specify
StoreAtShutdown to true to write data to memory at the end of a program.
Example: 'NeedsNVRAMAccess','true', 'RestoreAtStart', 'true',
'StoreAtShutdown', 'true'
Specify the persistency port to associate with the AUTOSAR adaptive variable. Port can be set with
DataElement only.
Example: 'Port','Perport','DataElement','Delement1'
Optionally specify an AUTOSAR additional native type qualifier to include in generated code for the
AUTOSAR variable.
Example: 'Qualifier','test_qualifier'
Specify short name for the AUTOSAR variable. If unspecified, ARXML export automatically generates
a short name, which can differ from the data store name.
Example: 'ShortName','LowSetPoint'
Specify a SwAddrMethod name that is valid for the AUTOSAR variable. Code generation uses the
SwAddrMethod name to group AUTOSAR variables in a memory section for access by calibration and
measurement tools. For a list of valid SwAddrMethod values for the variable, see the Code Mappings
editor, Data Stores tab. For more information, see “Configure SwAddrMethod”.
Example: 'SwAddrMethod','VAR'
Specify how calibration and measurement tools can access the AUTOSAR variable. Valid access
values include ReadOnly, ReadWrite, and NotAccessible. For more information, see “Configure
SwCalibrationAccess”.
Example: 'SwCalibrationAccess','ReadWrite'
1-154
mapDataStore
Version History
Introduced in R2019a
See Also
autosar.api.getSimulinkMapping | getDataStore | Data Store Memory
Topics
“Map Data Stores to AUTOSAR Variables”
“Map Submodel Data Stores to AUTOSAR Variables”
“Map Data Stores to AUTOSAR Persistent Memory Ports and Data Elements”
“Configure AUTOSAR Per-Instance Memory”
“Configure AUTOSAR Static Memory”
“Model AUTOSAR Adaptive Persistent Memory”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-155
1 Functions
mapDataTransfer
Package: autosar.api
Syntax
mapDataTransfer(slMap,slDataTransfer,arIrvName,arDataAccessMode)
Description
mapDataTransfer(slMap,slDataTransfer,arIrvName,arDataAccessMode) maps the
Simulink data transfer line or Rate Transition block slDataTransfer to AUTOSAR inter-runnable
variable arIrvName and AUTOSAR data access mode arDataAccessMode.
Examples
Set AUTOSAR mapping information for a data transfer line in the example model
autosar_swc_expfcns. The model has data transfer lines named irv1, irv2, irv3, and irv4.
This example changes the AUTOSAR data access mode for irv4 from Implicit to Explicit.
hModel = 'autosar_swc_expfcns';
open_system(hModel);
slMap=autosar.api.getSimulinkMapping(hModel);
mapDataTransfer(slMap,'irv4','IRV4','Explicit');
[arIrvName,arDataAccessMode]=getDataTransfer(slMap,'irv4')
arIrvName =
'IRV4'
arDataAccessMode =
'Explicit'
Set AUTOSAR mapping information for a Rate Transition block in the example model
mMultitasking_4rates. The model has Rate Transition blocks named RateTransition,
RateTransition1, and RateTransition2, which are located at the top level of the model. This
example changes the AUTOSAR data access mode for RateTransition from Implicit to
Explicit.
hModel = 'mMultitasking_4rates';
open_system(hModel);
slMap=autosar.api.getSimulinkMapping(hModel);
mapDataTransfer(slMap,'mMultitasking_4rates/RateTransition','IRV1','Explicit');
[arIrvName,arDataAccessMode]=getDataTransfer(slMap,'mMultitasking_4rates/RateTransition')
1-156
mapDataTransfer
arIrvName =
'IRV1'
arDataAccessMode =
'Explicit'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
slDataTransfer — Simulink data transfer line name or Rate Transition full block path
character vector | string scalar
Name of the Simulink data transfer line or full block path to the Rate Transition block for which to set
AUTOSAR mapping information.
Example: 'irv4'
Example: 'myModel/RateTransition2'
Name of the AUTOSAR inter-runnable variable to which to map the specified Simulink data transfer.
Example: 'IRV4'
Value of the AUTOSAR data access mode to which to map the specified Simulink data transfer. The
value can be Implicit or Explicit.
Example: 'Explicit'
Version History
Introduced in R2013b
See Also
autosar.api.getSimulinkMapping | getDataTransfer
Topics
“Map Data Transfers to AUTOSAR Inter-Runnable Variables”
“Model AUTOSAR Component Behavior”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-157
1 Functions
mapFunction
Package: autosar.api
Map Simulink entry-point function to AUTOSAR runnable and software address methods
Syntax
mapFunction(slMap,slEntryPointFunction,arRunnableName)
mapFunction(slMap,slEntryPointFunction,arRunnableName,Name,Value)
Description
mapFunction(slMap,slEntryPointFunction,arRunnableName) maps Simulink entry-point
function slEntryPointFunction to AUTOSAR runnable arRunnableName.
mapFunction(slMap,slEntryPointFunction,arRunnableName,Name,Value) specifies
additional properties for the AUTOSAR runnable by using one or more Name,Value pair arguments.
You can specify software address methods (SwAddrMethods) for runnable function code and internal
data.
Examples
Set AUTOSAR mapping information for a Simulink entry-point function in the example model
autosar_swc. The model has an initialize entry-point function named Runnable_Init and periodic
entry-point functions named Runnable_1s and Runnable_2s.
hModel = 'autosar_swc';
openExample(hModel);
slMap=autosar.api.getSimulinkMapping(hModel);
mapFunction(slMap,'Initialize','Runnable_Init');
arRunnableName=getFunction(slMap,'Initialize')
arRunnableName =
'Runnable_Init'
Set AUTOSAR SwAddrMethods for a Simulink entry-point function in the example model
autosar_swc_counter. The model has a single-tasking periodic entry-point step function.
hModel = 'autosar_swc_counter';
openExample(hModel);
1-158
mapFunction
addPackageableElement(arProps,'SwAddrMethod',...
'/Company/Powertrain/DataTypes/SwAddrMethods','myVAR',...
'SectionType','Var')
swAddrPaths = find(arProps,[],'SwAddrMethod','PathType','FullyQualified',...
'SectionType','Var')
% Map periodic function and internal data to myCODE and myVAR SwAddrMethods
slMap = autosar.api.getSimulinkMapping(hModel);
mapFunction(slMap,'Periodic','Runnable_Step',...
'SwAddrMethod','myCODE','SwAddrMethodForInternalData','myVAR')
swAddrPaths =
1×2 cell array
{'/Company/Powertrain/DataTypes/SwAddrMethods/CODE'}
{'/Company/Powertrain/DataTypes/SwAddrMethods/myCODE'}
swAddrPaths =
1×2 cell array
{'/Company/Powertrain/DataTypes/SwAddrMethods/VAR'}
{'/Company/Powertrain/DataTypes/SwAddrMethods/myVAR'}
arRunnableName =
'Runnable_Step'
arRunnableSwAddrMethod =
'myCODE'
arInternalDataSwAddrMethod =
'myVAR'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
Simulink entry-point function for which to set AUTOSAR mapping information. The value format is
based on the function type.
1-159
1 Functions
Example: 'Periodic:D1'
Name of AUTOSAR runnable to which to map the specified Simulink entry-point function object.
Example: 'Runnable_2s'
Before R2021a, use commas to separate each name and value, and enclose Name in quotes.
Example: 'SwAddrMethod','CODE' specifies SwAddrMethod CODE for an AUTOSAR runnable
function.
Specify a SwAddrMethod name that is valid for the AUTOSAR function. Code generation uses the
SwAddrMethod name to group AUTOSAR runnable functions in a memory section. For a list of valid
SwAddrMethod values for the function, see the Code Mappings editor, Entry-Point Functions tab.
For more information, see “Configure SwAddrMethod”.
Example: 'SwAddrMethod','CODE'
Specify a SwAddrMethod name that is valid for the AUTOSAR internal data. Code generation uses
the SwAddrMethod name to group AUTOSAR runnable internal data in a memory section. For a list of
1-160
mapFunction
valid SwAddrMethod values for the internal data, see the Code Mappings editor, Entry-Point
Functions tab. For more information, see “Configure SwAddrMethod”.
Code generation for runnable internal data SwAddrMethods requires setting the model configuration
option Code Generation > Interface > Generate separate internal data per entry-point
function (GroupInternalDataByFunction) to on.
Example: 'SwAddrMethodForInternalData','VAR'
Version History
Introduced in R2013b
See Also
autosar.api.getSimulinkMapping | getFunction
Topics
“Map Entry-Point Functions to AUTOSAR Runnables”
“Configure AUTOSAR Runnables and Events”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-161
1 Functions
mapFunctionCaller
Package: autosar.api
Syntax
mapFunctionCaller(slMap,slFcnName,arPortName,arOperationName)
Description
mapFunctionCaller(slMap,slFcnName,arPortName,arOperationName) maps the Simulink
function-caller block for Simulink function slFcnName to AUTOSAR client port arPortName and
AUTOSAR operation arOperationName.
If your model has multiple callers of Simulink function slFcnName, this function maps all of them to
the AUTOSAR client port and operation.
Examples
Set AUTOSAR mapping information for a function-caller block in a model in which AUTOSAR client
function invocation is being modeled. The model has a function-caller block for Simulink® function
readData.
hModel = 'mControllerWithInterface_client';
open_system(hModel);
slMapC = autosar.api.getSimulinkMapping(hModel);
mapFunctionCaller(slMapC,'readData','cPort','readData');
[arPort,arOp] = getFunctionCaller(slMapC,'readData')
arPort =
'cPort'
arOp =
'readData'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-162
mapFunctionCaller
Name of the Simulink function for the function-caller block for which to set AUTOSAR mapping
information.
Example: 'readData'
Name of the AUTOSAR client port to which to map the specified function-caller block.
Example: 'cPort'
Name of the AUTOSAR operation to which to map the specified function-caller block.
Example: 'readData'
Version History
Introduced in R2014b
See Also
autosar.api.getSimulinkMapping | getFunctionCaller
Topics
“Map Function Callers to AUTOSAR Client-Server Ports and Operations”
“Configure AUTOSAR Client-Server Communication”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-163
1 Functions
mapInport
Package: autosar.api
Syntax
mapInport(slMap,slPortName,arPortName,arDataElementName,arDataAccessMode)
Description
mapInport(slMap,slPortName,arPortName,arDataElementName,arDataAccessMode) maps
the Simulink inport slPortName to the AUTOSAR data element arDataElementName at AUTOSAR
receiver port arPortName. The AUTOSAR data access mode for the receiver port is set to
arDataAccessMode.
Examples
Set AUTOSAR mapping information for a model inport in the example model
autosar_swc_expfcns. The model has an inport named RPort_DE1. This example changes the
AUTOSAR data access mode for RPort_DE1 from ImplicitReceive to ExplicitReceive.
hModel = 'autosar_swc_expfcns';
openExample(hModel);
slMap=autosar.api.getSimulinkMapping(hModel);
mapInport(slMap,'RPort_DE1','RPort','DE1','ExplicitReceive');
[arPortName,arDataElementName,arDataAccessMode]=getInport(slMap,'RPort_DE1')
arPortName =
RPort
arDataElementName =
DE1
arDataAccessMode =
ExplicitReceive
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-164
mapInport
Name of the model inport for which to set AUTOSAR mapping information.
Example: 'Input'
Name of the AUTOSAR port to which to map the specified Simulink inport.
Example: 'Input'
Name of the AUTOSAR data element to which to map the specified Simulink inport.
Example: 'Input'
Value of the AUTOSAR data access mode to which to map the specified Simulink inport. The value
can be ImplicitReceive, ExplicitReceive, QueuedExplicitReceive, ErrorStatus,
ModeReceive, IsUpdated, EndToEndRead, or ExplicitReceiveByVal.
Example: 'ExplicitReceive'
Version History
Introduced in R2013b
See Also
autosar.api.getSimulinkMapping | getInport
Topics
“Map Inports and Outports to AUTOSAR Sender-Receiver Ports and Data Elements”
“Configure AUTOSAR Sender-Receiver Communication”
“Configure AUTOSAR Queued Sender-Receiver Communication”
“Map Inports and Outports to AUTOSAR Service Ports and Events”
“Model AUTOSAR Adaptive Service Communication”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-165
1 Functions
mapOutport
Package: autosar.api
Syntax
mapOutport(slMap,slPortName,arPortName,arDataElementName,arDataAccessMode)
Description
mapOutport(slMap,slPortName,arPortName,arDataElementName,arDataAccessMode)
maps the Simulink outport slPortName to the AUTOSAR data element arDataElementName at
AUTOSAR provider port arPortName. The AUTOSAR data access mode for the provider port is set to
arDataAccessMode.
Examples
Set AUTOSAR mapping information for a model outport in the example model
autosar_swc_expfcns. The model has an outport named PPort_DE1. This example changes the
AUTOSAR data access mode for PPort_DE1 from ImplicitSend to ExplicitSend.
hModel = 'autosar_swc_expfcns';
openExample(hModel);
slMap=autosar.api.getSimulinkMapping(hModel);
mapOutport(slMap,'PPort_DE1','PPort','DE1','ExplicitSend');
[arPortName,arDataElementName,arDataAccessMode]=getOutport(slMap,'PPort_DE1')
arPortName =
PPort
arDataElementName =
DE1
arDataAccessMode =
ExplicitSend
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-166
mapOutport
Name of the model outport for which to set AUTOSAR mapping information.
Example: 'Output'
Name of the AUTOSAR port to which to map the specified Simulink outport.
Example: 'Output'
Name of the AUTOSAR data element to which to map the specified Simulink outport.
Example: 'Output'
Value of the AUTOSAR data access mode to which to map the specified Simulink outport. The value
can be ImplicitSend, ImplicitSendByRef, ExplicitSend, EndToEndWrite, ModeSend, or
QueuedExplicitSend.
Example: 'ExplicitSend'
Version History
Introduced in R2013b
See Also
autosar.api.getSimulinkMapping | getOutport
Topics
“Map Inports and Outports to AUTOSAR Sender-Receiver Ports and Data Elements”
“Configure AUTOSAR Sender-Receiver Communication”
“Configure AUTOSAR Queued Sender-Receiver Communication”
“Map Inports and Outports to AUTOSAR Service Ports and Events”
“Model AUTOSAR Adaptive Service Communication”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-167
1 Functions
mapParameter
Package: autosar.api
Syntax
mapParameter(slMap,slParameter,arParamType)
mapParameter(slMap,slParameter,arParamType,Name,Value)
Description
mapParameter(slMap,slParameter,arParamType) maps the Simulink model workspace
parameter slParameter to an AUTOSAR parameter of type arParamType for AUTOSAR run-time
calibration. AUTOSAR parameter types include SharedParameter, PerInstanceParameter,
ConstantMemory, and PortParameter.
Examples
Set AUTOSAR mapping and property information for Simulink model workspace parameters K and
INC in example model autosar_swc_counter.
hModel = 'autosar_swc_counter';
openExample(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);
mapParameter(slMap,'K','SharedParameter')
arMappedTo = getParameter(slMap,'K')
arValue = getParameter(slMap,'K','SwCalibrationAccess')
mapParameter(slMap,'INC','ConstantMemory','SwCalibrationAccess','ReadOnly')
arMappedTo = getParameter(slMap,'INC')
arValue = getParameter(slMap,'INC','SwCalibrationAccess')
arMappedTo =
'SharedParameter'
arValue =
'ReadWrite'
arMappedTo =
'ConstantMemory'
1-168
mapParameter
arValue =
'ReadOnly'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
Name of the Simulink model workspace parameter for which to set AUTOSAR mapping information.
Example: 'INC'
Type of AUTOSAR component parameter to which to map the specified Simulink model workspace
parameter. Valid AUTOSAR parameter types include SharedParameter, PerInstanceParameter,
ConstantMemory, PortParameter, and Auto. To accept software mapping defaults, specify Auto.
Example: 'SharedParameter'
Before R2021a, use commas to separate each name and value, and enclose Name in quotes.
Example: 'SwCalibrationAccess','ReadOnly' specifies read-only access to the parameter for
run-time calibration.
Specify the name of a parameter interface data element configured in the AUTOSAR Dictionary.
Example: 'DataElement','ParamElement1'
Specify display format for the AUTOSAR parameter. AUTOSAR display format specifications control
the width and precision display for calibration and measurement data. For more information, see
“Configure DisplayFormat”.
Example: 'DisplayFormat','%2.6f'
1-169
1 Functions
Specify whether to include C type qualifier const in generated code for the AUTOSAR parameter.
Example: 'IsConst','true'
Specify whether to include C type qualifier volatile in generated code for the AUTOSAR
parameter.
Example: 'IsVolatile','true'
Specify the name of a parameter receiver port configured in the AUTOSAR Dictionary.
Example: 'Port','myParamPort'
Optionally specify an AUTOSAR additional native type qualifier to include in generated code for the
AUTOSAR parameter.
Example: 'Qualifier','test_qualifier'
Specify a SwAddrMethod name that is valid for the AUTOSAR parameter. Code generation uses the
SwAddrMethod name to group AUTOSAR parameters in a memory section for access by calibration
and measurement tools. For a list of valid SwAddrMethod values for the parameter, see the Code
Mappings editor, Parameters tab. For more information, see “Configure SwAddrMethod”.
Example: 'SwAddrMethod','CONST'
Specify how calibration and measurement tools can access the AUTOSAR parameter. Valid access
values include ReadOnly, ReadWrite, and NotAccessible. For more information, see “Configure
SwCalibrationAccess”.
Example: 'SwCalibrationAccess','ReadOnly'
1-170
mapParameter
Version History
Introduced in R2018b
See Also
autosar.api.getSimulinkMapping | getParameter
Topics
“Map Model Workspace Parameters to AUTOSAR Component Parameters”
“Map Submodel Parameters to AUTOSAR Component Parameters”
“Configure AUTOSAR Constant Memory”
“Configure AUTOSAR Shared or Per-Instance Parameters”
“Configure AUTOSAR Port Parameters for Communication with Parameter Component”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-171
1 Functions
mapSignal
Package: autosar.api
Syntax
mapSignal(slMap,slPortHandle,arVarType)
mapSignal(slMap,slPortHandle,arVarType,Name,Value)
Description
mapSignal(slMap,slPortHandle,arVarType) maps the named or test-pointed Simulink block
signal associated with outport port handle slPortHandle to an AUTOSAR variable of type
arVarType for AUTOSAR run-time calibration. AUTOSAR variable types include
ArTypedPerInstanceMemory and StaticMemory.
Examples
Set AUTOSAR mapping and property information for the Simulink block signals for blocks RelOpt
and Sum in example model autosar_swc_counter.
hModel = 'autosar_swc_counter';
openExample(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);
portHandles = get_param('autosar_swc_counter/RelOpt','portHandles');
outportHandle = portHandles.Outport;
mapSignal(slMap,outportHandle,'StaticMemory')
arMappedTo = getSignal(slMap,outportHandle)
arValue = getSignal(slMap,outportHandle,'SwCalibrationAccess')
portHandles = get_param('autosar_swc_counter/Sum','portHandles');
outportHandle = portHandles.Outport;
mapSignal(slMap,outportHandle,'ArTypedPerInstanceMemory',...
'SwCalibrationAccess','ReadWrite')
arMappedTo = getSignal(slMap,outportHandle)
arValue = getSignal(slMap,outportHandle,'SwCalibrationAccess')
arMappedTo =
'StaticMemory'
arValue =
'ReadOnly'
arMappedTo =
'ArTypedPerInstanceMemory'
1-172
mapSignal
arValue =
'ReadWrite'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
Outport port handle for a named or test-pointed Simulink block signal to set AUTOSAR mapping
information for. Use MATLAB commands to construct the outport port handle. For example, for a
Relational Operator block named RelOpt:
portHandles = get_param('autosar_swc_counter/RelOpt','portHandles');
outportHandle = portHandles.Outport;
Example: outportHandle
Type of AUTOSAR variable to map the specified Simulink block signal to. Valid AUTOSAR variable
types include ArTypedPerInstanceMemory, StaticMemory, and Auto. To accept software
mapping defaults, specify Auto.
Example: 'StaticMemory'
Before R2021a, use commas to separate each name and value, and enclose Name in quotes.
Example: 'SwCalibrationAccess','ReadWrite' specifies read-write access to the variable for
run-time calibration.
Specify display format for the AUTOSAR variable. AUTOSAR display format specifications control the
width and precision display for calibration and measurement data. For more information, see
“Configure DisplayFormat”.
Example: 'DisplayFormat','%2.6f'
1-173
1 Functions
Specify whether to include C type qualifier volatile in generated code for the AUTOSAR variable.
Example: 'IsVolatile','true'
Optionally specify an AUTOSAR additional native type qualifier to include in generated code for the
AUTOSAR variable.
Example: 'Qualifier','test_qualifier'
Specify a short name for the AUTOSAR variable. If unspecified, ARXML export generates a short
name, which can differ from the signal name.
Example: 'ShortName','SM_equal_to_count'
Specify a SwAddrMethod name that is valid for the AUTOSAR variable. Code generation uses the
SwAddrMethod name to group AUTOSAR variables in a memory section for access by calibration and
measurement tools. For a list of valid SwAddrMethod values for the variable, see the Code Mappings
editor, Signals/States tab. For more information, see “Configure SwAddrMethod”.
Example: 'SwAddrMethod','VAR'
Specify how calibration and measurement tools can access the AUTOSAR variable. Valid access
values include ReadOnly, ReadWrite, and NotAccessible. For more information, see “Configure
SwCalibrationAccess”.
Example: 'SwCalibrationAccess','ReadWrite'
Version History
Introduced in R2018b
See Also
autosar.api.getSimulinkMapping | addSignal | getSignal | removeSignal
Topics
“Map Block Signals and States to AUTOSAR Variables”
“Map Submodel Signals and States to AUTOSAR Variables”
1-174
mapSignal
1-175
1 Functions
mapState
Package: autosar.api
Syntax
mapState(slMap,slStateOwnerBlock,'',arVarType)
mapState(slMap,slStateOwnerBlock,slState,arVarType)
mapState(slMap,slStateOwnerBlock,slState,arVarType,Name,Value)
Description
mapState(slMap,slStateOwnerBlock,'',arVarType) maps the Simulink block state
associated with state owner block slStateOwnerBlock to an AUTOSAR variable of type arVarType
for AUTOSAR run-time calibration. AUTOSAR variable types include ArTypedPerInstanceMemory
and StaticMemory.
Examples
Set AUTOSAR mapping and property information for the Simulink block state for Unit Delay block X
in example model autosar_swc_counter. The state owner block has one state.
hModel = 'autosar_swc_counter';
openExample(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);
mapState(slMap,'autosar_swc_counter/X','','ArTypedPerInstanceMemory',...
'SwCalibrationAccess','ReadWrite')
arMappedTo = getState(slMap,'autosar_swc_counter/X')
arValue = getState(slMap,'autosar_swc_counter/X','','SwCalibrationAccess')
arMappedTo =
'ArTypedPerInstanceMemory'
arValue =
'ReadWrite'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-176
mapState
Handle or path to Simulink state owner block to set AUTOSAR mapping information for.
Example: 'autosar_swc_counter/X'
Name of Simulink state associated with state owner block slStateOwnerBlock. Specify a nonempty
state name only for blocks with multiple states. If slState is empty, the function sets mapping
information for the first state in the block.
Example: ''
Type of AUTOSAR variable to map the specified Simulink block state to. Valid AUTOSAR variable
types include ArTypedPerInstanceMemory, StaticMemory, and Auto. To accept software
mapping defaults, specify Auto.
Example: 'ArTypedPerInstanceMemory'
Before R2021a, use commas to separate each name and value, and enclose Name in quotes.
Example: 'SwCalibrationAccess','ReadWrite' specifies read-write access to the variable for
run-time calibration.
Specify display format for the AUTOSAR variable. AUTOSAR display format specifications control the
width and precision display for calibration and measurement data. For more information, see
“Configure DisplayFormat”.
Example: 'DisplayFormat','%2.6f'
Specify whether to include C type qualifier volatile in generated code for the AUTOSAR variable.
Example: 'IsVolatile','true'
1-177
1 Functions
Optionally specify an AUTOSAR additional native type qualifier to include in generated code for the
AUTOSAR variable.
Example: 'Qualifier','test_qualifier'
Specify a short name for the AUTOSAR variable. If unspecified, ARXML export generates a short
name, which is based on the state name if one exists. If the state is unnamed, the generated short
name can differ from the block name.
Example: 'ShortName','PIM_X'
Specify a SwAddrMethod name that is valid for the AUTOSAR variable. Code generation uses the
SwAddrMethod name to group AUTOSAR variables in a memory section for access by calibration and
measurement tools. For a list of valid SwAddrMethod values for the variable, see the Code Mappings
editor, Signals/States tab. For more information, see “Configure SwAddrMethod”.
Example: 'SwAddrMethod','VAR'
Specify how calibration and measurement tools can access the AUTOSAR variable. Valid access
values include ReadOnly, ReadWrite, and NotAccessible. For more information, see “Configure
SwCalibrationAccess”.
Example: 'SwCalibrationAccess','ReadWrite'
Version History
Introduced in R2018b
See Also
autosar.api.getSimulinkMapping | getState
Topics
“Map Block Signals and States to AUTOSAR Variables”
“Map Submodel Signals and States to AUTOSAR Variables”
“Configure AUTOSAR Per-Instance Memory”
“Configure AUTOSAR Static Memory”
1-178
mapState
1-179
1 Functions
open
Package: autosar.arch
Syntax
open(archModel)
Description
open(archModel) opens architecture model archModel in the editor. The archModel argument is
a model handle returned by a previous call to autosar.arch.createModel or
autosar.arch.loadModel. The model must be loaded.
Examples
Open a loaded AUTOSAR architecture model in the editor. Add a composition, save the change, and
close the model.
% Load AUTOSAR architecture model located in current folder or on MATLAB path
modelName = 'myArchModel';
archModel = autosar.arch.loadModel(modelName);
% Add a composition
composition = addComposition(archModel,'Sensors2');
layout(archModel); % Auto-arrange model layout
Input Arguments
archModel — Architecture model
handle
AUTOSAR architecture model to open in the editor. The argument is a model handle returned by a
previous call to autosar.arch.createModel or autosar.arch.loadModel. The model must be
loaded.
Example: archModel
Version History
Introduced in R2020a
1-180
open
See Also
autosar.arch.createModel | autosar.arch.loadModel | close | save
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Create AUTOSAR Architecture Models”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-181
1 Functions
removeSignal
Package: autosar.api
Syntax
removeSignal(slMap,slPortHandle)
Description
removeSignal(slMap,slPortHandle) removes the Simulink block signal associated with outport
port handle slPortHandle from AUTOSAR mapping.
Examples
portHandles = get_param('autosar_swc_counter/RelOpt','portHandles');
outportHandle = portHandles.Outport;
removeSignal(slMap,outportHandle);
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
Outport port handle for a Simulink block signal to remove from AUTOSAR mapping. Use MATLAB
commands to construct the outport port handle. For example, for a Relational Operator block named
RelOpt:
portHandles = get_param('autosar_swc_counter/RelOpt','portHandles');
outportHandle = portHandles.Outport;
Example: outportHandle
1-182
removeSignal
Version History
Introduced in R2020b
See Also
autosar.api.getSimulinkMapping | addSignal | getSignal | mapSignal
Topics
“Map Block Signals and States to AUTOSAR Variables”
“Map Submodel Signals and States to AUTOSAR Variables”
“Configure AUTOSAR Per-Instance Memory”
“Configure AUTOSAR Static Memory”
“AUTOSAR Property and Map Function Examples”
“AUTOSAR Component Configuration”
1-183
1 Functions
save
Package: autosar.arch
Syntax
save(archModel)
Description
save(archModel) saves architecture model archModel. The archModel argument is a model
handle returned by a previous call to autosar.arch.createModel or autosar.arch.loadModel.
The model must be open or loaded.
Examples
Create an AUTOSAR architecture model, add a composition, and save the model with the change.
Close the model.
% Create AUTOSAR architecture model
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
% Add a composition
composition = addComposition(archModel,'Sensors2');
Input Arguments
archModel — Architecture model
handle
AUTOSAR architecture model to save. The argument is a model handle returned by a previous call to
autosar.arch.createModel or autosar.arch.loadModel. The model must be open or loaded.
Example: archModel
Version History
Introduced in R2020a
See Also
autosar.arch.createModel | autosar.arch.loadModel | close | open
1-184
save
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Create AUTOSAR Architecture Models”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-185
1 Functions
set
Package: autosar.api
Syntax
set(arProps,elementPath,property,value)
Description
set(arProps,elementPath,property,value) sets the specified property of the AUTOSAR
element at elementPath to value. For properties that reference other elements, value is a path. To
set XML packaging options, specify elementPath as XmlOptions.
Examples
For an AUTOSAR model, set the IsService property for sender-receiver interface Interface1 to
true (1), indicating that the port interface is used for AUTOSAR services.
hModel = 'autosar_swc_expfcns';
openExample(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
set(arProps,'Interface1','IsService',true);
isService = get(arProps,'Interface1','IsService')
isService =
logical
1
For an AUTOSAR model, set the symbol property for runnable Runnable1 to test_symbol.
hModel = 'autosar_swc_expfcns';
openExample(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
compQName = get(arProps,'XmlOptions','ComponentQualifiedName');
runnables = find(arProps,compQName,'Runnable','PathType','FullyQualified');
runnables(2)
ans =
1×1 cell array
{'/pkg/swc/ASWC/IB/Runnable1'}
get(arProps,runnables{2},'symbol')
ans =
'Runnable1'
set(arProps,runnables{2},'symbol','test_symbol')
get(arProps,runnables{2},'symbol')
1-186
set
ans =
'test_symbol'
Input Arguments
arProps — AUTOSAR properties information for a model
handle
Path to an AUTOSAR element for which to set a property. To set XML packaging options, specify
XmlOptions,
Example: 'Input'
Property for which to set a value, among valid properties of the AUTOSAR element.
Example: 'IsService'
Value to set for the specified property. For properties that reference other elements, specify a path.
Example: true
Version History
Introduced in R2013b
The AUTOSAR property Instance Specifier for a port will be automatically generated. You can set a
new value using the function but setting the Instance Specifier will be deprecated in a future
release.
See Also
autosar.api.getAUTOSARProperties | get | autosar.api.getAUTOSARProperties XML Options
Settings
Topics
“AUTOSAR Property and Map Function Examples”
“Configure and Map AUTOSAR Component Programmatically”
1-187
1 Functions
1-188
set
set
Package: autosar.arch
Syntax
set(archElement,property,value)
Description
set(archElement,property,value) sets the specified property to value for AUTOSAR
architecture element archElement. The archElement argument is a component, composition, port,
or connector handle returned by a previous call to addComponent, addComposition, addPort,
connect, or find.
Examples
Then list the model port Name values, which reflect the port renames.
% Create AUTOSAR architecture model
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
% Set properties
1-189
1 Functions
ports_in_hierarchy =
7×1 CompPort array with properties:
Kind
Connected
Name
Parent
SimulinkHandle
Input Arguments
archElement — Architecture element
handle
AUTOSAR architecture element for which to set the value of a property. The argument is a
component, composition, port, or connector handle returned by a previous call to addComponent,
addComposition, addPort, connect, or find.
Example: port
Property for which to set a value, among valid properties of the AUTOSAR architecture element.
Example: 'Name'
Value to set for the specified property of the specified AUTOSAR architecture element.
Example: 'NewPortName1'
Version History
Introduced in R2020a
1-190
set
See Also
find | get
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-191
1 Functions
setClassName
Set class name of model
Syntax
setClassName(slMap, name)
Description
setClassName(slMap, name) sets the class name of the model in the generated code.
Examples
Open the model. To access the mapping information associated with the model, slMap, use the
autosar.api.getSimulinkMapping function.
Specify a class name for the model by using the setClassName function.
setClassName(slMap, 'myClassName');
name = getClassName(slMap)
name =
'myClassName'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-192
setClassName
Class name of model in the generated code specified as a character vector. If you do not specify a
class name, the class name of the model in the generated code is set to the name of the model.
Data Types: char | string
Version History
Introduced in R2021b
See Also
autosar.api.getSimulinkMapping | getClassName | getClassNamespace |
setClassNamespace
Topics
“Configure AUTOSAR Adaptive Code Generation”
1-193
1 Functions
setClassNamespace
Set class namespace of model
Syntax
setClassNamespace(slMap, namespace)
Description
setClassNamespace(slMap, namespace) sets the class namespace of the model in the generated
code. Control the scope of the generated code by specifying a namespace for the generated class. In
systems that use a model hierarchy, you can specify a different namespace for each model in the
hierarchy.
Examples
Open the model. To access the mapping information associated with the model, slMap, use the
autosar.api.getSimulinkMapping function.
To specify a namespace for the model in the generated code, use the setClassNamespace function.
setClassNamespace(slMap, 'myClassNamespace');
To configure a nested namespace, use the scope resolution operator :: to specify scope.
setClassNamespace(slMap, 'myNestedClassNamespace1::ns2::ns3');
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-194
setClassNamespace
Class namespace of model in the generated code specified as a character vector. If you do not specify
a class namespace, the code generated for the model does not use a namespace.
Data Types: char | string
Version History
Introduced in R2021b
See Also
autosar.api.getSimulinkMapping | getClassNamespace | setClassName | getClassName
Topics
“Configure AUTOSAR Adaptive Code Generation”
1-195
1 Functions
setDataDefaults
Set default end-to-end (E2E) protection method for AUTOSAR component model
Syntax
setDataDefaults(slMap,elementCategory,property,value)
Description
setDataDefaults(slMap,elementCategory,property,value) sets the default setting for the
end-to-end (E2E) protection method property in the modeling element category inports and outports
of an AUTOSAR component model.
Use E2E protection to optionally configure sender and receiver ports to securely transmit data
between AUTOSAR components. The default end-to-end protection method sets which end-to-end
protection method is used for root-level inports and outports in the generated code.
Supported protection methods are E2E Transformer and E2E Protection Wrapper.
The protection method is applied to AUTOSAR inports that are configured in the code mappings as
EndToEndRead and AUTOSAR outports that are configured as EndToEndWrite.
Examples
Set Default E2E Protection Setting for Root-Level Inports and Outports
Set the default end-to-end protection method for the AUTOSAR component model.
slMap = autosar.api.getSimulinkMapping(hModel);
e2eMethod = getDataDefaults(slMap, ...
'InportsOutports', 'EndToEndProtectionMethod');
e2eMethod =
'ProtectionWrapper'
Set and then read back the default E2E protection method.
setDataDefaults(slMap,'InportsOutports', ...
'EndToEndProtectionMethod', 'TransformerError');
e2eMethod = getDataDefaults(slMap,...
'InportsOutports', 'EndToEndProtectionMethod');
e2eMethod =
'TransformerError'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
1-196
setDataDefaults
Simulink to AUTOSAR mapping information for a model, specified as a function handle. Obtain this
information using autosar.api.getSimulinkMapping(model), where model is a handle,
character vector, or string scalar representing the model name.
Example: slMap
Category of model data elements that apply the end-to-end protection property, specified as
'InportsExports'. The only supported modeling element is inports and outports.
Default end-to-end protection method property that you set with the input parameter value, specified
as 'EndToEndProtectionMethod'. The only supported property is E2E protection method.
Default protection method parameter value to set, specified as one of the following:
• 'ProtectionWrapper':
E2E Protection Wrapper, which uses an E2E protection wrapper in the generated code in support
of end-to-end data consistency checks.
E2E Transformer, which configures RTE calls to use a transformer error argument in the
generated code.
Example: 'TransformerError'
Data Types: character vector
Version History
Introduced in R2022b
See Also
autosar.api.getSimulinkMapping | getDataDefaults
Topics
“Configure AUTOSAR S-R Interface Port for End-To-End Protection”
1-197
1 Functions
setInternalDataPackaging
Package: autosar.api
Syntax
setInternalDataPackaging(slMap,pkgSetting)
Description
setInternalDataPackaging(slMap,pkgSetting) sets the data packaging setting pkgSetting,
which configures the default packaging for internal data stores, signals, and states in the generated
code for an AUTOSAR component model.
Default packaging options differ depending on whether the component model instantiates an
AUTOSAR software component once or multiple times. Multi-instance software components can
generate reentrant, reusable functions. See “Multi-Instance Components” for more information.
• Default — Accept the default internal data packaging provided by the software. Use Default
for submodels referenced from AUTOSAR component models.
• PrivateGlobal — Package internal variable data without a struct object and make it
private (visible only to model.c).
• PrivateStructure — Package internal variable data in a struct object and make it private
(visible only to model.c).
• PublicGlobal — Package internal variable data without a struct object and make it public
(extern declaration in model.h).
• PublicStructure — Package internal variable data in a struct object and make it public
(extern declaration in model.h).
• For multi-instance models:
• Default — Accept the default internal data packaging provided by the software. Use Default
for submodels referenced from AUTOSAR component models.
• CTypedPerInstanceMemory — Package internal variable data for each instance of an
AUTOSAR software component to use C-typed per-instance memory in a struct object and
make it public (declaration in model.h).
• ArTypedPerInstanceMemory — Package internal variable data for each instance of an
AUTOSAR software component to use AUTOSAR-typed per-instance memory in a struct
object and make it public (declaration in Rte_Type.h). Setting ArTypedPerInstanceMemory
is not supported for models that contain model references.
When the data packaging setting is ArTypedPerInstanceMemory, code generation does not
support bitfield optimizations. If you configure ArTypedPerInstanceMemory, configuration
parameters BooleansAsBitfields, StateBitsets, and DataBitsets must be disabled.
1-198
setInternalDataPackaging
If the model configuration option Generate separate internal data per entry-point function is set
for the AUTOSAR model, task-based internal data grouping overrides the AUTOSAR internal data
packaging setting. However, the AUTOSAR setting determines the public or private visibility of the
generated task-based internal data groups.
Examples
Return and modify the default data packaging setting used for internal variables in the generated
code for the AUTOSAR component model. The PrivateStructure setting packages the internal
variable data in a struct object and makes it private.
hModel = 'autosar_swc';
openExample(hModel);
slMap = autosar.api.getSimulinkMapping(hModel);
pkgSetting1 = getInternalDataPackaging(slMap)
setInternalDataPackaging(slMap,'PrivateStructure')
pkgSetting2 = getInternalDataPackaging(slMap)
pkgSetting1 =
'Default'
pkgSetting2 =
'PrivateStructure'
Input Arguments
slMap — Simulink to AUTOSAR mapping information for a model
handle
Value specifying the default data packaging to use for internal variables in the generated code for the
AUTOSAR component model. Valid values for single-instance models are "Default",
"PrivateGlobal", "PrivateStructure", "PublicGlobal", and "PublicStructure". Valid
values for multi-instance models are "Default", "CTypedPerInstanceMemory", and
"ArTypedPerInstanceMemory".
Example: "PrivateStructure"
Version History
Introduced in R2021a
1-199
1 Functions
R2023b: Support for AUTOSAR-typed per-instance memory default for internal data
packaging
See Also
getInternalDataPackaging | autosar.api.getSimulinkMapping
Topics
“Map AUTOSAR Elements for Code Generation”
“AUTOSAR Component Configuration”
1-200
setPlatform
setPlatform
Set platform kind of architecture model to classic or adaptive
Syntax
setPlatform(archModel,platformKind)
Description
setPlatform(archModel,platformKind) sets the platform of the AUTOSAR architecture model
archModel to platformKind.
Examples
Create an AUTOSAR architecture model using the default settings, read the platform, and set the
platform kind to adaptive.
ptm =
'Classic'
ptm =
'Adaptive'
Input Arguments
archModel — Architecture model
handle
1-201
1 Functions
Set "Adaptive" to specify an adaptive architecture model. Set "Classic" to specify a classic
architecture model.
Version History
Introduced in R2023a
See Also
autosar.arch.createModel | autosar.arch.loadModel
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Create AUTOSAR Architecture Models”
1-202
setXmlOptions
setXmlOptions
Package: autosar.arch
Syntax
setXmlOptions(archModel,property,value)
Description
setXmlOptions(archModel,property,value) sets XML option property to value in
architecture model archModel. The archModel argument is a model handle returned by a previous
call to autosar.arch.createModel or autosar.arch.loadModel.
For more information about XML options, see “Configure AUTOSAR XML Options” for classic
architecture modeling and “Configure AUTOSAR Adaptive XML Options” for adaptive architecture
modeling.
Examples
For a new AUTOSAR architecture model, modify the value of the AUTOSAR XML data type package
path from /DataTypes to /MyDataTypes.
archModel = autosar.arch.createModel('MyArchModel');
setXmlOptions(archModel,'DataTypePackage','/MyDataTypes');
pValue = getXmlOptions(archModel,'DataTypePackage')
pValue =
'/MyDataTypes'
Input Arguments
archModel — Architecture model
handle
AUTOSAR architecture model for which to set the value of an XML option. The argument is a model
handle returned by a previous call to autosar.arch.createModel or autosar.arch.loadModel.
Example: archModel
For more information about XML options, see “Configure AUTOSAR XML Options” for classic
architecture modeling and “Configure AUTOSAR Adaptive XML Options” for adaptive architecture
modeling.
1-203
1 Functions
Example: 'DataTypePackage'
Value to set for the specified XML option of the specified AUTOSAR architecture model.
Example: '/MyDataTypes'
Version History
Introduced in R2020a
See Also
export | getXmlOptions
Topics
“Configure AUTOSAR Architecture Model Programmatically”
“Generate and Package AUTOSAR Composition XML Descriptions and Component Code”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
1-204
updateAUTOSARProperties
updateAUTOSARProperties
Package: arxml
Syntax
updateAUTOSARProperties(ar,modelname)
updateAUTOSARProperties(ar,modelname,Name,Value)
Description
updateAUTOSARProperties(ar,modelname) updates the specified open model with AUTOSAR
element definitions from packages 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.
Examples
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.
modelName = 'autosar_swc';
openExample(modelName);
ar = arxml.importer('SwAddrMethods.arxml');
updateAUTOSARProperties(ar,modelName);
1-205
1 Functions
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.
1-206
updateAUTOSARProperties
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
ar — arxml.importer object
handle
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'
Before R2021a, use commas to separate each name and value, and enclose Name in quotes.
Example: 'Category',{'ImplementationDataType'} directs the importer to update a model
with AUTOSAR elements of 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:
1-207
1 Functions
'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
Paths to one or more AUTOSAR data type mapping sets associated with application data type
elements.
Example: {'/AUTOSAR_PlatformTypes/DataTypeMappingSets/MapSet1'}
Version History
Introduced in R2019a
See Also
arxml.importer | updateModel | createEnumeration | createNumericType
Topics
“Import and Reference Shared AUTOSAR Element Definitions”
“Import AUTOSAR Package into Component Model”
“Import AUTOSAR Package into Adaptive Component Model”
“Import AUTOSAR XML Descriptions Into Simulink”
“AUTOSAR ARXML Importer”
1-208
updateModel
updateModel
Package: arxml
Syntax
updateModel(ar,modelname)
Description
updateModel(ar,modelname) updates the specified open model with changes found in the XML
files associated with arxml.importer object ar. The XML files must contain the AUTOSAR software
component mapped by the model.
When comparing the current version of the XML file with the previous version, the comparison
routine applies these rules in order:
1 If elements have the same UUID and type, the elements match. The function does not update the
model.
2 If elements have different UUIDs, the elements do not match. The function updates the model
with the ARXML change.
3 If elements have the same qualified name, the elements match. The function does not update the
model.
4 Otherwise, elements do not match. The function updates the model with the ARXML changes.
The update generates and opens a report that details the changes made to the model, and required
changes that were not made by the function.
AUTOSAR package structure updates affect the stored AR-PACKAGE structure and are applied to
future exports. But imported package structure updates do not affect AUTOSAR Dictionary package
path XML options. The XML package path options apply to AUTOSAR elements created in Simulink
rather than to imported elements.
Examples
Update model mySWC with the AUTOSAR ARXML changes described in updatedSWC.arxml and
open an update report.
open_system('mySWC')
ar = arxml.importer('updatedSWC.arxml');
updateModel(ar,'mySWC');
1-209
1 Functions
Input Arguments
ar — arxml.importer object
handle
AUTOSAR information previously imported from XML files, specified as an arxml.importer object
handle.
Name of an open model to be updated with changes in the XML files associated with an
arxml.importer object.
Example: 'mySWC'
Version History
Introduced in R2014a
updateModel supports generating AUTOSAR Basic Software (BSW) caller blocks when updating
with ARXML-imported software components that access Diagnostic Event Manager (Dem), NVRAM
Manager (NvM), or Function Inhibition Manager (FiM) services.
See Also
arxml.importer | updateAUTOSARProperties
Topics
“Import AUTOSAR Software Component Updates”
“Import AUTOSAR Component to Simulink”
“Import AUTOSAR Composition to Simulink”
“Import AUTOSAR XML Descriptions Into Simulink”
“AUTOSAR ARXML Importer”
1-210
exportDictionary
exportDictionary
Package: autosar.dictionary
Export interface, data type, and platform-specific definitions from interface dictionary
Syntax
exportedFolder = exportDictionary(platformMapping)
Description
exportedFolder = exportDictionary(platformMapping) exports the content from an
interface dictionary mapped to the AUTOSAR Classic Platform to ARXML files and RTE stub header
files. This operation creates a folder in the current folder that contains the output files.
Examples
Export AUTOSAR Interface and Data Type Definitions from Interface Dictionary
To export the AUTOSAR content of the interface dictionary to ARXML and header files, use the
exportDictionary function. For an example that shows more of the workflow for related functions,
see “Configure AUTOSAR Classic Data Interface and Properties in Interface Dictionary” on page 1-
222.
exportedFolder =
'C:\Users\myName\MyInterfaces'
.
..
MyInterfaces_datatype.arxml
MyInterfaces_interface.arxml
stub
Input Arguments
platformMapping — Platform mapping object
autosar.dictionary.ARClassicPlatformMapping object
1-211
1 Functions
Output Arguments
exportedFolder — Full path of folder containing exported files
string scalar | character vector
Full path of the folder containing the exported files from the interface dictionary, specified as a string
scalar or a character vector.
Exported files contained in exportedFolder include ARXML files, which are named
dictionaryname_datatypes.arxml and dictionaryname_interfaces.arxml, where
dictionaryname is the name of the interface dictionary, and a stub folder containing RTE header
files. If the files already exist, exportDictionary overwrites them.
Example: 'arxmlFolder'
Version History
Introduced in R2022b
See Also
autosar.dictionary.ARClassicPlatformMapping | getPlatformProperties |
getPlatformProperty | setPlatformProperty
Topics
“Apply Data Changes Programmatically”
1-212
getPlatformProperties
getPlatformProperties
Package: autosar.dictionary
Syntax
[propNames,propVals] = getPlatformProperties(platformMapping,dictElementObj)
Description
[propNames,propVals] = getPlatformProperties(platformMapping,dictElementObj)
returns AUTOSAR Classic platform-specific properties and their values for the specified dictionary
element. Specified dictionary elements can be a data interface object or data element object.
Examples
To get the platform-specific properties for a data interface, such as what kind of AUTOSAR
communication interface is defined and the path to the element package for the specified data
interface, use the getPlatformProperties function. For an example that shows more of the
workflow for related functions, see “Configure AUTOSAR Classic Data Interface and Properties in
Interface Dictionary” on page 1-222.
dictAPI = Simulink.interface.dictionary.open('MyInterfaces.sldd');
platformMapping = getPlatformMapping(dictAPI,'AUTOSARClassic');
interfaceObj = getInterface(dictAPI,'DataInterface');
[propNames,propValues] = ...
getPlatformProperties(platformMapping,interfaceObj)
propNames =
propValues =
To get the platform-specific properties for a data element in the data interface, such as
SwAddrMethod information for the specified data element, use the getPlatformProperties
1-213
1 Functions
function. For an example that shows more of the workflow for related functions, see “Configure
AUTOSAR Classic Data Interface and Properties in Interface Dictionary” on page 1-222.
dictAPI = Simulink.interface.dictionary.open('MyInterfaces.sldd');
platformMapping = getPlatformMapping(dictAPI,'AUTOSARClassic');
interfaceObj = getInterface(dictAPI,'DataInterface');
dataElementObj = getElement(interfaceObj,'DE1');
[propNames,propValues] = ...
getPlatformProperties(platformMapping,dataElementObj)
propNames =
propValues =
Input Arguments
platformMapping — Platform mapping object
autosar.dictionary.ARClassicPlatformMapping object
Element in a dictionary object from which you access the AUTOSAR platform-specific properties and
values, specified as a Simulink.interface.dictionary.DataInterface object or
Simulink.interface.dictionary.DataElement object.
The argument can be a data interface object, which is returned by a previous call to
addDataInterface or getInterface, or a data element object, which is returned by a previous
call to addElement or getElement.
Output Arguments
propNames — Property names
cell array of character vectors | string array
Property names in selected dictionary element and platform mapping, specified as a cell array of
character vectors or a string array.
For data interface objects, AUTOSAR properties include 'IsService', 'Package', and
'InterfaceKind'.
1-214
getPlatformProperties
Property values in selected dictionary element and platform mapping, specified as a cell array of
character vectors or a string array.
Version History
Introduced in R2022b
See Also
autosar.dictionary.ARClassicPlatformMapping | exportDictionary |
getPlatformProperty | setPlatformProperty
Topics
“Configure AUTOSAR Communication Interfaces”
“Configure AUTOSAR Data for Calibration and Measurement”
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-215
1 Functions
getPlatformProperty
Package: autosar.dictionary
Syntax
propValue = getPlatformProperty(platformMapping,dictElementObj,propName)
Description
propValue = getPlatformProperty(platformMapping,dictElementObj,propName) gets
the specified property for the specified dictionary element from an interface dictionary mapped to
AUTOSAR Classic Platform. The specified dictionary element can be a data interface object or data
element object.
Examples
To get the kind of AUTOSAR communication interface that is defined for the specified data interface,
use the getPlatformProperty function with the propName argument InterfaceKind. For an
example that shows more of the workflow for related functions, see “Configure AUTOSAR Classic
Data Interface and Properties in Interface Dictionary” on page 1-222.
platformMapping = getPlatformMapping(dictAPI,'AUTOSARClassic');
interfaceObj = getInterface(dictAPI,'interfaceName');
propValue_Interface = ...
getPlatformProperty(platformMapping,interfaceObj,'InterfaceKind')
propValue_Interface =
'NvDataInterface'
To get the calibration and measurement tool access defined for the specified data element, use the
getPlatformProperty function with the propName argument SwCalibrationAccess.
dataElemObj = userInterfaceObj.Elements(1);
propValue_Sw_CalAccess = ...
getPlatformProperty(platformMapping,dataElemObj,'SwCalibrationAccess')
1-216
getPlatformProperty
propValue_Sw_CalAccess =
'ReadWrite'
Input Arguments
platformMapping — Platform mapping object
autosar.dictionary.ARClassicPlatformMapping object
Element in a dictionary object from which you access the AUTOSAR platform-specific properties and
values, specified as a Simulink.interface.dictionary.DataInterface object or
Simulink.interface.dictionary.DataElement object.
The argument can be a data interface object, which is returned by a previous call to
addDataInterface or getInterface, or a data element object, which is returned by a previous
call to addElement or getElement.
For data interface objects, valid argument values are 'IsService', 'Package', and
'InterfaceKind'.
For data element objects, valid argument values are 'SwAddrMethod', 'SwCalibrationAccess',
and 'DisplayFormat'.
Example: 'InterfaceKind'
Output Arguments
propValue — Property value of dictionary element
character vector | string scalar
1-217
1 Functions
Version History
Introduced in R2022b
See Also
autosar.dictionary.ARClassicPlatformMapping | exportDictionary |
getPlatformProperties | setPlatformProperty
Topics
“Configure AUTOSAR Data for Calibration and Measurement”
“Configure AUTOSAR Communication Interfaces”
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-218
setPlatformProperty
setPlatformProperty
Package: autosar.dictionary
Syntax
setPlatformProperty(platformMapping,dictElementObj,Name=Value)
Description
setPlatformProperty(platformMapping,dictElementObj,Name=Value) sets the specified
platform properties for the specified dictionary element in an interface dictionary mapped to the
AUTOSAR Classic Platform. The specified dictionary element can be a data interface object or data
element object.
Examples
To set AUTOSAR package and communication properties for the specified data interface, use the
setPlatformProperty function. For an example that shows more of the workflow for related
functions, see “Configure AUTOSAR Classic Data Interface and Properties in Interface Dictionary” on
page 1-222.
dictAPI = Simulink.interface.dictionary.open('MyInterfaces.sldd');
platformMapping = getPlatformMapping(dictAPI,'AUTOSARClassic');
interfaceObj = getInterface(dictAPI,'DataInterface');
setPlatformProperty(platformMapping,interfaceObj,IsService=false,...
Package='/Interface3',InterfaceKind='SenderReceiverInterface');
To set the AUTOSAR SwAddrMethod and calibration properties for the specified data element, use
the setPlatformProperty function.
platformMapping = getPlatformMapping(dictAPI, 'AUTOSARClassic');
interfaceObj = getInterface(dictAPI, 'DataInterface');
dataElementObj = getElement(interfaceObj,'DE1');
setPlatformProperty(platformMapping,dataElementObj,SwAddrMethod='VAR1',...
SwCalibrationAccess='ReadWrite',DisplayFormat='%.3f');
Input Arguments
platformMapping — Platform mapping object
autosar.dictionary.ARClassicPlatformMapping object
1-219
1 Functions
Element in a dictionary object from which you access the AUTOSAR platform-specific properties and
values, specified as a Simulink.interface.dictionary.DataInterface object or
Simulink.interface.dictionary.DataElement object.
The argument can be a data interface object, which is returned by a previous call to
addDataInterface or getInterface, or a data element object, which is returned by a previous
call to addElement or getElement.
Before R2021a, use commas to separate each name and value, and enclose Name in quotes.
Example: SwAddrMethod='VAR1'
Calibration display format for the specified AUTOSAR data element object, specified as a character
vector or string scalar. AUTOSAR display format specifications control the width and precision
display for calibration and measurement data.
Example: DisplayFormat='%2.6f'
Kind of AUTOSAR communication interface that is represented for the specified AUTOSAR interface
object, specified as 'SenderReceiverInterface', 'NvDataInterface', and
'ModeSwitchInterface'.
Example: InterfaceKind='SenderReceiverInterface'
The fully-qualified path to the element package for the specified AUTOSAR interface object, specified
as a character vector or a string scalar.
Example: Package='/Interface2'
1-220
setPlatformProperty
SwAddrMethod name that is valid for the specified AUTOSAR data element object, specified as a
character vector or a string scalar. Code generation uses the SwAddrMethod name to group
AUTOSAR parameters in a memory section for access by calibration and measurement tools.
Example: SwAddrMethod='VAR'
How calibration and measurement tools access data for the specified AUTOSAR data element object,
specified as 'ReadOnly', 'ReadWrite', and 'NotAccessible'.
Example: SwCalibrationAccess='ReadOnly'
Version History
Introduced in R2022b
See Also
autosar.dictionary.ARClassicPlatformMapping | exportDictionary |
getPlatformProperties | getPlatformProperty
Topics
“Configure AUTOSAR Data for Calibration and Measurement”
“Configure AUTOSAR Communication Interfaces”
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-221
1 Functions
autosar.dictionary.ARClassicPlatformMapping
Manage platform-specific properties for elements in interface dictionary mapped to AUTOSAR Classic
Platform
Description
The autosar.dictionary.ARClassicPlatformMapping object provides methods that help you
manage the platform-specific properties in an interface dictionary mapped to the AUTOSAR Classic
Platform.
Creation
To create an autosar.dictionary.ARClassicPlatformMapping object, use the
addPlatformMapping function.
If you already have an interface dictionary mapped to the Classic Platform, you can represent an
autosar.dictionary.ARClassicPlatformMapping object by using the getPlatformMapping
function.
platformMapping = dictAPI.getPlatformMapping('AUTOSARClassic');
Object Functions
exportDictionary Export interface, data type, and platform-specific definitions from interface
dictionary
getPlatformProperties Get AUTOSAR platform properties from interface dictionary
getPlatformProperty Get AUTOSAR platform property from interface dictionary
setPlatformProperty Set AUTOSAR properties for data interface or element in interface dictionary
Examples
dictName = 'MyInterfaces.sldd';
dictAPI = Simulink.interface.dictionary.create(dictName);
Add data types, including an enumeration, an alias type, a value type, and a structure.
% Enum Types
myEnumType1 = addEnumType(dictAPI,'myColor');
1-222
autosar.dictionary.ARClassicPlatformMapping
myEnumType1.addEnumeral('RED','0','Solid Red');
myEnumType1.addEnumeral('BLUE','1','Solid Blue');
myEnumType1.StorageType = 'int16';
% ValueType
myValueType1 = addValueType(dictAPI,'myValueType1');
myValueType1.DataType = 'int32';
myValueType1.Dimensions = '[2 3]';
myValueType1.DataType = myEnumType1; % can also use interface dict type objs
% StructType
myStructType1 = addStructType(dictAPI,'myStructType1');
structElement1 = myStructType1.addElement('Element1');
structElement1.Type.DataType = 'single';
structElement1.Type.Dimensions = '3';
structElement2 = myStructType1.addElement('Element2');
structElement2.Type = myValueType1;
% or
structElement2.Type = 'ValueType: myValueType1';
dataElm1 = addElement(dataInterface1,'DE1');
dataElm1.Type = myValueType1;
dataElm2 = addElement(dataInterface1,'DE2');
dataElm2.Type = myStructType1;
dataElm2.Dimensions = '4';
dataElm2.Description = 'I am a data element with datatype = array of struct type';
dataInterface2 = addDataInterface(dictAPI,'DataInterface2');
platformMapping = addPlatformMapping(dictAPI,'AUTOSARClassic');
Configure interface properties for a classic component, including package path and nonvolatile data
communication.
setPlatformProperty(platformMapping, dataInterface1,...
'Package','/Interface2','InterfaceKind','NvDataInterface');
Add VAR1 software address method to the dictionary and set AUTOSAR platform-specific properties
for data element DE1 in data interface DataInterface.
arObj = autosar.api.getAUTOSARProperties(dictName);
addPackageableElement(arObj,'SwAddrMethod', ...
'/SwAddressMethods','VAR1','SectionType','Var');
setPlatformProperty(platformMapping,dataElm1, ...
1-223
1 Functions
'SwAddrMethod','VAR1','SwCalibrationAccess', ...
'ReadWrite','DisplayFormat','%.3f');
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | Simulink.interface.dictionary.DataInterface |
Simulink.interface.dictionary.DataElement | addElement | addAliasType |
addDataInterface | addEnumType | addPlatformMapping | addStructType | addValueType |
autosar.api.getAUTOSARProperties | getDataType | getInterface | getInterfaceNames |
getPlatformMapping
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-224
Simulink.dictionary.ArchitecturalData
Simulink.dictionary.ArchitecturalData
Edit architectural data in a Simulink data dictionary programmatically
Description
The Simulink.dictionary.ArchitecturalData object represents the Architectural Data section
of a Simulink data dictionary. The Architectural Data object allows you to programmatically access
shared definitions across Simulink and architecture models of port interfaces, data types, system
wide constants, and their platform properties. You can also use the Architectural Data Editor to
manage architectural data.
Creation
You can create a new data dictionary using the Simulink.dictionary.archdata.create
function. This function returns the Simulink.dictionary.ArchitecturalData object.
dictName = "MyInterfaces.sldd";
archDataObj = Simulink.dictionary.archdata.create(dictName);
If you already created a data dictionary, you can create the Architectural Data object using the
Simulink.dictionary.archdata.open function.
dictName = "MyInterfaces.sldd";
archDataObj = Simulink.dictionary.archdata.open(dictName);
Properties
DictionaryFileName — Name of the data dictionary
character vector | string scalar
File name of data dictionary, specified as a character vector or string scalar. The name must include
the .sldd extension and must be a valid MATLAB identifier.
1-225
1 Functions
Object Functions
addAliasType Add Simulink alias type to Architectural Data section of Simulink data
dictionary
addConstant Add constant to the Architectural Data section of Simulink data
dictionary
addDataInterface Add data interface to Architectural Data section of Simulink data
dictionary
addEnumType Add enumerated type to Architectural Data section of Simulink data
dictionary
addNumericType Add Simulink numeric type to Architectural Data section of Simulink
data dictionary
addPlatformMapping Add AUTOSAR Classic mapping to Architectural Data section of
Simulink data dictionary
addReference Add data dictionary reference to Architectural Data section of Simulink
data dictionary
addServiceInterface Add service interface to Architectural Data section of Simulink data
dictionary
addStructType Add structure type to Architectural Data section of Simulink data
dictionary
addValueType Add value type to Architectural Data section of Simulink data
dictionary
close Close any open connections to Simulink data dictionary
discardChanges Discard changes to Simulink data dictionary
findEntryByName Get object by name in Architectural Data section of Simulink data
dictionary
getConstant Get constant in Architectural Data section of Simulink data dictionary
getConstantNames Get constant names in Architectural Data section of Simulink data
dictionary
getDataType Get data type in Architectural Data section of Simulink data dictionary
getDataTypeNames Get names of data types in Architectural Data section of Simulink data
dictionary
getInterface Get interface object for interface in Architectural Data section of
Simulink data dictionary
getInterfaceNames Get interface names in Architectural Data section of Simulink data
dictionary
getPlatformMapping Get platform mapping object for platform of Simulink data dictionary
getReferences Get full paths of Simulink data dictionaries referenced by another
Simulink data dictionary
importFromBaseWorkspace Import Simulink object definitions from base workspace to
Architectural Data section of Simulink data dictionary
importFromFile Import Simulink object definitions from file to Architectural Data
section of data dictionary
isDirty Check for unsaved changes in Simulink data dictionary
moveToDesignData Move interfaces, data types, and constants in Architectural Data
section of Simulink data dictionary to design data
moveToDictionary Move architectural data of Simulink data dictionary to another data
dictionary
1-226
Simulink.dictionary.ArchitecturalData
Examples
Create the Simulink data dictionary and return the associated Architectural Data object.
dictName = "MyArchitecturalData.sldd";
archDataObj = Simulink.dictionary.archdata.create(dictName);
Use type-specific functions to add alias types, and enumerations to the data dictionary.
myAliasType1Obj = addAliasType(archDataObj,"aliasType",BaseType="single");
myAliasType1Obj.Name = "myAliasType1";
myAliasType1Obj.BaseType = "fixdt(1,32,16)";
myAliasType2Obj = addAliasType(archDataObj,"myAliasType2");
myAliasType2Obj.BaseType = myAliasType1Obj;
myEnumType1Obj = addEnumType(archDataObj,"myColor");
addEnumeral(myEnumType1Obj,"RED",'0',"Red Sunset");
addEnumeral(myEnumType1Obj,"BLUE",'1',"Blue Skies");
myEnumType1Obj.DefaultValue = "BLUE";
myEnumType1Obj.Description = "I am a Simulink Enumeration";
myEnumType1Obj.StorageType = 'int16';
You can set the base type of the created alias type to be the created enumeration data type myColor.
myAliasType3Obj = addAliasType(archDataObj,"myAliasType3");
myAliasType3Obj.BaseType = myEnumType1Obj;
Use the addNumericType function to add numeric types to the data dictionary.
myNumericType1Obj = addNumericType(archDataObj,"myNumericType1");
myNumericType1Obj.DataTypeMode = "Single";
Use the addValueType to add value types to the data dictionary. You can also set the data type of the
value types to be pre-existing data types or created enumeration data types.
myValueType1Obj = addValueType(archDataObj,"myValueType1");
myValueType1Obj.DataType = "int32";
myValueType1Obj.Dimensions = '[2 3]';
myValueType1Obj.Description = "I am a Simulink ValueType";
1-227
1 Functions
Use the addStructType function to add struct types to the data dictionary.
myStructType1Obj = addStructType(archDataObj,"myStructType1");
structElement1 = myStructType1Obj.addElement("Element1");
structElement1.Type.DataType = "single";
structElement1.Type.Dimensions = "3";
structElement2 = addElement(myStructType1Obj,"Element2");
structElement3 = addElement(myStructType1Obj,"Element3");
You can set the data type of a struct element using the data type object, or using the name of the data
type, specified as a string scalar or character vector.
structElement2.Type = myValueType1Obj;
% or
structElement3.Type = "ValueType: myValueType1";
You can add communication interfaces and their data elements using the functions of the
Simulink.dictionary.archdata.DataInterface object.
dataInterface1Obj = addDataInterface(archDataObj,"DataInterface");
dataElm1 = addElement(dataInterface1Obj,"DE1");
dataElm1.Type = myValueType1Obj;
dataElm2 = addElement(dataInterface1Obj,"DE2");
dataElm2.Type = myStructType1Obj;
dataElm2.Dimensions = "4";
dataElm2.Description = "I am a data element with datatype = array of struct type";
dataElm3 = addElement(dataInterface1Obj,"DE3");
dataElm3.Type.DataType = "single";
dataElm3.Type.Dimensions = "10";
dataElm3.Type.Minimum = "-5";
Get and set the AUTOSAR communication interface and package properties, using the
getPlatformProperties and setPlatformProperty functions.
setPlatformProperty(platformMapping, dataInterface1Obj,...
"Package","/Interface2","InterfaceKind","NvDataInterface");
[pNames, pValues] = getPlatformProperties(platformMapping,dataInterface1Obj);
You can now generate ARXML code for the data dictionary content.
exportedFolder = exportDictionary(platformMapping);
Manage AUTOSAR Classic platform-related elements, software address method and calibration
properties. These elements do not have mappings to Simulink.
arProps = autosar.api.getAUTOSARProperties(dictName);
addPackageableElement(arProps,"SwAddrMethod", ...
1-228
Simulink.dictionary.ArchitecturalData
"/SwAddressMethods","VAR1","SectionType","Var");
setPlatformProperty(platformMapping,dataElm1, ...
SwAddrMethod="VAR1",SwCalibrationAccess="ReadWrite",...
DisplayFormat="%.3f");
Version History
Introduced in R2023b
See Also
Tools
Architectural Data Editor
Objects
autosar.dictionary.ARClassicPlatformMapping |
Simulink.dictionary.archdata.DataInterface |
Simulink.dictionary.archdata.DataElement |
Simulink.dictionary.archdata.ServiceInterface |
Simulink.dictionary.archdata.FunctionElement |
Simulink.dictionary.archdata.FunctionArgument |
Simulink.dictionary.archdata.StructElement |
Simulink.dictionary.archdata.StructType
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
moveToDesignData | moveToDictionary | exportDictionary | getPlatformProperties |
getPlatformProperty | setPlatformProperty
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-229
1 Functions
Simulink.dictionary.archdata.create
Create Simulink data dictionary and Architectural Data object
Syntax
archDataObj = Simulink.dictionary.archdata.create(dictionaryName)
Description
archDataObj = Simulink.dictionary.archdata.create(dictionaryName) creates an
Architectural data object that represents the architectural data of the Simulink data dictionary
specified by dictionaryName.
Examples
To create an Architectural Data object that represents the architectural data in the specified Simulink
data dictionary, use the Simulink.dictionary.archdata.create function.
archDataObj = Simulink.dictionary.archdata.create("dictionaryName.sldd");
Input Arguments
dictionaryName — Name of Simulink data dictionary
character vector | string scalar
File name of a Simulink data dictionary, specified as a character vector or string scalar. The name
must include the .sldd extension and must be a valid MATLAB identifier.
Example: "myDictionary.sldd"
Data Types: char | string
Output Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Version History
Introduced in R2023b
1-230
Simulink.dictionary.archdata.create
See Also
Tools
Architectural Data Editor
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.open | addAliasType | addEnumType | addDataInterface |
addPlatformMapping | addStructType | addValueType | close | getDataType |
getDataTypeNames | getInterface | getInterfaceNames | importFromFile | isDirty |
removeDataType | removeInterface | save | show | showChanges
1-231
1 Functions
Simulink.dictionary.archdata.open
Create Architectural Data object representing architectural data of existing Simulink data dictionary
Syntax
archDataObj = Simulink.dictionary.archdata.open('dictionaryName')
Description
archDataObj = Simulink.dictionary.archdata.open('dictionaryName') returns an
Architectural Data object of the Simulink data dictionary specified by dictionaryName.
Examples
To create an Architectural Data object representing the architectural data of the Simulink data
dictionary specified by dictionaryName, use the Simulink.dictionary.archdata.open
function. For an example that shows more of this workflow for related functions, see “Create
Architectural Data Object and Use It to Configure Architectural Data” on page 1-227.
archDataObj = Simulink.dictionary.archdata.open("myDictionary.sldd");
Input Arguments
dictionaryName — Name of Simulink data dictionary
character vector | string scalar
File name of a Simulink data dictionary, specified as a character vector or string scalar. The name
must include the .sldd extension and must be a valid MATLAB identifier.
Example: "myDictionary.sldd"
Data Types: char | string
Output Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Version History
Introduced in R2023b
1-232
Simulink.dictionary.archdata.open
See Also
Tools
Architectural Data Editor
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | addAliasType | addDataInterface |
addEnumType | addPlatformMapping | addStructType | addValueType | close | getDataType
| getDataTypeNames | getInterface | getInterfaceNames | getPlatformMapping |
importFromBaseWorkspace | importFromFile | isDirty | removeDataType |
removeInterface | save | show | showChanges
1-233
1 Functions
addAliasType
Package: Simulink.dictionary.archdata
Add Simulink alias type to Architectural Data section of Simulink data dictionary
Syntax
dataType = addAliasType(archDataObj,dataTypeName)
dataType = addAliasType(archDataObj,dataTypeName,BaseType=baseType)
Description
dataType = addAliasType(archDataObj,dataTypeName) adds a Simulink.AliasType
specified by dataTypeName to archDataObj.
Examples
To add a Simulink.AliasType with a specified name to the data dictionary, use the addAliasType
function. For an example that shows more of the workflow for related functions, see “Create
Architectural Data Object and Use It to Configure Architectural Data” on page 1-227.
Create or open a data dictionary. This example uses a previously created data dictionary
MyInterfaces.sldd.
dictName = "MyInterfaces.sldd";
archDataObj = Simulink.dictionary.archdata.open(dictName);
Add alias types using the addAliasType function. Specify the name, and base type using either
input arguments of the function or the created alias type object.
myAliasType1 = addAliasType(archDataObj,'aliasType',BaseType="single");
myAliasType1.Name = "myAliasType1";
myAliasType1.BaseType = 'fixdt(1,32,16)';
myAliasType2 = addAliasType(archDataObj,'myAliasType2');
You can use alias type objects as the base types of other objects.
myAliasType2.BaseType = myAliasType1;
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
1-234
addAliasType
Base data type that this alias renames, specified as a character vector or string scalar. You can
specify the name of a standard data type, such as "uint32" or "single", or the name of a custom
data type, such as the name of another Simulink.AliasType object, or the name of an
enumeration.
Example: BaseType="uint32"
Output Arguments
dataType — Alias type object
Simulink.dictionary.archdata.AliasType object
Version History
Introduced in R2023b
See Also
Tools
Architectural Data Editor
Objects
Simulink.dictionary.ArchitecturalData | Simulink.AliasType
Functions
addEnumType | getDataType | getDataTypeNames
1-235
1 Functions
addDataInterface
Package: Simulink.dictionary.archdata
Syntax
interfaceObj = addDataInterface(archDataObj,interfaceName)
Description
interfaceObj = addDataInterface(archDataObj,interfaceName) adds a data interface
with the specified name to the data dictionary and returns the interface object that represents the
interface.
Examples
To add a data interface for the specified bus object, use the addDataInterface function. For an
example that shows more of the workflow for related functions, see “Create Architectural Data Object
and Use It to Configure Architectural Data” on page 1-227.
Add a data interface and create an object representing the interface using the addDataInterface
function.
dataInterface1 = addDataInterface(archDataObj,"DataInterface");
You can add elements to the data interface using the addElement function.
dataElm1 = addElement(dataInterface1,"DE1");
dataElm1.Type = myAliasType1;
dataElm2 = addElement(dataInterface1,"DE2");
dataElm2.Type = myAliasType2;
dataElm2.Dimensions = '4';
dataElm2.Description = "I am a data element with DataType = array of struct type";
dataElm3 = addElement(dataInterface1,"DE3");
dataElm3.Type.DataType = 'single';
dataElm3.Type.Dimensions = '10';
dataElm3.Type.Minimum = '-5';
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
1-236
addDataInterface
Output Arguments
interfaceObj — Data interface object
Simulink.dictionary.archdata.DataInterface object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.DataInterface |
Simulink.dictionary.archdata.DataElement
Functions
addElement | getInterface | getInterfaceNames | removeInterface
1-237
1 Functions
addEnumType
Package: Simulink.dictionary.archdata
Syntax
dataType = addEnumType(archDataObj,dataTypeName)
Description
dataType = addEnumType(archDataObj,dataTypeName) adds a Simulink enumeration
dataTypeName to archDataObj, the Architectural Data section of a data dictionary.
Examples
To add a Simulink enumeration with a specified name to the data dictionary, use the addEnumType
function. For an example that shows more of the workflow for related functions, see “Create
Architectural Data Object and Use It to Configure Architectural Data” on page 1-227.
Create or open a data dictionary. This example uses a previously created data dictionary
MyInterfaces.sldd.
dictName = "MyInterfaces.sldd";
archDataObj = Simulink.dictionary.archdata.open(dictName);
Add enumerated data type objects to the data dictionary using the addEnumType function. You can
specify the name, default value, storage type, and write a description of the enumerated data type
using the enumerated data type object.
myEnumType1 = addEnumType(archDataObj,"myColor");
myEnumType1.addEnumeral("RED",'0',"Solid Red");
myEnumType1.addEnumeral("BLUE",'1',"Solid Blue");
myEnumType1.DefaultValue = 'BLUE';
myEnumType1.Description = "I am a Simulink Enumeration";
myEnumType1.StorageType = 'int16';
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
1-238
addEnumType
Output Arguments
dataType — Enumerated data type object
Simulink.dictionary.archdata.EnumType object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
addAliasType | Simulink.dictionary.archdata.create |
Simulink.dictionary.archdata.open | addStructType | getDataType | getDataTypeNames
| removeDataType
1-239
1 Functions
addNumericType
Package: Simulink.dictionary.archdata
Add Simulink numeric type to Architectural Data section of Simulink data dictionary
Syntax
dataType = addNumericType(archDataObj,dataTypeName)
dataType = addNumericType(archDataObj,dataTypeName,SimulinkNumericType=
numericTypeObj)
Description
dataType = addNumericType(archDataObj,dataTypeName) adds a Simulink.NumericType
specified by dataTypeName to archDataobj, the Architectural Data section of the data dictionary.
dataType = addNumericType(archDataObj,dataTypeName,SimulinkNumericType=
numericTypeObj) adds a Simulink.NumericType that has the same property values as the
specified Simulink.NumericType object numericTypeObj.
Examples
To add a numeric data type with a specified name to the data dictionary, use the addNumericType
function. For an example that shows more of the workflow for related functions, see “Create
Architectural Data Object and Use It to Configure Architectural Data” on page 1-227.
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd");
myNumericType = addNumericType(archDataObj,"myNumericType1")
myNumericType =
Name: 'myNumericType1'
DataTypeMode: 'Double'
DataTypeOverride: 'Inherit'
IsAlias: 0
Description: ''
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To add a numeric data type that has the same property values as an existing
Simulink.NumericType data type to the data dictionary, use the addNumericType function
specifying the SimulinkNumericType name-value argument.
1-240
addNumericType
exampleNumericTypeObj = Simulink.NumericType;
exampleNumericTypeObj.DataTypeMode = 'Single';
exampleNumericTypeObj.Description = 'This is my example numeric type';
archDataObj = Simulink.interface.dictionary.open('MyInterfaces.sldd');
myNumericType2 = addNumericType(archDataObj,'myNumericType2',...
SimulinkNumericType=exampleNumericTypeObj)
myNumericType2 =
Name: 'myNumericType2'
DataTypeMode: 'Single'
DataTypeOverride: 'Inherit'
IsAlias: 0
Description: 'This is my example numeric type'
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Data type definition name of archDataObj, specified as a character vector or a string scalar.
Example: "airSpeed"
Simulink numeric data type object, specified as a Simulink.NumericType object that has been
previously defined.
Example: SimulinkNumericType=exampleSimulinkNumericTypeObj
Output Arguments
dataType — Numeric data type object
Simulink.dictionary.archdata.NumericType object
Version History
Introduced in R2023b
1-241
1 Functions
See Also
Objects
Simulink.dictionary.ArchitecturalData | Simulink.NumericType
Functions
addEnumType | getDataType | getDataTypeNames
1-242
addPlatformMapping
addPlatformMapping
Package: Simulink.dictionary.archdata
Add AUTOSAR Classic mapping to Architectural Data section of Simulink data dictionary
Syntax
platformMapping = addPlatformMapping(archDataObj,platformName)
Description
platformMapping = addPlatformMapping(archDataObj,platformName) adds a mapping for
the platform specified by platformName to archDataObj, the Architectural Data section of the data
dictionary.
Examples
To add an AUTOSAR Classic mapping to a Simulink data dictionary, use the addPlatformMapping
function. For an example that shows more of the workflow for related functions, see “Create
Architectural Data Object and Use It to Configure Architectural Data” on page 1-227.
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Output Arguments
platformMapping — Platform mapping object
autosar.dictionary.ARClassicPlatformMapping object
1-243
1 Functions
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData |
autosar.dictionary.ARClassicPlatformMapping
Functions
getPlatformMapping | Simulink.dictionary.archdata.create |
Simulink.dictionary.archdata.open
1-244
addReference
addReference
Package: Simulink.dictionary.archdata
Add data dictionary reference to Architectural Data section of Simulink data dictionary
Syntax
addReference(archDataObj,refDict)
Description
addReference(archDataObj,refDict) adds a referenced dictionary, specified by refDict, to
the Architectural Data section of the specified data dictionary, archDataObj. Dictionary referencing
is supported only for data dictionaries that do not have applied platform mappings.
Examples
refDicts = getReferences(archDataObj1)
refDicts =
{'C:\work\ReferenceInterfaces1.sldd'}
{'C:\work\ReferenceInterfaces2.sldd'}
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
1-245
1 Functions
Example: "ReferenceDictionary.sldd"
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
getReferences | removeReference
1-246
addServiceInterface
addServiceInterface
Package: Simulink.dictionary.archdata
Syntax
serviceInterfaceObj = addServiceInterface(archDataObj,serviceInterfaceName)
Description
serviceInterfaceObj = addServiceInterface(archDataObj,serviceInterfaceName)
adds a service interface specified by serviceInterfaceName to archDataObj, the Architectural
Data section of a data dictionary, and returns the
Simulink.dictionary.archdata.ServiceInterface object that represents this interface.
Examples
To add a service interface with a specified name to a native (unmapped) data dictionary, use the
addServiceInterface function. For an example that shows more of the workflow for related
functions, see “Create Architectural Data Object and Use It to Configure Architectural Data” on page
1-227.
dictName = "MyInterfaces.sldd";
archDataObj = Simulink.dictionary.archdata.open(dictName);
serviceInterfObj = addServiceInterface(archDataObj,"ServiceInterface1")
serviceInterfObj =
Name: 'ServiceInterface1'
Description: ''
Elements: [0×0 Simulink.dictionary.archdata.FunctionElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
1-247
1 Functions
Service interface name in the Interfaces property array of archDataObj, specified as a character
vector or a string scalar.
Example: "ServiceInterface1"
Output Arguments
serviceInterfaceObj — Service interface object
Simulink.dictionary.archdata.ServiceInterface object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.ServiceInterface
Functions
getInterface | getInterfaceNames | removeInterface
1-248
addStructType
addStructType
Package: Simulink.dictionary.archdata
Syntax
dataType = addStructType(archDataObj,dataTypeName)
dataType = addStructType(archDataObj,dataTypeName,SimulinkBus=busObj)
Description
dataType = addStructType(archDataObj,dataTypeName) adds a Simulink.Bus type
specified by dataTypeName to archDataObj, the Architectural Data section of the data dictionary.
Examples
To add a Simulink.Bus type with the specified name to a data dictionary, use the addStructType
function. For an example that shows more of the workflow for related functions, see “Create
Architectural Data Object and Use It to Configure Architectural Data” on page 1-227.
Create or open a data dictionary. This example uses a previously created data dictionary
MyInterfaces.sldd.
dictName = "MyInterfaces.sldd";
archDataObj = Simulink.dictionary.archdata.open(dictName);
Add a structured data type to the Architectural Data section of the data dictionary. You can specify
the name, data type, and dimensions using the addStructType function or the object representing
the structured data type.
Add Structure Type Based on Simulink.Bus Type to the Architectural Data Section of
Simulink Data Dictionary
This example adds a StructType type that is the same as an existing Simulink.Bus object to the
Architectural Data section of the Simulink data dictionary, MyInterfaces.sldd.
1-249
1 Functions
Create a Simulink.Bus object and add elements using the Simulink.Bus object.
simBusObj = Simulink.Bus;
busElement1 = Simulink.BusElement;
busElement1.Name = "MyBusElement1";
busElement1.DataType = 'single';
simBusObj.Elements(1) = busElement1;
busElement2 = Simulink.BusElement;
busElement2.Name = "MyBusElement2";
simBusObj.Elements(2) = busElement2;
Using the addStructType function you can add a structured data type to the Architectural Data
section of the data dictionary that is based on the Simulink.Bus object created in the previous step.
myNewStructType = addStructType(archDataObj,"StructFromSimBus",SimulinkBus=simBusObj)
myNewStructType =
Name: 'StructFromSimBus'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.StructElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Output Arguments
dataType — Structure type object
Simulink.dictionary.archdata.StructureType object
1-250
addStructType
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData | Simulink.Bus
Functions
addAliasType | addEnumType | addValueType | getDataType | getDataTypeNames |
removeDataType | Simulink.dictionary.archdata.create |
Simulink.dictionary.archdata.open
1-251
1 Functions
addValueType
Package: Simulink.dictionary.archdata
Syntax
dataType = addValueType(archDataObj,dataTypeName)
dataType = addValueType(archDataObj,dataTypeName,SimulinkValueType=
valueTypeObj)
Description
dataType = addValueType(archDataObj,dataTypeName) adds a Simulink.ValueType
specified as dataTypeName to archDataObj, the Architectural Data section of the data dictionary.
dataType = addValueType(archDataObj,dataTypeName,SimulinkValueType=
valueTypeObj) adds a value type based on the specified Simulink.ValueType valueTypeObj to
the data dictionary.
Examples
To add a Simulink.ValueType with a specified name to the data dictionary, use the addValueType
function. For an example that shows more of the workflow for related functions, see “Create
Architectural Data Object and Use It to Configure Architectural Data” on page 1-227.
Create or open a data dictionary. This example adds a value type to the data dictionary
MyInterfaces.sldd.
dictName = "MyInterfaces.sldd";
archDataObj = Simulink.dictionary.archdata.open(dictName);
Add a value type to the Architectural Data section of a data dictionary. You can set the data type,
dimensions, and define a description of the created value type.
myValueType1 = addValueType(archDataObj,"myValueType1");
myValueType1.DataType = 'int32';
myValueType1.Dimensions = '[2 3]';
myValueType1.Description = "I am a Simulink ValueType";
This example adds a value type that is the same as an existing Simulink.ValueType to the
Architectural Data section of a data dictionary, MyInterfaces.sldd.
1-252
addValueType
dictName = 'MyInterfaces.sldd';
archDataObj = Simulink.dictionary.archdata.open(dictName);
simValueType = Simulink.ValueType;
simValueType.DataType = 'single';
simValueType.Min = 11;
simValueType.Max = 17;
simValueType.Dimensions = [2 4 3];
simValueType.Description = 'Simulink value type';
Using the addValueType function you can add a value data type to the Architectural Data section of
the data dictionary that is based on the Simulink.ValueType object created in the previous step.
myNewValueType1 =
Name: 'MyNewValueType'
DataType: 'single'
Minimum: '11'
Maximum: '17'
Unit: ''
Complexity: 'real'
Dimensions: '[2 4 3]'
Description: 'Simulink value type'
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Input Arguments
archDataObj — Architectural data object
Simulink.dictionary.ArchitecturalData object
1-253
1 Functions
Output Arguments
dataType — Value type object
Simulink.dictionary.archdata.ValueType object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData | Simulink.ValueType
Functions
addAliasType | addEnumType | addStructType | getDataType | getDataTypeNames | save |
show | showChanges | Simulink.dictionary.archdata.create |
Simulink.dictionary.archdata.open
1-254
close
close
Package: Simulink.dictionary.archdata
Syntax
close(archDataObj)
close(archDataObj,"DiscardChanges",true)
Description
close(archDataObj) closes any open connections to the data dictionary. If the dictionary has
unsaved changes, an error is thrown.
Examples
To close any open connections to a data dictionary, use the close function.
close(archDataObj);
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
isDirty | save | show | showChanges | Simulink.dictionary.archdata.create |
Simulink.dictionary.archdata.open
1-255
1 Functions
discardChanges
Package: Simulink.dictionary.archdata
Syntax
discardChanges(archDataObj)
Description
discardChanges(archDataObj) discards any changes made to the data dictionary archDataObj
since the last time the data dictionary was saved.
Examples
Add a new enumeration data type to the Architectural Data section of a data dictionary and then
discard the changes.
Open the data dictionary MyInterfaces.sldd and use the isDirty function to verify that the data
dictionary does not contain changes.
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd");
isDirty(archDataObj)
ans =
logical
ans =
Columns 1 through 4
Columns 5 through 8
1-256
discardChanges
discardChanges(archDataObj);
getDataTypeNames(archDataObj)
ans =
Columns 1 through 4
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
addEnumType | getDataTypeNames | isDirty | showChanges |
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open
1-257
1 Functions
findEntryByName
Package: Simulink.dictionary.archdata
Syntax
entryObj = findEntryByName(archDataObj,entryName)
Description
entryObj = findEntryByName(archDataObj,entryName) returns the object that corresponds
to the specified entry name, entryName, in archDataObj, the Architectural Data section of a data
dictionary. If the entry does not exist in the data dictionary, an empty value is returned.
Examples
Get the object representing the structure data type named myStructType1 from the Architectural
Data section of the data dictionary MyInterfaces.sldd.
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd");
structObj = findEntryByName(archDataObj,"myStructType1")
structObj =
Name: 'myStructType1'
Description: ''
Elements: [0×0 Simulink.dictionary.archdata.StructElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
1-258
findEntryByName
Output Arguments
entryObj — Architectural data element object
DataInterface object | AliasType object | EnumType object | NumericType object | StructType
object | ValueType object | Constant object
Architectural data element object, returned as the object type of the corresponding entry in the
Architectural Data section. If the specified data element object does not exist an error is thrown.
Version History
Introduced in R2023b
See Also
Tools
Simulink.dictionary.ArchitecturalData
Functions
getInterface | getInterfaceNames | getDataTypeNames | getDataType |
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open
1-259
1 Functions
getDataType
Package: Simulink.dictionary.archdata
Syntax
dataTypeObj = getDataType(archDataObj,dataTypeName)
Description
dataTypeObj = getDataType(archDataObj,dataTypeName) returns the data type object in
archDataObj, the Architectural Data section of a data dictionary, that represents the data type
specified by dataTypeName.
Examples
Get Data Type from Architectural Data Section of Simulink Data Dictionary
To get the data type object that represents a data type in a data dictionary, use the getDataType
function. For an example that shows more of the workflow for related functions, see “Create
Architectural Data Object and Use It to Configure Architectural Data” on page 1-227.
myColorObj = getDataType(archDataObj,"myColor")
myColorObj =
Name: 'myColor'
Description: ''
DefaultValue: 'enum1'
StorageType: 'Native Integer'
Enumerals: [1×1 Simulink.dictionary.archdata.Enumeral]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Get the AliasType object specified by the myAliasType1 data type name in the archDataObj
object.
myAliasType1Obj = getDataType(archDataObj,'myAliasType1')
myAliasType1Obj =
Name: 'myAliasType1'
BaseType: 'double'
1-260
getDataType
Description: ''
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Output Arguments
dataTypeObj — Data type object
AliasType object | EnumType object | NumericType object | StructType object | ValueType
object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addAliasType | addEnumType | addNumericType | addStructType | addValueType |
getDataTypeNames | removeDataType
1-261
1 Functions
getDataTypeNames
Package: Simulink.dictionary.archdata
Get names of data types in Architectural Data section of Simulink data dictionary
Syntax
dataTypeNames = getDataTypeNames(archDataObj)
dataTypeNames = getDataTypeNames(archDataObj,LookInsideDictReferences=tf)
Description
dataTypeNames = getDataTypeNames(archDataObj) returns a cell array of the data type
names in archDataObj, the Architectural Data section of a data dictionary.
dataTypeNames = getDataTypeNames(archDataObj,LookInsideDictReferences=tf)
returns data type names in the top data dictionary only, or in the top data dictionary and in
referenced data dictionaries.
Examples
Get Data Type Names in Architectural Data Section of Simulink Data Dictionary
To get a cell array of the data type names in a data dictionary, use the getDataTypeNames function.
For an example that shows more of the workflow for related functions, see “Create Architectural Data
Object and Use It to Configure Architectural Data” on page 1-227.
dataTypeNames = getDataTypeNames(archDataObj)
dataTypeNames =
Columns 1 through 3
Column 4 through 6
Column 7
{'myValueType1'}
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
1-262
getDataTypeNames
Flag to list constants in referenced data dictionaries in the returned cell array, specified as one of
these values:
• true — Data types in the referenced data dictionaries will be included in the returned cell array.
• false — Data types in the referenced data dictionaries will not be included in the returned cell
array.
Example: true
Output Arguments
dataTypeNames — Data type names
cell array of character vectors
Data type names in DataTypes property array of archDataObj, returned as a cell array of character
vectors.
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
getDataType | removeDataType | removeInterface
1-263
1 Functions
getInterface
Package: Simulink.dictionary.archdata
Get interface object for interface in Architectural Data section of Simulink data dictionary
Syntax
interfaceObj = getInterface(archDataObj,interfaceName)
Description
interfaceObj = getInterface(archDataObj,interfaceName) returns the interface object
that represents the interface specified by interfaceName in archDataObj, the Architectural Data
section of the data dictionary.
Examples
Get Interface Object from Architectural Data Section of Simulink Data Dictionary
To get the interface object that represents the an interface in a data dictionary, use the
getInterface function. For an example that shows more of the workflow for related functions, see
“Create Architectural Data Object and Use It to Configure Architectural Data” on page 1-227.
myInterfaceObj = getInterface(archDataObj,"DataInterface")
myInterfaceObj =
Name: 'DataInterface'
Description: ''
Elements: [1×1 Simulink.dictionary.archdata.DataElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Input Arguments
archDataObj — Architectural data object
Simulink.dictionary.ArchitecturalData object
1-264
getInterface
Output Arguments
interfaceObj — Interface object
DataInterface object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.DataElement
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addDataInterface | addServiceInterface | getInterfaceNames | removeInterface
1-265
1 Functions
getInterfaceNames
Package: Simulink.dictionary.archdata
Syntax
interfaceNames = getInterfaceNames(archDataObj)
interfaceNames = getInterfaceNames(archDataObj,LookInsideDictReferences=tf)
Description
interfaceNames = getInterfaceNames(archDataObj) returns a cell array of the interface
names in archDataObj, the Architectural Data section of a data dictionary.
interfaceNames = getInterfaceNames(archDataObj,LookInsideDictReferences=tf)
returns interface names in the top data dictionary only, or in the top data dictionary and in referenced
data dictionaries.
Examples
To get a cell array of the interface names in the data dictionary, use the getInterfaceNames
function. For an example that shows more of the workflow for related functions, see “Create
Architectural Data Object and Use It to Configure Architectural Data” on page 1-227.
myInterfaceNames = getInterfaceNames(archDataObj)
myInterfaceNames =
{'DataInterface'} {'DataInterface2'}
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Flag to list constants in referenced data dictionaries in the returned cell array, specified as one of
these values:
• true — Interfaces in the referenced data dictionaries will be included in the returned cell array.
1-266
getInterfaceNames
• false — Interfaces in the referenced data dictionaries will not be included in the returned cell
array.
Example: true
Output Arguments
interfaceNames — Interface names
cell array of character vectors
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.DataInterface |
Simulink.dictionary.archdata.DataElement
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addDataInterface | addServiceInterface | getInterface | removeInterface
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-267
1 Functions
getPlatformMapping
Package: Simulink.dictionary.archdata
Syntax
platformMapping = getPlatformMapping(archDataObj,"AUTOSARClassic")
Description
platformMapping = getPlatformMapping(archDataObj,"AUTOSARClassic") returns the
mapping object for the AUTOSAR Classic platform in the data dictionary. This allows configuration of
platform-specific properties in the data dictionary.
Examples
To get the mapping object for the AUTOSAR Classic platform in the data dictionary, use the
getPlatformMapping function. For an example that shows more of the workflow for related
functions, see “Create Architectural Data Object and Use It to Configure Architectural Data” on page
1-227.
myPlatformMapping = getPlatformMapping(archDataObj,"AUTOSARClassic")
myPlatformMapping =
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Output Arguments
platformMapping — Platform mapping object
autosar.dictionary.ARClassicPlatformMapping object
Version History
Introduced in R2023b
1-268
getPlatformMapping
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
addAliasType | addDataInterface | addEnumType | addPlatformMapping | addStructType |
addValueType | close | getDataType | getDataTypeNames | getInterface |
getInterfaceNames | importFromBaseWorkspace | importFromFile | isDirty |
removeDataType | removeInterface | save | show | showChanges |
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open
1-269
1 Functions
getReferences
Package: Simulink.dictionary.archdata
Get full paths of Simulink data dictionaries referenced by another Simulink data dictionary
Syntax
refDictNames = getReferences(archDataObj)
Description
refDictNames = getReferences(archDataObj) returns a cell array of the full paths of the data
dictionaries that are referenced by the data dictionary with Architectural Data object archDataObj.
Examples
Get Full Paths of Simulink Data Dictionaries Referenced from Another Simulink Data
Dictionary
Get full paths of data dictionaries referenced from the data dictionary MyInterfaces.sldd. For an
example that shows more of the workflow for related functions, see “Create Architectural Data Object
and Use It to Configure Architectural Data” on page 1-227.
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd");
refDicts = getReferences(archDataObj)
refDicts =
{'C:\work\ReferenceInterfaces1.sldd'}
{'C:\work\ReferenceInterfaces2.sldd'}
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Output Arguments
refDictNames — Full paths of referenced data dictionaries
cell array of character vectors
Full paths of referenced data dictionaries represented as full paths, returned as a cell array of
character vectors.
Example: {'C:\work\ReferenceInterfaces1.sldd'}
1-270
getReferences
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addReference | removeReference
1-271
1 Functions
importFromBaseWorkspace
Package: Simulink.dictionary.archdata
Import Simulink object definitions from base workspace to Architectural Data section of Simulink
data dictionary
Syntax
importFromBaseWorkspace(archDataObj)
Description
importFromBaseWorkspace(archDataObj) copies all variables from base workspace to the
Architectural Data section of a data dictionary archDataObj without overwriting any existing
entries. The Simulink.Bus objects are imported as data interfaces. For those objects that need to be
used as structure DataType, use the convertToDataInterface and convertToStructType
functions respectively.
Examples
To import Simulink objects from the base workspace to a data dictionary, use the
importFromBaseWorkspace function. For an example that shows more of the workflow for related
functions, see “Create Architectural Data Object and Use It to Configure Architectural Data” on page
1-227.
importFromBaseWorkspace(archDataObj);
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addAliasType | addDataInterface | addEnumType | addPlatformMapping | addStructType |
1-272
importFromBaseWorkspace
1-273
1 Functions
importFromFile
Package: Simulink.dictionary.archdata
Import Simulink object definitions from file to Architectural Data section of data dictionary
Syntax
importFromFile(archDataObj,matFileName)
Description
importFromFile(archDataObj,matFileName) copies Simulink.Bus, Simulink.ValueType,
Simulink.AliasType, and constant objects from the MAT file specified by matFileName to the
Architectural Data section of a data dictionary identified by archDataObj. The Simulink.Bus
objects are imported as data interfaces. For those objects that need to be used as structure
DataType, use the convertToDataInterface and convertToStructType functions respectively.
Examples
Import Buses, Value Types, Alias Types, and Constants to Architectural Data Section of Data
Dictionary
importFromFile(archDataObj,"myMatFile.mat");
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Name of MAT file, specified as a character vector or string scalar. The name must include the .mat
extension and must be a valid MATLAB identifier.
Example: "myMatFile.mat"
Version History
Introduced in R2023b
1-274
importFromFile
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addAliasType | addDataInterface | addEnumType | addPlatformMapping | addStructType |
addValueType | close | getDataType | getDataTypeNames | getInterface |
getInterfaceNames | getPlatformMapping | importFromBaseWorkspace | isDirty |
removeDataType | removeInterface | save | show | showChanges
1-275
1 Functions
isDirty
Package: Simulink.dictionary.archdata
Syntax
hasUnsavedChanges = isDirty(archDataObj)
Description
hasUnsavedChanges = isDirty(archDataObj) returns a 1 (true) if the data dictionary
specified by archDataObj has unsaved changes.
Examples
To determine whether a data dictionary has unsaved changes, use the isDirty function. For an
example that shows more of the workflow for related functions, see “Create Architectural Data Object
and Use It to Configure Architectural Data” on page 1-227.
isDirty(archDataObj)
ans =
logical
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
1-276
isDirty
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open | close |
save | show | showChanges
1-277
1 Functions
removeDataType
Package: Simulink.dictionary.archdata
Remove data type from Architectural Data section of Simulink data dictionary
Syntax
removeDataType(archDataObj,dataTypeName)
Description
removeDataType(archDataObj,dataTypeName) deletes the data type specified by
dataTypeName in archDataObj, the Architectural Data section of a data dictionary.
Examples
Remove Data Type from Architectural Data Section of Simulink Data Dictionary
To delete a DataType in a data dictionary, use the removeDataType function. For an example that
shows more of the workflow for related functions, see “Create Architectural Data Object and Use It to
Configure Architectural Data” on page 1-227.
removeDataType(archDataObj,"myAliasType1");
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
1-278
removeDataType
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addAliasType | addEnumType | addNumericType | addStructType | addValueType |
getDataType | getDataTypeNames
1-279
1 Functions
removeInterface
Package: Simulink.dictionary.archdata
Syntax
removeInterface(archDataObj,interfaceName)
Description
removeInterface(archDataObj,interfaceName) deletes the interface specified by
interfaceName from archDataObj, the Architectural Data section of a data dictionary.
Examples
To delete an interface from a data dictionary, use the removeInterface function. For an example
that shows more of the workflow for related functions, see “Create Architectural Data Object and Use
It to Configure Architectural Data” on page 1-227.
removeInterface(archDataObj,"DataInterface");
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Version History
Introduced in R2023b
1-280
removeInterface
See Also
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.DataInterface |
Simulink.dictionary.archdata.DataElement
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addDataInterface | getInterface | getInterfaceNames
1-281
1 Functions
removeReference
Package: Simulink.dictionary.archdata
Syntax
removeReference(archDataObj,refDict)
Description
removeReference(archDataObj,refDict) removes a Simulink data dictionary reference,
specified as refDict, from archDataObj, the Architectural Data section of a data dictionary.
Examples
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd");
refDicts = getReferences(archDataObj)
refDicts =
{'C:\work\ReferenceInterfaces1.sldd'}
{'C:\work\ReferenceInterfaces2.sldd'}
Remove the referenced dictionaries, using the Architectural Data object or character vector
representing the referenced data dictionary.
refArchDataObj = Simulink.dictionary.archdata.open("ReferenceInterfaces1.sldd");
removeReference(archDataObj,refArchDataObj);
removeReference(archDataObj,"ReferenceInterfaces2.sldd");
refDicts = getReferences(archDataObj)
1-282
removeReference
refDicts =
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addReference | getReferences
1-283
1 Functions
save
Package: Simulink.dictionary.archdata
Syntax
save(archDataObj)
Description
save(archDataObj) saves changes to the Architectural Data section of a data dictionary.
Examples
To save your changes to architectural data of a data dictionary, use the save function. For an example
that shows more of the workflow for related functions, see “Create Architectural Data Object and Use
It to Configure Architectural Data” on page 1-227.
save(archDataObj);
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open | close |
isDirty | show | showChanges
1-284
show
show
Package: Simulink.dictionary.archdata
Syntax
show(archDataObj)
show(dataInterfaceObj)
show(dataElementObj)
Description
show(archDataObj) displays the architectural data of a Simulink data dictionary in the
Architectural Data Editor.
Examples
To view the architectural data of a Simulink data dictionary in the Architectural Data Editor, use the
show function. For an example that shows more of the workflow for related functions, see “Create
Architectural Data Object and Use It to Configure Architectural Data” on page 1-227.
show(archDataObj);
1-285
1 Functions
This example shows how to view a data interface in the Architectural Data Editor.
archDataObj = Simulink.dictionary.archdata.open("myInterfaceDict.sldd")
archDataObj =
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
interfaceObj = getInterface(archDataObj,"DataInterface")
interfaceObj =
Name: 'DataInterface'
Description: ''
1-286
show
Use the show function to display the data interface in the Architectural Data Editor.
show(dataInterfaceObj)
This example shows how to view a data element in the Architectural Data Editor.
archDataObj = Simulink.dictionary.archdata.open("myInterfaces.sldd")
archDataObj =
DictionaryFileName: 'myInterfaces.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
dataElem1 = getElement(interfaceObj,"element1")
1-287
1 Functions
dataElem1 =
Name: 'element1'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
Use the show function to display the data element in the Architectural Data Editor.
show(dataElem1)
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
1-288
show
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.DataInterface |
Simulink.dictionary.archdata.DataElement
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open | close |
isDirty | save | showChanges
1-289
1 Functions
showChanges
Package: Simulink.dictionary.archdata
Syntax
showChanges(archDataObj)
Description
showChanges(archDataObj) opens the Comparison Tool and displays changes to the data
dictionary archDataObj since it was last saved. The Comparison tab shows the differences in the
Simulink design data properties. Changes made to platform properties are not shown.
Examples
To open the Comparison Tool window and display changes to the architectural data since it was last
saved, use the showChanges function. For an example that shows more of the workflow for related
functions, see “Create Architectural Data Object and Use It to Configure Architectural Data” on page
1-227.
showChanges(archDataObj);
1-290
showChanges
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
1-291
1 Functions
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open | close |
isDirty | save | show
1-292
addConstant
addConstant
Package: Simulink.dictionary.archdata
Syntax
constObj = addConstant(archDataObj,constName)
constObj = addConstant(archDataObj,constName,value)
Description
constObj = addConstant(archDataObj,constName) adds a constant with the specified name
constName to the archDataObj, the Architectural Data section of a data dictionary and returns the
constant object that represents the constant.
Examples
To add a constant to the data dictionary, use the addConstant function. For an example that shows
more of the workflow for related functions, see “Create Architectural Data Object and Use It to
Configure Architectural Data” on page 1-227.
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd");
myConst = addConstant(archDataObj,"myConstant")
myConst =
Name: 'myConstant'
Value: 0
DataType: 'double'
Description: ''
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
myCylinders = addConstant(archDataObj,"numOfCylinders",Value=4)
myCylinders =
Name: 'numOfCylinders'
Value: 4
DataType: 'double'
1-293
1 Functions
Description: ''
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Output Arguments
constObj — Constant object
Simulink.dictionary.archdata.Constant object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addEnumType | addValueType | getConstant | getConstantNames | removeConstant
1-294
getConstant
getConstant
Package: Simulink.dictionary.archdata
Syntax
constObj = getConstant(archDataObj,constName)
Description
constObj = getConstant(archDataObj,constName) returns the constant object in
archDataObj, the Architectural Data section of a data dictionary, that represents the constant
specified by constName.
Examples
To get the constant object that represents a constant in a data dictionary, use the getConstant
function. For an example that shows more of the workflow for related functions, see “Create
Architectural Data Object and Use It to Configure Architectural Data” on page 1-227.
myConstObj = getConstant(archDataObj,"numOfCylinders")
myConstObj =
Name: 'numOfCylinders'
Value: 4
DataType: 'double'
Description: ''
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
1-295
1 Functions
Output Arguments
constObj — Constant object
Simulink.dictionary.archdata.Constant
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addConstant | getConstantNames | removeConstant | moveToDictionary
1-296
getConstantNames
getConstantNames
Package: Simulink.dictionary.archdata
Syntax
constantNames = getConstantNames(archDataObj)
constantNames = getConstantNames(archDataObj,LookInsideDictReferences=tf)
Description
constantNames = getConstantNames(archDataObj) returns a cell array of the constant names
in the top data dictionary specified by archDataObj, and in referenced data dictionaries.
constantNames = getConstantNames(archDataObj,LookInsideDictReferences=tf)
returns constant names in the top data dictionary only, or in the top data dictionary and in referenced
data dictionaries.
Examples
To get a cell array of the constant names in a data dictionary, use the getConstantNames function.
For an example that shows more of the workflow for related functions, see “Create Architectural Data
Object and Use It to Configure Architectural Data” on page 1-227.
constantNames = getConstantNames(archDataObj)
constantNames =
{'myConstant'} {'numOfCylinders'}
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Flag to list constants in referenced data dictionaries in the returned cell array, specified as one of
these values:
• true — Constants in the referenced data dictionaries will be included in the returned cell array.
1-297
1 Functions
• false — Constants in the referenced data dictionaries will not be included in the returned cell
array.
Example: true
Output Arguments
constantNames — Constant names
cell array of character vectors
Constant names in the Constants property array of archDataObj, returned as a cell array of
character vectors.
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addConstant | getConstant | moveToDictionary | removeConstant
1-298
removeConstant
removeConstant
Package: Simulink.dictionary.archdata
Syntax
removeConstant(archDataObj,constantName)
Description
removeConstant(archDataObj,constantName) deletes the constant specified by
constantName in archDataObj, in the Architectural Data section of a data dictionary.
Examples
To delete a specified constant from the data dictionary, use the removeConstant function. For an
example that shows more of the workflow for related functions, see “Create Architectural Data Object
and Use It to Configure Architectural Data” on page 1-227.
constNames = getConstantNames(archDataObj)
constNames =
{'constToRemove'} {'myConstant'}
Remove a constant.
removeConstant(archDataObj,"constToRemove")
constNames = getConstantNames(archDataObj)
constNames =
{'myConstant'}
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
1-299
1 Functions
Name of constant in the Constants property array of archDataObj, specified as a character vector
or string scalar.
Example: "myConst"
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addConstant | getConstant | getConstantNames
1-300
moveToDesignData
moveToDesignData
Package: Simulink.dictionary.archdata
Move interfaces, data types, and constants in Architectural Data section of Simulink data dictionary
to design data
Syntax
moveToDesignData(objName)
Description
moveToDesignData(objName) removes the data element specified by objName from the
Architectural Data section of a data dictionary while storing it in design data.
Examples
This example adds a data interface to the Architectural Data section of a data dictionary and then
moves it to design data.
Create a data dictionary and add a data interface to the Architectural Data section.
archDataObj = Simulink.dictionary.archdata.create('dataDictionary.sldd');
myDataInterfaceObj = addDataInterface(archDataObj, 'MyDataInterface');
moveToDesignData(myDataInterfaceObj);
Input Arguments
objName — Architectural data element
Simulink.dictionary.archdata.DataInterface object |
Simulink.dictionary.archdata.Constant object |
Simulink.dictionary.archdata.DataType
Architectural data element to be moved to design data, specified as one of the following object types:
Simulink.dictionary.archdata.DataInterface,
Simulink.dictionary.archdata.Constant, and
Simulink.dictionary.archdata.DataType.
Example: myConstantObj
Version History
Introduced in R2023b
1-301
1 Functions
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addDataInterface | getInterfaceNames | getDataTypeNames | getDataType | addElement |
moveToDictionary
1-302
moveToDictionary
moveToDictionary
Package: Simulink.dictionary.archdata
Syntax
moveToDictionary(archDataObj,dataName)
Description
moveToDictionary(archDataObj,dataName) moves the architectural data object specified by
elementName to archDataObj, the Architectural Data section of the data dictionary. This allows you
to move architectural data between dictionaries while maintaining port associations the moved
interfaces, as well as copying over custom profiles and stereotypes.
Examples
To move a data interface to the Architectural Data section of a data dictionary, use the
moveToDictionary function. For more information regarding workflows for related functions, see
“Create Architectural Data Object and Use It to Configure Architectural Data” on page 1-227.
archDataObj = Simulink.dictionary.archdata.create("MyInterfaces.sldd");
interfaceObj = addDataInterface(archDataObj,"myDataInterface");
archDataObj2 = Simulink.dictionary.archdata.create("OtherInterfaces.sldd");
interfaceObj.moveToDictionary(archDataObj2);
Input Arguments
archDataObj — Architectural Data object
Simulink.dictionary.ArchitecturalData object
Name of interface, data type, constant, specified as a character vector or string scalar.
Example: "dataInterface"
Data Types: char | string
Version History
Introduced in R2023b
1-303
1 Functions
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open |
addDataInterface | getInterfaceNames | getDataTypeNames | getDataType | addElement
1-304
Simulink.dictionary.archdata.DataInterface
Simulink.dictionary.archdata.DataInterface
Edit data interface in Simulink data dictionary programmatically
Description
Data interfaces represent information that is shared through a connector and enters or exits a
component through a port. Data interfaces are composed of data elements that describe the structure
of the transmitted data. Data interfaces can not be composite when using an AUTOSAR platform
mapping.
Creation
To create a Simulink.dictionary.archdata.DataInterface object, add a data interface to an
existing Simulink.dictionary.ArchitecturalData object using the addDataInterface
function.
dataInterfaceObj = addDataInterface(archDataObj,"DataInterface")
dataInterfaceObj =
Name: 'DataInterface'
Description: ''
Elements: [0×0 Simulink.dictionary.archdata.DataElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Properties
Name — Name of data interface
character vector | string scalar
1-305
1 Functions
Architectural Data object of the data dictionary containing the data interface, specified as a
Simulink.dictionary.ArchitecturalData object.
Object Functions
addElement Add data element to data interface
destroy Delete data interface and remove it from Architectural Data section of Simulink
data dictionary
getElement Get data element from data interface
removeElement Remove data element from data interface
show View architectural data of Simulink data dictionary in Architectural Data Editor
Examples
This example shows how to add, get, and remove data elements from a data interface.
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [1×2 Simulink.dictionary.archdata.DataType]
Constants: [1×1 Simulink.dictionary.archdata.Constant]
interfaceObj =
Name: 'DataInterface'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.DataElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Data interfaces are composed of data elements that describe parts of a data interface. This interface
definition contains two data elements.
interfaceObj.Elements(1)
ans =
1-306
Simulink.dictionary.archdata.DataInterface
Name: 'Element1'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
interfaceObj.Elements(2)
ans =
Name: 'Element2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
Use the addElement function to add a new data element to the data interface.
dataElem3 = addElement(interfaceObj,"Element3")
dataElem3 =
Name: 'Element3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
You can get an existing data element using the getElement function.
dataElem3 = getElement(interfaceObj,"Element3")
dataElem3 =
Name: 'Element3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
removeElement(interfaceObj, 'Element3')
Version History
Introduced in R2023b
1-307
1 Functions
See Also
Settings
Architectural Data Editor
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.DataElement
Functions
addDataInterface | moveToDictionary | moveToDesignData
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-308
addElement
addElement
Package: Simulink.dictionary.archdata
Syntax
dataElementObj = addElement(dataInterfaceObj,elementName)
Description
dataElementObj = addElement(dataInterfaceObj,elementName) creates a data element
with the name elementName and adds it to the data interface specified by dataInterfaceObj.
Examples
This example shows how to add, get, and remove data elements from a data interface.
archDataObj = Simulink.dictionary.archdata.open("myInterfaceDict.sldd")
archDataObj =
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
interfaceObj = getInterface(archDataObj,"DataInterface")
interfaceObj =
Name: 'DataInterface'
Description: ''
Elements: [0×0 Simulink.dictionary.archdata.DataElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Data interfaces are composed of data elements that describe parts of a data interface. This interface
definitions contains two data elements.
getElement(interfaceObj,"Element1")
1-309
1 Functions
ans =
Name: 'Element1'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
getElement(interfaceObj,"Element2")
ans =
Name: 'Element2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
Use the addElement function to add a new data element to the data interface.
dataElem1 = addElement(interfaceObj,"element3")
dataElem1 =
Name: 'element3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
You can get an existing data element using the getElement function.
dataElem3 = getElement(interfaceObj,"element3")
dataElem3 =
Name: 'element3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
removeElement(interfaceObj,"element3")
Input Arguments
dataInterfaceObj — Data interface object
Simulink.dictionary.archdata.DataInterface object
1-310
addElement
Name of data element to add to dataInterfaceObj object, specified as a character vector or string
scalar.
Example: "myElement"
Output Arguments
dataElementObj — Data element object
Simulink.dictionary.archdata.DataElement object
Version History
Introduced in R2023b
See Also
Tools
Architectural Data Editor
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.DataInterface |
Simulink.dictionary.archdata.DataElement
Functions
getElement | removeElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-311
1 Functions
destroy
Package: Simulink.dictionary.archdata
Delete data interface and remove it from Architectural Data section of Simulink data dictionary
Syntax
destroy(dataInterfaceObj)
Description
destroy(dataInterfaceObj) deletes the data interface dataInterfaceObj and removes it from
the Architectural Data section of its parent data dictionary.
Examples
Delete and Remove Data Interface from Architectural Data Section of Simulink Data
Dictionary
This example shows how to delete a data interface and remove it from the Architectural Data section
of a Simulink data dictionary.
archDataObj = Simulink.dictionary.archdata.open("myInterfaceDict.sldd")
archDataObj =
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
interfaceObj = archDataObj.Interfaces
interfaceObj =
Name: 'DataInterface'
Description: ''
Elements: [0×0 Simulink.dictionary.archdata.DataElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Use the destroy function to delete the interface and remove it from the archDataObj.
1-312
destroy
destroy(interfaceObj)
archDataObj
archDataObj =
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [0×0 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
Input Arguments
dataInterfaceObj — Data interface object
Simulink.dictionary.archdata.DataInterface object
Version History
Introduced in R2023b
See Also
Tools
Architectural Data Editor
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.DataInterface
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-313
1 Functions
getElement
Package: Simulink.dictionary.archdata
Syntax
dataElementObj = getElement(dataInterfaceObj,elementName)
Description
dataElementObj = getElement(dataInterfaceObj,elementName) returns the data element
object with the name elementName contained in the data interface specified by
dataInterfaceObj.
Examples
This example shows how to add, get, and remove data elements from a data interface.
archDataObj =
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
interfaceObj =
Name: 'DataInterface'
Description: ''
Elements: [0×0 Simulink.dictionary.archdata.DataElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Data interfaces are composed of data elements that describe parts of a data interface. This interface
definition contains two data elements.
getElement(interfaceObj,"Element1")
1-314
getElement
ans =
Name: 'Element1'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
getElement(interfaceObj,"Element2")
ans =
Name: 'Element2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
Use the addElement function to add a new data element to the data interface.
dataElem1 = addElement(interfaceObj,"element3")
dataElem1 =
Name: 'element3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
You can get an existing data element using the getElement function.
dataElem3 = getElement(interfaceObj,"element3")
dataElem3 =
Name: 'element3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
removeElement(interfaceObj,"element3")
Input Arguments
dataInterfaceObj — Data interface object
Simulink.dictionary.archdata.DataInterface object
1-315
1 Functions
Name of the data element in the dataInterfaceObj object, specified as a character vector or string
scalar.
Output Arguments
dataElementObj — Data element object
Simulink.dictionary.archdata.DataElement object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData
Functions
addDataInterface | getInterfaceNames | removeInterface |
Simulink.dictionary.archdata.create | Simulink.dictionary.archdata.open
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-316
removeElement
removeElement
Package: DataInterface
Syntax
removeElement(dataInterfaceObj,elementName)
Description
removeElement(dataInterfaceObj,elementName) removes the data element with the name
elementName from the data interface specified by dataInterfaceObj.
Examples
This example shows how to add, get, and remove data elements from a data interface.
archDataObj = Simulink.dictionary.archdata.open("myInterfaceDict.sldd")
archDataObj =
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
interfaceObj = getInterface(archDataObj,"DataInterface")
interfaceObj =
Name: 'DataInterface'
Description: ''
Elements: [0×0 Simulink.dictionary.archdata.DataElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Data interfaces are composed of data elements that describe parts of a data interface. This interface
definition contains two data elements.
getElement(interfaceObj,"Element1")
1-317
1 Functions
ans =
Name: 'Element1'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
getElement(interfaceObj,"Element2")
ans =
Name: 'Element2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
Use the addElement function to add a new data element to the data interface.
dataElem1 = addElement(interfaceObj,"element3")
dataElem1 =
Name: 'element3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
You can get an existing data element using the getElement function.
dataElem3 = getElement(interfaceObj,"element3")
dataElem3 =
Name: 'element3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
removeElement(interfaceObj,"element3")
Input Arguments
dataInterfaceObj — Data interface object
Simulink.dictionary.archdata.DataInterface object
1-318
removeElement
Name of the data element in the dataInterfaceObj object, specified as a character vector or string
scalar.
Version History
Introduced in R2023b
See Also
Tools
Architectural Data Editor
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.DataInterface |
Simulink.dictionary.archdata.DataElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-319
1 Functions
Simulink.dictionary.archdata.DataElement
Data element of data interface
Description
A data element describes a part of a data interface, such as the structure of the transmitted data or
other decomposition of the interface.
Creation
To create a Simulink.dictionary.archdata.DataElement object, add a data element to an
existing Simulink.dictionary.archdata.DataInterface object using the addElement
function.
dataElementObj = addElement(dataInterfaceObj,"element")
dataElementObj =
Name: 'element'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
You can access an existing data element using the getElement function.
Properties
Name — Name of data element
character vector | string scalar
Type of the data element, specified as an object of one of the following types:
Simulink.dictionary.archdata.AliasType,
Simulink.dictionary.archdata.Datainterface,
1-320
Simulink.dictionary.archdata.DataElement
Simulink.dictionary.archdata.EnumType,
Simulink.dictionary.archdata.NumericType,
Simulink.dictionary.archdata.StructType, or
Simulink.dictionary.archdata.ValueType.
Dimensions of a data element, specified as a character vector representing a two element vector
containing the dimensions of the element.
Example: '[1 2]'
Data Types: char
Object Functions
destroy Delete data element and remove from data interface
show View architectural data of Simulink data dictionary in Architectural Data Editor
Examples
This example shows how to add, get, and remove data elements from a data interface.
archDataObj =
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
1-321
1 Functions
interfaceObj =
Name: 'DataInterface'
Description: ''
Elements: [0×0 Simulink.dictionary.archdata.DataElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Data interfaces are composed of data elements that describe parts of a data interface. This interface
definitions contains two data elements.
getElement(interfaceObj,"Element1")
ans =
Name: 'Element1'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
getElement(interfaceObj,"Element2")
ans =
Name: 'Element2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
Use the addElement function to add a new data element to the data interface.
dataElem1 = addElement(interfaceObj,"element3")
dataElem1 =
Name: 'element3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
You can get an existing data element using the getElement function.
dataElem3 = getElement(interfaceObj,"element3")
dataElem3 =
Name: 'element3'
1-322
Simulink.dictionary.archdata.DataElement
removeElement(interfaceObj,"element3")
Version History
Introduced in R2023b
See Also
Tools
Architectural Data Editor
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.DataInterface
Functions
moveToDictionary | moveToDesignData
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-323
1 Functions
destroy
Package: Simulink.dictionary.archdata
Syntax
destroy(dataElementObj)
Description
destroy(dataElementObj) deletes the data element dataElementObj and removes it from its
parent Simulink.dictionary.archdata.DataInterface object.
Examples
This example shows how to delete a data element and remove it from a data interface.
archDataObj =
DictionaryFileName: 'myInterfaces.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
The data dictionary has one data interface definition. The data interface has two data elements.
interfaceObj = getInterface(archDataObj,"DataInterface")
interfaceObj =
Name: 'DataInterface'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.DataElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
dataElem1 =
1-324
destroy
Name: 'element1'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
Use the destroy function to delete the data element and remove it from the data interface.
destroy(dataElem1)
interfaceObj
interfaceObj =
Name: 'DataInterface'
Description: ''
Elements: [1×1 Simulink.dictionary.archdata.DataElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
The data interface, interfaceObj now has only one data element.
Input Arguments
dataElementObj — Data element object
Simulink.dictionary.archdata.DataElement object
Version History
Introduced in R2023b
See Also
Tools
Architectural Data Editor
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.DataInterface |
Simulink.dictionary.archdata.DataElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-325
1 Functions
Simulink.dictionary.archdata.ServiceInterface
Service interface
Description
A ServiceInterface object represents the structure of a service interface.
Creation
Create a ServiceInterface object using the addServiceInterface function.
ServInterfaceObj = addServiceInterface(archDataObj,"ServInterface");
Properties
Name — Name of service interface
character vector | string scalar
Object Functions
addElement Add function element to service interface
getElement Get function element from service interface
removeElement Remove element from service interface
moveToDictionary Move architectural data of Simulink data dictionary to another data dictionary
moveToDesignData Move interfaces, data types, and constants in Architectural Data section of
Simulink data dictionary to design data
1-326
Simulink.dictionary.archdata.ServiceInterface
show View architectural data of Simulink data dictionary in Architectural Data Editor
Examples
To configure function elements of a service interface, use the addElement, getElement, and
removeElement functions.
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.ServiceInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
Get the service interface object using the getInterface function. The service interface object
contains two function element objects.
servInterfaceObj = getInterface(archDataObj,"myServiceInterface")
servInterfaceObj =
Name: 'myServiceInterface'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.FunctionElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To create a physical element object and add it to the physical interface, use the addElement
function.
funcElemObj3 = addElement(servInterfaceObj,"servElem3")
funcElemObj3 =
funcElemObj2 =
1-327
1 Functions
To remove a function element from a function interface, use the removeElement function.
removeElement(servInterfaceObj,"funcElem1");
The service interface object now contains only two function elements, funcElem2 and funcElem3
servInterfaceObj.Elements(1)
ans =
servInterfaceObj.Elements(2)
ans =
Version History
Introduced in R2023b
See Also
Tools
Architectural Data Editor
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.DataInterface |
Simulink.dictionary.archdata.FunctionElement |
Simulink.dictionary.archdata.FunctionArgument
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-328
Simulink.dictionary.archdata.FunctionArgument
Simulink.dictionary.archdata.FunctionArgument
Function argument in function element of client-server interface
Description
a FunctionArgument object describes the attributes of an argument in a function element of a
client-server interface. The function element is a
Simulink.dictionary.archdata.FunctionElement object.
Creation
After configuring the function prototype of a
Simulink.dictionary.archdata.FunctionElement object, get the function argument using the
getFunctionArgument function.
functionArgObj = getFunctionArgument(functionElemObj,"y")
Properties
Name — Name of function argument
character vector | string scalar
1-329
1 Functions
Object Functions
moveToDictionary Move architectural data of Simulink data dictionary to another data dictionary
moveToDesignData Move interfaces, data types, and constants in Architectural Data section of
Simulink data dictionary to design data
show View architectural data of Simulink data dictionary in Architectural Data Editor
Examples
A function element describes attributes of a function in a client-server interface such as the function
prototype, and whether the function is executed asynchronously. A function argument describes the
attributes of a single argument of a function, such as dimensions, and data type.
In this example, the dictionary MyInterfaces.sldd contains one service interface, which contains
three function elements.
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd")
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.ServiceInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
serviceInterfaceObj = getInterface(archDataObj,"ServiceInterface1")
serviceInterfaceObj =
Name: 'ServiceInterface1'
Description: ''
Elements: [1×3 Simulink.dictionary.archdata.FunctionElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Each function element contains two function arguments. View the first function element.
funcElemObj1 = serviceInterfaceObj.Elements(1)
ans =
1-330
Simulink.dictionary.archdata.FunctionArgument
Name: 'functionElement1'
Owner: [1×1 Simulink.dictionary.archdata.ServiceInterface]
funcArg1 = funcElemObj1.FunctionArguments(1)
funcArg1 =
Name: 'u'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.FunctionElement]
funcArg1.Dimensions = "2";
funcArg1.Description = "Input argument"
funcArg1 =
Name: 'u'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: 'Input argument'
Dimensions: '2'
Owner: [1×1 Simulink.dictionary.archdata.FunctionElement]
Version History
Introduced in R2023b
See Also
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.ServiceInterface |
Simulink.dictionary.archdata.FunctionElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-331
1 Functions
Simulink.dictionary.archdata.FunctionElement
Function in client-server interface
Description
A FunctionElement object describes the attributes of a function in a client-server interface. The
client-server interface is a Simulink.dictionary.archdata.ServiceInterface.
Creation
Create a FunctionElement object using the addElement function.
functionElement = addElement(serviceInterface,"f0")
Properties
FunctionPrototype — Function prototype
character vector | string scalar
Function prototype to define the function name, and input and output arguments, specified as a
character vector or string scalar.
Data Types: char | string
1-332
Simulink.dictionary.archdata.FunctionElement
Object Functions
moveToDictionary Move architectural data of Simulink data dictionary to another data dictionary
moveToDesignData Move interfaces, data types, and constants in Architectural Data section of
Simulink data dictionary to design data
show View architectural data of Simulink data dictionary in Architectural Data Editor
Examples
To configure function elements of a service interface, use the addElement, getElement, and
removeElement functions.
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd")
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.ServiceInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
Get the service interface object using the getInterface function. The service interface object
contains two function element objects.
serviceInterfaceObj =
Name: 'ServiceInterface1'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.FunctionElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To create a function element object and add it to the service interface, use the addElement function.
funcElemObj3 =
1-333
1 Functions
funcElemObj2 =
To remove a function element from a service interface, use the removeElement function.
removeElement(serviceInterfaceObj, "functionElement1")
The service interface object now contains only two function elements, functionElement2 and
functionElement3.
serviceInterfaceObj.Elements(1)
ans =
serviceInterfaceObj.Elements(2)
ans =
To modify the function prototype of a function element, edit the FunctionPrototype property of the
function element.
funcElem1 = getElement(serviceInterfaceObj,"functionElement1")
funcElemObj1 =
1-334
Simulink.dictionary.archdata.FunctionElement
Asynchronous: 0
FunctionArguments: [1×2 Simulink.dictionary.archdata.FunctionArgument]
Name: 'functionElement1'
Owner: [1×1 Simulink.dictionary.archdata.ServiceInterface]
To modify the function prototype, for example to add an input argument, modify the
FunctionPrototype property of the FunctionElement object.
funcElemObj1 =
Version History
Introduced in R2023b
See Also
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.ServiceInterface |
Simulink.dictionary.archdata.FunctionArgument
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-335
1 Functions
Simulink.dictionary.archdata.StructElement
Struct element of a struct type
Description
A struct element of a struct type, represented by a
Simulink.dictionary.archdata.StructType object.
Creation
To create a Simulink.dictionary.archdata.StructElement object, add a struct element to an
existing StructType object using the addElement function.
StructElemObj1 = addElement(StructTypeObj,"myStructElem1");
Properties
Name — Struct element name
character vector | string scalar
Dimensions of the struct element, specified as a character vector or string scalar representing a two-
element vector containing the dimensions of the element.
Data Types: char
1-336
Simulink.dictionary.archdata.StructElement
Object Functions
moveToDictionary Move architectural data of Simulink data dictionary to another data dictionary
moveToDesignData Move interfaces, data types, and constants in Architectural Data section of
Simulink data dictionary to design data
show View architectural data of Simulink data dictionary in Architectural Data Editor
Examples
To configure struct elements of a struct type, use the addElement, getElement, and
removeElement functions.
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd")
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [0×0 Simulink.dictionary.archdata.DataInterface]
DataTypes: [1×1 Simulink.dictionary.archdata.StructType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
Get the struct type object using the getDataType function. The struct type object contains two
struct element objects.
structTypeObj = getDataType(archDataObj,"structType1")
structTypeObj =
Name: 'structType1'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.StructElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To create a struct element object and add it to the struct type, use the addElement function.
structElemObj3 = addElement(structTypeObj,"structElement3")
structElemObj3 =
Name: 'structElement3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
1-337
1 Functions
structElemObj2 = getElement(structTypeObj,"structElement2")
structElemObj2 =
Name: 'structElement2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
To remove a struct element from a struct type, use the removeElement function.
removeElement(structTypeObj,"structElement1")
The struct type object now contains only two struct elements, structElement2 and
structElement3
structTypeObj.Elements(1)
ans =
Name: 'structElement2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
structTypeObj.Elements(2)
ans =
Name: 'structElement3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.ServiceInterface |
Simulink.dictionary.archdata.StructType
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-338
Simulink.dictionary.archdata.StructElement
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-339
1 Functions
Simulink.dictionary.archdata.StructType
Structure data type
Description
A StructType object represents a structure data type containing elements represented by
Simulink.dictionary.archdata.StructElement objects.
Creation
Create a StructType object using the addStructType function.
structTypeObj = addStructType(archDataObj,"structType1")
Properties
Name — Name of struct type
character vector | string scalar
Object Functions
addElement Add struct element to struct type
getElement Get struct element from struct type
removeElement Remove element from struct type
convertToDataInterface Convert struct type to data interface object
1-340
Simulink.dictionary.archdata.StructType
Examples
To configure struct elements of a struct type, use the addElement, getElement, and
removeElement functions.
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd")
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [0×0 Simulink.dictionary.archdata.DataInterface]
DataTypes: [1×1 Simulink.dictionary.archdata.StructType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
Get the struct type object using the getDataType function. The struct type object contains two
struct element objects.
structTypeObj = getDataType(archDataObj,"structType1")
structTypeObj =
Name: 'structType1'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.StructElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To create a struct element object and add it to the struct type, use the addElement function.
structElemObj3 = addElement(structTypeObj,"structElement3")
structElemObj3 =
Name: 'structElement3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
1-341
1 Functions
structElemObj2 = getElement(structTypeObj,"structElement2")
structElemObj2 =
Name: 'structElement2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
To remove a struct element from a struct type, use the removeElement function.
removeElement(structTypeObj,"structElement1")
The struct type object now contains only two struct elements, structElement2 and
structElement3
structTypeObj.Elements(1)
ans =
Name: 'structElement2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
structTypeObj.Elements(2)
ans =
Name: 'structElement3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.ServiceInterface |
Simulink.dictionary.archdata.StructElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-342
Simulink.dictionary.archdata.StructType
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-343
1 Functions
convertToStructType
Package: Simulink.dictionary.archdata
Syntax
StructTypeObj = convertToStructType(dataInterfaceObj)
Description
StructTypeObj = convertToStructType(dataInterfaceObj) converts the data interface
object interfaceObj to a Simulink.dictionary.archdata.StructType object.
Examples
To convert a data interface to a struct type in a data dictionary, use the convertToStructType
function.
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
interfaceObj =
Name: 'DataInterface1'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.DataElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To convert the data interface to a struct type, use the convertToStructType function.
structTypeObj = convertToStructType(dataInterfaceObj)
structTypeObj =
1-344
convertToStructType
Name: 'DataInterface1'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.StructElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
The output struct type contains two struct elements corresponding to the two data elements of the
input data interface.
The architectural data object now contains no data interfaces, and one struct type.
archDataObj
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [0×0 Simulink.dictionary.archdata.DataInterface]
DataTypes: [1×1 Simulink.dictionary.archdata.StructType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
Input Arguments
dataInterfaceObj — Data interface object
Simulink.dictionary.archdata.DataInterface object
Output Arguments
StructTypeObj — Struct type object
Simulink.dictionary.archdata.StructType object
Version History
Introduced in R2023b
See Also
Simulink.dictionary.archdata.StructType |
Simulink.dictionary.archdata.DataInterface | convertToDataInterface |
Simulink.dictionary.archdata.StructElement
1-345
1 Functions
addElement
Package: Simulink.dictionary.archdata
Syntax
functionElementObj = addElement(serviceInterfaceObj,elementName)
Description
functionElementObj = addElement(serviceInterfaceObj,elementName) creates a
Simulink.dictionary.archdata.FunctionElement object with the name elementName and
adds the element to the service interface object serviceInterfaceObj.
Examples
To configure function elements of a service interface, use the addElement, getElement, and
removeElement functions.
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.ServiceInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
Get the service interface object using the getInterface function. The service interface object
contains two function element objects.
serviceInterfaceObj = getInterface(archDataObj,"ServiceInterface1")
serviceInterfaceObj =
Name: 'ServiceInterface1'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.FunctionElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To create a function element object and add it to the service interface, use the addElement function.
funcElemObj3 = addElement(serviceInterfaceObj,"functionElement3")
1-346
addElement
funcElemObj3 =
funcElemObj2 =
To remove a function element from a service interface, use the removeElement function.
removeElement(serviceInterfaceObj,"functionElement1")
The service interface object now contains only two function elements, functionElement2 and
functionElement3.
serviceInterfaceObj.Elements(1)
ans =
serviceInterfaceObj.Elements(2)
ans =
Input Arguments
serviceInterfaceObj — Service interface object
Simulink.dictionary.archdata.ServiceInterface object
1-347
1 Functions
Output Arguments
functionElementObj — Function element
Simulink.dictionary.archdata.FunctionElement object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.ServiceInterface
Functions
getElement | removeElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-348
getElement
getElement
Package: Simulink.dictionary.archdata
Syntax
functionElemObj = getElement(serviceInterfaceObj,elementName)
Description
functionElemObj = getElement(serviceInterfaceObj,elementName) returns the function
element object with the name elementName contained in the service interface object
serviceInterfaceObj.
Examples
To configure function elements of a service interface, use the addElement, getElement, and
removeElement functions.
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.ServiceInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
Get the service interface object using the getInterface function. The service interface object
contains two function element objects.
serviceInterfaceObj = getInterface(archDataObj,"ServiceInterface1")
serviceInterfaceObj =
Name: 'ServiceInterface1'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.FunctionElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To create a function element object and add it to the service interface, use the addElement function.
funcElemObj3 = addElement(serviceInterfaceObj,"functionElement3")
1-349
1 Functions
funcElemObj3 =
funcElemObj2 =
To remove a function element from a service interface, use the removeElement function.
removeElement(serviceInterfaceObj,"functionElement1")
The service interface object now contains only two function elements, functionElement2 and
functionElement3.
serviceInterfaceObj.Elements(1)
ans =
serviceInterfaceObj.Elements(2)
ans =
Input Arguments
serviceInterfaceObj — Service interface
Simulink.dictionary.archdata.ServiceInterface object
1-350
getElement
Output Arguments
functionElemObj — Function element
Simulink.dictionary.archdata.FunctionElement object
Version History
Introduced in R2023b
See Also
addElement | removeElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-351
1 Functions
removeElement
Package: Simulink.dictionary.archdata
Syntax
removeElement(serviceInterfaceObj,elementName)
Description
removeElement(serviceInterfaceObj,elementName) removes the function element with the
name elementName from the service interface ServiceInterfaceObj.
Examples
To configure function elements of a service interface, use the addElement, getElement, and
removeElement functions.
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd")
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.ServiceInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
Get the service interface object using the getInterface function. The service interface object
contains two function element objects.
serviceInterfaceObj = getInterface(archDataObj,"ServiceInterface1")
serviceInterfaceObj =
Name: 'ServiceInterface1'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.FunctionElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To create a function element object and add it to the service interface, use the addElement function.
funcElemObj3 = addElement(serviceInterfaceObj,"functionElement3")
1-352
removeElement
funcElemObj3 =
funcElemObj2 =
To remove a function element from a service interface, use the removeElement function.
removeElement(serviceInterfaceObj,"functionElement1")
The service interface object now contains only two function elements, functionElement2 and
functionElement3.
serviceInterfaceObj.Elements(1)
ans =
serviceInterfaceObj.Elements(2)
ans =
Input Arguments
serviceInterfaceObj — Service interface
Simulink.dictionary.archdata.ServiceInterface object
1-353
1 Functions
Version History
Introduced in R2023b
See Also
addElement | getElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-354
addElement
addElement
Package: Simulink.dictionary.archdata
Syntax
structElementObj = addElement(StructTypeObj,elementName)
Description
structElementObj = addElement(StructTypeObj,elementName) creates a
Simulink.dictionary.archdata.StructElement object with the name elementName and adds
the element to the struct type object StructTypeObj.
Examples
To configure struct elements of a struct type, use the addElement, getElement, and
removeElement functions.
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [0×0 Simulink.dictionary.archdata.DataInterface]
DataTypes: [1×1 Simulink.dictionary.archdata.StructType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
Get the struct type object using the getDataType function. The struct type object contains two
struct element objects.
structTypeObj = getDataType(archDataObj,"structType1")
structTypeObj =
Name: 'structType1'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.StructElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To create a struct element object and add it to the struct type, use the addElement function.
structElemObj3 = addElement(structTypeObj,"structElement3")
1-355
1 Functions
structElemObj3 =
Name: 'structElement3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
structElemObj2 =
Name: 'structElement2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
To remove a struct element from a struct type, use the removeElement function.
removeElement(structTypeObj,"structElement1")
The struct type object now contains only two struct elements, structElement2 and
structElement3
structTypeObj.Elements(1)
ans =
Name: 'structElement2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
structTypeObj.Elements(2)
ans =
Name: 'structElement3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
Input Arguments
StructTypeObj — Struct type object
Simulink.dictionary.archdata.StructType object
1-356
addElement
Output Arguments
structElementObj — Struct element
Simulink.dictionary.archdata.StructElement object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.StructElement |
Simulink.dictionary.archdata.StructType
Functions
getElement | removeElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-357
1 Functions
getElement
Package: Simulink.dictionary.archdata
Syntax
StructElemObj = getElement(StructTypeObj, elementName)
Description
StructElemObj = getElement(StructTypeObj, elementName) returns the struct element
object with the name elementName contained in the struct type object, StructTypeObj.
Examples
To configure struct elements of a struct type, use the addElement, getElement, and
removeElement functions.
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd")
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [0×0 Simulink.dictionary.archdata.DataInterface]
DataTypes: [1×1 Simulink.dictionary.archdata.StructType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
Get the struct type object using the getDataType function. The struct type object contains two
struct element objects.
structTypeObj = getDataType(archDataObj,"structType1")
structTypeObj =
Name: 'structType1'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.StructElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To create a struct element object and add it to the struct type, use the addElement function.
structElemObj3 = addElement(structTypeObj,"structElement3")
1-358
getElement
structElemObj3 =
Name: 'structElement3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
structElemObj2 =
Name: 'structElement2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
To remove a struct element from a struct type, use the removeElement function.
removeElement(structTypeObj,"structElement1")
The struct type object now contains only two struct elements, structElement2 and
structElement3
structTypeObj.Elements(1)
ans =
Name: 'structElement2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
structTypeObj.Elements(2)
ans =
Name: 'structElement3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
Input Arguments
StructTypeObj — Struct type
Simulink.dictionary.archdata.StructType object
1-359
1 Functions
Output Arguments
StructElemObj — Struct element
Simulink.dictionary.archdata.StructElement object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.StructElement |
Simulink.dictionary.archdata.StructType
Functions
addElement | removeElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-360
removeElement
removeElement
Package: Simulink.dictionary.archdata
Syntax
removeElement(StructTypeObj,elementName)
Description
removeElement(StructTypeObj,elementName) removes the struct element with the name
elementName from the struct type specified by StructTypeObj.
Examples
To configure struct elements of a struct type, use the addElement, getElement, and
removeElement functions.
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd")
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [0×0 Simulink.dictionary.archdata.DataInterface]
DataTypes: [1×1 Simulink.dictionary.archdata.StructType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
Get the struct type object using the getDataType function. The struct type object contains two
struct element objects.
structTypeObj = getDataType(archDataObj,"structType1")
structTypeObj =
Name: 'structType1'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.StructElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To create a struct element object and add it to the struct type, use the addElement function.
structElemObj3 = addElement(structTypeObj,"structElement3")
1-361
1 Functions
structElemObj3 =
Name: 'structElement3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
structElemObj2 =
Name: 'structElement2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
To remove a struct element from a struct type, use the removeElement function.
removeElement(structTypeObj,"structElement1")
The struct type object now contains only two struct elements, structElement2 and
structElement3
structTypeObj.Elements(1)
ans =
Name: 'structElement2'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
structTypeObj.Elements(2)
ans =
Name: 'structElement3'
Type: [1×1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.dictionary.archdata.StructType]
Input Arguments
StructTypeObj — Struct type
Simulink.dictionary.archdata.StructType object
1-362
removeElement
Version History
Introduced in R2023b
See Also
addElement | getElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-363
1 Functions
convertToDataInterface
Package: Simulink.dictionary.archdata
Syntax
dataInterfaceObj = convertToDataInterface(structTypeObj)
Description
dataInterfaceObj = convertToDataInterface(structTypeObj) converts the struct type
object structTypeObj to a Simulink.dictionary.archdata.DataInterface object.
Examples
To convert a struct type to a data interface in a data dictionary, use the convertToDataInterface
function.
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [0×0 Simulink.dictionary.archdata.DataInterface]
DataTypes: [1×1 Simulink.dictionary.archdata.StructType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
structTypeObj =
Name: 'StructType1'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.StructElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To convert the struct type to a data interface, use the convertToDataInterface function.
interfaceObj = convertToDataInterface(structTypeObj)
interfaceObj =
1-364
convertToDataInterface
Name: 'StructType1'
Description: ''
Elements: [1×2 Simulink.dictionary.archdata.DataElement]
Owner: [1×1 Simulink.dictionary.ArchitecturalData]
The output data interface contains two data elements corresponding to the two struct elements of the
input struct type.
The architectural data object now contains no struct types, and one data interface.
archDataObj
archDataObj =
DictionaryFileName: 'MyInterfaces.sldd'
Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
Constants: [0×0 Simulink.dictionary.archdata.Constant]
Input Arguments
structTypeObj — Struct type object
Simulink.dictionary.archdata.StructType object
Output Arguments
dataInterfaceObj — Data interface object
Simulink.dictionary.archdata.DataInterface object
Version History
Introduced in R2023b
See Also
Objects
Simulink.dictionary.archdata.DataInterface |
Simulink.dictionary.archdata.StructType |
Simulink.dictionary.archdata.StructElement
Functions
convertToStructType
1-365
1 Functions
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
1-366
overflowed
overflowed
Determine when a message queue overflows
Syntax
overflowed(message_name)
Description
overflowed(message_name) checks whether a message is lost because it was sent to a queue that
was already full. In each time step, the value of this operator is set when a chart adds a message to,
or removes a message from, a queue. It is invalid to use the overflowed operator before sending or
retrieving a message in the same time step. To use the overflowed operator, set the model to an
autosar.tlc target for both simulation and code generation and verify that the inport or outport
message connects to an external queue.
• To check the overflow status of an input message queue, first remove a message from the queue.
• To check the overflow status of an output message queue, first add a message to the queue.
• To check the overflow status of a local message queue, first add a message to the queue or remove
a message from the queue.
Examples
Check the input or local queue for message M. If a message is present and the queue has overflowed,
transition occurs.
M[overflowed(M)]
Check the input or local queue for message M. If a message is present and the queue has overflowed,
increment the value of x.
on M:
if overflowed(M) == true
x = x+1;
end
Send message and check for overflow. If the queue overflows, increment the value of x.
entry:
M.data = 3;
1-367
1 Functions
send(M);
if overflowed(M) == true
x = x+1;
end
Input Arguments
message_name — input message
handle
AUTOSAR information previously imported from XML files, specified as an arxml.importer object
handle.
Tips
• By default, when a message queue overflows, simulation stops with an error. To prevent a run-time
error and allow the overflowed operator to dynamically react to dropped messages, set the
value of the Queue Overflow Diagnostic property to Warning or None. For more information,
see “Queue Overflow Diagnostic” (Stateflow).
Version History
Introduced in R2018b
See Also
length | receive | send
Topics
“Determine When a Queue Overflows”
“Control Message Activity in Stateflow Charts” (Stateflow)
“Set Properties for a Message” (Stateflow)
1-368
autosar.api.getAUTOSARProperties XML Options Settings
openExample('autosar_swc');
hModel = 'autosar_swc';
arProps = autosar.api.getAUTOSARProperties(hModel);
set(arProps, 'XmlOptions', 'ArxmlFilePackaging', 'SingleFile');
get(arProps, 'XmlOptions', 'ArxmlFilePackaging')
ans =
'SingleFile'
XML Options
XML Options
Absolute path of the application data type package, specified as a character vector or string scalar.
Example: '/Company/Powertrain/ApplDataTypes'
Data Types: char | string
Example: "Modular"
Setting to produce an error or warning specified as one of these values when generating code for a
model that cannot be invoked concurrently:
Example: "Warning"
1-369
1 Functions
Absolute path of the component name, specified as a character vector or string scalar.
Example: '/Company/Powertrain/Components/ASWC'
Data Types: char | string
Example: "InternalToPhys"
Note This option is only available for the AUTOSAR Classic platform.
Absolute path the CompuMethod package path, specified as a character vector or string scalar.
Example: '/Company/Powertrain/CompuMethods'
Note This option is only available for the AUTOSAR Classic platform.
Absolute path of the constant specification package, specified as a character vector or string scalar.
Example: '/Company/Powertrain/Constants'
Data Types: char | string
Absolute path of the data constraint package, specified as a character vector or string scalar.
Example: '/Company/Powertrain/DataConstrs'
Data Types: char | string
1-370
autosar.api.getAUTOSARProperties XML Options Settings
Absolute path of the data type mappings package, specified as a character vector or string scalar.
Example: '/Company/Powertrain/DataTypeMappings'
Note This option is only available for the AUTOSAR Classic platform.
Absolute path of the data types package, specified as a character vector or string scalar.
Example: '/Company/Powertrain/DataTypes'
Data Types: char | string
Export setting for look up table constants, specified as true or false, and returned as logical 1 or 0.
Example: false
Note This option is only available for the AUTOSAR Classic platform.
When set to "None" the propagated variant conditions are not exported. When set to "All" the
conditions are exported.
Example: "None"
Export setting for AdminData in ARXML lookup table description, specified as true or false, and
returned as logical 1 or 0.
1-371
1 Functions
Example: true
Note This option is only available for the AUTOSAR Classic platform.
Specify unique identifiers for each port in an adaptive AUTOSAR model. This identifier can be any
string that you choose, as long as it is unique within the system.
See “Configure AUTOSAR Adaptive Service Instance Identification” for more information.
Example: "InstanceIdentifier"
Note This option is only available for the AUTOSAR Adaptive platform.
Note This option is only available for the AUTOSAR Classic platform.
Setting for generating AUTOSAR data types, specified as "Allowed" or "NotAllowed". By default,
the Simulink generates application base types only for fixed-point data types and enumerated date
types with storage types. You can override the default behavior for generating application types by
configuring the ARXML exporter to generate an application type, along with the implementation type
and base type, for each exported AUTOSAR data type.
• "Allowed" — Allow direct reference of implementation types in the generated ARXML code. If an
application data type is not strictly required to describe an AUTOSAR data type, use an
implementation data type reference.
• "NotAllowed" — Do not allow direct reference of implementation data types in the generated
ARXML code. Generate an application data type for each AUTOSAR data type.
1-372
autosar.api.getAUTOSARProperties XML Options Settings
Example: "Allowed"
Absolute path of the interface package, specified as a character vector or string scalar.
Example: '/Company/Powertrain/Interfaces'
Data Types: char | string
Absolute path of the atomic software component internal behavior qualified name, specified as a
character vector or string scalar.
Example: '/Company/Powertain/Components/ASWC_IB'
Note This option is only available for the AUTOSAR Classic platform.
Export setting for internal data constraints, specified as true or false, and returned as logical 1 or
0.
Example: true
Note This option is only available for the AUTOSAR Classic platform.
Absolute path of the internal data constraints package, specified as a character vector or string
scalar.
Example: '/Company/Powertrain/DataTypes/DataConstrs'
Data Types: char | string
Absolute path of the mode declaration group package, specified as a character vector or string scalar.
Example: '/Company/Powertrain/ModeDeclarations'
1-373
1 Functions
Note This option is only available for the AUTOSAR Classic platform.
If you programmatically modify a package path, you can specify the handling of affected elements
with the following values:
• "All" — All affected package elements will be moved to the modified package path.
• "Alert" — If packageable elements are affected a dialog box with OK and Cancel buttons
appear. Clicking OK will move the affected package elements to the modified package path.
Clicking Cancel will set the new package path without moving any package elements.
• "None" — None of the affected package elements will be moved to the modified package path.
Example: "Alert"
Property that controls whether the native declaration inherits the AUTOSAR platform type name or
uses a C integral type name, specified as one of these values:
• • "PlatformTypeName" — The native declaration inherits the AUTOSAR platform type name.
• "CIntegralTypeName" — The native declaration uses a C integral type name according to
the hardware configuration specified in the model settings.
Example: "PlatformTypeName"
Note This option is only available for the AUTOSAR Classic platform.
The top-level package name for AUTOSAR implementation platform types and base types, specified as
a character vector or string scalar. This is the programmatic name of the implementation platform
types package field present in the XML Options of the AUTOSAR Blockset Data Dictionary.
Example: '/AUTOSAR_PlatformTypes'
Data Types: char | string
To learn more about AUTOSAR platform types and their corresponding Simulink data types see
“About AUTOSAR Data Types”.
1-374
autosar.api.getAUTOSARProperties XML Options Settings
Example: "AUTOSAR3.x"
Note This option is only available for the AUTOSAR Classic platform.
Note This option is only available for the AUTOSAR Classic platform.
Absolute path of the SwAddressMethod package, specified as a character vector or string scalar.
Example: '/DataTypes/SwAddrMethods'
Note This option is only available for the AUTOSAR Classic platform.
Absolute path of the SwBaseType package, specified as a character vector or string scalar.
Example: '/Company/Powertrain/SwBaseTypes'
Note This option is only available for the AUTOSAR Classic platform.
The SwCalibrationAccess property for measurement variables, calibration parameters, and signal
and parameter data objects, specified as one of the following values:
• "ReadOnly" — Data element appears in the generated description file with read-only access.
• "ReadWrite" — Data element appears in the generated description file with both read and write
access.
• "NotAccessible" — Data element appears in the generated description file and is not accessible
with calibration and measurement tools.
1-375
1 Functions
Example: "ReadWrite"
Data Types: char | string
Absolute path of the SwRecordLayout package, specified as a character vector or string scalar.
Example: '/Company/Powertrain/ApplDataTypes/SwRecordLayouts'
Data Types: char | string
Note This option is only available for the AUTOSAR Classic platform.
Note This option is only available for the AUTOSAR Classic platform.
Example: "BaseTypeReference"
1-376
autosar.api.getAUTOSARProperties XML Options Settings
Note This option is only available for the AUTOSAR Classic platform.
• PreCompileTime — Set the binding time for variation points to before compile time.
• CodeGenerationTime — Set the binding time for variations to be at code generation.
Example: "CodeGenerationTime"
Source of which XML options to use when the model builds if a component model is contained within
an AUTOSAR architecture model, specified as one of these values:
• "Inlined" — Override the shared settings to the XML option settings of the local component
model.
• "Inherit" — Use the shared architecture model XML option settings.
Example: "Inherit"
Version History
Introduced in R2013b
See Also
Topics
“Configure AUTOSAR Package for Component, Interface, CompuMethod, or SwAddrMethod”
“Configure AUTOSAR Data Types Export”
“Configure Lookup Tables for AUTOSAR Calibration and Measurement”
“Configure AUTOSAR Packages”
“Model AUTOSAR Data Types”
“Configure AUTOSAR Elements and Properties”
1-377
1 Functions
Migrator
Migrate data types and interfaces from base workspace and data dictionaries to an interface
dictionary
Description
The interface dictionary Migrator object lets you perform migration from a model or an
architecture.
The object functions let you programmatically execute the steps in the migration workflow, including:
Creation
migratorObj = Simulink.interface.dictionary.Migrator(modelName,
'InterfaceDictionaryName', dictionaryName, 'DeleteFromOriginalSource',
deleteFlag, 'ConflictResolutionPolicy', conflictResolutionPolicyFlag) constructs
1-378
Migrator
a Migrator object representing the data types and interfaces to migrate from the base workspace
and data dictionaries to the interface dictionary. See “Create Interface Dictionary Migrator Object”
on page 1-381
The Migrator function input arguments select the model, interface dictionary, whether to delete
variables from the model, and the conflict resolution policy.
Input Arguments
Name of interface dictionary, specified as a character vector or string. The name must include
the .sldd extension and must be a valid MATLAB identifier.
• deleteFlag — Select variable deletion
Selects (if true) whether to delete variables (data types and interfaces) from the source base
workspace and data dictionaries after these migrate to the interface dictionary.
• conflictResolutionPolicyFlag — Select conflict resolution
Selects resolution policy for merge conflicts between data types and interfaces in the base
workspace and the data dictionaries versus those already present in the interface dictionary.
1-379
1 Functions
Output Arguments
Migrator object
Properties
DeleteFromOriginalSource — Select variable deletion
true (default) | false
Selects (if true) whether to delete variables from the source base workspace and data dictionaries
after these migrate to the interface dictionary.
Selects resolution policy for merge conflicts between data types and interfaces in source base
workspace and data dictionaries versus those already present in the interface dictionary.
Analysis result from the analyze function listing data types and interfaces to migrate from the base
workspace and data dictionaries to the interface dictionary. An interface is a Simulink.Bus used in a
root IO. Other Simulink.Bus objects are considered as data types
Analysis result from the analyze function listing interfaces to migrate from the base workspace and
data dictionaries to the interface dictionary.
1-380
Migrator
Analysis result from the analyze function listing objects in conflict with the interface dictionary.
Analysis result from the analyze function listing objects not used in the base workspace and data
dictionaries.
Analysis result from the analyze function listing unsupported objects to migrate.
Object Functions
analyze Analyze a model or an architecture for migration to interface dictionary
analyzeAndApply Analyze a model or an architecture and apply migration to interface dictionary
apply Apply interface dictionary migration changes from analysis of a model or an
architecture
revert Revert interface dictionary migration changes applied from analysis of a model or
an architecture
save Save applied interface dictionary migration changes from analysis of a model or
an architecture
Examples
Create a Migrator object to migrate data types and interfaces from base workspace and data
dictionaries to an interface dictionary.
myMigratorObj =
DeleteFromOriginalSource: 1
ConflictResolutionPolicy: "Error"
DataTypesToMigrate: []
InterfacesToMigrate: []
ConflictObjects: []
1-381
1 Functions
UnusedObjects: []
UnsupportedMigration: []
Version History
Introduced in R2022b
See Also
analyze | analyzeAndApply | apply | revert | save | Architectural Data Editor
1-382
Simulink.interface.Dictionary
Simulink.interface.Dictionary
Manage interface dictionary
Description
The Simulink.interface.Dictionary object provides methods that help you manage the
interface dictionary.
Creation
To create a Simulink interface dictionary and return an object representing the dictionary, use the
Simulink.interface.dictionary.create function.
dictName = 'MyInterfaces.sldd';
dictAPI = Simulink.interface.dictionary.create(dictName);
dictAPI = Simulink.interface.dictionary.open('MyInterfaces.sldd');
Properties
DataTypes — Data types defined in dictionary
array of DataType objects
Data types defined in dictionary, specified as an array of DataType objects with properties: Name and
Owner.
Object Functions
addAliasType Add Simulink alias type to Simulink interface dictionary
addDataInterface Add data interface to Simulink interface dictionary
addEnumType Add enumerated type to Simulink interface dictionary
addNumericType Add Simulink numeric type to Simulink interface dictionary
addPlatformMapping Add AUTOSAR Classic mapping to Simulink interface dictionary
1-383
1 Functions
Examples
myAliasType2 = addAliasType(dictAPI,'myAliasType2');
% can also use interface dict type objs
myAliasType2.BaseType = myAliasType1;
% Enum Type
myEnumType1 = addEnumType(dictAPI,'myColor');
myEnumType1.addEnumeral('RED','0','Solid Red');
myEnumType1.addEnumeral('BLUE','1','Solid Blue');
1-384
Simulink.interface.Dictionary
myEnumType1.DefaultValue = 'BLUE';
myEnumType1.Description = 'I am a Simulink Enumeration';
myEnumType1.StorageType = 'int16';
% Value Type
myValueType1 = addValueType(dictAPI,'myValueType1');
myValueType1.DataType = 'int32';
myValueType1.Dimensions = '[2 3]';
myValueType1.Description = 'I am a Simulink ValueType';
myValueType1.DataType = myEnumType1; % can also use interface dict type objs
% Struct Type
myStructType1 = addStructType(dictAPI,'myStructType1');
structElement1 = myStructType1.addElement('Element1');
structElement1.Type.DataType = 'single';
structElement1.Type.Dimensions = '3';
structElement2 = myStructType1.addElement('Element2');
structElement2.Type = myValueType1;
% or
structElement2.Type = 'ValueType: myValueType1';
dataElm1 = addElement(dataInterface1,'DE1');
dataElm1.Type = myValueType1;
dataElm2 = addElement(dataInterface1,'DE2');
dataElm2.Type = myStructType2;
dataElm2.Dimensions = '4';
dataElm2.Description = 'I am a data element with datatype = array of struct type';
dataInterface2 = addDataInterface(dictAPI,'DataInterface2');
platformMapping = addPlatformMapping(dictAPI,'AUTOSARClassic');
setPlatformProperty(platformMapping,dataInterface1,...
Package='/Interface2',InterfaceKind='NvDataInterface');
arObj = autosar.api.getAUTOSARProperties(dictName);
addPackageableElement(arObj,'SwAddrMethod', ...
1-385
1 Functions
'/SwAddressMethods','VAR1','SectionType','Var');
setPlatformProperty(platformMapping,dataElm1, ...
SwAddrMethod='VAR1',SwCalibrationAccess='ReadWrite',...
DisplayFormat='%.3f');
Version History
Introduced in R2022b
See Also
autosar.dictionary.ARClassicPlatformMapping |
Simulink.interface.dictionary.DataInterface |
Simulink.interface.dictionary.DataElement | addElement | exportDictionary |
getPlatformProperties | getPlatformProperty | setPlatformProperty |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-386
Simulink.interface.dictionary.DataInterface
Simulink.interface.dictionary.DataInterface
Data interface
Description
Data interfaces represent information that is shared through a connector and enters or exits a
component through a port. Data interfaces are composed of data elements that describe the structure
of the transmitted data. Data interfaces can be composite and can reference other data interfaces.
Creation
To create a Simulink.interface.dictionary.DataInterface object, add a data interface to an
existing Simulink.interface.Dictionary object using the addDataInterface function.
dataInterfaceObj = addDataInterface(interfaceDictionaryObj,"interface1")
Properties
Name — Name of data interface
character vector | string scalar
Object Functions
addElement Add data element to data interface
destroy Destroy data interface and remove from interface dictionary
getElement Get data element from data interface
1-387
1 Functions
Examples
This example shows how to access, add, and remove data elements from a data interface.
interfaceDictObj =
ArchitecturalData with properties:
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1x1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0x0 Simulink.dictionary.archdata.DataType]
Constants: [0x0 Simulink.dictionary.archdata.Constant]
interfaceObj =
DataInterface with properties:
Name: 'interface1'
Description: ''
Elements: [1x2 Simulink.dictionary.archdata.DataElement]
Owner: [1x1 Simulink.dictionary.ArchitecturalData]
Data interfaces are composed of data elements which describe portions of a data interface. This
interface definition contains two data elements.
interfaceObj.Elements(1)
ans =
DataElement with properties:
Name: 'element1'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
interfaceObj.Elements(2)
ans =
DataElement with properties:
Name: 'element2'
1-388
Simulink.interface.dictionary.DataInterface
Use the addElement function to add a new data element to the data interface.
dataElem1 =
DataElement with properties:
Name: 'element3'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
You can access an existing data element using the getElement function.
dataElem3 =
DataElement with properties:
Name: 'element3'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
removeElement(interfaceObj, 'element3')
Version History
Introduced in R2022b
See Also
Architectural Data Editor | Simulink.interface.Dictionary |
Simulink.interface.dictionary.DataElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-389
1 Functions
Simulink.interface.dictionary.DataElement
Data element of data interface
Description
A data element describes a portion of a data interface, such as the structure of the transmitted data
or other decomposition of the interface.
Creation
To create a Simulink.interface.dictionary.DataElement object, add a data element to an
existing Simulink.interface.dictionary.DataInterface object using the addElement
function.
dataElementObj = addElement(dataInterfaceObj,"element")
You can access an existing data element using the getElement function.
Properties
Name — Name of data element
character vector | string scalar
Dimensions of data element, specified as a character vector representing a two element vector
containing the dimensions of the element.
Data Types: char
1-390
Simulink.interface.dictionary.DataElement
Object Functions
destroy Destroy data element and remove from data interface
show Show data element in Interface Editor
Examples
This example shows how to access, add, and remove data elements from a data interface.
interfaceDictObj = Simulink.interface.dictionary.open('myInterfaceDict.sldd')
interfaceDictObj =
ArchitecturalData with properties:
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1x1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0x0 Simulink.dictionary.archdata.DataType]
Constants: [0x0 Simulink.dictionary.archdata.Constant]
interfaceObj = interfaceDictObj.Interfaces
interfaceObj =
DataInterface with properties:
Name: 'interface1'
Description: ''
Elements: [1x2 Simulink.dictionary.archdata.DataElement]
Owner: [1x1 Simulink.dictionary.ArchitecturalData]
Data interfaces are composed of data elements which describe portions of a data interface. This
interface definition contains two data elements.
interfaceObj.Elements(1)
ans =
DataElement with properties:
Name: 'element1'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
interfaceObj.Elements(2)
1-391
1 Functions
ans =
DataElement with properties:
Name: 'element2'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
Use the addElement function to add a new data element to the data interface.
dataElem1 =
DataElement with properties:
Name: 'element3'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
You can access an existing data element using the getElement function.
dataElem3 =
DataElement with properties:
Name: 'element3'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
removeElement(interfaceObj, 'element3')
Version History
Introduced in R2022b
See Also
Architectural Data Editor | Simulink.interface.Dictionary |
Simulink.interface.dictionary.DataInterface
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-392
addAliasType
addAliasType
Package: Simulink.interface
Syntax
dataType = addAliasType(dictObj,dtName)
dataType = addAliasType(dictObj,dtName,BaseType=baseType)
Description
dataType = addAliasType(dictObj,dtName) adds a Simulink.AliasType with the specified
name to the dictionary.
Examples
To add a Simulink.AliasType with the specified name to the dictionary, use the addAliasType
function. For an example that shows more of the workflow for related functions, see “Create and
Configure Interface Dictionary” on page 1-384.
% open interface dictionary
dictName = 'MyInterfaces.sldd';
dictAPI = Simulink.interface.dictionary.open(dictName);
myAliasType2 = addAliasType(dictAPI,'myAliasType2');
% can also use interface dict type objs
myAliasType2.BaseType = myAliasType1;
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
1-393
1 Functions
DataType definition name in DataTypes property array of dictObj, specified as a character vector
or a string scalar.
Example: "airSpeed"
Name of the base data type that this alias renames, specified as a character vector or string scalar.
You can specify the name of a standard data type, such as "uint32" or "single", or the name of a
custom data type, such as the name of another Simulink.AliasType object, or the name of an
enumeration.
Example: BaseType='uint32'
Output Arguments
dataType — Alias type object
AliasType object
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | Simulink.AliasType | addEnumType | getDataType |
getDataTypeNames
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-394
addDataInterface
addDataInterface
Package: Simulink.interface
Syntax
interfaceObj = addDataInterface(dictObj,interfaceName)
Description
interfaceObj = addDataInterface(dictObj,interfaceName) adds a data interface with the
specified name in the dictionary. Returns the interface object that represents this interface.
Examples
To add a data interface with the specified name that mirrors the specified bus object, use the
addDataInterface function. For an example that shows more of the workflow for related functions,
see “Create and Configure Interface Dictionary” on page 1-384.
dataInterface1 = addDataInterface(dictAPI,'DataInterface');
dataElm1 = addElement(dataInterface1,'DE1');
dataElm1.Type = myValueType1;
dataElm2 = addElement(dataInterface1,'DE2');
dataElm2.Type = myStructType2;
dataElm2.Dimensions = '4';
dataElm2.Description = 'I am a data element with DataType = array of struct type';
dataInterface2 = addDataInterface(dictAPI,'DataInterface2');
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
1-395
1 Functions
Output Arguments
interfaceObj — Interface object
DataInterface object
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | Simulink.interface.dictionary.DataInterface |
Simulink.interface.dictionary.DataElement | addElement | getInterface |
getInterfaceNames | removeInterface
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-396
addEnumType
addEnumType
Package: Simulink.interface
Syntax
dataType = addEnumType(dictObj,dtName)
Description
dataType = addEnumType(dictObj,dtName) adds a Simulink enumeration with the specified
name to the dictionary.
Examples
To add a Simulink enumeration with the specified name to the dictionary, use the addEnumType
function. For an example that shows more of the workflow for related functions, see “Create and
Configure Interface Dictionary” on page 1-384.
% open interface dictionary
dictName = 'MyInterfaces.sldd';
dictAPI = Simulink.interface.dictionary.open(dictName);
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
DataType definition name in DataTypes property array of dictObj, specified as a character vector
or a string scalar.
Example: "airSpeed"
1-397
1 Functions
Output Arguments
dataType — Enumerated type
Simulink.interface.dictionary.EnumType object
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | addAliasType | addStructType | getDataType |
getDataTypeNames | removeDataType | Simulink.interface.dictionary.create |
Simulink.interface.dictionary.open
1-398
addNumericType
addNumericType
Package: Simulink.interface
Syntax
dataType = addNumericType(dictObj,dtName)
dataType = addNumericType(dictObj,dtName,SimulinkNumericType=numericTypeObj)
Description
dataType = addNumericType(dictObj,dtName) adds a Simulink.NumericType with the
specified name to the dictionary.
dataType = addNumericType(dictObj,dtName,SimulinkNumericType=numericTypeObj)
adds a Simulink.NumericType with the specified name that has the same property values as the
specified Simulink.NumericType object numericTypeObj to the dictionary.
Examples
To add a Simulink.NumericType with the specified name to the dictionary, use the
addNumericType function.
dictAPI = Simulink.interface.dictionary.open('MyInterfaces.sldd');
myNumericType = addNumericType(dictAPI,'myNumericType1')
myNumericType =
Name: 'myNumericType1'
DataTypeMode: 'Double'
DataTypeOverride: 'Inherit'
IsAlias: 0
Description: ''
Owner: [1×1 Simulink.interface.Dictionary]
1-399
1 Functions
exampleNumericTypeObj = Simulink.NumericType;
exampleNumericTypeObj.DataTypeMode = 'Single';
exampleNumericTypeObj.Description = 'This is my example numeric type';
dictAPI = Simulink.interface.dictionary.open('MyInterfaces.sldd');
myNumericType2 = addNumericType(dictAPI,'myNumericType2',...
SimulinkNumericType=exampleNumericTypeObj)
myNumericType2 =
Name: 'myNumericType2'
DataTypeMode: 'Single'
DataTypeOverride: 'Inherit'
IsAlias: 0
Description: 'This is my example numeric type'
Owner: [1×1 Simulink.interface.Dictionary]
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
DataType definition name in DataTypes property array of dictObj, specified as a character vector
or a string scalar.
Example: "airSpeed"
Simulink numeric type, specified as a Simulink.NumericType object that has been previously
defined.
Example: SimulinkNumericType=exampleSimulinkNumericTypeObj
Output Arguments
dataType — Numeric type
Simulink.interface.dictionary.NumericType object
Version History
Introduced in R2023a
1-400
addNumericType
See Also
Simulink.interface.Dictionary | Simulink.NumericType | addEnumType | getDataType |
getDataTypeNames
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-401
1 Functions
addPlatformMapping
Package: Simulink.interface
Syntax
platformMapping = addPlatformMapping(dictObj,platformName)
Description
platformMapping = addPlatformMapping(dictObj,platformName) adds mapping for the
specified platform in the interface dictionary.
Examples
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Output Arguments
platformMapping — Platform mapping object
autosar.dictionary.ARClassicPlatformMapping object
1-402
addPlatformMapping
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | autosar.dictionary.ARClassicPlatformMapping |
getPlatformMapping | Simulink.interface.dictionary.create |
Simulink.interface.dictionary.open
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-403
1 Functions
addReference
Package: Simulink.interface
Syntax
addReference(dictObj,refDict)
Description
addReference(dictObj,refDict) adds a referenced dictionary, specified by refDict, to the
specified interface dictionary, dictObj. Dictionary referencing is supported for Simulink interface
dictionaries that do not have applied platform mappings.
Examples
refDicts = getReferences(dictAPI1)
refDicts =
{'C:\work\ReferenceInterfaces1.sldd'}
{'C:\work\ReferenceInterfaces2.sldd'}
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
1-404
addReference
Example: 'ReferenceDictionary.sldd'
Version History
Introduced in R2023a
See Also
Simulink.interface.Dictionary | Simulink.interface.dictionary.create |
Simulink.interface.dictionary.open | getReferences | removeReference
1-405
1 Functions
addServiceInterface
Package: Simulink.interface
Syntax
serviceInterfaceObj = addServiceInterface(dictObj,serviceInterfaceName)
Description
serviceInterfaceObj = addServiceInterface(dictObj,serviceInterfaceName) adds a
service interface with the specified name in the dictionary and returns the service interface object
that represents this interface.
Examples
To add a service interface with the specified name to a native (unmapped) interface dictionary, use
the addServiceInterface function.
dictName = 'MyInterfaces.sldd';
dictAPI = Simulink.interface.dictionary.create(dictName);
serviceInterfObj = addServiceInterface(dictAPI,'ServiceInterface1');
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Service interface name in Interfaces property array of dictObj, specified as a character vector or
a string scalar.
Example: 'ServiceInterface1'
Output Arguments
serviceInterfaceObj — Service interface
Simulink.interface.dictionary.ServiceInterface object
1-406
addServiceInterface
Version History
Introduced in R2023a
See Also
Simulink.interface.Dictionary | getInterface | getInterfaceNames | removeInterface
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-407
1 Functions
addStructType
Package: Simulink.interface
Syntax
dataType = addStructType(dictObj,dtName)
dataType = addStructType(dictObj,dtName, SimulinkBus=busObj)
Description
dataType = addStructType(dictObj,dtName) adds a Simulink.Bus type with the specified
name to the dictionary.
Examples
To add a Simulink.Bus type with the specified name to the dictionary, use the addStructType
function. For an example that shows more of the workflow for related functions, see “Create and
Configure Interface Dictionary” on page 1-384.
% open interface dictionary
dictName = 'MyInterfaces.sldd';
dictAPI = Simulink.interface.dictionary.open(dictName);
% add a value type that uses the enum type as its data type
myValueType1 = addValueType(dictAPI, 'myValueType1');
myValueType1.DataType = 'int32';
myValueType1.Dimensions = '[2 3]';
myValueType1.DataType = myEnumType1;
1-408
addStructType
This example adds a StructType type that mirrors an existing Simulink.Bus object to the Simulink
interface dictionary, MyInterfaces.sldd.
% open interface dictionary
dictName = 'MyInterfaces.sldd';
dictAPI = Simulink.interface.dictionary.open(dictName);
myNewStructType =
StructType with properties:
Name: 'StructFromSimBus'
Description: ''
Elements: [1×2 Simulink.interface.dictionary.StructElement]
Owner: [1×1 Simulink.interface.Dictionary]
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
DataType definition name in DataTypes property array of dictObj, specified as a character vector
or a string scalar.
Example: "airSpeed"
Output Arguments
dataType — Structure type object
StructType object
1-409
1 Functions
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | Simulink.Bus | addAliasType | addEnumType |
addValueType | getDataType | getDataTypeNames | removeDataType |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-410
addValueType
addValueType
Package: Simulink.interface
Syntax
dataType = addValueType(dictObj,dtName)
dataType = addValueType(dictObj,dtName, SimulinkValueType=valueTypeObj)
Description
dataType = addValueType(dictObj,dtName) adds a Simulink.ValueType with the specified
name to the interface dictionary.
Examples
To add a Simulink.ValueType with the specified name to the dictionary, use the addValueType
function. For an example that shows more of the workflow for related functions, see “Create and
Configure Interface Dictionary” on page 1-384.
This example adds a value type that mirrors an existing Simulink.ValueType to the Simulink
interface dictionary, MyInterfaces.sldd.
1-411
1 Functions
myNewValueType1 =
ValueType with properties:
Name: 'MyNewValueType'
DataType: 'single'
Minimum: '11'
Maximum: '17'
Unit: ''
Complexity: 'real'
Dimensions: '[2 4 3]'
Description: 'Simulink value type'
Owner: [1×1 Simulink.interface.Dictionary]
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
DataType definition name in DataTypes property array of dictObj, specified as a character vector
or a string scalar.
Example: "airSpeed"
Output Arguments
dataType — Value type object
Simulink.interface.dictionary.ValueType object
1-412
addValueType
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | Simulink.ValueType | addAliasType | addEnumType |
addStructType | getDataType | getDataTypeNames | save | show | showChanges |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-413
1 Functions
close
Package: Simulink.interface
Syntax
close(dictObj)
close(dictObj, 'DiscardChanges', true)
Description
close(dictObj) closes the open connections to the interface dictionary. If the dictionary has
unsaved changes, an error is thrown.
Examples
To close the open connections to the interface dictionary, use the close function.
close(dictObj);
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Version History
Introduced in R2022b
1-414
close
See Also
Simulink.interface.Dictionary | isDirty | save | show | showChanges |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-415
1 Functions
Simulink.interface.dictionary.create
Package: Simulink.interface.dictionary
Syntax
dictObj = Simulink.interface.dictionary.create(dictionaryName)
Description
dictObj = Simulink.interface.dictionary.create(dictionaryName) creates a Simulink
Interface Dictionary and returns an object representing the dictionary.
Examples
To create a Simulink Interface Dictionary and return an object representing the dictionary, use the
Simulink.interface.dictionary.create function.
dictObj = Simulink.interface.dictionary.create(dictionaryName);
Input Arguments
dictionaryName — Name of interface dictionary
character vector | string scalar
Name of interface dictionary, specified as a character vector or string scalar. The name must include
the .sldd extension and must be a valid MATLAB identifier.
Example: "new_dictionary.sldd"
Output Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Version History
Introduced in R2022b
1-416
Simulink.interface.dictionary.create
See Also
Simulink.interface.Dictionary | addAliasType | addDataInterface | addEnumType |
addPlatformMapping | addStructType | addValueType | close | getDataType |
getDataTypeNames | getInterface | getInterfaceNames | getPlatformMapping |
importFromBaseWorkspace | importFromFile | isDirty | removeDataType |
removeInterface | save | show | showChanges | Simulink.interface.dictionary.open
1-417
1 Functions
destroy
Destroy data element and remove from data interface
Syntax
destroy(dataElementObj)
Description
destroy(dataElementObj) destroys the data element dataElementObj and removes it from its
parent Simulink.interface.dictionary.DataInterface object.
Examples
This example shows how to delete a data element and remove it from a data interface.
interfaceDictObj =
Dictionary with properties:
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1×1 Simulink.interface.dictionary.DataInterface]
DataTypes: [0×0 Simulink.interface.dictionary.DataType]
This interface dictionary has one data interface definition. The data interface has two data elements.
interfaceObj = interfaceDictObj.Interfaces
interfaceObj =
DataInterface with properties:
Name: 'interface1'
Description: ''
Elements: [1×2 Simulink.interface.dictionary.DataElement]
Owner: [1×1 Simulink.interface.Dictionary]
dataElem1 =
Name: 'element1'
Type: [1×1 Simulink.interface.dictionary.ValueType]
1-418
destroy
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.interface.dictionary.DataInterface]
Use the destroy function to delete the data element and remove it from the data interface.
destroy(dataElem1)
interfaceObj
interfaceObj =
Name: 'interface1'
Description: ''
Elements: [1×1 Simulink.interface.dictionary.DataElement]
Owner: [1×1 Simulink.interface.Dictionary]
The data interface, interfaceObj now has only one data element.
Input Arguments
dataElementObj — Data element
Simulink.interface.dictionary.DataElement object
Version History
Introduced in R2022b
See Also
Architectural Data Editor | Simulink.interface.Dictionary |
Simulink.interface.dictionary.DataInterface |
Simulink.interface.dictionary.DataElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-419
1 Functions
show
Show data element in Interface Editor
Syntax
show(dataElementObj)
Description
show(dataElementObj) displays the DataElement object in the Architectural Data Editor.
Examples
This example shows how to view a data element in the Interface Editor.
interfaceDictObj = Simulink.interface.dictionary.open('myInterfaceDict.sldd')
interfaceDictObj =
Dictionary with properties:
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1×1 Simulink.interface.dictionary.DataInterface]
DataTypes: [0×0 Simulink.interface.dictionary.DataType]
dataElem1 = getElement(interfaceObj,'element1')
dataElem1 =
Name: 'element1'
Type: [1×1 Simulink.interface.dictionary.ValueType]
Description: ''
Dimensions: '1'
Owner: [1×1 Simulink.interface.dictionary.DataInterface]
Use the show function to display the data element in the Interface Editor.
show(dataElem1)
1-420
show
Input Arguments
dataElementObj — Data element
Simulink.interface.dictionary.DataElement object
Version History
Introduced in R2022b
See Also
Architectural Data Editor | Simulink.interface.Dictionary |
Simulink.interface.dictionary.DataInterface |
Simulink.interface.dictionary.DataElement
1-421
1 Functions
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-422
addElement
addElement
Add data element to data interface
Syntax
dataElementObj = addElement(dataInterfaceObj,elementName)
Description
dataElementObj = addElement(dataInterfaceObj,elementName) creates a
Simulink.interface.dictionary.DataElement object with the specified name and adds it to
the Simulink.interface.dictionary.DataInterface object dataInterfaceObj.
Examples
This example shows how to access, add, and remove data elements from a data interface.
interfaceDictObj = Simulink.interface.dictionary.open('myInterfaceDict.sldd')
interfaceDictObj =
ArchitecturalData with properties:
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1x1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0x0 Simulink.dictionary.archdata.DataType]
Constants: [0x0 Simulink.dictionary.archdata.Constant]
interfaceObj = interfaceDictObj.Interfaces
interfaceObj =
DataInterface with properties:
Name: 'interface1'
Description: ''
Elements: [1x2 Simulink.dictionary.archdata.DataElement]
Owner: [1x1 Simulink.dictionary.ArchitecturalData]
Data interfaces are composed of data elements which describe portions of a data interface. This
interface definition contains two data elements.
interfaceObj.Elements(1)
1-423
1 Functions
ans =
DataElement with properties:
Name: 'element1'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
interfaceObj.Elements(2)
ans =
DataElement with properties:
Name: 'element2'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
Use the addElement function to add a new data element to the data interface.
dataElem1 = addElement(interfaceObj, 'element3')
dataElem1 =
DataElement with properties:
Name: 'element3'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
You can access an existing data element using the getElement function.
dataElem3 = getElement(interfaceObj, 'element3')
dataElem3 =
DataElement with properties:
Name: 'element3'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
Input Arguments
dataInterfaceObj — Data interface to add element to
Simulink.interface.dictionary.DataInterface object
1-424
addElement
Name of data element to add to dataInterfaceObj object, specified as a character vector or string
scalar.
Output Arguments
dataElementObj — Data element object
Simulink.interface.dictionary.DataElement object
Version History
Introduced in R2022b
See Also
Architectural Data Editor | Simulink.interface.Dictionary |
Simulink.interface.dictionary.DataInterface |
Simulink.interface.dictionary.DataElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-425
1 Functions
destroy
Destroy data interface and remove from interface dictionary
Syntax
destroy(dataInterfaceObj)
Description
destroy(dataInterfaceObj) destroys the data interface dataInterfaceObj and removes it
from its parent interface dictionary.
Examples
This example shows how to delete a data interface and remove it from an interface dictionary.
interfaceDictObj =
Dictionary with properties:
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1×1 Simulink.interface.dictionary.DataInterface]
DataTypes: [0×0 Simulink.interface.dictionary.DataType]
interfaceObj =
DataInterface with properties:
Name: 'interface1'
Description: ''
Elements: [1×2 Simulink.interface.dictionary.DataElement]
Owner: [1×1 Simulink.interface.Dictionary]
Use the destroy function to delete the interface and remove it from the interface dictionary.
destroy(interfaceObj)
interfaceDictObj
interfaceDictObj =
DictionaryFileName: 'myInterfaceDict.sldd'
1-426
destroy
Input Arguments
dataInterfaceObj — Data interface to delete
Simulink.interface.dictionary.DataInterface object
Version History
Introduced in R2022b
See Also
Architectural Data Editor | Simulink.interface.Dictionary |
Simulink.interface.dictionary.DataInterface
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-427
1 Functions
getElement
Get data element from data interface
Syntax
dataElementObj = getElement(dataInterfaceObj,elementName)
Description
dataElementObj = getElement(dataInterfaceObj,elementName) returns the
Simulink.interface.dictionary.DataElement object with the name elementName contained
in the Simulink.interface.dictionary.DataInterface object dataInterfaceObj.
Examples
This example shows how to access, add, and remove data elements from a data interface.
interfaceDictObj = Simulink.interface.dictionary.open('myInterfaceDict.sldd')
interfaceDictObj =
ArchitecturalData with properties:
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1x1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0x0 Simulink.dictionary.archdata.DataType]
Constants: [0x0 Simulink.dictionary.archdata.Constant]
interfaceObj = interfaceDictObj.Interfaces
interfaceObj =
DataInterface with properties:
Name: 'interface1'
Description: ''
Elements: [1x2 Simulink.dictionary.archdata.DataElement]
Owner: [1x1 Simulink.dictionary.ArchitecturalData]
Data interfaces are composed of data elements which describe portions of a data interface. This
interface definition contains two data elements.
interfaceObj.Elements(1)
1-428
getElement
ans =
DataElement with properties:
Name: 'element1'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
interfaceObj.Elements(2)
ans =
DataElement with properties:
Name: 'element2'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
Use the addElement function to add a new data element to the data interface.
dataElem1 = addElement(interfaceObj, 'element3')
dataElem1 =
DataElement with properties:
Name: 'element3'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
You can access an existing data element using the getElement function.
dataElem3 = getElement(interfaceObj, 'element3')
dataElem3 =
DataElement with properties:
Name: 'element3'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
Input Arguments
dataInterfaceObj — Data interface containing the data element
Simulink.interface.dictionary.DataInterface object
1-429
1 Functions
Name of the data element to return from dataInterfaceObj, specified as a character vector or
string scalar.
Output Arguments
dataElementObj — Data element object
Simulink.interface.dictionary.DataElement object
Version History
Introduced in R2022b
See Also
Architectural Data Editor | Simulink.interface.Dictionary |
Simulink.interface.dictionary.DataInterface
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-430
removeElement
removeElement
Remove data element from data interface
Syntax
removeElement(dataInterfaceObj,elementName)
Description
removeElement(dataInterfaceObj,elementName) removes the data element with the name
elementName from the Simulink.interface.dictionary.DataInterface object
dataInterfaceObj.
Examples
This example shows how to access, add, and remove data elements from a data interface.
interfaceDictObj = Simulink.interface.dictionary.open('myInterfaceDict.sldd')
interfaceDictObj =
ArchitecturalData with properties:
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1x1 Simulink.dictionary.archdata.DataInterface]
DataTypes: [0x0 Simulink.dictionary.archdata.DataType]
Constants: [0x0 Simulink.dictionary.archdata.Constant]
interfaceObj = interfaceDictObj.Interfaces
interfaceObj =
DataInterface with properties:
Name: 'interface1'
Description: ''
Elements: [1x2 Simulink.dictionary.archdata.DataElement]
Owner: [1x1 Simulink.dictionary.ArchitecturalData]
Data interfaces are composed of data elements which describe portions of a data interface. This
interface definition contains two data elements.
interfaceObj.Elements(1)
1-431
1 Functions
ans =
DataElement with properties:
Name: 'element1'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
interfaceObj.Elements(2)
ans =
DataElement with properties:
Name: 'element2'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
Use the addElement function to add a new data element to the data interface.
dataElem1 = addElement(interfaceObj, 'element3')
dataElem1 =
DataElement with properties:
Name: 'element3'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
You can access an existing data element using the getElement function.
dataElem3 = getElement(interfaceObj, 'element3')
dataElem3 =
DataElement with properties:
Name: 'element3'
Type: [1x1 Simulink.dictionary.archdata.ValueType]
Description: ''
Dimensions: '1'
Owner: [1x1 Simulink.dictionary.archdata.DataInterface]
Input Arguments
dataInterfaceObj — Data interface to remove element from
Simulink.interface.dictionary.DataInterface object
1-432
removeElement
Name of data element to remove from data interface, specified as a string scalar or character vector.
Version History
Introduced in R2022b
See Also
Architectural Data Editor | Simulink.interface.Dictionary |
Simulink.interface.dictionary.DataInterface |
Simulink.interface.dictionary.DataElement
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-433
1 Functions
show
Show data interface in the Interface Editor
Syntax
show(dataInterfaceObj)
Description
show(dataInterfaceObj) displays the data interface in the Architectural Data Editor.
Examples
This example shows how to view a data interface in the Interface Editor.
interfaceDictObj = Simulink.interface.dictionary.open('myInterfaceDict.sldd')
interfaceDictObj =
Dictionary with properties:
DictionaryFileName: 'myInterfaceDict.sldd'
Interfaces: [1×1 Simulink.interface.dictionary.DataInterface]
DataTypes: [0×0 Simulink.interface.dictionary.DataType]
Use the show function to display the data interface in the Interface Editor.
show(interfaceObj)
1-434
show
Input Arguments
dataInterfaceObj — Data interface to display
Simulink.interface.dictionary.DataInterface object
Version History
Introduced in R2022b
See Also
Architectural Data Editor | Simulink.interface.Dictionary |
Simulink.interface.dictionary.DataInterface
1-435
1 Functions
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
1-436
discardChanges
discardChanges
Package: Simulink.interface
Syntax
discardChanges(dictObj)
Description
discardChanges(dictObj) discards any changes made to the interface dictionary dictObj since
the last time the dictionary was saved.
Examples
Add a new enumeration type to an interface dictionary and then discard the changes.
dictAPI = Simulink.interface.dictionary.open('MyInterfaces.sldd');
isDirty(dictAPI)
ans =
logical
0
addEnumType(dictAPI,'MyEnum');
getDataTypeNames(dictAPI)
ans =
1×8 cell array
Columns 1 through 5
{'MyEnum'} {'myAliasType1'} {'myAliasType2'} {'myAliasType3'} {'myColor'}
Columns 6 through 8
{'myStructType1'} {'myStructType2'} {'myValueType1'}
discardChanges(dictAPI);
getDataTypeNames(dictAPI)
ans =
1×7 cell array
Columns 1 through 4
{'myAliasType1'} {'myAliasType2'} {'myAliasType3'} {'myColor'}
1-437
1 Functions
Columns 5 through 7
{'myStructType1'} {'myStructType2'} {'myValueType1'}
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Version History
Introduced in R2023a
See Also
Simulink.interface.Dictionary | addEnumType | getDataTypeNames | isDirty |
showChanges | Simulink.interface.dictionary.create |
Simulink.interface.dictionary.open
1-438
findEntryByName
findEntryByName
Package: Simulink.interface
Syntax
entryObj = findEntryByName(dictObj,entryName)
Description
entryObj = findEntryByName(dictObj,entryName) returns the object that corresponds to the
specified entry name, entryName, in the interface dictionary. If the entry does not exist in the
dictionary, an empty value is returned.
Examples
Get object for structure type named myStructType1 from the interface dictionary
MyInterfaces.sldd.
dictAPI = Simulink.interface.dictionary.open('MyInterfaces.sldd');
structObj = findEntryByName(dictAPI,'myStructType1')
structObj =
StructType with properties:
Name: 'myStructType1'
Description: ''
Elements: [1×2 Simulink.interface.dictionary.StructElement]
Owner: [1×1 Simulink.interface.Dictionary]
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
1-439
1 Functions
Output Arguments
entryObj — Interface or data type object
DataInterface object | ServiceInterface object | AliasType object | EnumType object |
NumericType object | StructType object | ValueType object
Interface or data type object, returned as the object type of the corresponding entry in the interface
dictionary.
Version History
Introduced in R2023a
See Also
Simulink.interface.Dictionary | getInterface | getInterfaceNames |
getDataTypeNames | getDataType | Simulink.interface.dictionary.create |
Simulink.interface.dictionary.open
1-440
getDataType
getDataType
Package: Simulink.interface
Syntax
dataTypeObj = getDataType(dictObj,dtName)
Description
dataTypeObj = getDataType(dictObj,dtName) returns the data type object that represents
the data type specified by dtName.
Examples
To get the data type object that represents the specified data type name, use the getDataType
function. For an example that shows more of the workflow for related functions, see “Create and
Configure Interface Dictionary” on page 1-384.
Get the EnumType object for myColor data type name in the dictAPI dictionary object.
myColorObj = getDataType(dictAPI,'myColor')
myColorObj =
Name: 'myColor'
Description: 'I am a Simulink Enumeration'
DefaultValue: 'BLUE'
StorageType: 'int16'
Enumerals: [1×3 Simulink.interface.dictionary.Enumeral]
Owner: [1×1 Simulink.interface.Dictionary]
Get the AliasType object for myAliasType1 data type name in the dictAPI dictionary object.
myAliasType1Obj = getDataType(dictAPI,'myAliasType1')
myAliasType1Obj =
Name: 'myAliasType1'
BaseType: 'fixdt(1,32,16)'
1-441
1 Functions
Description: ''
Owner: [1×1 Simulink.interface.Dictionary]
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
DataType definition name in DataTypes property array of dictObj, specified as a character vector
or a string scalar.
Example: "airSpeed"
Output Arguments
dataTypeObj — DataType object
AliasType object | EnumType object | NumericType object | StructType object | ValueType
object
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | addAliasType | addEnumType | addNumericType |
addStructType | addValueType | getDataTypeNames | removeDataType |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-442
getDataTypeNames
getDataTypeNames
Package: Simulink.interface
Syntax
dataTypeNames = getDataTypeNames(dictObj)
Description
dataTypeNames = getDataTypeNames(dictObj) returns a cell array of the data type names in
the dictionary.
Examples
To get a cell array of the data type names in the dictionary, use the getDataTypeNames function. For
an example that shows more of the workflow for related functions, see “Create and Configure
Interface Dictionary” on page 1-384.
dataTypeNames = getDataTypeNames(dictAPI)
dataTypeNames =
Columns 1 through 3
Columns 4 through 6
Column 7
{'myValueType1'}
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
1-443
1 Functions
Output Arguments
dataTypeNames — DataType definition names
cell array of character vectors | string array
DataType definition names in DataTypes property array of dictObj, specified as a cell array of
character vectors or a string array.
Example: {'myAliasType1'} {'myAliasType2'} {'myAliasType3'}
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | getDataType | removeDataType | removeInterface |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-444
getInterface
getInterface
Package: Simulink.interface
Syntax
interfaceObj = getInterface(dictObj,interfaceName)
Description
interfaceObj = getInterface(dictObj,interfaceName) returns the interface object that
represents the specified interface in the interface dictionary.
Examples
To get the interface object that represents the specified interface, use the getInterface function.
For an example that shows more of the workflow for related functions, see “Create and Configure
Interface Dictionary” on page 1-384.
myInterfaceObj = getInterface(dictAPI,'DataInterface')
myInterfaceObj =
Name: 'DataInterface'
Description: ''
Elements: [1×3 Simulink.interface.dictionary.DataElement]
Owner: [1×1 Simulink.interface.Dictionary]
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
1-445
1 Functions
Output Arguments
interfaceObj — Interface object
DataInterface object | ServiceInterface object
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | Simulink.interface.dictionary.DataInterface |
Simulink.interface.dictionary.DataElement | addDataInterface |
addServiceInterface | getInterfaceNames | removeInterface |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-446
getInterfaceNames
getInterfaceNames
Package: Simulink.interface
Syntax
interfaceNames = getInterfaceNames(dictObj)
Description
interfaceNames = getInterfaceNames(dictObj) returns a cell array of the interface names in
the interface dictionary.
Examples
To get a cell array of the interface names in the dictionary, use the getInterfaceNames function.
For an example that shows more of the workflow for related functions, see “Create and Configure
Interface Dictionary” on page 1-384.
myInterfaceNames = getInterfaceNames(dictAPI)
myInterfaceNames =
{'DataInterface'} {'DataInterface2'}
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Output Arguments
interfaceNames — Interfaces definition names
cell array of character vectors | string array
1-447
1 Functions
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | Simulink.interface.dictionary.DataInterface |
Simulink.interface.dictionary.DataElement | addDataInterface |
addServiceInterface | getInterface | removeInterface |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-448
getPlatformMapping
getPlatformMapping
Package: Simulink.interface
Syntax
platformMapping = getPlatformMapping(dictObj,platformName)
Description
platformMapping = getPlatformMapping(dictObj,platformName) returns the mapping
object for the specified platform in the dictionary. This allows configuration of platform-specific
properties in the dictionary.
Examples
To get the mapping object for the specified platform in the dictionary, use the getPlatformMapping
function. For an example that shows more of the workflow for related functions, see “Create and
Configure Interface Dictionary” on page 1-384.
myPlatformMapping =
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Output Arguments
platformMapping — Platform mapping object
autosar.dictionary.ARClassicPlatformMapping object
1-449
1 Functions
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | addAliasType | addDataInterface | addEnumType |
addPlatformMapping | addStructType | addValueType | close | getDataType |
getDataTypeNames | getInterface | getInterfaceNames | importFromBaseWorkspace |
importFromFile | isDirty | removeDataType | removeInterface | save | show | showChanges
| Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-450
getReferences
getReferences
Package: Simulink.interface
Get cell array of names of interface dictionaries that are referenced by another interface dictionary
Syntax
refDictNames = getReferences(dictObj)
Description
refDictNames = getReferences(dictObj) returns a cell array of the names of interface
dictionaries that are referenced by the interface dictionary dictObj.
Examples
Get names of interface dictionaries referenced from the interface dictionary MyInterfaces.sldd.
dictAPI = Simulink.interface.dictionary.open('MyInterfaces.sldd');
refDicts = getReferences(dictAPI)
refDicts =
{'C:\work\ReferenceInterfaces1.sldd'}
{'C:\work\ReferenceInterfaces2.sldd'}
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Output Arguments
refDictNames — Names of interface dictionaries referenced
cell array of character vectors | string array
Names of referenced interface dictionaries represented using full paths, specified as a cell array of
character vectors or a string array.
Example: {'C:\work\ReferenceInterfaces1.sldd'}
1-451
1 Functions
Version History
Introduced in R2023a
See Also
Simulink.interface.Dictionary | Simulink.interface.dictionary.create |
Simulink.interface.dictionary.open | addReference | removeReference
1-452
importFromBaseWorkspace
importFromBaseWorkspace
Package: Simulink.interface
Syntax
importFromBaseWorkspace(dictObj)
Description
importFromBaseWorkspace(dictObj) copies Simulink.Bus, Simulink.ValueType, and
Simulink.AliasType objects from base workspace to the interface dictionary identified by
dictObj. The Simulink.Bus objects are imported as data interfaces. For those objects that need to
be used as a structure DataType, these objects can be cut and pasted into the interface dictionary
after the import operation.
Examples
Import Buses, Value Types, and Alias Types to Simulink Interface Dictionary
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Version History
Introduced in R2022b
1-453
1 Functions
See Also
Simulink.interface.Dictionary | addAliasType | addDataInterface | addEnumType |
addPlatformMapping | addStructType | addValueType | close | getDataType |
getDataTypeNames | getInterface | getInterfaceNames | getPlatformMapping |
importFromFile | isDirty | removeDataType | removeInterface | save | show | showChanges
| Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-454
importFromFile
importFromFile
Package: Simulink.interface
Syntax
importFromFile(dictObjmatFileName)
Description
importFromFile(dictObjmatFileName) copies Simulink.Bus, Simulink.ValueType, and
Simulink.AliasType objects from the specified MAT file to the interface dictionary identified by
dictObj. The Simulink.Bus objects are imported as data interfaces. For those objects that need to
be used as structure DataType, these objects can be cut and pasted in the interface dictionary to the
Interfaces tab after the import operation.
Examples
Import Buses, Value Types, and Alias Types to Simulink Interface Dictionary
importFromFile(dictAPI,'myMatFile.mat');
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Name of MAT file, specified as a character vector or string. The name must include the .mat
extension and must be a valid MATLAB identifier.
Example: 'myMatFile.mat'
Version History
Introduced in R2022b
1-455
1 Functions
See Also
Simulink.interface.Dictionary | addAliasType | addDataInterface | addEnumType |
addPlatformMapping | addStructType | addValueType | close | getDataType |
getDataTypeNames | getInterface | getInterfaceNames | getPlatformMapping |
importFromBaseWorkspace | isDirty | removeDataType | removeInterface | save | show |
showChanges | Simulink.interface.dictionary.create |
Simulink.interface.dictionary.open
1-456
isDirty
isDirty
Package: Simulink.interface
Syntax
hasUnsavedChanges = isDirty(dictObj)
Description
hasUnsavedChanges = isDirty(dictObj) returns a 1 (true) if the dictionary has unsaved
changes.
Examples
To determine whether the dictionary has unsaved changes, use the isDirty function. For an
example that shows more of the workflow for related functions, see “Create and Configure Interface
Dictionary” on page 1-384.
isDirty(dictAPI)
ans =
logical
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Version History
Introduced in R2022b
1-457
1 Functions
See Also
Simulink.interface.Dictionary | close | save | show | showChanges |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-458
analyze
analyze
Package: Simulink.interface.dictionary
Syntax
analyze(migratorObj)
Description
analyze(migratorObj) analyzes a model or an architecture for migration to an interface
dictionary. The analysis identifies the data types and interfaces in the model and data dictionaries for
migration to an interface dictionary. The analysis also identifies conflict issues that affect migration.
Examples
Select a model that is linked to a data dictionary or an architecture that is linked to an interface
dictionary. See figure. The goal of the migration is to add content to the interface dictionary and link
the models and dictionaries.
1-459
1 Functions
In this example migration, there are no conflicting data types or interfaces. The analysis identifies:
The architecture consists of SWC1, SWC2, and Composition. The architecture uses a data dictionary
hierarchy of dDictionary.sldd --> dLinkedDictionary.sldd.
load_system("mArchitectureWithDataDictionary");
load('hWorkspaceData.mat',...
'MyBus','AnotherMyBus','NonInterfaceBus');
1-460
analyze
analyze(myMigratorObj);
disp('Imported interfaces')
cellfun(@(x) x.Name,myMigratorObj.InterfacesToMigrate, ...
'UniformOutput',false)
disp('Imported datatypes')
cellfun(@(x) x.Name,myMigratorObj.DataTypesToMigrate, ...
'UniformOutput',false)
disp('Objects in conflict')
cellfun(@(x) strcat(x{1}.Name,' -> ',x{1}.Source), ...
myMigratorObj.ConflictObjects,'UniformOutput',false)
disp('Unused objects')
cellfun(@(x) x.Name,myMigratorObj.UnusedObjects, ...
'UniformOutput',false)
apply(myMigratorObj);
To save the interface dictionary, use the save function. To revert applying the migration analysis, use
the revert function.
save(myMigratorObj);
After migration (the apply step), the models and dictionaries are linked. See figure.
1-461
1 Functions
After Sources have been linked and data has been migrated
Input Arguments
migratorObj — Migrator object
Migrator object
Version History
Introduced in R2022b
1-462
analyze
See Also
Migrator | analyzeAndApply | apply | revert | save
1-463
1 Functions
analyzeAndApply
Package: Simulink.interface.dictionary
Syntax
analyzeAndApply(migratorObj)
Description
analyzeAndApply(migratorObj) analyzes a model or an architecture for migration to an
interface dictionary. The analysis identifies the data types and interfaces in the model and data
dictionaries for migration to an interface dictionary. The analysis also identifies conflict issues that
affect migration. After analysis, the analyzeAndApply function applies the migration.
Examples
Select a model that is linked to a data dictionary or an architecture that is linked to an interface
dictionary. See figure. The goal of the migration is to add content to the interface dictionary and link
the models and dictionaries.
1-464
analyzeAndApply
In this example migration, there are no conflicting data types or interfaces. The analysis identifies:
The architecture consists of SWC1, SWC2, and Composition. The architecture uses a data dictionary
hierarchy of dDictionary.sldd --> dLinkedDictionary.sldd.
load_system("mArchitectureWithDataDictionary");
load('hWorkspaceData.mat',...
'MyBus','AnotherMyBus','NonInterfaceBus');
1-465
1 Functions
analyze(myMigratorObj);
disp('Imported interfaces')
cellfun(@(x) x.Name,myMigratorObj.InterfacesToMigrate, ...
'UniformOutput',false)
disp('Imported datatypes')
cellfun(@(x) x.Name,myMigratorObj.DataTypesToMigrate, ...
'UniformOutput',false)
disp('Objects in conflict')
cellfun(@(x) strcat(x{1}.Name,' -> ',x{1}.Source), ...
myMigratorObj.ConflictObjects,'UniformOutput',false)
disp('Unused objects')
cellfun(@(x) x.Name,myMigratorObj.UnusedObjects, ...
'UniformOutput',false)
Analyze data type and interface content in the model for migration to the interface dictionary and
apply the migration.
analyzeAndApply(myMigratorObj);
To save the interface dictionary, use the save function. To revert applying the migration analysis, use
the revert function.
save(myMigratorObj);
After migration (the apply step), the models and dictionaries are linked. See figure.
1-466
analyzeAndApply
After Sources have been linked and data has been migrated
Input Arguments
migratorObj — Migrator object
Migrator object
Version History
Introduced in R2022b
1-467
1 Functions
See Also
Migrator | analyze | apply | revert | save
1-468
apply
apply
Package: Simulink.interface.dictionary
Syntax
apply(migratorObj)
Description
apply(migratorObj) applies migration to an interface dictionary from the analysis by the analyze
function of a model or an architecture. The analysis identifies the data types and interfaces in the
model and data dictionaries for migration to an interface dictionary. The analysis also identifies
conflict issues that affect migration.
Examples
Select a model that is linked to a data dictionary or an architecture that is linked to an interface
dictionary. See figure. The goal of the migration is to add content to the interface dictionary and link
the models and dictionaries.
1-469
1 Functions
In this example migration, there are no conflicting data types or interfaces. The analysis identifies:
The architecture consists of SWC1, SWC2, and Composition. The architecture uses a data dictionary
hierarchy of dDictionary.sldd --> dLinkedDictionary.sldd.
load_system("mArchitectureWithDataDictionary");
load('hWorkspaceData.mat',...
'MyBus','AnotherMyBus','NonInterfaceBus');
1-470
apply
analyze(myMigratorObj);
disp('Imported interfaces')
cellfun(@(x) x.Name,myMigratorObj.InterfacesToMigrate, ...
'UniformOutput',false)
disp('Imported datatypes')
cellfun(@(x) x.Name,myMigratorObj.DataTypesToMigrate, ...
'UniformOutput',false)
disp('Objects in conflict')
cellfun(@(x) strcat(x{1}.Name,' -> ',x{1}.Source), ...
myMigratorObj.ConflictObjects,'UniformOutput',false)
disp('Unused objects')
cellfun(@(x) x.Name,myMigratorObj.UnusedObjects, ...
'UniformOutput',false)
apply(myMigratorObj);
To save the interface dictionary, use the save function. To revert applying the migration analysis, use
the revert function.
save(myMigratorObj);
After migration (the apply step), the models and dictionaries are linked. See figure.
1-471
1 Functions
After Sources have been linked and data has been migrated
Input Arguments
migratorObj — Migrator object
Migrator object
Version History
Introduced in R2022b
1-472
apply
See Also
Migrator | analyze | analyzeAndApply | revert | save
1-473
1 Functions
revert
Package: Simulink.interface.dictionary
Revert interface dictionary migration changes applied from analysis of a model or an architecture
Syntax
revert(migratorObj)
Description
revert(migratorObj) reverts changes that resolve conflicts in data types and interfaces that were
migrated to an interface dictionary. The migration analysis from the analyze function identifies
these conflicts.
Examples
Select a model that is linked to a data dictionary or an architecture that is linked to an interface
dictionary. See figure. The goal of the migration is to add content to the interface dictionary and link
the models and dictionaries.
1-474
revert
In this example migration, there are no conflicting data types or interfaces. The analysis identifies:
The architecture consists of SWC1, SWC2, and Composition. The architecture uses a data dictionary
hierarchy of dDictionary.sldd --> dLinkedDictionary.sldd.
load_system("mArchitectureWithDataDictionary");
load('hWorkspaceData.mat',...
'MyBus','AnotherMyBus','NonInterfaceBus');
1-475
1 Functions
analyze(myMigratorObj);
disp('Imported interfaces')
cellfun(@(x) x.Name,myMigratorObj.InterfacesToMigrate, ...
'UniformOutput',false)
disp('Imported datatypes')
cellfun(@(x) x.Name,myMigratorObj.DataTypesToMigrate, ...
'UniformOutput',false)
disp('Objects in conflict')
cellfun(@(x) strcat(x{1}.Name,' -> ',x{1}.Source), ...
myMigratorObj.ConflictObjects,'UniformOutput',false)
disp('Unused objects')
cellfun(@(x) x.Name,myMigratorObj.UnusedObjects, ...
'UniformOutput',false)
apply(myMigratorObj);
After migration (the apply step), the models and dictionaries are linked. See figure.
After sources have been linked and data has been migrated
To revert the migration to the interface dictionary and undo changes to sources, use the revert
function. To keep the migration and changes, use the save function.
revert(myMigratorObj);
1-476
revert
Input Arguments
migratorObj — Migrator object
Migrator object
Version History
Introduced in R2022b
1-477
1 Functions
See Also
Migrator | analyze | analyzeAndApply | apply | save
1-478
save
save
Package: Simulink.interface.dictionary
Save applied interface dictionary migration changes from analysis of a model or an architecture
Syntax
save(migratorObj)
Description
save(migratorObj) save the applied migration to an interface dictionary from the analysis by the
analyze function of a model or an architecture. The analysis identifies the data types and interfaces
in the model and data dictionaries for migration to an interface dictionary. The analysis also identifies
conflict issues that affect migration. The save operation makes changes persistent in:
• The model
• Any data dictionary that is used by the model and their hierarchies
• The interface dictionary
Examples
Select a model that is linked to a data dictionary or an architecture that is linked to an interface
dictionary. See figure. The goal of the migration is to add content to the interface dictionary and link
the models and dictionaries.
1-479
1 Functions
In this example migration, there are no conflicting data types or interfaces. The analysis identifies:
The architecture consists of SWC1, SWC2, and Composition. The architecture uses a data dictionary
hierarchy of dDictionary.sldd --> dLinkedDictionary.sldd.
load_system("mArchitectureWithDataDictionary");
load('hWorkspaceData.mat',...
'MyBus','AnotherMyBus','NonInterfaceBus');
1-480
save
analyze(myMigratorObj);
disp('Imported interfaces')
cellfun(@(x) x.Name,myMigratorObj.InterfacesToMigrate, ...
'UniformOutput',false)
disp('Imported datatypes')
cellfun(@(x) x.Name,myMigratorObj.DataTypesToMigrate, ...
'UniformOutput',false)
disp('Objects in conflict')
cellfun(@(x) strcat(x{1}.Name,' -> ',x{1}.Source), ...
myMigratorObj.ConflictObjects,'UniformOutput',false)
disp('Unused objects')
cellfun(@(x) x.Name,myMigratorObj.UnusedObjects, ...
'UniformOutput',false)
apply(myMigratorObj);
To save the interface dictionary, use the save function. To revert applying the migration analysis, use
the revert function.
save(myMigratorObj);
After migration (the apply step), the models and dictionaries are linked. See figure.
1-481
1 Functions
After Sources have been linked and data has been migrated
Input Arguments
migratorObj — Migrator object
Migrator object
Version History
Introduced in R2022b
1-482
save
See Also
Migrator | analyze | analyzeAndApply | apply | revert
1-483
1 Functions
Simulink.interface.dictionary.open
Package: Simulink.interface.dictionary
Syntax
dictObj = Simulink.interface.dictionary.open(dictionaryName)
Description
dictObj = Simulink.interface.dictionary.open(dictionaryName) opens the specified
Interface Dictionary dictionaryName and returns an object representing the dictionary.
Examples
To open the specified Interface Dictionary dictionaryName and return an object representing the
dictionary, use the open function. For an example that shows more of the workflow for related
functions, see “Create and Configure Interface Dictionary” on page 1-384.
dictAPI = Simulink.interface.dictionary.open("new_dictionary.sldd");
Input Arguments
dictionaryName — Name of interface dictionary
character vector | string scalar
Name of interface dictionary, specified as a character vector or string scalar. The name must include
the .sldd extension and must be a valid MATLAB identifier.
Example: "new_dictionary.sldd"
Output Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Version History
Introduced in R2022b
1-484
Simulink.interface.dictionary.open
See Also
Simulink.interface.Dictionary | addAliasType | addDataInterface | addEnumType |
addPlatformMapping | addStructType | addValueType | close | getDataType |
getDataTypeNames | getInterface | getInterfaceNames | getPlatformMapping |
importFromBaseWorkspace | importFromFile | isDirty | removeDataType |
removeInterface | save | show | showChanges | Simulink.interface.dictionary.create
1-485
1 Functions
removeDataType
Package: Simulink.interface
Syntax
removeDataType(dictObj,dataTypeName)
Description
removeDataType(dictObj,dataTypeName) deletes the specified data type in the interface
dictionary.
Examples
To delete the specified DataType in the dictionary, use the removeDataType function. For an
example that shows more of the workflow for related functions, see “Create and Configure Interface
Dictionary” on page 1-384.
removeDataType(dictAPI,'myAliasType1')
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
DataType definition name in DataTypes property array of dictObj, specified as a character vector
or a string scalar.
Example: 'myAliasType1'
Version History
Introduced in R2022b
1-486
removeDataType
See Also
Simulink.interface.Dictionary | addAliasType | addEnumType | addNumericType |
addStructType | addValueType | getDataType | getDataTypeNames |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-487
1 Functions
removeInterface
Package: Simulink.interface
Syntax
removeInterface(dictObj,interfaceName)
Description
removeInterface(dictObj,interfaceName) deletes the specified interface from the interface
dictionary.
Examples
To delete the specified interface from the dictionary, use the removeInterface function. For an
example that shows more of the workflow for related functions, see “Create and Configure Interface
Dictionary” on page 1-384.
removeInterface(dictAPI,'DataInterface')
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Version History
Introduced in R2022b
1-488
removeInterface
See Also
Simulink.interface.Dictionary | Simulink.interface.dictionary.DataInterface |
Simulink.interface.dictionary.DataElement | addDataInterface |
addServiceInterface | getInterface | getInterfaceNames |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-489
1 Functions
removeReference
Package: Simulink.interface
Syntax
removeReference(dictObj,refDict)
Description
removeReference(dictObj,refDict) removes an interface dictionary reference, specified by
refDict, from the specified interface dictionary, dictObj.
Examples
dictAPI1 = Simulink.interface.dictionary.open('MyInterfaces.sldd');
refDicts = getReferences(dictAPI1)
refDicts =
{'C:\work\ReferenceInterfaces1.sldd'}
{'C:\work\ReferenceInterfaces2.sldd'}
Remove the referenced dictionaries, using a dictionary object and character vector.
dictAPI2 = Simulink.interface.dictionary.open('ReferenceInterfaces1.sldd');
removeReference(dictAPI1,dictAPI2);
removeReference(dictAPI1,'ReferenceInterfaces2.sldd');
refDicts = getReferences(dictAPI1)
refDicts =
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
1-490
removeReference
Version History
Introduced in R2023a
See Also
Simulink.interface.Dictionary | Simulink.interface.dictionary.create |
Simulink.interface.dictionary.open | addReference | getReferences
1-491
1 Functions
save
Package: Simulink.interface
Syntax
save(dictObj)
Description
save(dictObj) saves the interface dictionary.
Examples
To save the interface dictionary, use the save function. For an example that shows more of the
workflow for related functions, see “Create and Configure Interface Dictionary” on page 1-384.
save(dictAPI);
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | close | isDirty | show | showChanges |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-492
show
show
Package: Simulink.interface
Syntax
show(dictObj)
Description
show(dictObj) displays the dictionary contents in the standalone interface editor.
Examples
To display the dictionary contents in the standalone interface editor, use the show function. For an
example that shows more of the workflow for related functions, see “Create and Configure Interface
Dictionary” on page 1-384.
show(dictAPI);
1-493
1 Functions
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
Version History
Introduced in R2022b
1-494
show
See Also
Simulink.interface.Dictionary | close | isDirty | save | showChanges |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-495
1 Functions
showChanges
Package: Simulink.interface
Syntax
showChanges(dictObj)
Description
showChanges(dictObj) opens the Comparison Tool window and displays changes to the dictionary
since it was last saved. The Comparison Tool shows the differences in the Simulink design data
properties. Changes made to platform properties are not shown.
Examples
To open the Comparison Tool window and display changes to the dictionary since it was last saved,
use the showChanges function. For an example that shows more of the workflow for related
functions, see “Create and Configure Interface Dictionary” on page 1-384.
showChanges(dictAPI);
1-496
showChanges
Input Arguments
dictObj — Interface dictionary
Simulink.interface.Dictionary object
1-497
1 Functions
Version History
Introduced in R2022b
See Also
Simulink.interface.Dictionary | close | isDirty | save | show |
Simulink.interface.dictionary.create | Simulink.interface.dictionary.open
1-498
2
Blocks
2 Blocks
Adaptive Component
Model adaptive software component in AUTOSAR architecture model
Libraries:
AUTOSAR Blockset
Description
In an AUTOSAR architecture model, you use the composition editor and the Simulink Toolstrip
Modeling tab to add and connect compositions and components. Use the Adaptive Component block
to add an adaptive software component to an AUTOSAR adaptive software design.
• From the Modeling tab, configure the platform kind for the architecture model by setting
Platform to Adaptive.
• For each component required by the design, from the Modeling tab or the palette to the left of
the canvas, add an Adaptive Component block. You can view the component Kind in the Property
Inspector. For adaptive components, the component kind is AdaptiveApplication.
• Add component require ports and provide ports. To add each component port, click an edge of a
Adaptive Component block. When port controls appear, select Input or Client for a require port,
or Output or Server for a provide port.
• To connect the Adaptive Component blocks to other blocks, connect the block ports with signal
lines.
• To connect the Adaptive Component blocks to architecture or composition model root ports, drag
a line from the component ports to the containing model boundary. Releasing the connection
creates a root port at the boundary.
• Configure additional AUTOSAR properties using the Property Inspector.
After you add and connect AUTOSAR components, add Simulink behavior to the AUTOSAR
components by creating, importing, or linking models.
If you have Requirements Toolbox™ software, you can link components in an AUTOSAR architecture
model to Simulink requirements.
Each Adaptive Component block represents an adaptive application. Upon deployment, each adaptive
component is treated as an executable.
Ports
Input
2-2
Adaptive Component
If you link the component block to an implementation model, the port interfaces of the block and
model, including the number of ports, match.
Client port on a service interface for AUTOSAR method communication, implementing a service
consumer.
If you link the component block to an implementation model, the port interfaces of the block and
model, including the number of ports, match.
Output
If you link the component block to an implementation model, the port interfaces of the block and
model, including the number of ports, match.
Server port on a service interface for AUTOSAR method communication, implementing a service
provider.
If you link the component block to an implementation model, the port interfaces of the block and
model, including the number of ports, match.
Version History
Introduced in R2023a
See Also
Software Composition
Topics
“Add and Connect AUTOSAR Adaptive Components and Compositions”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
“Define AUTOSAR Component Behavior by Creating or Linking Models”
“Create Profiles Stereotypes and Views for AUTOSAR Architecture Analysis”
“Link AUTOSAR Components to Requirements”
2-3
2 Blocks
Classic Component
Model classic software component in AUTOSAR architecture model
Libraries:
AUTOSAR Blockset
Description
In an AUTOSAR architecture model, you use the composition editor and the Simulink Toolstrip
Modeling tab to add and connect compositions and components. Use the Classic Component block to
add a classic software component to an AUTOSAR classic software design.
• From the Modeling tab, configure the platform kind for the architecture model by setting
Platform to Classic.
• For each component required by the design, from the Modeling tab or the palette to the left of
the canvas, add a Classic Component block. You can use the Property Inspector to set the
component Kind — Application, ComplexDeviceDriver, EcuAbstraction,
SensorActuator, or ServiceProxy. (Application and SensorActuator are common.)
• Add component require ports and provide ports. To add each component port, click an edge of a
Classic Component block. When port controls appear, select Input for a require port or Output
for a provide port.
• To connect Classic Component blocks to other blocks, connect the block ports with signal lines.
• To connect Classic Component blocks to architecture or composition model root ports, drag a line
from the component ports to the containing model boundary. Releasing the connection creates a
root port at the boundary.
• Configure additional AUTOSAR properties using the Property Inspector.
After you add and connect AUTOSAR components, add Simulink behavior to the AUTOSAR
components by creating, importing, or linking models.
If you have Requirements Toolbox software, you can link components in an AUTOSAR architecture
model to Simulink requirements.
The Classic Component block was named Software Component. The block was renamed to
differentiate it from the Adaptive Component block, which was introduced in R2023a.
Ports
Input
2-4
Classic Component
If you link the component block to an implementation model, the port interfaces of the block and
model, including the number of ports, match.
Output
If you link the component block to an implementation model, the port interfaces of the block and
model, including the number of ports, match.
Version History
Introduced in R2019b
See Also
Software Composition | Diagnostic Service Component | NVRAM Service Component
Topics
“Add and Connect AUTOSAR Classic Components and Compositions”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
“Define AUTOSAR Component Behavior by Creating or Linking Models”
“Create Profiles Stereotypes and Views for AUTOSAR Architecture Analysis”
“Link AUTOSAR Components to Requirements”
2-5
2 Blocks
Libraries:
AUTOSAR Blockset / Classic Platform / Basic Software / Function Inhibition
Manager (FiM)
Description
For the AUTOSAR Classic Platform, the AUTOSAR standard defines important services as part of
Basic Software (BSW) that runs in the AUTOSAR Runtime Environment (RTE). Examples include
services provided by the Diagnostic Event Manager (Dem), the Function Inhibition Manager (FiM),
and the NVRAM Manager (NvM). In the AUTOSAR RTE, AUTOSAR software components typically
access BSW services using client-server communication.
To support system-level modeling and simulation of AUTOSAR components and services, AUTOSAR
Blockset provides an AUTOSAR Basic Software block library. The library contains preconfigured
blocks for modeling component calls to AUTOSAR BSW services and reference implementations of
the BSW services.
As defined in the AUTOSAR specification, the Function Inhibition Manager provides a control
mechanism for selectively inhibiting (deactivating) function execution in software component
runnables based on function identifiers (FIDs) with inhibit conditions.
The Function Inhibition Manager is closely related to the Diagnostic Event Manager because
inhibiting conditions can be based on the status of diagnostic events. The Control Function Available
Caller block calls the FiM service interface ControlFunctionAvailable to initiate the
SetFunctionAvailable operation.
Parameters
Client port name — Name of client port AUTOSAR component uses to call FiM service interface
ControlFunctionAvailable
FiM_ControlFunctionAvailable (default) | character vector
Enter the name of the client port the AUTOSAR software component uses to call the FiM service
interface FiM_ControlFunctionAvailable.
This block supports the FiM operation SetFunctionAvailable and generates inports and outports
for the operation. Passing a true value marks the function associated with the client port as available,
a false value marks the function as not available. A GetPermission operation (Function Inhibition
Caller block) associated with a function that is not available returns false.
The Operation parameter must be set to an operation supported by the schema currently specified
by the model. The list of operations on the block parameters dialog reflects the operations supported
by the current schema.
2-6
Control Function Available Caller
Block sample time. The default sets the block to inherit its sample time from the model.
Version History
Introduced in R2020a
R2023a: Basic Software caller blocks support all AUTOSAR schema versions
Starting in 23a, Basic Software caller (BSW) blocks support all AUTOSAR schema versions supported
by AUTOSAR Blockset. The BSW blocks inherit the same schema version specified by the model.
Code and ARXML generated from the component reflect the schema version specified on the model.
When you change the schema version specified by the model, the software automatically replaces
software calls to the correct operation. In some cases, the software may prompt you to confirm a
change when moving between schema versions.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
Function Inhibition Caller | DiagnosticOperationCycleCaller | Diagnostic Service Component
Topics
“Configure Calls to AUTOSAR Function Inhibition Manager Service”
“Model AUTOSAR Basic Software Service Calls”
2-7
2 Blocks
Curve
Approximate one-dimensional function
Libraries:
AUTOSAR Blockset / Classic Platform / Library Routines / Interpolation
Description
The Curve block performs one-dimensional interpolated table lookup, including index searches. The
table is a sampled representation of a function. Breakpoint sets relate the input values to positions in
the table. You can also use the Prelookup and Prelookup Using Curve blocks together to perform the
same operations as this block.
If you select the AUTOSAR 4.0 code replacement library (CRL) for your AUTOSAR model, code
generated from this block is replaced with the AUTOSAR library routine that you configure in the
block parameters dialog box.
Ports
Input
u1 — First-dimension inputs
scalar | vector | matrix
Real-valued inputs to the u1 port, mapped to an output value by looking up or interpolating the table
of values that you define.
Example: 0:10
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point
Output
Output generated by looking up or estimating table values based on the input values. If the inputs
match the index values of breakpoint sets the curve block provides a table value as output. If the
block inputs do not match index values in breakpoint sets, but are within range, the block performs
the interpolation method you selected and provides an estimated value from the table values as
output.
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point
Parameters
Targeted Routine Library — Indicates the AUTOSAR routine library used for block code replacement
IFX(fixed-point) (default) | IFL(floating-point)
2-8
Curve
If you select the AUTOSAR 4.0 code replacement library (CRL) for your model, code generated from
this block is replaced from the selected AUTOSAR routine library. This parameter enables you to
choose either fixed-point (IFX) or floating-point (IFL) code replacement and validation checks.
This parameter reflects the name of the AUTOSAR code replacement library (CRL) routine used to
replace the code generated by this block. The naming convention includes the targeted routine
library, interpolation method, and block type. This parameter is reference-only and must not be
edited.
Table Specification
• Table and breakpoints — Specify the table data and breakpoints. Selecting this option
enables these parameters:
• Table data
• Breakpoints specification
• Breakpoints
• Edit table and breakpoints
• Lookup table object — Use an existing lookup table (Simulink.LookupTable) object.
Selecting this option enables the Name field and the Edit table and breakpoints button.
Programmatic Use
Block Parameter: DataSpecification
Type: character vector
Values: 'Table and breakpoints' | 'Lookup table object'
Default: 'Table and breakpoints'
2-9
2 Blocks
During simulation, the matrix must be one-dimensional. However, during block diagram editing, you
can enter an empty matrix (specified as []) or an undefined workspace variable. This technique lets
you postpone specifying a correctly dimensioned matrix for the table data and continue editing the
block diagram.
Dependencies
Specify whether to enter data as explicit breakpoints or as parameters that generate evenly spaced
breakpoints.
• To explicitly specify breakpoint data, set this parameter to Explicit values and enter
breakpoint data in the text box next to the Breakpoints parameters.
• To specify parameters that generate evenly spaced breakpoints, set this parameter to Even
spacing and enter values for the First point and Spacing parameters for each dimension of
breakpoint data. The block calculates the number of points to generate from the table data.
Dependencies
Specify the breakpoint data explicitly or as evenly-spaced breakpoints, based on the value of the
Breakpoints specification parameter.
• If you set Breakpoints specification to Explicit values, enter the breakpoint set that
corresponds to each dimension of table data in each Breakpoints row. For each dimension,
specify breakpoints as a 1-by-n or n-by-1 vector whose values are strictly monotonically
increasing.
• If you set Breakpoints specification to Even spacing, enter the parameters First point and
Spacing in each Breakpoints row to generate evenly-spaced breakpoints in the respective
dimension. Your table data determines the number of evenly spaced points.
Dependencies
2-10
Curve
Programmatic Use
Block Parameter: BreakpointsForDimension1
Type: character vector
Values: 1-by-n or n-by-1 vector of monotonically increasing values
Default: '[10, 22, 31]'
Specify the first point in your evenly spaced breakpoint data as a real-valued, finite, or scalar. This
parameter is available when you set the Breakpoints specification to Even spacing.
Dependencies
To enable this parameter, set Data specification to Table and breakpoints and Breakpoints
specification to Even spacing.
Programmatic Use
Block Parameter: BreakpointsForDimension1FirstPoint
Type: character vector
Values: real-valued, finite, scalar
Default: '1'
To enable this parameter, set Data specification to Table and breakpoints and Breakpoints
specification to Even spacing.
Programmatic Use
Block Parameter: BreakpointsForDimension1Spacing
Type: character vector
Values: positive, real-valued, finite, scalar
Default: '1'
Edit table and breakpoints — Launch Lookup Table Editor dialog box
button
Click this button to open the Lookup Table Editor. You can then edit the object and save the new
values for the object. For more information, see “Edit Lookup Tables” in the Simulink documentation.
Algorithm
Select Evenly spaced points, Linear search, or Binary search. Each search method has
speed advantages in different circumstances:
• For evenly spaced breakpoint sets (for example, 10, 20, 30, and so on), you achieve optimal speed
by selecting Evenly spaced points to calculate table indices. This algorithm uses only the first
two breakpoints of a set to determine the offset and spacing of the remaining points.
2-11
2 Blocks
Note When using the Simulink.LookupTable object to specify table data and the Breakpoints
Specification parameter of the referenced Simulink.LookupTable object is set to Even
spacing, set the Index search method to Evenly spaced points.
• For unevenly spaced breakpoint sets, follow these guidelines:
• If input signals do not vary significantly between time steps, selecting Linear search with
Begin index search using previous index result produces the best performance.
• If input signals jump more than one or two table intervals per time step, selecting Binary
search produces the best performance.
A suboptimal choice of an index search method can lead to slow performance of models that rely
heavily on lookup tables.
The generated code stores only the first breakpoint, the spacing, and the number of breakpoints
when:
Programmatic Use
Block Parameter: IndexSearchMethod
Type: character vector
Values: 'Binary search' | 'Evenly spaced points' | 'Linear search'
Default: 'Linear search'
Begin index search using previous index result — Start using the index from the previous time
step
off (default) | on
Select this check box when you want the block to start its search using the index found at the
previous time step. For inputs that change slowly with respect to the interval size, enabling this
option can improve performance. Otherwise, the linear search and binary search methods can take
longer, especially for large breakpoint sets.
Dependencies
To enable this parameter, set Index search method to Linear search or Binary search.
Programmatic Use
Block Parameter: BeginIndexSearchUsing PreviousIndexResult
Type: character vector
Values: 'off' | 'on'
Default: 'off'
When an input falls between breakpoint values, the block interpolates the output value by using
neighboring breakpoints. For more information, see “Interpolation Methods”.
Programmatic Use
Block Parameter: InterpMethod
Type: character vector
Values: 'Linear point-slope' | 'Flat'
2-12
Curve
Specify the rounding mode for fixed-point lookup table calculations that occur during simulation or
execution of code generated from the model.
This option does not affect rounding of block parameter values. Simulink rounds such values to the
nearest representable integer value. To control the rounding of a block parameter, enter an
expression using a MATLAB rounding function into the edit field on the block dialog box.
Programmatic Use
Block Parameter: RndMeth
Type: character vector
Values: 'Round' | 'Zero'
Default: 'Round'
Data Types
Specify the table data type. The block validates that the selected types are compatible with the
specification of the targeted routine. You can set the table data type to:
• A rule that inherits a data type, for example, Inherit: Same as output
• The name of a built-in data type, for example, single
• The name of a data type object, for example, a Simulink.NumericType object
• An expression that evaluates to a data type, for example, fixdt(1,16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps
you set the data type attributes. For more information, see “Specify Data Types Using Data Type
Assistant”.
Tip Specify a table data type different from the output data type in these cases:
• Lower memory requirement for storing table data that uses a smaller type than the output signal.
• Sharing of prescaled table data between two Map blocks that have different output data types.
• Sharing of custom storage table data in the generated code for blocks that have different output
data types.
Programmatic Use
Block Parameter: TableDataTypeStr
Type: character vector
Values: 'Inherit: Inherit from 'Table data'' | 'Inherit: Same as output' |
'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' |
2-13
2 Blocks
Specify the data type for a set of breakpoint data. You can set the breakpoint data type to:
• A rule that inherits a data type, for example, Inherit: Same as corresponding input
• The name of a built-in data type, for example, single
• The name of a data type class, for example, an enumerated data type class
• The name of a data type object, for example, a Simulink.NumericType object
• An expression that evaluates to a data type, for example, fixdt(1,16,0)
A limitation for using enumerated data with this block is that it does not support out-of-range input
for enumerated date. When specifying enumerated data, include the entire enumeration set in the
breakpoint data set.
Click the Show data type assistant button to display the Data Type Assistant, which helps
you set the data type attributes. For more information, see “Specify Data Types Using Data Type
Assistant”.
Programmatic Use
Block Parameter: BreakpointsForDimension1DataTypeStr |
BreakpointsForDimension2DataTypeStr
Type: character vector
Values: 'Inherit: Same as corresponding input' | 'Inherit: Inherit from
'Breakpoint data'' | 'double' | 'single' | 'int8' | 'uint8' | 'int16' |
'uint16' | 'int32' | 'uint32' | 'fixdt(1,16)' | 'fixdt(1,16,0)' |
'fixdt(1,16,2^0,0)'|'<data type expression>'
Default: 'Inherit: Same as corresponding input'
Version History
Introduced in R2019a
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
Curve Using Prelookup | Map | Map Using Prelookup | Prelookup
Topics
“Configure Lookup Tables for AUTOSAR Calibration and Measurement”
“Code Generation with AUTOSAR Code Replacement Library”
2-14
Curve Using Prelookup
Libraries:
AUTOSAR Blockset / Classic Platform / Library Routines / Interpolation
Description
The Curve Using Prelookup block is intended for use with a Prelookup block. This block enables a
prelookup result to drive multiple interpolation results. The Prelookup block computes the index and
interval fraction that specify how its input value u relates to the breakpoint data set and feeds the
resulting index and fraction values into the Curve Using Prelookup block to interpolate a one-
dimensional table. The Prelookup and Curve Using Prelookup blocks have distributed algorithms that
when used together perform the same algorithm operation as the Curve block but offer greater
flexibility and more efficient simulation and code generation.
If you select the AUTOSAR 4.0 code replacement library (CRL) for your AUTOSAR model, code
generated from this block is replaced with the AUTOSAR library routine that you configure in the
block parameters dialog box.
Ports
Input
Inputs to the kf1 port contain index k and fraction f specified as a bus object.
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point |
bus
T — Table data
scalar | vector | matrix | 1-d array
Table data values provided as input to port T. These table values correspond to the breakpoint data
sets specified in Prelookup blocks. The Interpolation Using Prelookup block generates output by
looking up or estimating table values based on index (k) and interval fraction (f) values fed from
Prelookup blocks.
Dependencies
2-15
2 Blocks
Output
Approximation of the one-dimensional function computed by interpolating table data that uses values
from the input index, k, and the fraction, f.
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point
Parameters
Targeted Routine Library — Indicates the AUTOSAR routine library used for block code replacement
IFX(fixed-point) (default) | IFL(floating-point)
If you select the AUTOSAR 4.0 code replacement library (CRL) for your model, code generated from
this block is replaced from the selected AUTOSAR routine library. This parameter enables you to
choose either fixed-point (IFX) or floating-point (IFL) code replacement and validation checks.
This parameter reflects the name of the AUTOSAR code replacement library (CRL) routine used to
replace the code generated by this block. The naming convention includes the targeted routine
library, interpolation method, and block type. This parameter is reference-only and must not be
edited.
Table Specification
Specify whether to enter table data directly or use a lookup table object. If you set this parameter to:
• Explicit values, the Table Data parameter is visible in the dialog box.
• Lookup table object, the Name parameter is visible in the dialog box.
Programmatic Use
Block Parameter: TableSpecification
Type: character vector
Values: 'Explicit values' | 'Lookup table object'
Default: 'Explicit values'
Specify the name of a Simulink.LookupTable object. A lookup table object references Simulink
breakpoint objects. If a Simulink.LookupTable object does not exist, click the action button and
select Create. The corresponding parameters of the new lookup table object are populated with the
block information.
Dependencies
2-16
Curve Using Prelookup
Programmatic Use
Block Parameter: LookupTableObject
Type: character vector
Value: Simulink.LookupTable object
Default: ''
During simulation, the matrix size must be one-dimensional. However, during block diagram editing,
you can enter an empty matrix (specified as []) or an undefined workspace variable. This technique
lets you postpone specifying a correctly dimensioned matrix for the table data and continue editing
the block diagram.
Dependencies
Edit table and breakpoints — Launch Lookup Table Editor dialog box
button
Click this button to open the Lookup Table Editor. For more information, see “Edit Lookup Tables” in
the Simulink documentation.
Clicking this button for a lookup table object lets you edit the object and save the new values for the
object.
Algorithm
Specify the method that the block uses to interpolate table data. You can select Linear point-
slope or Flat. For more information, see “Interpolation Methods”.
Programmatic Use
Block Parameter: InterpMethod
Type: character vector
Values: 'Flat' | 'Linear point-slope'
Default: 'Linear point-slope'
Specify the rounding mode for fixed-point or floating-point lookup table calculations that occur during
simulation or execution of code generated from the model.
2-17
2 Blocks
This option does not affect rounding of values of block parameters. Simulink rounds such values to
the nearest representable integer value. To control the rounding of a block parameter, enter an
expression using a MATLAB rounding function into the edit field on the block dialog box.
Programmatic Use
Block Parameter: RndMeth
Type: character vector
Values: 'Round' | 'Zero'
Default: 'Round'
Data Types
Specify the table data type. The block validates that the selected types are compatible with the
specification of the targeted routine. You can set it to:
• A rule that inherits a data type, for example, Inherit: Same as output
• The name of a built-in data type, for example, single
• The name of a data type object, for example, a Simulink.NumericType object
• An expression that evaluates to a data type, for example, fixdt(1,16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps
you set the data type attributes. For more information, see “Specify Data Types Using Data Type
Assistant”.
Tip Specify a table data type different from the output data type for these cases:
• Lower memory requirement for storing table data that uses a smaller type than the output signal
• Sharing of prescaled table data between two Curve blocks with different output data types
• Sharing of custom storage table data in the generated code for blocks with different output data
types
Programmatic Use
Block Parameter: TableDataTypeStr
Type: character vector
Values: 'Inherit: Inherit from 'Table data'' | 'Inherit: Same as output' |
'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' |
'uint32' | 'fixdt(1,16)' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)'|'<data type
expression>'
Default: 'Inherit: Same as output'
Version History
Introduced in R2019a
2-18
Curve Using Prelookup
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
Curve | Map | Map Using Prelookup | Prelookup
Topics
“Configure Lookup Tables for AUTOSAR Calibration and Measurement”
“Code Generation with AUTOSAR Code Replacement Library”
2-19
2 Blocks
Libraries:
AUTOSAR Blockset / Classic Platform / Basic Software / Diagnostic Event
Manager (Dem)
Description
The Dem Status Inject block can be configured to instantaneously set the diagnostic status for an
AUTOSAR event simulated in the Diagnostic Service Component block. This status value can be
configured according to the Unified Diagnostic Services (UDS) standard. Specifically, you can use this
block to inject a transient failure into a system to test its ability to recover. This block simulates and
responds to other blocks affecting its status to show system recovery.
Parameters
EventID — Specify the event
0 (default) | integer
Specify the AUTOSAR event that you want to override by using this block.
Specify the type of diagnostic event that you want to inject into the system.
Test Failed — Indicates the result of the most recently performed test
Clear (default) | Set
Test Failed this Operation Cycle — Indicates whether a diagnostic test has reported a failure during
the current operation cycle
Clear (default) | Set
2-20
Dem Status Inject
Pending DTC — Indicates whether a diagnostic test has reported a failure during the current or last
completed operation cycle
Clear (default) | Set
Confirmed DTC — Indicates whether a malfunction was detected enough times to warrant that the
DTC should be stored in long-term memory
Clear (default) | Set
Test Not Complete Since Last Clear — Indicates whether a test has run and completed since the
last time a call was made to ClearDiagnosticInformation
Clear (default) | Set
Test Failed Since Last Clear — Indicates whether a test has failed since the last time a call was
made to ClearDiagnosticInformation
Clear (default) | Set
Test Not Complete This Operation Cycle — Test not performed during the current operation cycle
Clear (default) | Set
Warning Indicator Requested — Indicates the status of any warning indicators associated with a
particular DTC
Clear (default) | Set
Version History
Introduced in R2022a
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
2-21
2 Blocks
See Also
Dem Status Override
2-22
Dem Status Override
Libraries:
AUTOSAR Blockset / Classic Platform / Basic Software / Diagnostic Event
Manager (Dem)
Description
The Dem Status Override block can be configured to set the diagnostic status for an AUTOSAR event
simulated in the Diagnostic Service Component block. This status value can be configured according
to the Unified Diagnostic Services (UDS) standard. Specifically, you can use this block to set the
return value of GetEventStatus calls for a specific event regardless of the behavior of the other
events in the model. Other blocks that attempt to modify the event status during simulation are
ignored. This block allows a predictable entry-point for testing specific behavior that you can use as a
low-cost method to quickly gain coverage of a component model.
Parameters
EventID — Specify the event
0 (default) | integer
Specify the AUTOSAR event that you want to override by using this block.
Test Failed — Indicates the result of the most recently performed test
Clear (default) | Set
To set this property, select Dialog to manually configure the status or Input port to have the
status configured dynamically in response to the behavior of a connected input.
Test Failed this Operation Cycle — Indicates whether a diagnostic test has reported a failure during
the current operation cycle
Clear (default) | Set
To set this property, select Dialog to manually configure the status or Input port to have the
status configured dynamically in response to the behavior of a connected input.
Pending DTC — Indicates whether a diagnostic test has reported a failure during the current or last
completed operation cycle
Clear (default) | Set
To set this property, select Dialog to manually configure the status or Input port to have the
status configured dynamically in response to the behavior of a connected input.
2-23
2 Blocks
Confirmed DTC — Indicates whether a malfunction was detected enough times to warrant that the
DTC should be stored in long-term memory
Clear (default) | Set
To set this property, select Dialog to manually configure the status or Input port to have the
status configured dynamically in response to the behavior of a connected input.
Test Not Completed Since Last Clear — Indicates whether a test has run and completed since the
last time a call was made to ClearDiagnosticInformation
Clear (default) | Set
To set this property, select Dialog to manually configure the status or Input port to have the
status configured dynamically in response to the behavior of a connected input.
Test Failed Since Last Clear — Indicates whether a test has failed since the last time a call was
made to ClearDiagnosticInformation
Clear (default) | Set
To set this property, select Dialog to manually configure the status or Input port to have the
status configured dynamically in response to the behavior of a connected input.
Test Not Completed This Operation Cycle — Test not performed during the current operation cycle
Clear (default) | Set
To set this property, select Dialog to manually configure the status or Input port to have the
status configured dynamically in response to the behavior of a connected input.
Warning Indicator Requested — Indicates the status of any warning indicators associated with a
particular DTC
Clear (default) | Set
To set this property, select Dialog to manually configure the status or Input port to have the
status configured dynamically in response to the behavior of a connected input.
Version History
Introduced in R2022a
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
2-24
Dem Status Override
See Also
Dem Status Inject
2-25
2 Blocks
Libraries:
AUTOSAR Blockset / Classic Platform / Basic Software / Diagnostic Event Manager
(Dem)
Description
The Diagnostic Service Component block provides reference implementations of Diagnostic Event
Manager (Dem) and Function Inhibition Manager (FiM) services supported by AUTOSAR Basic
Software (BSW) caller blocks. When coupled with Dem and FiM caller blocks, the reference
implementations enable you to configure and run system-level or composition-level simulations of
AUTOSAR Dem and FiM service calls.
The block has prepopulated parameters, including RTE service ID parameters, Dem Counter-Based
Debouncing parameters, and FiM inhibition condition parameters. Examine the parameter settings
and, if necessary, make modifications based on how you are using the Dem or FiM service operations.
The RTE tab lists component client ports and their mapping to Dem or FiM service IDs for events,
operation cycles, or functions with inhibition conditions. Each row in the table represents a call into
Dem or FiM services from a Basic Software caller block, for which you can modify an ID value.
The Dem tab Counter-Based Debouncing parameters control the counter-based debounce
algorithm provided by the Dem service reference implementations. During multiple simulations, you
can adjust event step size and threshold parameters and observe the effects.
Use the counter-based debouncing parameters to determine when a monitored event has passed or
failed. For each event ID, the software maintains a counter. When PREFAIL events arrive, the event
ID counter increments by the Increment step size (default 1). When PREPASS events arrive, the
event ID counter decrements by the Decrement step size (default 1). To determine the event ID
counter thresholds at which an event fails or passes, use block parameters Failed threshold (default
2) and Passed threshold (default -1).
In the Dem reference implementations, the step size and threshold parameters apply globally to event
IDs, not to individual IDs.
The FIM tab lists function identifiers (FIDs) and their associated inhibition conditions and client
ports. The tab provides graphical controls for adding or removing inhibition conditions for a selected
FID. For each inhibition condition, select ID and mask values.
Parameters
ID (RTE tab) — ID that identifies service event, operation cycle, or function with inhibition condition
1 (default) | scalar
Each row in the RTE tab table represents a call into Dem or FiM services from a Basic Software caller
block. Check the ID mappings for events, operation cycles, and functions with inhibition conditions.
For events, calls that act on the same event use the same event ID. For an example of mapping Dem
2-26
Diagnostic Service Component
client ports to shared event IDs, see “Simulate AUTOSAR Basic Software Services and Run-Time
Environment”.
Increment step size — Fixed-step value to increment event ID counter when PREFAIL events arrive
1 (default) | scalar (1 to 32767)
Specify a fixed-step value that the Dem event ID counter increments by when PREFAIL events arrive.
Decrement step size — Fixed-step value to decrement the event ID counter when PREPASS events
arrive
1 (default) | scalar (1 to 32767)
Specify a fixed-step value that the Dem event ID counter decrements by when PREPASS events
arrive.
Failed threshold — Dem event ID counter threshold that represents a failed status
2 (default) | scalar (1 to 32767)
Specify a Dem event ID counter threshold value to represent failed status. Events that reach this
threshold are considered to have failed.
Passed threshold — Dem event ID counter threshold that represents passed status
-1 (default) | scalar (-32768 to -1)
Specify a Dem event ID counter threshold value to represent passed status. Events that reach this
threshold are considered to have passed.
In the FiM tab table, each row grouped under an FID represents an inhibition condition with an ID,
one or more component client ports associated with the ID, and a mask. For each inhibition condition,
you can modify the ID value. For examples of inhibition condition configuration, see “Configure and
Simulate AUTOSAR Function Inhibition Service Calls”.
In the FiM tab table, each row grouped under an FID represents an inhibition condition with an ID,
one or more component client ports associated with the ID, and a mask. For each inhibition condition,
you can modify the mask value. For examples of inhibition condition configuration, see “Configure
and Simulate AUTOSAR Function Inhibition Service Calls”.
Version History
Introduced in R2017b
See Also
DiagnosticInfoCaller | DiagnosticMonitorCaller | DiagnosticEventAvailableCaller |
DiagnosticOperationCycleCaller | Function Inhibition Caller | Control Function Available Caller
Topics
“Configure Calls to AUTOSAR Diagnostic Event Manager Service”
2-27
2 Blocks
2-28
DiagnosticEventAvailableCaller
DiagnosticEventAvailableCaller
Call AUTOSAR Diagnostic Event Manager (Dem) service interface EventAvailable
Libraries:
AUTOSAR Blockset / Classic Platform / Basic Software / Diagnostic Event
Manager (Dem)
Description
For the AUTOSAR Classic Platform, the AUTOSAR standard defines important services as part of
Basic Software (BSW) that runs in the AUTOSAR Runtime Environment (RTE). Examples include
services provided by the Diagnostic Event Manager (Dem), the Function Inhibition Manager (FiM),
and the NVRAM Manager (NvM). In the AUTOSAR RTE, AUTOSAR software components typically
access BSW services by using client-server communication.
To support system-level modeling and simulation of AUTOSAR components and services, AUTOSAR
Blockset provides an AUTOSAR Basic Software block library. The library contains preconfigured
blocks for modeling component calls to AUTOSAR BSW services and reference implementations of
the BSW services.
Parameters
Client port name — Name of client port AUTOSAR component uses to call Dem service interface
EventAvailable
EventAvailable (default) | character vector
Enter the name of the client port the AUTOSAR software component uses to call the Dem service
interface EventAvailable.
This block supports the Dem operation SetEventAvailable and generates inports and outports for
the operation. You can use this operation to configure events as unavailable. An unavailable event is
treated as if it is not configured in the system and returns E_NOT_OK when accessed by other
operations.
The Operation parameter must be set to an operation supported by the schema currently specified
by the model. The list of operations on the block parameters dialog reflects the operations supported
by the current schema.
2-29
2 Blocks
Block sample time. The default sets the block to inherit its sample time from the model.
Version History
Introduced in R2020a
R2023a: Basic Software caller blocks support all AUTOSAR schema versions
Starting in 23a, Basic Software caller (BSW) blocks support all AUTOSAR schema versions supported
by AUTOSAR Blockset. The BSW blocks inherit the same schema version specified by the model.
Code and ARXML generated from the component reflect the schema version specified on the model.
When you change the schema version specified by the model, the software automatically replaces
software calls to the correct operation. In some cases, the software may prompt you to confirm a
change when moving between schema versions.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
DiagnosticInfoCaller | DiagnosticMonitorCaller | DiagnosticOperationCycleCaller | Diagnostic Service
Component
Topics
“Configure Calls to AUTOSAR Diagnostic Event Manager Service”
“Model AUTOSAR Basic Software Service Calls”
2-30
DiagnosticInfoCaller
DiagnosticInfoCaller
Call AUTOSAR Diagnostic Event Manager (Dem) service interface DiagnosticInfo
Libraries:
AUTOSAR Blockset / Classic Platform / Basic Software / Diagnostic Event Manager
(Dem)
Description
The AUTOSAR standard defines a Diagnostic Event Manager (Dem) service as a part of Basic
Software (BSW) that runs in the AUTOSAR Runtime Environment (RTE). AUTOSAR software
components access Dem services through client-server calls. The DiagnosticInfoCaller block calls the
Dem service interface DiagnosticInfo to initiate a specified operation.
Parameters
Client port name — Name of client port AUTOSAR component uses to call Dem service interface
DiagnosticInfo
DiagnosticInfo (default) | character vector
Enter the name of the client port the AUTOSAR software component uses to call the Dem service
interface DiagnosticInfo.
Select the operation that the AUTOSAR software component calls from the Dem service interface
DiagnosticInfo. The AUTOSAR standard defines the operations. After you select the operation, the
inports and outports for the block are generated to support the operation.
The Operation parameter must be set to an operation supported by the schema currently specified
by the model. The list of operations on the block parameters dialog reflects the operations supported
by the current schema.
Data type for FormatStatus — Specify data type to represent a Dem format type
Enum:Dem_DTCFormatType (default)
Specify an enumerated data type to represent a Dem format type required for some operations. For
more information, see the AUTOSAR standard Specification of Diagnostic Event Manager.
Dependencies
Block sample time. The default sets the block to inherit its sample time from the model.
2-31
2 Blocks
Version History
Introduced in R2016b
R2023a: Basic Software caller blocks support all AUTOSAR schema versions
Starting in 23a, Basic Software caller (BSW) blocks support all AUTOSAR schema versions supported
by AUTOSAR Blockset. The BSW blocks inherit the same schema version specified by the model.
Code and ARXML generated from the component reflect the schema version specified on the model.
When you change the schema version specified by the model, the software automatically replaces
software calls to the correct operation. In some cases, the software may prompt you to confirm a
change when moving between schema versions.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
DiagnosticMonitorCaller | DiagnosticOperationCycleCaller | DiagnosticEventAvailableCaller |
Diagnostic Service Component
Topics
“Configure Calls to AUTOSAR Diagnostic Event Manager Service”
“Configure AUTOSAR Basic Software Service Implementations for Simulation”
2-32
DiagnosticMonitorCaller
DiagnosticMonitorCaller
Call AUTOSAR Diagnostic Event Manager (Dem) service interface DiagnosticMonitor
Libraries:
AUTOSAR Blockset / Classic Platform / Basic Software / Diagnostic Event
Manager (Dem)
Description
The AUTOSAR standard defines a Diagnostic Event Manager (Dem) service as a part of Basic
Software (BSW) that runs in the AUTOSAR Runtime Environment (RTE). AUTOSAR software
components access Dem services through client-server calls. The DiagnosticMonitorCaller block calls
the Dem service interface DiagnosticMonitor to initiate a specified operation.
Parameters
Client port name — Name of client port AUTOSAR component uses to call Dem service interface
DiagnosticMonitor
DiagnosticMonitor (default) | character vector
Enter the name of the client port the AUTOSAR software component uses to call the Dem service
interface DiagnosticMonitor.
Select the operation that the AUTOSAR software component calls from the Dem service interface
DiagnosticMonitor. The operations are defined by the AUTOSAR standard. After the operation is
selected, the inports and outports for the block are generated to support the operation.
The Operation parameter must be set to an operation supported by the schema currently specified
by the model. The list of operations on the block parameters dialog reflects the operations supported
by the current schema.
Data type for EventStatus — Specify a data type to represent a Dem event type
Enum: Dem_EventStatusType (default)
Specify an enumerated data type to represent a Dem event type required for some operations. For
more information, see the AUTOSAR standard Specification of Diagnostic Event Manager.
Dependencies
Block sample time. The default sets the block to inherit its sample time from the model.
2-33
2 Blocks
Version History
Introduced in R2016b
R2023a: Basic Software caller blocks support all AUTOSAR schema versions
Starting in 23a, Basic Software caller (BSW) blocks support all AUTOSAR schema versions supported
by AUTOSAR Blockset. The BSW blocks inherit the same schema version specified by the model.
Code and ARXML generated from the component reflect the schema version specified on the model.
When you change the schema version specified by the model, the software automatically replaces
software calls to the correct operation. In some cases, the software may prompt you to confirm a
change when moving between schema versions.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
DiagnosticInfoCaller | DiagnosticOperationCycleCaller | DiagnosticEventAvailableCaller | Diagnostic
Service Component
Topics
“Configure Calls to AUTOSAR Diagnostic Event Manager Service”
“Configure AUTOSAR Basic Software Service Implementations for Simulation”
2-34
DiagnosticOperationCycleCaller
DiagnosticOperationCycleCaller
Call AUTOSAR Diagnostic Event Manager (Dem) service interface OperationCycle
Libraries:
AUTOSAR Blockset / Classic Platform / Basic Software / Diagnostic Event
Manager (Dem)
Description
For the AUTOSAR Classic Platform, the AUTOSAR standard defines important services as part of
Basic Software (BSW) that runs in the AUTOSAR Runtime Environment (RTE). Examples include
services provided by the Diagnostic Event Manager (Dem), the Function Inhibition Manager (FiM),
and the NVRAM Manager (NvM). In the AUTOSAR RTE, AUTOSAR software components typically
access BSW services by using client-server communication.
To support system-level modeling and simulation of AUTOSAR components and services, AUTOSAR
Blockset provides an AUTOSAR Basic Software block library. The library contains preconfigured
blocks for modeling component calls to AUTOSAR BSW services and reference implementations of
the BSW services.
As defined in the AUTOSAR specification, the Function Inhibition Manager provides a control
mechanism for selectively inhibiting (deactivating) function execution in software component
runnables based on function identifiers (FIDs) with inhibit conditions.
The Function Inhibition Manager is closely related to the Diagnostic Event Manager because
inhibiting conditions can be based on the status of diagnostic events. An operation cycle affects
events that share the same Diagnostic Service Component. The DiagnosticOperationCycleCaller block
calls the Dem service interface OperationCycle to control operation cycles.
Parameters
Client port name — Name of client port AUTOSAR component uses to call Dem service interface
OperationCycle
OperationCycle (default) | character vector
Enter the name of the client port the AUTOSAR software component uses to call the Dem service
interface OperationCycle.
Select a Dem operation to control or monitor operation cycles. To start and stop operation cycles,
select SetOperationCycleState. To query the current state of an operation cycle, select
GetOperationCycleState. After you select an operation, the inports and outports for the block are
generated to support that operation.
The Operation parameter must be set to an operation supported by the schema currently specified
by the model. The list of operations on the block parameters dialog reflects the operations supported
by the current schema.
2-35
2 Blocks
Enter a value to control the start or stop of component operation cycles. To start operation cycles,
enter the value Enum:Dem_OperationCycleStateType.DEM_CYCLE_STATE_START. To end
operation cycles, enter the value
Enum:Dem_OperationCycleStateType.DEM_CYCLE_STATE_END.
Dependencies
Block sample time. The default sets the block to inherit its sample time from the model.
Version History
Introduced in R2020a
R2023a: Basic Software caller blocks support all AUTOSAR schema versions
Starting in 23a, Basic Software caller (BSW) blocks support all AUTOSAR schema versions supported
by AUTOSAR Blockset. The BSW blocks inherit the same schema version specified by the model.
Code and ARXML generated from the component reflect the schema version specified on the model.
When you change the schema version specified by the model, the software automatically replaces
software calls to the correct operation. In some cases, the software may prompt you to confirm a
change when moving between schema versions.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
Function Inhibition Caller | Control Function Available Caller | Diagnostic Service Component
Topics
“Configure Calls to AUTOSAR Function Inhibition Manager Service”
“Model AUTOSAR Basic Software Service Calls”
2-36
Event Receive
Event Receive
Convert input event to signal
Libraries:
AUTOSAR Blockset / Adaptive Platform / Signal Routing
Description
At the top level of an AUTOSAR adaptive model, use the Event Receive and Event Send blocks to set
up event-based communication.
• After each root inport, add an Event Receive block which converts an input event to a signal, while
preserving the signal values and data type.
• Before each root outport, add an Event Send block which converts an input signal to an event,
while preserving the signal values and data type.
Ports
Input
The input port for the Event Receive block to accept an event.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 |
Boolean | enumerated | bus
Output
The output port for the Event Receive block to output a signal.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 |
Boolean | enumerated | bus
Version History
Introduced in R2019a
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
2-37
2 Blocks
See Also
Event Send
Topics
“Configure AUTOSAR Adaptive Software Components”
“Create and Configure AUTOSAR Adaptive Software Component”
2-38
Event Send
Event Send
Convert input signal to event
Libraries:
AUTOSAR Blockset / Adaptive Platform / Signal Routing
Description
At the top level of an AUTOSAR adaptive model, use the Event Receive and Event Send blocks to set
up event-based communication.
• After each root inport, add an Event Receive block which converts an input event to a signal, while
preserving the signal values and data type.
• Before each root outport, add an Event Send block which converts an input signal to an event,
while preserving the signal values and data type.
Ports
Input
The input port for the Event Send block to receive inputs of any type that AUTOSAR Blockset
supports.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 |
Boolean | enumerated | bus
Output
The output port for the Event Send block to output an event.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 |
Boolean | enumerated | bus
Version History
Introduced in R2019a
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
2-39
2 Blocks
See Also
Event Receive
Topics
“Configure AUTOSAR Adaptive Software Components”
“Create and Configure AUTOSAR Adaptive Software Component”
2-40
Function Inhibition Caller
Libraries:
AUTOSAR Blockset / Classic Platform / Basic Software / Function Inhibition
Manager (FiM)
Description
For the AUTOSAR Classic Platform, the AUTOSAR standard defines important services as part of
Basic Software (BSW) that runs in the AUTOSAR Runtime Environment (RTE). Examples include
services provided by the Diagnostic Event Manager (Dem), the Function Inhibition Manager (FiM),
and the NVRAM Manager (NvM). In the AUTOSAR RTE, AUTOSAR software components typically
access BSW services by using client-server communication.
To support system-level modeling and simulation of AUTOSAR components and services, AUTOSAR
Blockset provides an AUTOSAR Basic Software block library. The library contains preconfigured
blocks for modeling component calls to AUTOSAR BSW services and reference implementations of
the BSW services.
As defined in the AUTOSAR specification, the Function Inhibition Manager provides a control
mechanism for selectively inhibiting (deactivating) function execution in software component
runnables based on function identifiers (FIDs) with inhibit conditions.
The Function Inhibition Manager is closely related to the Diagnostic Event Manager because
inhibiting conditions can be based on the status of diagnostic events. The Function Inhibition Caller
block calls the FiM service interface FunctionInhibition to initiate the
GetFunctionPermission operation.
Parameters
Client port name — Name of client port AUTOSAR component uses to call FiM service interface
FunctionInhibition
FiM_FunctionInhibition (default) | character vector
Enter the name of the client port the AUTOSAR software component uses to call the FiM service
interface FiM_FunctionInhibition.
This block supports the FiM operation GetFunctionPermission and generates inports and
outports for this operation. This operation queries the Function Inhibition Manager to check if it has
permission to run associated functionality. Permissions are based on the inhibition configuration
created by using the Diagnostic Service Component block. The operation returns true if the
functionality has permission or false if the functionality is inhibited.
2-41
2 Blocks
The Operation parameter must be set to an operation supported by the schema currently specified
by the model. The list of operations on the block parameters dialog reflects the operations supported
by the current schema.
Block sample time. The default sets the block to inherit its sample time from the model.
Version History
Introduced in R2020a
R2023a: Basic Software caller blocks support all AUTOSAR schema versions
Starting in 23a, Basic Software caller (BSW) blocks support all AUTOSAR schema versions supported
by AUTOSAR Blockset. The BSW blocks inherit the same schema version specified by the model.
Code and ARXML generated from the component reflect the schema version specified on the model.
When you change the schema version specified by the model, the software automatically replaces
software calls to the correct operation. In some cases, the software may prompt you to confirm a
change when moving between schema versions.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
Control Function Available Caller | DiagnosticOperationCycleCaller | Diagnostic Service Component
Topics
“Configure Calls to AUTOSAR Function Inhibition Manager Service”
“Model AUTOSAR Basic Software Service Calls”
2-42
Map
Map
Approximate two-dimensional function
Libraries:
AUTOSAR Blockset / Classic Platform / Library Routines / Interpolation
Description
The Map block performs two-dimensional, interpolated table lookup, including index searches. The
table is a sampled representation of a function in two variables. Breakpoint sets relate the input
values to positions in the table. You can also use the Prelookup and Prelookup Using Map blocks
together to perform the same operations as this block.
When you set the Math and Data Types > Use algorithms optimized for row-major array layout
configuration parameter, the block behavior changes from column-major to row-major. For these
blocks, the column-major and row-major algorithms might differ in the order of the output
calculations, possibly resulting in slightly different numeric values. This capability requires Simulink
Coder or Embedded Coder software. For more information on row-major support, see “Code
Generation of Matrices and Arrays” (Simulink Coder).
If you select the AUTOSAR 4.0 code replacement library (CRL) for your AUTOSAR model, code
generated from this block is replaced with the AUTOSAR library routine that you configure in the
block parameters dialog box.
Ports
Input
Real-valued inputs to the first port, mapped to an output value by looking up or interpolating the
table of values that you define.
Example: 0:10
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point
Real-valued inputs to the second port, mapped to an output value by looking up or interpolating the
table of values that you define.
Example: 0:10
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point
2-43
2 Blocks
Output
Output generated by looking up or estimating table values based on input values. If the inputs match
the index values of breakpoint sets, the map block provides a table value as output. If the block inputs
do not match index values in breakpoint sets, but are within range, the block performs the configured
interpolation method and provides an estimated value from the table as output.
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point
Parameters
Targeted Routine Library — Indicates the AUTOSAR routine library used for block code replacement
IFX(fixed-point) (default) | IFL(floating-point)
If you select the AUTOSAR 4.0 code replacement library (CRL) for your model, code generated from
this block is replaced from the selected AUTOSAR routine library. This parameter enables you to
choose either fixed-point (IFX) or floating-point (IFL) code replacement and validation checks.
This parameter reflects the name of the AUTOSAR code replacement library (CRL) routine used to
replace the code generated by this block. The naming convention includes the targeted routine
library, interpolation method, and block type. This parameter is reference-only and must not be
edited.
Table Specification
• Table and breakpoints — Specify the table data and breakpoints. Selecting this option
enables these parameters:
• Table data
• Breakpoints specification
• Breakpoints 1
• Breakpoints 2
• Edit table and breakpoints
• Lookup table object — Use an existing lookup table (Simulink.LookupTable) object.
Selecting this option enables the Name field and the Edit table and breakpoints button.
Programmatic Use
Block Parameter: DataSpecification
Type: character vector
Values: 'Table and breakpoints' | 'Lookup table object'
Default: 'Table and breakpoints'
2-44
Map
During simulation, the matrix size must be two dimensional. However, during block diagram editing,
you can enter an empty matrix (specified as []) or an undefined workspace variable. This technique
lets you postpone specifying a correctly dimensioned matrix for the table data and continue editing
the block diagram.
Dependencies
Specify whether to enter data as explicit breakpoints or as parameters that generate evenly spaced
breakpoints.
• To explicitly specify breakpoint data, set this parameter to Explicit values and enter
breakpoint data in the text box next to the Breakpoints parameters.
• To specify parameters that generate evenly spaced breakpoints, set this parameter to Even
spacing and enter values for the First point and Spacing parameters for each dimension of
breakpoint data. The block calculates the number of points to generate from the table data.
Dependencies
2-45
2 Blocks
Specify the breakpoint data explicitly or as evenly-spaced breakpoints, based on the value of the
Breakpoints specification parameter.
• If you set Breakpoints specification to Explicit values, enter the breakpoint set that
corresponds to each dimension of table data in each Breakpoints row. For each dimension,
specify breakpoints as a 1-by-n or n-by-1 vector whose values are strictly monotonically
increasing.
• If you set Breakpoints specification to Even spacing, enter the parameters First point and
Spacing in each Breakpoints row to generate evenly-spaced breakpoints in the respective
dimension. Your table data determines the number of evenly spaced points.
Dependencies
Specify the first point in your evenly spaced breakpoint data as a real-valued, finite, or scalar. This
parameter is available when you set the Breakpoints specification to Even spacing.
Dependencies
To enable this parameter, set Data specification to Table and breakpoints and Breakpoints
specification to Even spacing.
Programmatic Use
Block Parameter: BreakpointsForDimension1FirstPoint |
BreakpointsForDimensionSecondPoint
Type: character vector
Values: real-valued, finite, scalar
Default: '1'
To enable this parameter, set Data specification to Table and breakpoints and Breakpoints
specification to Even spacing.
Programmatic Use
Block Parameter: BreakpointsForDimension1Spacing |
BreakpointsForDimension2Spacing
Type: character vector
2-46
Map
Edit table and breakpoints — Launch Lookup Table Editor dialog box
button
Click this button to open the Lookup Table Editor. You can then edit the object and save the new
values for the object. For more information, see “Edit Lookup Tables” in the Simulink documentation.
Algorithm
Select Evenly spaced points, Linear search, or Binary search. Each search method has
speed advantages in different circumstances:
• For evenly spaced breakpoint sets (for example, 10, 20, 30, and so on), you achieve optimal speed
by selecting Evenly spaced points to calculate table indices. This algorithm uses only the first
two breakpoints of a set to determine the offset and spacing of the remaining points.
Note When using the Simulink.LookupTable object to specify table data and the Breakpoints
Specification parameter of the referenced Simulink.LookupTable object is set to Even
spacing, set the Index search method to Evenly spaced points.
• For unevenly spaced breakpoint sets, follow these guidelines:
• If input signals do not vary significantly between time steps, selecting Linear search with
Begin index search using previous index result produces the best performance.
• If input signals jump more than one or two table intervals per time step, selecting Binary
search produces the best performance.
A suboptimal choice of an index search method can lead to slow performance of models that rely
heavily on lookup tables.
The generated code stores only the first breakpoint, the spacing, and the number of breakpoints
when:
Begin index search using previous index result — Start using the index from the previous time
step
off (default) | on
Select this check box when you want the block to start its search using the index found at the
previous time step. For inputs that change slowly with respect to the interval size, enabling this
option can improve performance. Otherwise, the linear search and binary search methods can take
longer, especially for large breakpoint sets.
2-47
2 Blocks
Dependencies
To enable this parameter, set Index search method to Linear search or Binary search.
Programmatic Use
Block Parameter: BeginIndexSearchUsing PreviousIndexResult
Type: character vector
Values: 'off' | 'on'
Default: 'off'
When an input falls between breakpoint values, the block interpolates the output value by using
neighboring breakpoints. For more information, see “Interpolation Methods”.
Programmatic Use
Block Parameter: InterpMethod
Type: character vector
Values: 'Linear point-slope' | 'Flat'
Default: 'Linear point-slope'
Specify the rounding mode for fixed-point or floating-point lookup table calculations that occur during
simulation or execution of code generated from the model.
This option does not affect rounding of block parameter values. Simulink rounds such values to the
nearest representable integer value. To control the rounding of a block parameter, enter an
expression using a MATLAB rounding function into the edit field on the block dialog box.
Programmatic Use
Block Parameter: RndMeth
Type: character vector
Values: 'Round' | 'Zero'
Default: 'Round'
Data Types
Specify the table data type. The block validates that the selected types are compatible with the
specification of the targeted routine. You can set the table data type to:
• A rule that inherits a data type, for example, Inherit: Same as output
• The name of a built-in data type, for example, single
• The name of a data type object, for example, a Simulink.NumericType object
• An expression that evaluates to a data type, for example, fixdt(1,16,0)
2-48
Map
Click the Show data type assistant button to display the Data Type Assistant, which helps
you set the data type attributes. For more information, see “Specify Data Types Using Data Type
Assistant”.
Tip Specify a table data type different from the output data type in these cases:
• Lower memory requirement for storing table data that uses a smaller type than the output signal.
• Sharing of prescaled table data between two Map blocks that have different output data types.
• Sharing of custom storage table data in the generated code for blocks that have different output
data types.
Programmatic Use
Block Parameter: TableDataTypeStr
Type: character vector
Values: 'Inherit: Inherit from 'Table data'' | 'Inherit: Same as output' |
'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' |
'uint32' | 'fixdt(1,16)' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)'|'<data type
expression>'
Default: 'Inherit: Same as output'
Specify the data type for a set of breakpoint data. You can set the breakpoint data type to:
• A rule that inherits a data type, for example, Inherit: Same as corresponding input
• The name of a built-in data type, for example, single
• The name of a data type class, for example, an enumerated data type class
• The name of a data type object, for example, a Simulink.NumericType object
• An expression that evaluates to a data type, for example, fixdt(1,16,0)
A limitation for using enumerated data with this block is that it does not support out-of-range input
for enumerated date. When specifying enumerated data, include the entire enumeration set in the
breakpoint data set.
Click the Show data type assistant button to display the Data Type Assistant, which helps
you set the data type attributes. For more information, see “Specify Data Types Using Data Type
Assistant”.
Programmatic Use
Block Parameter: BreakpointsForDimension1DataTypeStr |
BreakpointsForDimension2DataTypeStr
Type: character vector
Values: 'Inherit: Same as corresponding input' | 'Inherit: Inherit from
'Breakpoint data'' | 'double' | 'single' | 'int8' | 'uint8' | 'int16' |
2-49
2 Blocks
Version History
Introduced in R2019a
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
Curve | Curve Using Prelookup | Map Using Prelookup | Prelookup
Topics
“Configure Lookup Tables for AUTOSAR Calibration and Measurement”
“Code Generation with AUTOSAR Code Replacement Library”
2-50
Map Using Prelookup
Libraries:
AUTOSAR Blockset / Classic Platform / Library Routines / Interpolation
Description
The Map Using Prelookup block is intended for use with a Prelookup block. This block enables a
prelookup result to drive multiple interpolation results. The Prelookup block calculates the index and
interval fraction that specify how its input value u relates to the breakpoint data set and feeds the
resulting index and fraction values into a Map Using Prelookup block to interpolate a two-
dimensional table. The Prelookup and Map Using Prelookup blocks have distributed algorithms that
when used together perform the same algorithm operation as the Map block but offer greater
flexibility and more efficient simulation and code generation.
If you select the AUTOSAR 4.0 code replacement library (CRL) for your AUTOSAR model, code
generated from this block is replaced with the AUTOSAR library routine that you configure in the
block parameters dialog box.
Ports
Input
Inputs to the kf1 port contain index k and fraction f specified as a bus object.
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point |
bus
T — Table data
scalar | vector | matrix | 2-d array
Table data values provided as input to port T. These table values correspond to the breakpoint data
sets specified in Prelookup blocks. The Interpolation Using Prelookup block generates output by
looking up or estimating table values based on index (k) and interval fraction (f) values fed from a
Prelookup block.
Dependencies
2-51
2 Blocks
Output
Approximation of the two-dimensional function computed by interpolating table data that uses values
from the input index, k, and the fraction, f.
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point
Parameters
Targeted Routine Library — Indicates the AUTOSAR routine library used for block code replacement
IFX(fixed-point) (default) | IFL(floating-point)
If you select the AUTOSAR 4.0 code replacement library (CRL) for your model, code generated from
this block is replaced from the selected AUTOSAR routine library. This parameter enables you to
choose either fixed-point (IFX) or floating-point (IFL) code replacement and validation checks.
This parameter reflects the name of the AUTOSAR code replacement library (CRL) routine used to
replace the code generated by this block. The naming convention includes the targeted routine
library, interpolation method, and block type. This parameter is reference-only and must not be
edited.
Table Specification
Specify whether to enter table data directly or use a lookup table object. If you set this parameter to:
• Explicit values, the Table Data parameter is visible in the dialog box.
• Lookup table object, the Name parameter is visible in the dialog box.
Programmatic Use
Block Parameter: TableSpecification
Type: character vector
Values: 'Explicit values' | 'Lookup table object'
Default: 'Explicit values'
Specify the name of a Simulink.LookupTable object. A lookup table object references Simulink
breakpoint objects. If a Simulink.LookupTable object does not exist, click the action button and
select Create. The corresponding parameters of the new lookup table object are populated with the
block information.
Dependencies
2-52
Map Using Prelookup
Programmatic Use
Block Parameter: LookupTableObject
Type: character vector
Value: Simulink.LookupTable object
Default: ''
During simulation, the matrix size must be two-dimensional. However, during block diagram editing,
you can enter an empty matrix (specified as []) or an undefined workspace variable. This technique
lets you postpone specifying a correctly dimensioned matrix for the table data and continue editing
the block diagram.
Dependencies
Edit table and breakpoints — Launch Lookup Table Editor dialog box
button
Click this button to open the Lookup Table Editor. For more information, see “Edit Lookup Tables” in
the Simulink documentation.
Clicking this button for a lookup table object lets you edit the object and save the new values for the
object.
Algorithm
Specify the method that the block uses to interpolate table data. You can select Linear point-
slope or Flat. For more information, see “Interpolation Methods”.
Programmatic Use
Block Parameter: InterpMethod
Type: character vector
Values: 'Flat' | 'Linear point-slope'
Default: 'Linear point-slope'
Specify the rounding mode for fixed-point or floating-point lookup table calculations that occur during
simulation or execution of code generated from the model.
2-53
2 Blocks
This option does not affect rounding of values of block parameters. Simulink rounds such values to
the nearest representable integer value. To control the rounding of a block parameter, enter an
expression using a MATLAB rounding function into the edit field on the block dialog box.
Programmatic Use
Block Parameter: RndMeth
Type: character vector
Values: 'Round' | 'Zero'
Default: 'Round'
Data Types
Specify the table data type. The block will validate that the selected types are compatible with the
specification of the targeted routine. You can set it to:
• A rule that inherits a data type, for example, Inherit: Same as output
• The name of a built-in data type, for example, single
• The name of a data type object, for example, a Simulink.NumericType object
• An expression that evaluates to a data type, for example, fixdt(1,16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps
you set the data type attributes. For more information, see “Specify Data Types Using Data Type
Assistant”.
Tip Specify a table data type different from the output data type for these cases:
• Lower memory requirement for storing table data that uses a smaller type than the output signal
• Sharing of prescaled table data between two Curve blocks with different output data types
• Sharing of custom storage table data in the generated code for blocks with different output data
types
Programmatic Use
Block Parameter: TableDataTypeStr
Type: character vector
Values: 'Inherit: Inherit from 'Table data'' | 'Inherit: Same as output' |
'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' |
'uint32' | 'fixdt(1,16)' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)'|'<data type
expression>'
Default: 'Inherit: Same as output'
Version History
Introduced in R2019a
2-54
Map Using Prelookup
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
Curve | Curve Using Prelookup | Map | Prelookup
Topics
“Configure Lookup Tables for AUTOSAR Calibration and Measurement”
“Code Generation with AUTOSAR Code Replacement Library”
2-55
2 Blocks
Ramp
Generate signal that follows input value bound by rising or falling slope
Libraries:
AUTOSAR Blockset / Classic Platform / Library Routines / Math Operations
Description
The Mathematical Floating point Library (MFL) Ramp block generates a signal that starts at a
specified value and changes by a specified rate until the value of the input signal is reached. The
block parameters Rise slope, Fall slope, Initial condition, and Sample time, and the input signal
u determine the characteristics of the output signal.
When you select the AUTOSAR 4.0 Code Replacement Library (CRL) for your AUTOSAR model, your
model replaces code that you generate for this block with calls to the following AUTOSAR library
routines:
• Mfl_Ramp_InitState
• Mfl_Ramp_SetParam
• Mfl_RampCalc
• Mfl_RampOut_f32
Ports
Input
u — Input signal
scalar
R — Reset port
scalar
Option to reset the output signal to the initial condition, specified as a scalar.
Dependencies
rs — Rise slope
scalar
2-56
Ramp
Dependencies
To enable this port, set the Source field of the Rise slope parameter to Input port.
Data Types: single
fs — Fall slope
scalar
To enable this port, set the Source field of the Fall Slope parameter to Input port.
Data Types: single
Output
Parameters
Rise slope — Increase value of output
Dialog | Input port
Specify the Source field of this parameter as one the following values.
• Dialog — Set the slope using the Value field of this parameter.
• Input port — Set the slope using the rs port. The block uses the value from this port as the
slope.
Programmatic Use
Block Parameter: RiseSlope
Type: character vector
Values: real finite nonnegative values
Default: '1'
Programmatic Use
Block Parameter: RiseSlopeSource
Type: character vector
Values: 'Dialog' | 'Input port'
Default: 'Dialog'
Specify the Source field of this parameter as one the following values.
• Dialog — Set the slope using the Value field of this parameter.
• Input port — Set the slope using the fs port. The block uses the value from this port as the
slope.
2-57
2 Blocks
Programmatic Use
Block Parameter: FallSlope
Type: character vector
Values: real finite nonnegative values
Default: '1'
Programmatic Use
Block Parameter: FallSlopeSource
Type: character vector
Values: 'Dialog' | 'Input Port'
Default: 'Dialog'
Programmatic Use
Block Parameter: ShowResetPort
Type: character vector
Values: 'off' | 'on'
Default: 'off'
The initial condition of the output signal, specified as a double. The default is 0.
When Show reset port is selected, the initial condition is set to the value specified in the Initial
Condition parameter.
Programmatic Use
Block Parameter: InitialCondition
Type: character vector
Values: real finite values
Default: '0'
For more information specifying discrete sample times, see “Specify Sample Time”.
Programmatic Use
Block Parameter: SampleTime
Type: character vector
Values: real finite values
Default: '-1'
Version History
Introduced in R2023b
2-58
Ramp
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
Single Point Interpolation | Map | Map Using Prelookup | Curve | Curve Using Prelookup | Prelookup
Topics
“Code Generation with AUTOSAR Code Replacement Library”
2-59
2 Blocks
Libraries:
AUTOSAR Blockset / Classic Platform / Basic Software / NVRAM Manager (NvM)
Description
The NVRAM Service Component block provides reference implementations of NVRAM Manager
(NvM) services supported by AUTOSAR Basic Software (BSW) caller blocks. When coupled with NvM
caller blocks, the reference implementations enable you to configure and run system-level or
composition-level simulations of AUTOSAR NvM service calls.
The block has prepopulated parameters, including RTE block ID parameters and NvM NVRAM
Properties parameters. Examine the parameter settings and consider if modifications are required
based on how you are using the NvM service operations.
Parameters
Block ID — ID that identifies service block
1 (default) | scalar
The RTE tab table lists component client ports and their mapping to NvM service block IDs. Each row
in the table represents a call into NvM services from a Basic Software caller block. Calls that act on
the same NvM block use the same block ID. Check the block ID mappings. For examples of mapping
NvM client ports to block IDs, see “Simulate AUTOSAR Basic Software Services and Run-Time
Environment”.
Maximum number of memory blocks — Maximum number of memory blocks to use in NvM service
operations
10 (default) | scalar
Specify the initial values of the NvM client ports as finite, real-valued scalars or vectors. The values
must be scalar, or have the same dimensions as the input signal.
Version History
Introduced in R2017b
2-60
NVRAM Service Component
R2022b enables you to define initial values for NVRAM services that are accessed during simulation
by basic software. To configure the initial values, you can open the NVRAM Service Component block
parameters, click the Initial Values tab, and set an initial value for each NvM client port.
See Also
NvMAdminCaller | NvMServiceCaller
Topics
“Configure Calls to AUTOSAR NVRAM Manager Service”
“Configure AUTOSAR Basic Software Service Implementations for Simulation”
2-61
2 Blocks
NvMAdminCaller
Call AUTOSAR NVRAM Manager (NvM) service interface NvMadmin
Libraries:
AUTOSAR Blockset / Classic Platform / Basic Software / NVRAM Manager (NvM)
Description
The AUTOSAR standard defines a NVRAM Manager (NvM) service as a part of Basic Software (BSW)
that runs in the AUTOSAR Runtime Environment (RTE). AUTOSAR software components access NvM
services through client-server calls. The NvMAdminCaller block calls the AUTOSAR NvM service
interface NvMAdmin to initiate a specified operation.
Parameters
Client port name — Name of client port AUTOSAR component uses to call NvM service interface
NvMAdmin
NvMAdmin (default) | character vector
Enter the name of the client port the AUTOSAR software component uses to call the NvM service
interface NvMAdmin.
Select the operation that the AUTOSAR software component calls from the NvM service interface
NvMAdmin. The AUTOSAR standard defines the operations. After you select the operation, the inports
and outports for the block are generated to support the operation. One operation is supported:
SetBlockProtection.
The Operation parameter must be set to an operation supported by the schema currently specified
by the model. The list of operations on the block parameters dialog reflects the operations supported
by the current schema.
Block sample time. The default sets the block to inherit its sample time from the model.
Version History
Introduced in R2016b
R2023a: Basic Software caller blocks support all AUTOSAR schema versions
Starting in 23a, Basic Software caller (BSW) blocks support all AUTOSAR schema versions supported
by AUTOSAR Blockset. The BSW blocks inherit the same schema version specified by the model.
2-62
NvMAdminCaller
Code and ARXML generated from the component reflect the schema version specified on the model.
When you change the schema version specified by the model, the software automatically replaces
software calls to the correct operation. In some cases, the software may prompt you to confirm a
change when moving between schema versions.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
NvMServiceCaller | NVRAM Service Component
Topics
“Configure Calls to AUTOSAR NVRAM Manager Service”
“Configure AUTOSAR Basic Software Service Implementations for Simulation”
2-63
2 Blocks
NvMServiceCaller
Call AUTOSAR NVRAM Manager (NvM) service interface NvMService
Libraries:
AUTOSAR Blockset / Classic Platform / Basic Software / NVRAM Manager (NvM)
Description
The AUTOSAR standard defines a NVRAM Manager (NvM) service as a part of Basic Software (BSW)
that runs in the AUTOSAR Runtime Environment (RTE). AUTOSAR software components access NvM
services through client-server calls. The NvMServiceCaller block calls the AUTOSAR NvM service
interface NvMService by to initiate specified operation.
Parameters
Client port name — Name of client port AUTOSAR component uses to call NvM service interface
NvMService
NvMService (default) | character vector
Enter the name of the client port the AUTOSAR software component uses to call the NvM service
interface NvMService.
Select the operation that the AUTOSAR software component calls from the NvM service interface
NvMService. The AUTOSAR standard defines the operations. After you select the operation, the
inports and outports for the block are generated to support the operation.
The Operation parameter must be set to an operation supported by the schema currently specified
by the model. The list of operations on the block parameters dialog reflects the operations supported
by the current schema.
Argument specification — Specify data type and dimensions for operation read or write access
uint8(1) (default) | single() | double() | int8() | int16() | int32() | int64() | uint16() |
uint32() | uint64() | Boolean() | enumerated() | bus()
A MATLAB expression that specifies data type and dimensions for data to be read or written by the
operation.
• To specify a multidimensional data type, you can use array syntax, such as int8([1 1; 1 1]).
• To specify a structured data type, you can create a Simulink.Parameter data object, type it
with a Simulink.Bus object, and reference the parameter name.
2-64
NvMServiceCaller
Dependencies
Block sample time. The default sets the block to inherit its sample time from the model.
Version History
Introduced in R2016b
R2023a: Basic Software caller blocks support all AUTOSAR schema versions
Starting in 23a, Basic Software caller (BSW) blocks support all AUTOSAR schema versions supported
by AUTOSAR Blockset. The BSW blocks inherit the same schema version specified by the model.
Code and ARXML generated from the component reflect the schema version specified on the model.
When you change the schema version specified by the model, the software automatically replaces
software calls to the correct operation. In some cases, the software may prompt you to confirm a
change when moving between schema versions.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
NvMAdminCaller | NVRAM Service Component
Topics
“Configure Calls to AUTOSAR NVRAM Manager Service”
“Configure AUTOSAR Basic Software Service Implementations for Simulation”
2-65
2 Blocks
Prelookup
Compute index and fraction for a Curve Using Prelookup or Map Using Prelookup block
Libraries:
AUTOSAR Blockset / Classic Platform / Library Routines / Interpolation
Description
The Prelookup block computes the index and fraction that specify how its input value u relates to the
breakpoint dataset. The Prelookup block feeds the resulting output index and fraction values as a bus
into a Curve Using Prelookup block to interpolate a one-dimensional table or a Map Using Prelookup
block to interpolate a two-dimensional table. When a Prelookup block is used with either a Curve
Using Prelookup or Map Using Prelookup block, they perform the same algorithm operation as the
Curve or Map blocks. The use of the two blocks together offers greater flexibility and more efficient
simulation and code generation.
If you select the AUTOSAR 4.0 code replacement library (CRL) for your AUTOSAR model, code
generated from this block is replaced with the AUTOSAR library routine that you configure in the
block parameters dialog box.
Ports
Input
The Prelookup block accepts real-valued signals of any numeric data type that Simulink supports,
except Boolean. The Prelookup block supports fixed-point data types for signals and breakpoint data.
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point |
bus
Output
Outputs the index and fraction as a bus, which specifies the interval containing the input and the
normalized position of the input on the interval. The bus type is defined automatically based on if the
Targeted Routine Library is set to fixed-point (IFX) or floating-point (IFL) code replacement.
Data Types: bus
Parameters
Targeted Routine Library — Indicates the AUTOSAR routine library used for block code replacement
IFX(fixed-point) (default) | IFL(floating-point)
2-66
Prelookup
If you select the AUTOSAR 4.0 code replacement library (CRL) for your model, code generated from
this block is replaced from the selected AUTOSAR routine library. This parameter enables you to
choose either fixed-point (IFX) or floating-point (IFL) code replacement and validation checks.
This parameter reflects the name of the AUTOSAR code replacement library (CRL) routine used to
replace the code generated by this block. The naming convention includes the targeted routine
library, interpolation method, and block type. This parameter is reference-only and must not be
edited.
Table Specification
• Explicit values, the Breakpoints and parameter becomes visible in the dialog box.
• Breakpoint object, the Name parameter is visible in the dialog box.
Programmatic Use
Block Parameter: BreakpointsSpecification
Type: character vector
Values: 'Explicit values' | 'Breakpoint object'
Default: 'Explicit values'
Explicitly specify the breakpoint data. Each breakpoint data set must be a strictly monotonically
increasing vector that contains two or more elements.
Dependencies
exist, click the action button and select Create. The corresponding parameters of the new
breakpoint object are populated with the block information.
Dependencies
2-67
2 Blocks
Programmatic Use
Block Parameter: BreakpointObject
Type: character vector
Values: Simulink.Breakpoint object
Default: ''
Algorithms
• If input values for u do not vary significantly between time steps, selecting Linear search with
Begin index search using previous index result produces the best performance.
• If input values for u jump more than one or two table intervals per time step, selecting Binary
search produces the best performance.
A suboptimal choice of index search method can lead to slow performance of models that rely heavily
on lookup tables.
Begin index search using previous index result — Start search using the index found at the
previous time step
off (default) | on
For input values of u that change slowly with respect to the interval size, enabling this option can
improve performance. Otherwise, the linear search and binary search methods can take longer,
especially for large breakpoint sets.
Programmatic Use
Block Parameter: IndexSearchMethod
Values: 'Binary search' | 'Linear search'
Type: character vector
Default: 'Binary search'
Specify the rounding mode for fixed-point or floating-point lookup table calculations that occur during
simulation or execution of code generated from the model.
This option does not affect rounding of block parameter values. Simulink rounds such values to the
nearest representable integer value. To control the rounding of a block parameter, enter an
expression using a MATLAB rounding function into the edit field on the block dialog box.
Programmatic Use
Block Parameter: RndMeth
Type: character vector
Values: 'Round' | 'Zero'
Default: 'Round'
Version History
Introduced in R2019a
2-68
Prelookup
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
Curve | Curve Using Prelookup | Map | Map Using Prelookup
Topics
“Configure Lookup Tables for AUTOSAR Calibration and Measurement”
“Code Generation with AUTOSAR Code Replacement Library”
2-69
2 Blocks
Signal Invalidation
Control AUTOSAR root outport data element invalidation
Libraries:
AUTOSAR Blockset / Classic Platform / Signal Routing
Description
Relay the first input, a data value, to the output, based on the value of the second input, an
invalidation control flag.
If the input data value is valid (invalidation control flag is false), the software relays the input data
value to the output.
If the input data value is invalid (invalidation control flag is true), the resulting action is determined
by the value of the block parameter Signal invalidation policy:
• Keep - Replace the input data value with the last valid signal value.
• Replace - Replace the input data value with the value of the block parameter Initial value.
• DontInvalidate - Do not replace the input data value.
This block must be connected directly to a root outport block. It cannot be used within a reusable
subsystem.
Ports
Input
The invalidation control flag determines whether the input data value is valid and can be relayed
(false), or is invalid and must be handled based on an invalidation policy (true).
Example: false
Data Types: Boolean
2-70
Signal Invalidation
Output
Output data value produced by the combination of the input data value and the invalidation control
flag.
Data Types: single | double | base integer | Boolean | fixed point | enumerated | bus
Parameters
Signal invalidation policy — Invalidation policy
Keep (default) | Replace | DontInvalidate
Specify an AUTOSAR data element invalidation policy, which determines how an invalid data element
is handled.
Specify a data element initial value. If the input data value is flagged as invalid, and if the Signal
invalidation policy is Replace, the software replaces the input data value with the specified initial
value.
Version History
Introduced in R2015b
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
Topics
“Configure AUTOSAR Sender-Receiver Data Invalidation”
2-71
2 Blocks
Software Composition
Model software composition in AUTOSAR architecture model
Libraries:
AUTOSAR Blockset
Description
In an AUTOSAR architecture model, you use the composition editor and the Simulink Toolstrip
Modeling tab to add and connect compositions and components. Use the Software Composition
block to add a nested software composition to an AUTOSAR software design. Compositions are
supported for classic and adaptive modeling.
• From the Modeling tab or the palette to the left of the canvas, add a Software Composition block.
• Add composition require ports and provide ports. To add each composition port, click an edge of
the Software Composition block. When port controls appear:
• For classic modeling, select Input for a require port or Output for a provide port.
• For adaptive modeling, select Input or Client for a require port, or Output or Server for a
provide port.
Alternatively, open the Software Composition block. To add each composition port, click the
boundary of the composition diagram and select require and provide ports as needed.
• To connect the Software Composition block to other blocks, connect the block ports with signal
lines.
• To connect the Software Composition block to architecture or composition model root ports, drag
a line from the composition ports to the containing model boundary. Releasing the connection
creates a root port at the boundary.
• Configure additional AUTOSAR properties using the Property Inspector.
An AUTOSAR composition contains a set of AUTOSAR components and compositions with a shared
purpose. To populate a composition, open the Software Composition block and begin adding more
Software Composition blocks and Classic Component or Adaptive Component blocks. Mixing classic
and adaptive components is not supported.
Ports
Input
2-72
Software Composition
Client port in the AUTOSAR software composition port interface. Client ports are supported when you
model method communication in an AUTOSAR adaptive architecture.
Output
Server port in the AUTOSAR software composition port interface. Server ports are supported when
you model method communication in an AUTOSAR adaptive architecture.
Version History
Introduced in R2019b
Client and server ports are available and supported when you model method communication in an
AUTOSAR adaptive architecture.
See Also
Classic Component | Adaptive Component | Diagnostic Service Component | NVRAM Service
Component
Topics
“Add and Connect AUTOSAR Classic Components and Compositions”
“Add and Connect AUTOSAR Adaptive Components and Compositions”
“Author AUTOSAR Classic Compositions and Components in Architecture Model”
“Create Profiles Stereotypes and Views for AUTOSAR Architecture Analysis”
2-73
2 Blocks
Libraries:
AUTOSAR Blockset / Classic Platform / Library Routines / Interpolation
Description
The Single Point Interpolation block performs linear interpolation using the AUTOSAR
Ifl_Interpolate_f32 routine. The Single Point Interpolation block performs interpolation using
inputs u1 and u2 and a fraction source parameter f according to this equation: y = u1 + f (u2 − u1)
You can specify the fraction source using the Block Parameters dialog box or an Input port. The
Single Point Interpolation block supports software-in-the-loop (SIL) mode.
When you select the AUTOSAR 4.0 code replacement library (CRL) for your AUTOSAR model, your
model replaces code that you generate for this block with a call to the Ifl_Interpolate_f32
AUTOSAR library routine.
Ports
Input
f — Fraction value
scalar
To enable this port, set the Source field of the “Fraction” on page 2-0 parameter to Input port.
Data Types: single
2-74
Single Point Interpolation
Output
y — Output signal
scalar | vector
Parameters
Fraction — Fraction source and value
0 (default) | scalar
• Dialog — Set the coefficient using the Value field of this parameter.
• Input port — Set the coefficient using the f port. The block uses the value of this port as the
coefficient.
Programmatic Use
Block Parameter: FractionValue
Type: Character vector
Values: real value
Default: '0'
Version History
Introduced in R2023a
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
See Also
Curve | Curve Using Prelookup | Map | Map Using Prelookup | Prelookup
Topics
“Code Generation with AUTOSAR Code Replacement Library”
2-75
3
Apps
3 Apps
Description
Use the AUTOSAR Component Designer app to generate C or C++ code and ARXML descriptions
from an AUTOSAR component model. When you open the app, an AUTOSAR tab is added to the
toolstrip. The AUTOSAR tab represents groups of tasks in the AUTOSAR Blockset workflow.
• If you are new to AUTOSAR Blockset, use the Embedded Coder Quick Start to prepare your model
for AUTOSAR code generation. The Quick Start chooses fundamental code generation settings
based on your goals and application. Click Quick Start. For code generation output, select either
C code compliant with AUTOSAR or C++ code compliant with AUTOSAR Adaptive
Platform.
• Set code generation objectives and prepare your model for code generation. Click C/C++ Code
Advisor.
• Configure model configuration parameters. Select Settings > C/C++ Code generation settings
or Settings > Hardware Implementation.
• Opening the AUTOSAR Component Designer app opens the AUTOSAR Code perspective, which
contains the Code Mappings editor. Use the Code Mappings editor to map model entry-point
functions, data, and other elements to AUTOSAR elements and properties that are defined in the
AUTOSAR standard. Select Code Interface > Individual Element Code Mappings.
• Configure AUTOSAR elements from an AUTOSAR component perspective by using the AUTOSAR
Dictionary. Select Code Interface > AUTOSAR Dictionary or, from the Code Mappings editor,
click . In the XML Options view, configure settings for ARXML export.
• Generate AUTOSAR code and ARXML descriptions for testing or integration. Click Generate
Code.
• Open the Code view to view the generated code alongside your model. Click View Code. In the
Code view, you can trace between model elements and the code by clicking hyperlinked lines of
code. To remove traceability highlighting, click Remove Highlighting.
• Open the latest HTML code generation report by clicking Open Report. To configure HTML
report generation options, from the Open Report menu, select Report Options.
• Create a protected model to share with a third party for simulation and code generation. Select
Share > Generate Protected Model.
• Package the model code and build artifacts in a ZIP file, for example, for relocation and
integration. Select Share > Generate Code and Package. Optionally, you can modify the name
of the generated ZIP file.
3-2
AUTOSAR Component Designer
Examples
• “Create AUTOSAR Software Component in Simulink”
• “Design and Simulate AUTOSAR Components and Generate Code”
• Code Mappings Editor
Tips
• If you are working with a model hierarchy, open the AUTOSAR Component Designer app in the
Simulink Editor window for the top model of the hierarchy that you are generating code for. On
3-3
3 Apps
the AUTOSAR tab, the functionalities apply to the top model of the hierarchy that is open in the
editor.
• To configure and view code for a referenced model, navigate to the model in the hierarchy and use
the AUTOSAR Dictionary, Code Mappings editor, and Code view. These views apply to the active
model, which can be the top model or a referenced model.
Version History
Introduced in R2019b
See Also
Functions
autosar.api.create | autosar_ui_launch
Topics
“Create AUTOSAR Software Component in Simulink”
“Design and Simulate AUTOSAR Components and Generate Code”
Code Mappings Editor
3-4
4
Tools
4 Tools
Description
The Code Mappings editor is a graphical interface for mapping AUTOSAR elements for code
generation. Map Simulink model elements such as inports, outports, and entry-point functions to
AUTOSAR component elements such as receiver ports, sender ports, and runnables.
Using a tabbed table format, the Code Mappings editor displays model inports, outports, and other
model elements relevant to your AUTOSAR platform. Use this view to map model elements to
AUTOSAR component elements from a Simulink model perspective. The mappings that you configure
are reflected in generated AUTOSAR-compliant C or C++ code and exported ARXML descriptions.
4-2
Code Mappings Editor
The Code Mappings editor provides in-canvas access to AUTOSAR mapping information, with batch
editing, element filtering, easy navigation to model elements and AUTOSAR properties, and model
element traceability. As you progressively configure the model representation of the AUTOSAR
component, you can apply these Code Mappings editor controls:
• Filter contents field – Selectively display some elements, while omitting others, in the current
view.
•
AUTOSAR Dictionary button – Switch from the Code Mappings editor view of a Simulink
element to the AUTOSAR Dictionary view of the corresponding AUTOSAR element.
•
Validate button – Validate the AUTOSAR component configuration.
• Update button – Update the Simulink to AUTOSAR mapping of the model to reflect model
changes, such as adding, changing, or removing Simulink entry-point functions, parameters,
signals, data transfers, or function callers.
•
Edit icon – Open a properties dialog box to view and modify additional AUTOSAR code and
calibration attributes for the currently-selected element.
• From the Apps tab, open the AUTOSAR Component Designer app.
• Click the perspective control in the lower-right corner and select Code.
The model opens in the AUTOSAR code perspective, which includes the Code Mappings editor.
• If your model does not have a mapped AUTOSAR component, in the model window, do one of the
following:
4-3
4 Tools
1 With the Embedded Coder app open, on the C Code tab, select Quick Start. The
Embedded Coder Quick Start opens.
2 As you work through the quick-start procedure, in the Output window, select output option
C code compliant with AUTOSAR or C++ code compliant with AUTOSAR Adaptive
Platform.
3 Click Finish.
The model opens in the AUTOSAR code perspective, which includes the Code Mappings editor.
Examples
Map Model Elements to AUTOSAR Component Elements
If you are modeling for the AUTOSAR Classic Platform, navigate Code Mappings editor tabs to
perform these actions:
If you are modeling for the AUTOSAR Adaptive Platform, navigate Code Mappings editor tabs to:
Version History
Introduced in R2018a
4-4
Code Mappings Editor
See Also
Topics
“Map AUTOSAR Elements for Code Generation”
“Map Calibration Data for Submodels Referenced from AUTOSAR Component Models”
“Configure AUTOSAR Elements and Properties”
“Map AUTOSAR Adaptive Elements for Code Generation”
“Configure AUTOSAR Adaptive Elements and Properties”
“Configure and Map AUTOSAR Component Programmatically”
“AUTOSAR Component Configuration”
4-5
4 Tools
Description
The Architectural Data Editor lets you edit the Architectural Data section of a Simulink data
dictionary. By using the Architectural Data Editor, you can manage interfaces, data types, and
constants that are used by Simulink and shared across architectural models.
• Create and configure definitions for interfaces, data types, and constants.
• Filter, sort, and search architectural data in the main Contents pane. See “Filter and Manage
Entries in Contents Pane” on page 4-13 for more information.
• Manage the architectural data of multiple data dictionaries.
• Configure AUTOSAR Classic platform properties of architectural data:
For more information about shared interfaces and data types, see “Graphically Manage Shared
Interfaces, Data Types, and Constants” and “Programmatically Manage Shared Interfaces, Data
Types, and Constants of Architecture Models”.
4-6
Architectural Data Editor
• Open Model Explorer by double-clicking an .sldd file, then navigate to the Architectural Data
section and click the Open Architectural Data Editor button.
• From the Interface Editor of a system architecture model, click the Manage interfaces, data
types and dictionary references in the Architectural Data Editor button.
• From the Modeling tab of a system architecture model, select Design > Architectural Data
Editor.
• Use the show function on an Architectural Data object.
archDataObj = Simulink.dictionary.archdata.create("newDictionary.sldd");
show(archDataObj)
• At the MATLAB command prompt, enter archdataeditor.
Examples
You can create a data dictionary from the Architectural Data Editor and then edit the architectural
data.
From the Architectural Data Editor, to create a new data dictionary, from the File section, click New.
To configure architectural data for an existing data dictionary, click Open and select the data
dictionary. Add interfaces, data types, and constants by navigating to the Create tab and selecting
the desired data object.
You can create a data dictionary and return the Architectural Data object programmatically.
archDataObj = Simulink.dictionary.archdata.create('newDictionary.sldd');
archDataObj = Simulink.dictionary.archdata.open('dataDictionary.sldd');
4-7
4 Tools
You can open multiple data dictionaries in a single editor window and switch between them by using
the Sources pane.
1 From the File section, click Open to open existing data dictionaries or click New to create new
data dictionaries.
2 From the Sources pane, select a data dictionary.
3 Select the Interfaces, Data Types, Constants, or platform-specific tabs to view and edit
architectural data. See “Create and Configure Interface, Data Type, and Constant Definitions” on
page 4-9 for more information.
On the Interfaces and Data Types tabs, the Architectural Data Editor provides a DataSource
column indicating the source data dictionary for each interface or data type.
4-8
Architectural Data Editor
Once a data dictionary is referenced, architectural data from the referenced dictionary can be used
by the open dictionary that references it. For example, the image shows that the data element in data
interface MyDataInterface2 uses enumeration OtherEnum from the referenced dictionary
OtherDictionary for its data type.
From the Referenced Dictionaries section of the Details pane, you can add references to existing
data dictionaries, remove references, or open referenced data dictionaries in the Sources pane.
You cannot reference data dictionaries from Simulink data dictionaries that are mapped to the
AUTOSAR Classic Platform. For more information see “Configure AUTOSAR Classic Platform
Properties in Architectural Data Section” on page 4-11.
You can create interfaces, data types, and constants to be shared among both architecture models
and other Simulink models and configure their associated properties.
4-9
4 Tools
On the toolstrip, in the Create section, add interface, data type, and constant definitions on the
Interfaces, Data Types, and Constants tabs, respectively, by clicking the data type, interface, and
constant icons.
To configure interfaces, data types, and constants, on the Interfaces, Data Types, Constants tabs,
select an interface, data type, or constant object and edit its properties in the main Contents pane
and in the Details pane.
On the Interfaces tab, you can view service interfaces previously created in System Composer or by
using the getInterface and getInterfaceNames functions.
You can also add interfaces, data types, and constants programmatically. Add data types by using the
addAliasType, addEnumType, addNumericType, addStructType, and addValueType functions.
4-10
Architectural Data Editor
Note Physical interfaces and service interfaces are not supported for the AUTOSAR Classic platform.
For the AUTSOAR Adaptive platform configure service interfaces using a data dictionary with no
applied platform mapping.
When you save the Architectural Data section, the properties that you configured are stored in
the .sldd file.
Once you specify the platform as AUTOSAR Classic you can configure the platform-specific interface
and calibration properties as well as the software address methods. Specifically:
• On the toolstrip, in the Platform section, select AUTOSAR Classic. The toolstrip, the main
Contents pane, and the Details pane update to display platform-specific options.
4-11
4 Tools
1 On the toolstrip, in the Create section, click SwAddrMethod. A software address method
definition is added on the SwAddrMethods tab.
2 Under SwAddrMethods, set SectionType, MemoryAllocationKeywordPolicy, and Exported
XML File as needed.
For more information about configuring software address methods, see “Configure AUTOSAR
SwAddrMethods”.
1 On the toolstrip, in the Create section, click Data Interface. A data interface object is added
under the Interfaces tab.
2 Under Interfaces, click a data interface and edit its name as needed.
3 While the interface is selected, configure the attributes of the interface in the main Contents
pane and in the Details pane. Platform-specific interface properties InterfaceKind, IsService,
and Package are located under the AUTOSAR section in the Details pane.
4 While the interface is selected, on the toolstrip, in the Create section, click Interface Element
to add elements to the interface.
5 Click a data element and edit its name as needed.
6 While the data element is selected, configure its attributes in the main Contents pane and in the
Details pane.
• For Type, supported data types include ones you have created, located on the Data Types
tab. See “Create and Configure Interface, Data Type, and Constant Definitions” on page 4-9
for more information.
4-12
Architectural Data Editor
1 On the toolstrip, in the Create section, click Constant. A constant object is added under the
Constants tab.
2 Under the Constants tab, click a constant and edit its name as needed.
3 While the constant is selected, configure its attributes in the main Contents pane and in the
Details pane.
• For the Value field, only double data types are supported.
• The MappedTo and Package properties are located under the AUTOSAR section in the
Details pane.
When you save the Architectural Data section, the interface, data type, constant, and platform-
specific data is saved in the .sldd file.
For more information about AUTOSAR interface and calibration properties, see “Configure AUTOSAR
Communication Interfaces” and “Configure AUTOSAR Data for Calibration and Measurement”. For
more information about setting AUTOSAR properties programmatically, see setPlatformProperty.
The XML Options button is available in the Platform section when the development platform is set
to AUTOSAR Classic. Component and architecture models linked to the data dictionary use the
same XML export parameter values as defined in the linked data dictionary.
On the toolstrip, under Platform, click the XML Options button to configure the export options.
Clicking the XML Options button opens the View and Edit XML Options dialog box and lets you
set options for export to ARXML files.
For more information about XML options for classic architecture modeling, see “Configure AUTOSAR
XML Options” and autosar.api.getAUTOSARProperties XML Options Settings.
You can export AUTOSAR definitions and other architectural data defined in a data dictionary to
ARXML.
Clicking the Export button exports the data dictionary contents to ARXML and RTE stub header files.
This operation creates a folder in the current folder that contains the ARXML files. You can use
exportDictionary to programmatically perform this operation.
4-13
4 Tools
The main Contents pane provides an interactive table with information about the interface, data
types, and constants objects, such as hierarchy and properties. You can select which columns appear
in the table by selecting Columns in the toolstrip.
For more information about using the Contents pane, see “Manage Interfaces with Data Dictionaries”
(System Composer).
Version History
Introduced in R2023b
In R2023b, the Architectural Data Editor replaced the Interface Editor (AUTOSAR Blockset) that was
introduced in R2022b.
See Also
Objects
Simulink.dictionary.ArchitecturalData |
Simulink.dictionary.archdata.DataInterface |
Simulink.dictionary.archdata.DataElement |
Simulink.dictionary.archdata.ServiceInterface |
Simulink.dictionary.archdata.FunctionElement |
Simulink.dictionary.archdata.FunctionArgument |
Simulink.dictionary.archdata.StructType |
Simulink.dictionary.archdata.StructElement |
autosar.dictionary.ARClassicPlatformMapping
Topics
“Graphically Manage Shared Interfaces, Data Types, and Constants”
“Programmatically Manage Shared Interfaces, Data Types, and Constants of Architecture Models”
4-14
Architectural Data Editor
4-15
5
Use AUTOSAR Blockset Model Advisor checks to configure your model for AUTOSAR standard
compatibility.
See Also
Description
Check configuration settings in the model configuration that apply to AUTOSAR compatibility.
Following are the model parameters the check examines, provided that AUTOSAR Compliance is
set to on by using a proper license (TLC file).
5-2
AUTOSAR Blockset Checks
external
SIL
PIL
SupportComplex off off ~isAdaptiveAutosar
SupportContinuousTime off off
SupportNonFinite off off
SupportNonInlinedSFcn off off
s
See Also
Description
Identifies Simulink lookup table blocks that are incompatible with AUTOSAR Blockset Interpolation
Routines.
5-3
5 Model Advisor Checks
See Also
5-4