Use Operating Points to Specify Initial State of Simulation
This example shows how to use operating points to get the results of a continuous simulation without starting from time t = 0. An operating point is a snapshot of the state of a Simulink® model during simulation. If your model contains a Stateflow® chart, the operating point includes information about active states, output and local data, and persistent variables. For more information, see Save and Restore Operating Points for Stateflow Charts.
sf_boiler model illustrates the logic of a bang-bang control system
that regulates the temperature of a boiler.
This model simulates for 1400 seconds. During the initial phase of the simulation, the temperature of the boiler rises from 15℃ to 20℃. This initial phase of the simulation takes approximately 500 seconds.
To see how the system reacts to changes in the temperature set point after the initial phase of simulation, simulate the model and save the operating point at t =500. Then, load that operating point and run the simulation between t = 500 and t = 1400 using different temperature set points.
For more information about this model, see Model Bang-Bang Temperature Control System.
Save Operating Point for Initial Simulation Segment
Set the model to save the final operating point. Open the Configuration Parameters dialog box and, in the Data Import/Export pane:
Select Final states and enter a name for the operating point. For this example, use
Select Save final operating point.
Set the stop time for this simulation segment. In the Simulation tab, set Stop Time to
Run the simulation.
When you simulate the model, you save the operating point at t = 500 in the variable
xFinalin the MATLAB® base workspace.
In the Configuration Parameters dialog box, in the Data Import/Export pane, clear the Save final operating point and Final states parameters. This step prevents you from overwriting the operating point you saved in the previous step.
Start Simulation from Operation Point
Load the operating point as the initial state of the model. In the Configuration Parameters dialog box, in the Data Import/Export pane, select Initial state and enter the variable that contains the operating point of your chart,
xFinal. Then, click OK.
Define the stop time for the new simulation segment. In the Simulation tab, set Stop Time to
Run the simulation.
The model starts at t = 500 without repeating the initial phase of the simulation. The Scope block shows the chart output between t = 500 and t = 1400 using the original temperature set point of 20℃.
Change the value of the
temperature set pointblock to
Run the simulation again.
The Scope block shows the chart output between t = 500 and t = 1400 using the modified temperature set point of 18℃.