Main Content

decreaseExecutionOrder

Change function execution order to earlier

Since R2021b

    Description

    decreaseExecutionOrder(functionObj) decreases execution order of the specified function functionObj by 1. If the function is at the minimum execution order, the decreaseExecutionOrder method will fail with a warning.

    example

    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 = 6×1 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 = 6×1 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 = 6×1 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.

    Input Arguments

    collapse all

    Function, specified as a systemcomposer.arch.Function object.

    More About

    collapse all

    Version History

    Introduced in R2021b