Main Content

getComponentNames

Get AUTOSAR software component names from ARXML files

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.

example

names = getComponentNames(ar,compKind) uses the compKind argument to specify the type of software component to return. You can narrow the search to a specific type of atomic software component, such as 'Application' or 'SensorActuator', or specify a nonatomic component, such as 'Composition' or 'Parameter'.

example

Examples

collapse all

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.

Create an initial Simulink® representation of the Controller composition.

ar = arxml.importer('ThrottlePositionControlComposition.arxml');
names = getComponentNames(ar)
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.

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.

Create an initial Simulink representation of the listed composition.

ar = arxml.importer('ThrottlePositionControlComposition.arxml');
names = getComponentNames(ar,'Composition')
names =
  1×1 cell array
    {'/Company/Components/ThrottlePositionControlComposition'}
createCompositionAsModel(ar,'/Company/Components/ThrottlePositionControlComposition');

Input Arguments

collapse all

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

Type of software component to return.

Output Argument

collapse all

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