Contenuto principale

autosar.arch.Model

R2026b

AUTOSAR architecture model

    Description

    An autosar.arch.Model object represents an AUTOSAR architecture model that contains components, compositions, connectors, and ports. Use this object to define the top-level software architecture for an AUTOSAR system.

    Creation

    Create an autosar.arch.Model object by using the createModel function.

    archModel = autosar.arch.createModel("MyArchModel")
    archModel = autosar.arch.createModel("MyArchModel",Platform="Adaptive")
    archModel =
    
      Model with properties:
    
                    Name: 'MyArchModel'
          SimulinkHandle: 1.0000
              Components: [0×0 autosar.arch.Component]
            Compositions: [0×0 autosar.arch.Composition]
      ParameterComponent: [0×0 autosar.arch.ParameterComponent]
                   Ports: [0×0 autosar.arch.CompPort]
              Connectors: [0×0 autosar.arch.Connector]
              Interfaces: [0×0 Simulink.dictionary.archdata.PortInterface]
                Platform: 'Classic'

    Or load an existing architecture model by using the loadModel function.

    archModel = autosar.arch.loadModel("ExistingArchModel")

    Properties

    expand all

    Name of architecture model, specified as a character vector or string scalar.

    Example: "MyArchModel"

    Data Types: char | string

    This property is read-only.

    Simulink model handle, represented as a double.

    Data Types: double

    This property is read-only.

    AUTOSAR components in the model, represented as an array of autosar.arch.Component objects.

    This property is read-only.

    AUTOSAR compositions in the model, represented as an array of autosar.arch.Composition objects.

    This property is read-only.

    AUTOSAR parameter software component, represented as an autosar.arch.ParameterComponent object.

    This property is read-only.

    Architecture root-level ports, represented as an array of autosar.arch.CompPort objects.

    This property is read-only.

    Port connectors in the model, represented as an array of autosar.arch.Connector objects.

    This property is read-only.

    Port interfaces linked to the architecture model, represented as an array of Simulink.dictionary.archdata.PortInterface objects.

    This property is read-only.

    AUTOSAR platform type, represented as "Classic" or "Adaptive".

    Data Types: string

    Object Functions

    addComponentAdd component to AUTOSAR architecture model
    addCompositionAdd composition to AUTOSAR architecture model
    addPortAdd port to AUTOSAR component, parameter component, composition, or architecture model
    addBSWServiceAdd Basic Software component to AUTOSAR classic architecture model
    connectConnect AUTOSAR architecture components and compositions
    exportExport ARXML, ASAP2 files from AUTOSAR Blockset architecture models, and generate component code
    findFind AUTOSAR architecture, composition, component, parameter component and elements
    importFromARXMLImport compositions and components from ARXML files into AUTOSAR architecture model
    layoutArrange AUTOSAR composition or architecture model layout based on heuristics
    setPlatformSet platform kind of architecture model to classic or adaptive
    getXmlOptionsGet XML option for AUTOSAR architecture model
    setXmlOptionsSet XML option for AUTOSAR architecture model
    closeClose AUTOSAR architecture model
    saveSave AUTOSAR architecture model
    openOpen AUTOSAR architecture model
    destroyRemove and delete AUTOSAR architecture element

    Examples

    collapse all

    This example shows how to create an AUTOSAR software architecture, add components with ports, connect them, and export the architecture to ARXML.

    Create an architecture model and add components.

    archModel = autosar.arch.createModel("MyController");
    swc1 = addComponent(archModel,"SensorSWC");
    swc2 = addComponent(archModel,"ControlSWC");

    Add ports to the components.

    sndPort = addPort(swc1,"Sender","SensorData");
    rcvPort = addPort(swc2,"Receiver","SensorData");

    Connect matching ports.

    connect(archModel,swc1,swc2);

    Export the architecture to ARXML.

    export(archModel);

    Version History

    Introduced in R2021a