Main Content

autosar.arch.createModel

Create AUTOSAR architecture model

Since R2020a

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.

example

archModel = autosar.arch.createModel(modelName,openFlag) allows you to control whether the created AUTOSAR architecture model opens in the editor. Specify openFlag as false to create an architecture model without opening it in the editor.

example

archModel = autosar.arch.createModel(modelName,"platform",platformKind) allows you to specify the platform platformKind as Adaptive or Classic for the created AUTOSAR architecture model. Use this option with any of the input argument combinations in the previous syntaxes.

example

Examples

collapse all

Create an AUTOSAR classic architecture model named myArchModel, open the model in the editor, and return model properties.

By default, autosar.arch.createModel without the platform name-value argument creates an architecture model for the Classic Platform.

modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName)
archModel = 

  Model with properties:

              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]

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 = 

  Model with properties:

              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]

Since R2023a

Create an AUTOSAR adaptive architecture model, and return model properties.

modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName,"platform","Adaptive")
archModel = 

  Model with properties:

              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.

% Load the model containing the composition
archModel = autosar.arch.loadModel('autosar_tpc_compositon');

% Create the composition object
sensorComposition = archModel.Compositions(1)
sensorComposition = 

  Composition with properties:

              Name: 'Sensors'
    SimulinkHandle: 169.0001
            Parent: [1×1 autosar.arch.Model]
        Components: [4×1 autosar.arch.Component]
      Compositions: [0×0 autosar.arch.Composition]
             Ports: [5×1 autosar.arch.CompPort]
        Connectors: [7×1 autosar.arch.Connector]
          Adapters: [0×0 autosar.arch.Adapter]
% Create a new architecture model containing the composition
sensorComposition.createModel('Sensor_Composition');

Input Arguments

collapse all

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

Since R2023a

Specify "Adaptive" to create an architecture model for the Adaptive Platform. Specify "Classic" to create an architecture model for the Classic Platform.

Mixing classic and adaptive architecture modeling is not supported.

Example: 'platform','Adaptive'

Output Arguments

collapse all

An AUTOSAR architecture model handle, returned as an autosar.arch.Model object.

Version History

Introduced in R2020a

expand all