Main Content

get

Get property of AUTOSAR architecture element

Since R2020a

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.

example

Examples

collapse all

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);

% Add composition and component at architecture model top level
composition = addComposition(archModel,'Sensors');
addComponent(archModel,'Controller1');

% Add composition ports
addPort(composition,'Receiver',{'TPS_Hw','APP_Hw'});
addPort(composition,'Sender',{'TPS_Perc','APP_Perc'});

% Add component ports
controller = find(archModel,'Component','Name','Controller1');
addPort(controller,'Receiver',{'TPS_Perc','APP_Perc'});
addPort(controller,'Sender','ThrCmd_Perc');

% Connect composition and component based on matching port names
connect(archModel,composition,controller);

% Create implementation model for component
createModel(controller);

layout(archModel);  % Auto-arrange layout

% 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

% Find ports in architecture model hierarchy
ports_in_hierarchy = find(archModel,'Port','AllLevels',true)
% List Kind and Name property values for each port
for ii=1:length(ports_in_hierarchy)
    port = ports_in_hierarchy(ii);
    portName = get(port,'Name');
    portKind = get(port,'Kind');
    fprintf('%s port %s\n',portKind,portName);
end
ports_in_hierarchy = 
  7×1 CompPort array with properties:
    Kind
    Connected
    Name
    Parent
    SimulinkHandle

Receiver port NewPortName1
Receiver port APP_Hw
Sender port NewPortName2
Sender port APP_Perc
Sender port ThrCmd_Perc
Receiver port NewPortName3
Receiver port APP_Perc

Input Arguments

collapse all

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

collapse all

Returns the value of the specified property of the specified AUTOSAR architecture element.

Version History

Introduced in R2020a