Using Simulink    

Controlling Execution of a Simulation

The Simulink graphical interface includes menu commands and toolbar buttons that enable you to start, stop, and pause a simulation.

Starting a Simulation

To start execution of a model, select Start from the model editor's Simulation menu or click the Start button on the model's toolbar.

You can also use the keyboard shortcut, Ctrl+T, to start the simulation.

Simulink starts executing the model at the start time specified on the Simulation Parameters dialog box. Execution continues until the simulation reaches the final time step specified on the Simulation Parameters dialog box, an error occurs, or you pause or terminate the simulation (see The Simulation Parameters Dialog Box).

While the simulation is running, a progress bar at the bottom of the model window shows how far the simulation has progressed. A Stop command replaces the Start command on the Simulation menu. A Pause command appears on the menu and replaces the Start button on the model toolbar.

Your computer beeps to signal the completion of the simulation.

Pausing or Stopping a Simulation

Select the Pause command or button to pause the simulation. Simulink completes execution of the current time step and suspends execution of the simulation. When you select Pause, the menu item and button change to Continue. (The button has the same appearance as the Start button). You can resume a suspended simulation at the next time step by choosing Continue.

To terminate execution of the model, select the Stop command or button. The keyboard shortcut for stopping a simulation is Ctrl+T, the same as for starting a simulation. Simulink completes execution of the current time step before terminating the model. Subsequently selecting the Start command or button restarts the simulation at the first time step specified on the Simulation Parameters dialog box.

If the model includes any blocks that write output to a file or to the workspace, or if you select output options on the Simulation Parameters dialog box, Simulink writes the data when the simulation is terminated or suspended.

Interacting with a Running Simulation

You can perform certain operations interactively while a simulation is running. You can

You cannot make changes to the structure of the model, such as adding or deleting lines or blocks, during a simulation. If you need to make these kinds of changes, you need to stop the simulation, make the change, then start the simulation again to see the results of the change.


  Specifying Simulation Parameters The Simulation Parameters Dialog Box