Contenu principal

autosar.arch.createModel

Create AUTOSAR architecture model

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.

example

archModel = autosar.arch.createModel(modelName,Name=Value) specifies additional options for AUTOSAR architecture creation using one or more name-value arguments. For example, to direct the software to create an architecture model configured for the AUTOSAR Adaptive Platform, set platform to "Adaptive".

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 AUTOSAR Classic Platform.

modelName = "myArchModel";
archModel = autosar.arch.createModel(modelName,true)
archModel = 

  Model with properties:

                  Name: 'myArchModel'
        SimulinkHandle: 368.0071
            Components: [0×0 autosar.arch.Component]
          Compositions: [0×0 autosar.arch.Composition]
    ParameterComponent: [0×0 autosar.arch.ParameterComponent]
                 Ports: [0×0 autosar.arch.PortBase]
            Connectors: [0×0 autosar.arch.Connector]
            Interfaces: [0×0 Simulink.dictionary.archdata.PortInterface]
              Platform: 'Classic'

Since R2023a

Create an architecture model configured for the AUTOSAR Adaptive Platform, and return the model properties.

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

  Model with properties:

              Name: 'myArchModel'
    SimulinkHandle: 368.0073
        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.dictionary.archdata.PortInterface]
          Platform: 'Adaptive'

For an AUTOSAR composition in an architecture model, create an architecture model containing only the specified AUTOSAR composition.

Load an AUTOSAR architecture model containing an AUTOSAR composition.

openExample("autosar_tpc_composition");
archModel = autosar.arch.loadModel("autosar_tpc_composition");

Create an autosar.arch.Composition object by extracting the composition from the architecture model.

sensorComposition = archModel.Compositions(1)
sensorComposition = 

  Composition with properties:

              Name: 'Sensors'
    SimulinkHandle: 370.0083
            Parent: [1×1 autosar.arch.Model]
        Components: [0×0 autosar.arch.Component]
      Compositions: [0×0 autosar.arch.Composition]
             Ports: [0×0 autosar.arch.PortBase]
        Connectors: [0×0 autosar.arch.Connector]
          Adapters: [0×0 autosar.arch.Adapter]

Create a new AUTOSAR architecture model containing the composition.

createModel(sensorComposition,"Sensor_Composition");

Input Arguments

collapse all

Name of the AUTOSAR architecture model to create, specified as a character vector or string scalar.

Example: "myArchModel"

Data Types: char | string

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: autosar.arch.createModel("archModel",platform="Classic",openFlag=0)

Option to automatically open architecture model, specified as numeric or logical 1 (true) or 0 (false).

Example: openFlag=false

Data Types: logical

Since R2023a

AUTOSAR platform kind that the architecture is configured for, specified as either "Classic" or "Adaptive".

  • "Classic" — Creates an architecture model configured for the AUTOSAR Classic Platform.

  • "Adaptive" — Creates an architecture model configured for the AUTOSAR Adaptive Platform.

Modeling AUTOSAR Classic and AUTOSAR Adaptive components and compositions in the same AUTOSAR architecture model is not supported.

Example: platform="Adaptive"

Data Types: char | string

Output Arguments

collapse all

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

Tips

  • You can extract compositions from architecture models, and components from compositions programmatically.

    For example, for example model autosar_tpc_composition you can extract the composition from the architecture model by running these commands in the MATLAB® Command Window.

    openExample("autosar_tpc_composition");
    archModel = autosar.arch.loadModel("autosar_tpc_composition.slx");
    sensorComposition = archModel.Compositions(1)
    sensorComposition = 
    
      Composition with properties:
    
                  Name: 'Sensors'
        SimulinkHandle: 238.0005
                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]

    You can also extract a component from a composition by running this command in the MATLAB Command Window.

    component = sensorComposition.Components(1)
    component = 
    
      Component with properties:
    
                  Name: 'Monitor'
        SimulinkHandle: 819.0001
                Parent: [1×1 autosar.arch.Model]
                  Kind: 'Application'
                 Ports: [3×1 autosar.arch.CompPort]
         ReferenceName: 'autosar_tpc_throttle_sensor_monitor'

Version History

Introduced in R2020a

expand all