Main Content

createInterface

Create and set owned interface for port

Since R2021b

    Description

    interface = createInterface(port,kind) creates and sets an owned interface for a port.

    example

    Examples

    collapse all

    Create an architecture model archModel. Get the root architecture, then add a new component newComponent and a new port newCompPort. Create an owned interface for the port as a ValueType.

    model = systemcomposer.createModel("archModel");
    systemcomposer.openModel("archModel");
    rootArch = get(model,"Architecture");
    newComponent = addComponent(rootArch,"newComponent");
    newPort = addPort(newComponent.Architecture,"newCompPort","in");
    interface = newPort.createInterface("ValueType")
    interface = 
    
      ValueType with properties:
    
               Name: ''
           DataType: 'double'
         Dimensions: '1'
              Units: ''
         Complexity: 'real'
            Minimum: '[]'
            Maximum: '[]'
        Description: ''
              Owner: [1×1 systemcomposer.arch.ArchitecturePort]
              Model: [1×1 systemcomposer.arch.Model]
               UUID: 'd23669e1-f26c-4c64-a482-a27a33ac6541'
        ExternalUID: ''

    Create an architecture model archModel. Get the root architecture, then add a new component newComponent and a new port newCompPort. Create an owned interface for the port as a DataInterface.

    model = systemcomposer.createModel("archModel");
    rootArch = get(model,"Architecture");
    newComponent = addComponent(rootArch,"newComponent");
    newPort = addPort(newComponent.Architecture,"newCompPort","in");
    interface = newPort.createInterface("DataInterface");

    Remove the owned interface from the port.

    newPort.setInterface("");

    Create an architecture model archModel. Get the root architecture, then add a new component newComponent and a new physical port newCompPort. Create an owned interface for the physical port and set the physical domain Domain property.

    model = systemcomposer.createModel("archModel");
    rootArch = get(model,"Architecture");
    newComponent = addComponent(rootArch,"newComponent");
    newPort = addPort(newComponent.Architecture,"newCompPort","physical");
    port = newComponent.getPort("newCompPort");
    interface = port.createInterface("PhysicalDomain");
    interface.Domain = "rotational.rotational"
    interface = 
    
      PhysicalDomain with properties:
    
             Domain: 'foundation.mechanical.rotational.rotational'
              Owner: [1×1 systemcomposer.arch.ArchitecturePort]
              Model: [1×1 systemcomposer.arch.Model]
               UUID: '65f143cb-ed3a-49e1-bbc9-de89e84aa8e6'
        ExternalUID: ''

    Input Arguments

    collapse all

    Kind of interface, specified as one of these options:

    • "DataInterface"

    • "ValueType"

    • "PhysicalDomain"

    Data Types: char | string

    Output Arguments

    collapse all

    More About

    collapse all

    Version History

    Introduced in R2021b

    See Also

    Functions

    Objects

    Blocks

    Tools