Main Content

Save and Restore Simulation Operating Point


In R2019a, the SimState object was renamed to ModelOperatingPoint.

To effectively design a system, you simulate a model iteratively, so you can analyze the system based on different inputs, boundary conditions, or operating conditions. In many applications, when performing multiple simulations, a startup phase with significant dynamic behavior is common. For example, the cold start takeoff of a gas turbine engine occurs before each set of aircraft maneuvers. In multiple simulations, you ideally:

  1. Simulate the startup phase once.

  2. Save the simulation snapshot at the end of the startup phase.

  3. Use this snapshot as the initial state for each set of conditions or maneuvers.

Use the ModelOperatingPoint object to save the snapshot of a simulation. Once you save the snapshot, in future simulations, restore the ModelOperatingPoint object and use it to set initial conditions.

The ModelOperatingPoint object contains information about:

  • Logged states

  • State of the solver and execution engine

  • Zero-crossing signals for blocks that register zero crossings

  • Output values of certain blocks in the model

    Simulink® analyzes block connections and other information to determine whether it is using the output values effectively as state information.

The ModelOperatingPoint object also stores the hidden states of these blocks:

  • Transport Delay

  • Variable Transport Delay

  • From Workspace

  • For Each subsystem

  • Conditionally executed subsystems

  • Stateflow

  • MATLAB System

  • Simscape™ Multibody™ Second Generation

By storing this information, the ModelOperatingPoint object ensures that the result of a simulation that starts from the operating point is the same as a simulation that runs from the beginning.

Benefits of Using Operating Point

  • When the ModelOperatingPoint object saves the snapshot of a simulation, it saves information in addition to the logged states in the model. Restore all of this information to ensure that the simulation matches the uninterrupted simulation. For example, if solver information affected the simulation, then changing the state of a block without using ModelOperatingPoint can produce different results.

  • You can save several operating points during a simulation, then resume the simulation from any of those operating points.

  • The ModelOperatingPoint object restores the state of blocks that are typically difficult to restore to a particular state, for example, the Transport delay block. The state of the Transport Delay block is not saved in the structure format or the array format when you log data using the Final states configuration parameter.

You can also use the Final states option in the Configuration Parameters Data Import/Export pane to save a simulation state. However, this option saves only logged states—the continuous and discrete states of blocks. These states are only subsets of the complete simulation state of the model. They do not include information about hidden states of blocks, which required for the proper execution of a block.

Save an Operating Point

Save an operating point at the beginning of the final step using one of these options:

  • At the final Stop time.

  • When you interrupt a simulation with the Pause or Stop button. You can also save an operating point when you pause a simulation using get_param('modelName','CurrentOperatingPoint').

  • When you use set_param or a block, like the Stop block, to stop a simulation.

Interactive Save

  1. In the Configuration Parameters dialog box, in the Data Import/Export pane, select the Final states check box. The Save final Operating Point check box becomes available.

  2. Select the Save final Operating Point check box.

  3. In the Final states text box, enter a variable name for the ModelOperatingPoint object.

  4. Simulate the model.

Save and Restore an Operating Point

Use the sim command with set_param. Set the SaveOperatingPoint parameter to 'on'.

simOut = sim('sldemo_tonegen','StopTime','10');
myOperPoint = simOut.myOperPoint;

To configure the simulation to restore the operating point that you saved, use LoadInitialState. Simulink® restores the ModelOperatingPoint object when you simulate the model.

myOperPoint = simOut.myOperPoint;


Before you save the operating point, disable the Block Reduction parameter in Configuration Settings > Simulation Target > Advanced Parameters.

Restore Operating Point

Restore the simulation snapshot using the ModelOperatingPoint object after modifying the model. The Start time does not change from the value in the simulation that generated the operating point. It is a reference value for all time and time-dependent variables in both the original and the current simulation. For example, a block can save and restore the number of sample time hits that occurred since the beginning of simulation as its ModelOperatingPoint object.

Consider a model that you ran from 0 to100 s and that you now want to run from 100 to 200 s. The Start time is 0 s for both the original simulation and for the current simulation. The initial time of the current simulation is 100 s. Also, if the block had 10 sample time hits during the original simulation, Simulink recognizes that the next sample time hit is the 11th, relative to 0, not 100 s.


If you change the Start time before restoring the ModelOperatingPoint, Simulink overwrites the Start time with the value saved in the ModelOperatingPoint.

Interactive Restore

  1. In the Configuration Parameters dialog box, in the Data Import/Export pane, under Load from workspace, select the Initial state check box. The text box becomes available.

  2. Enter the name of the variable containing the ModelOperatingPoint in the text box.

  3. Set the Stop time to a value greater than the time at which the operating point was saved.

Restore from Different Simulink Versions

You can use ModelOperatingPoint objects saved in releases starting with R2010a to restore the ModelOperatingPoint of a model. However, this option restores only the logged states of the model. To see the version of Simulink used to save the ModelOperatingPoint, examine the version parameter of the ModelOperatingPoint object.

Simulink detects if the ModelOperatingPoint object you provided as the initial state was saved in the current release. By default, Simulink displays an error message if the ModelOperatingPoint was not saved in the current release. You can configure the diagnostic to allow Simulink to display the message as a warning and try to restore as many of the values as possible. To enable this best-effort restoration, in the Configuration Parameters dialog box set the message for Operating Point object from earlier release to warning. Previously named SimState objects are loaded as ModelOperatingPoint objects in 19a.

Related Topics