Contenido principal

systemcomposer.arch.Adapter

System Composer adapter

Since R2026a

    Description

    An Adapter object represents an adapter in a System Composer™ model. This class is derived from systemcomposer.arch.Element.

    Creation

    Create an adapter in an architecture model using the addAdapter function.

    model = systemcomposer.createModel('archModel');
    arch = get(model,'Architecture');
    adapter = addAdapter(arch,'newAdapter');

    Properties

    expand all

    Inputs of adapter, specified as an array of systemcomposer.arch.ComponentPort objects.

    Output of adapter, specified as a systemcomposer.arch.ComponentPort object.

    Mapping table that uses qualified port element names to map input elements to output elements in the adapter, specified as an N-by-2 table.

    Data Types: table

    Interface conversion mode, specified as one of these options:

    • "None"

    • "Unit Delay"

    • "Rate Transition"

    • "Merge"

    Data Types: string

    Additional options for interface conversion, specified as one of these options:

    • empty

    • systemcomposer.arch.AdapterUnitDelayOptions:

      • property InitialConditions — Initial condition for the state of the unit delay, specified as a string representation of a numeric value, with a default value of "0".

    • systemcomposer.arch.AdapterRateTransitionOptions:

      • property Integrity"Ensure data integrity during data transfer" option of the rate transition, specified as a logical, with a default value of true.

      • property Deterministic"Ensure deterministic data transfer" option of the rate transition, specified as a logical, with a default value of true.

    Data Types: class

    Position on canvas, specified as a vector of coordinates, in pixels: [left top right bottom].

    Each vector specifies the location of the top left corner and bottom right corner of the component, specified as a 1-by-4 numeric array. The array denotes the top left corner in terms of its x and y coordinates followed by the x and y coordinates of the bottom right corner.

    Data Types: double

    Architecture that owns adapter, specified as a systemcomposer.arch.Architecture object.

    Parent System Composer model, specified as a systemcomposer.arch.Model object.

    Simulink® handle, specified as a double.

    This property is necessary for several Simulink workflows and for using Requirements Toolbox™ programmatic interfaces.

    Example: handle = get(object,'SimulinkHandle')

    Data Types: double

    Simulink handle to parent System Composer model, specified as a double.

    This property is necessary for several Simulink workflows and for using Requirements Toolbox programmatic interfaces.

    Example: handle = get(object,'SimulinkModelHandle')

    Data Types: double

    Unique external identifier, specified as a character vector. The external ID is preserved over the lifespan of the element and through all operations that preserve the UUID.

    Data Types: char

    Universal unique identifier, specified as a character vector.

    Example: '91d5de2c-b14c-4c76-a5d6-5dd0037c52df'

    Data Types: char

    Object Functions

    addInputCreate new inputs on adapter
    getInputGet adapter input port by name
    connectToConnect adapter to architectural elements
    updatePositionUpdate position of adapter based on destination port
    addMappingAdd new mapping entries to adapter
    removeMappingRemove mapping entries for input elements in adapter
    isFMUDetermine component link to Functional Mockup Unit (FMU)
    isProtectedDetermine component reference model is protected
    isReferenceDetermine component reference to another model
    connectCreate architecture model connections
    getPortGet port by name
    setMaskImageApply mask image to component
    getQualifiedNameGet model element qualified name
    currentGet object of currently selected element
    destroyRemove model element

    Examples

    collapse all

    Create and connect an adapter to three components in System Composer.

    Create a model and get the root architecture.

    model = systemcomposer.createModel("archModel");
    systemcomposer.openModel("archModel");
    rootArch = get(model,"Architecture");

    Create three new components.

    names = ["Component1","Component2","Component3"];
    newComponents = addComponent(rootArch,names);

    Add ports to the components.

    comp1 = getComponent(rootArch,"Component1");
    comp2 = getComponent(rootArch,"Component2");
    comp3 = getComponent(rootArch,"Component3");
    outPort1 = addPort(comp1.Architecture,"p1","out");
    outPort2 = addPort(comp2.Architecture,"p2","out");
    inPort1 = addPort(comp3.Architecture,"p3","in");

    Extract the component ports.

    srcPort1 = getPort(comp1,"p1");
    srcPort2 = getPort(comp2,"p2");
    destPort = getPort(comp3,"p3");

    Create an adapter.

    adapter = rootArch.addAdapter(InputName=["p1","p2"],OutputName=["p3"]);

    Connect the adapter to the three components.

    adapter.connectTo(SourcePort=[srcPort1,srcPort2],TargetPort=[destPort]);

    Improve the model layout.

    Simulink.BlockDiagram.arrangeSystem("archModel")

    More About

    expand all

    Version History

    Introduced in R2026a