Main Content

systemcomposer.interface.FunctionElement

Function in client-server interface

Since R2022a

    Description

    A FunctionElement object describes the attributes of a function in a client-server interface systemcomposer.interface.ServiceInterface.

    Creation

    Create a function element using the addElement function.

    element = addElement(serviceInterface,"f0")

    Properties

    expand all

    Parent service interface of function element, specified as a systemcomposer.interface.ServiceInterface object.

    Function element name, specified as a character vector or string.

    Example: "newFunctionElement"

    Data Types: char | string

    Whether function element is asynchronous, specified as 1 (true) or 0 (false).

    Data Types: logical

    Function prototype to define input and output arguments, specified as a character vector or string.

    Example: "[y1,y2]=f1(u1,u2)"

    Data Types: char | string

    Function arguments, specified as an array of systemcomposer.interface.FunctionArgument objects.

    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

    setNameSet name for value type, function argument, interface, or element
    setFunctionPrototypeSet prototype for function element
    getFunctionArgumentGet function argument on function element
    setAsynchronousSet function element as asynchronous
    destroyRemove model element

    Examples

    collapse all

    Create a new model.

    model = systemcomposer.createModel("archModel","SoftwareArchitecture");
    systemcomposer.openModel("archModel");

    Create a service interface.

    interface = addServiceInterface(model.InterfaceDictionary,"newServiceInterface");

    Create a function element.

    element = addElement(interface,"newFunctionElement");

    Set a function prototype to add function arguments.

    setFunctionPrototype(element,"y=f0(u)")

    Get a function argument.

    argument = getFunctionArgument(element,"y")
    argument = 
    
      FunctionArgument with properties:
    
          Interface: [1×1 systemcomposer.interface.ServiceInterface]
            Element: [1×1 systemcomposer.interface.FunctionElement]
               Name: 'y'
               Type: [1×1 systemcomposer.ValueType]
         Dimensions: '1'
        Description: ''
               UUID: '018b4e55-fa8f-4250-ac2b-df72bf620feb'
        ExternalUID: ''

    More About

    expand all

    Version History

    Introduced in R2022a