This example shows how to use the Fast Restart feature of Simulink® to speed up optimization of a model. You use fast restart to estimate the parameters of an engine throttle model.
Simulation of Simulink models requires that the model be compiled before it is simulated. In this context compilation of a model means analyzing and formatting the model so that it can be simulated. The idea of fast restart is to perform the model compilation once and reuse the compiled information for subsequent simulations. For more information about when to use fast restart, see How Fast Restart Improves Iterative Simulations.
During optimization the model is repeatedly simulated (often tens or hundreds of times) Fast Restart means that the model is only compiled once for these simulation in comparison to non-fast restart where the model is recompiled each time.
Models where compilation is a significant portion of overall simulation time benefit the most from Fast Restart. Further once a model is compiled not all model parameters can be changed, specifically only tunable parameters can be changed. For more information, see Get Started with Fast Restart.
Load the model and click the "Parameter Estimation with preloaded data" block to load a preconfigured parameter estimation problem. The goal is to tune the parameters of an engine throttle model to match measured data. For details on the problem setup see the Estimate Model Parameter Values (GUI) example.
To compare the estimation with and without fast restart, change the estimation options in the app to not update the model with estimated values.
Click More Options in the Parameter Estimator and click General Options. Clear Update model at end of estimation, and select Save estimated values as new estimation result.
Click Estimate to estimate the model parameter values. The estimation progress report shows the estimation start and end time.
To configure the model to use Fast Restart during simulation, click Enable Fast Restart in the Simulink model.
Click Estimate in the Parameter Estimator. The estimation progress report shows the estimation start and end time. Note the reduction in total estimation time compared to the estimation without using fast restart, in this case around 28 seconds or 45% of the original estimation time.
Generate MATLAB Code feature of the Parameter Estimator and Response Optimizer will generate the MATLAB® code to configure the model for fast restart if the app is configured to use fast restart.
To learn how to use Fast Restart at the command line see Improving Optimization Performance Using Fast Restart (Code).
Close the model.