주요 콘텐츠

autosar.arch.Connector

R2026b

Connection between ports in AUTOSAR architecture model

    Description

    An autosar.arch.Connector object represents a connection between two ports in an AUTOSAR software architecture model. Connectors define the data flow between components and compositions.

    Creation

    Create an autosar.arch.Connector object by using the connect function on an autosar.arch.Model or autosar.arch.Composition object. The connect function creates connectors between matching ports.

    connect(archModel,sourceComp,destComp)
    connect(archModel,sourcePort,destPort)
    connect(composition,innerComp,[])

    Access existing connectors through the Connectors property of an autosar.arch.Model or autosar.arch.Composition object.

    connectors = archModel.Connectors
    connectors =
    
      Connector with properties:
    
                  Name: ''
        SimulinkHandle: 8.0001
                Parent: [1×1 autosar.arch.Model]
            SourcePort: [1×1 autosar.arch.CompPort]
       DestinationPort: [1×1 autosar.arch.CompPort]

    Properties

    expand all

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

    Data Types: char | string

    This property is read-only.

    Simulink line handle, represented as a double.

    Data Types: double

    This property is read-only.

    Architecture element that contains the connector, represented as an autosar.arch.Model or autosar.arch.Composition object.

    This property is read-only.

    Source port of the connection, represented as an autosar.arch.CompPort object.

    This property is read-only.

    Destination port of the connection, represented as an autosar.arch.CompPort object.

    Object Functions

    destroyRemove and delete AUTOSAR architecture element

    Examples

    collapse all

    This example shows how to connect two components and inspect the resulting connector properties.

    Create an AUTOSAR software architecture model with two components.

    archModel = autosar.arch.createModel("ConnectorExample");
    sender = addComponent(archModel, "SenderSWC");
    receiver = addComponent(archModel,"ReceiverSWC");

    Add matching ports to the components.

    addPort(sender,"Sender","DataOut");
    addPort(receiver,"Receiver","DataOut");

    Connect the components.

    connect(archModel,sender,receiver);

    Inspect the resulting connectors.

    connectors = archModel.Connectors;
    connectors(1).SourcePort
    connectors(1).DestinationPort
    ans =
    
      CompPort with properties:
    
                  Name: 'DataOut'
             Interface: []
                  Kind: 'Sender'
             Connected: 1
                Parent: [1×1 autosar.arch.Component]
        SimulinkHandle: 9.0001
    
    ans =
    
      CompPort with properties:
    
                  Name: 'DataOut'
             Interface: []
                  Kind: 'Receiver'
             Connected: 1
                Parent: [1×1 autosar.arch.Component]
        SimulinkHandle: 10.0001

    Version History

    Introduced in R2021a