Use Model Operating Point for Faster Simulation Workflow
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:
Simulate the startup phase once.
Save a snapshot at the end of the startup phase that represents the operating point for the system.
Use this snapshot as the initial state for each in a set of simulations for different conditions or maneuvers.
To save a snapshot of a model at a given point in a simulation, save the final
states with the operating point. The snapshot is saved as a
Simulink.op.ModelOperatingPoint object you can specify as the initial state
for subsequent simulations, which start from that operating point.
The model operating point contains information about:
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 model operating point also includes the hidden states of these blocks:
Variable Transport Delay
For Each subsystem
Conditionally executed subsystems
Simscape™ Multibody™ Second Generation
Because the model operating point includes complete information about the state of the system at that point in the simulation, the results of a simulation that starts from an initial operating point are the same as a simulation that runs from the beginning.
Benefits of Using Operating Point
Saving a model operating point creates a record of 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 specifying an initial state without the operating point can produce different results.
You can save several operating points during a simulation, then resume the simulation from any of those operating points.
You can use a model operating point to restore the state of blocks that are typically difficult to restore to a particular state, including 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. With dataset logging format, the answers returned by
ModelOperatingPointalways match those returned by state logging (non-Operating Point save). Logged states for blocks inside of accelerator-mode model reference are visible and editable. Logged states for many blocks with custom operating point functions, for example, Simscape, model reference accel and variable transport delay are editable.
You can also save a simulation state by saving final states without the operating point. However, this option saves only 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 the solver, execution engine, or hidden states of blocks, which are 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
When you use
set_paramor a block, like the Stop block, to stop a simulation.
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.
Select the Save final Operating Point check box.
In the Final states text box, enter a variable name for the
Simulate the model.
Restore Operating Point
Restore the simulation snapshot using the
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
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 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.
Enter the name of the variable containing the
ModelOperatingPointin the text box.
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
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
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
warning. Previously named
SimState objects are loaded as
objects in 19a.