Main Content

Use Fast Restart Mode During Response Optimization

This topic shows how to speed up response optimization using Simulink® fast restart. You can use the fast restart feature to speed up response optimization of tunable parameters 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.

When you enable fast restart, you can only change tunable properties of the model during simulation. For more information about the limitations, see Limitations.

You can optimize using fast restart in the Response Optimizer or at the command line.

Response Optimizer App Workflow for Fast Restart

To optimize a model response using fast restart in the Response Optimizer:

  1. Open the Simulink model.

  2. Enable fast restart in the model.

    Click Fast Restart in the model window.

  3. Open the Response Optimizer for the model.

  4. Configure the design variables, design requirements, and, optionally, optimization settings.

    For more information, see Specify Design Variables, Specify Time-Domain Design Requirements in the App, Specify Frequency-Domain Design Requirements in the App, and Specify Optimization Options.

  5. Click Optimize to optimize the model response in fast restart mode.

  6. Disable fast restart.

    In the model window, click Fast Restart .

Command-Line Workflow for Fast Restart

To optimize a model response using fast restart at the command line:

  1. Open the Simulink model.

  2. Create a model simulation scenario. 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.

    Simulator = sdo.SimulationTest('model');

    Specify model signals to log during model simulation.

    For response optimization problems that include frequency-domain requirements, the model is linearized using Simulink Control Design™. Use the SystemLoggingInfo property of the sdo.SimulationTest object, Simulator, to specify linear systems to log when simulating the model. For an example, see Design Optimization to Meet Frequency-Domain Requirements (Code).

    Note

    In fast restart mode, you cannot use the linearize (Simulink Control Design) command from Simulink Control Design to specify and compute linear systems. Using linearize (Simulink Control Design) generates an error.

  3. Specify design requirements, Requirements, and design variables, param. For and example, see Design Optimization to Meet Step Response Requirements (Code).

  4. Configure the model and simulation scenario for fast restart.

    Simulator = fastRestart(Simulator,'on');
  5. Create an optimization 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.

    optimfcn = @(param) myCostfcn(param,Simulator,Requirements);
    

    Here, myCostfcn is a cost function that takes design variables, param, simulation scenario, Simulator, and design requirements, Requirements, as inputs.

  6. Run the optimization.

    [param_opt,opt_info] = sdo.optimize(optimfcn,param);
  7. Restore the simulator fast restart settings.

    Simulator = fastRestart(Simulator,'off');

Troubleshooting

Why Don’t I See the Optimization 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 optimization speed.

See Also

| |

Related Topics