Main Content

systemcomposer.arch.Function

Software architecture function

Since R2021b

    Description

    A Function object represents a function in a software architecture model.

    Use the Functions Editor from the toolstrip on a software architecture model, to edit the simulation execution order and sample time of functions with inherited sample time (-1) in your software architecture.

    Creation

    Get functions in a software architecture model with the Functions property on the systemcomposer.arch.Architecture object.

    model = systemcomposer.openModel('ThrottleControlComposition');
    sim('ThrottleControlComposition');
    functions = model.Architecture.Functions

    Properties

    expand all

    Architecture model where element belongs, specified as a systemcomposer.arch.Model object.

    Name of function, specified as a character vector.

    Data Types: char

    Component where function is defined, specified as a systemcomposer.arch.Component object.

    Parent architecture of element where function is defined, specified as a systemcomposer.arch.Architecture object.

    Period of function, specified as a numeric value convertible to a string, or a string of valid MATLAB® variables. You can edit the Period property of aperiodic functions. If you edit the Period property of a periodic function, you see an error.

    Execution order of functions, specified as a row vector of numeric values.

    Example: [model.Architecture.Functions.ExecutionOrder]

    Data Types: uint64

    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

    increaseExecutionOrderChange function execution order to later
    decreaseExecutionOrderChange function execution order to earlier
    applyStereotypeApply stereotype to architecture model element
    getStereotypesGet stereotypes applied on element of architecture model
    removeStereotypeRemove stereotype from model element
    setPropertySet property value corresponding to stereotype applied to element
    getPropertyGet property value corresponding to stereotype applied to element
    getPropertyValueGet value of architecture property
    getEvaluatedPropertyValueGet evaluated value of property from element
    getStereotypePropertiesGet stereotype property names on element
    hasStereotypeFind if element has stereotype applied
    hasPropertyFind if element has property
    destroyRemove model element

    Examples

    collapse all

    This example shows the software architecture of a throttle position control system and how to schedule the execution order of the root level functions.

    model = systemcomposer.openModel("ThrottleControlComposition");

    Simulate the model to populate it with functions.

    sim("ThrottleControlComposition");

    View the function names ordered by execution order.

    functions = {model.Architecture.Functions.Name}'
    functions = 6x1 cell
        {'Actuator_output_5ms'   }
        {'Controller_run_5ms'    }
        {'TPS_Primary_read_5ms'  }
        {'TPS_Secondary_read_5ms'}
        {'TP_Monitor_D1'         }
        {'APP_Sensor_read_10ms'  }
    
    

    Decrease the execution order of the third function.

    decreaseExecutionOrder(model.Architecture.Functions(3))

    View the function names ordered by execution order.

    functions = {model.Architecture.Functions.Name}'
    functions = 6x1 cell
        {'Actuator_output_5ms'   }
        {'TPS_Primary_read_5ms'  }
        {'Controller_run_5ms'    }
        {'TPS_Secondary_read_5ms'}
        {'TP_Monitor_D1'         }
        {'APP_Sensor_read_10ms'  }
    
    

    The third function is now moved up in execution order, executing earlier.

    Increase the execution order of the second function.

    increaseExecutionOrder(model.Architecture.Functions(2))

    View the function names ordered by execution order.

    functions = {model.Architecture.Functions.Name}'
    functions = 6x1 cell
        {'Actuator_output_5ms'   }
        {'Controller_run_5ms'    }
        {'TPS_Primary_read_5ms'  }
        {'TPS_Secondary_read_5ms'}
        {'TP_Monitor_D1'         }
        {'APP_Sensor_read_10ms'  }
    
    

    The second function is now moved down in execution order, executing later.

    More About

    expand all

    Version History

    Introduced in R2021b