Documentation

Use Fast Restart Mode During Sensitivity Analysis

This topic shows how to speed up sensitivity analysis using Simulink® fast restart. You can use the fast restart feature to speed up sensitivity analysis of tunable parameters (Simulink) of a model.

Fast restart enables you to perform iterative simulations without compiling a model or terminating the simulation each time. Using fast restart, you compile a model only once. You can then tune parameters and simulate the model again without spending time on compiling. Fast restart associates multiple simulation phases with a single compile phase to make iterative simulations more efficient. You see a speedup of design optimization tasks using fast restart in models that have a long compilation phase. See How Fast Restart Improves Iterative Simulations (Simulink).

When you enable fast restart, you can only change tunable properties of the model during simulation. For more information about the limitations, see Factors Affecting Fast Restart (Simulink).

You can perform sensitivity analysis using fast restart in the Sensitivity Analysis tool or at the command line.

Sensitivity Analysis Tool Workflow for Fast Restart

To evaluate a model using fast restart in the Sensitivity Analysis tool:

  1. Open the Simulink model.

  2. Enable fast restart in the model.

    Click Fast Restart in the model window.

  3. Open the Sensitivity Analysis tool for the model.

  4. Specify the parameter set, generate parameter samples, and specify the requirements for sensitivity analysis. Optionally, specify evaluation settings. For example, see Design Exploration Using Parameter Sampling (GUI) and Identify Key Parameters for Estimation (Code).

  5. Click Evaluate to evaluate the model in fast restart mode. The design requirements are evaluated for each combination of parameter values in your parameter set.

  6. Disable fast restart.

    In the model window, click Fast Restart .

Command-Line Workflow for Fast Restart

You can use sensitivity analysis to evaluate which model parameters most influence a cost function. You can use these parameters during parameter estimation or response optimization. Suppose that you want to use sensitivity analysis to reduce the number of parameters that you need to estimate to fit a model.

To evaluate the model in fast restart mode using a cost function aimed at parameter estimation:

  1. Open the Simulink model.

  2. Specify the model parameter values, params, to estimate and generate parameter samples, params_samples. For an example, see Identify Key Parameters for Estimation (Code).

  3. Create an experiment object, Exp.

    Exp = sdo.Experiment('model');

    Store the measured input-output data in Exp. For an example, see Identify Key Parameters for Estimation (Code).

  4. Create a model simulator from the experiment.

    Simulator = createSimulator(Exp);

    Simulator is an sdo.SimulationTest object.

    Note

    You must create a simulation scenario with logging information before configuring the model for fast restart. You cannot modify logging information once the model has been compiled for fast restart.

  5. Configure the model and simulator for fast restart.

    Simulator = fastRestart(Simulator,'on');
  6. Create a cost function, myCostfcn, and pass Simulator to the cost function as an input. For more information, see Write a Cost Function. In the cost function, the simulator configured for fast restart is used to update the model parameters, simulate the model, and log signals.

    Use an anonymous function with one argument that calls myCostfcn.

    evalfcn = @(param) myCostfcn(param,Simulator,Exp);
    
  7. Evaluate the model.

    [param_opt,opt_info] = sdo.evaluate(evalfcn,param,param_samples);
  8. Restore the simulator fast restart settings.

    Simulator = fastRestart(Simulator,'off');

The fast restart workflow is similar for sensitivity analysis that identifies design variables using a cost function aimed at response optimization. See Use Fast Restart Mode During Response Optimization.

Troubleshooting

Why Don’t I See the Evaluation Speedup I Expected Using Fast Restart?

You see a speedup of design optimization tasks using fast restart in models that have a long compilation phase. If the compilation phase of your model is not long, you do not see a significant change in estimation speed.

See Also

| |

Related Topics

Was this topic helpful?