Update Diagram and Run Simulation

Updating the Diagram

You can leave many attributes of a block diagram, such as signal data types and sample times, unspecified. The Simulink® software then infers the values of block diagram attributes, based on the block connectivity and attributes that you specify. The process that Simulink uses is known as updating the diagram.

Simulink attempts to infer the most appropriate values for attributes that you do not specify. If Simulink cannot infer an attribute, it halts the update and displays an error.

Simulation Updates the Diagram

Simulink updates the diagram at the start of a simulation. The updated diagram provides the simulation with the results of the latest changes that you have made to a model.

Update Diagram While Editing

As you create a model, at any point you can update the diagram. Updating the diagram periodically can help you to identify and fix potential simulation issues as you develop the model. This approach can make it easier to identify the sources of problems by focusing on a set of recent changes. Also, the update diagram processing takes less time than performing a simulation, so you can identify issues more efficiently.

To update the diagram select Simulation > Update Diagram, or press Ctrl+D.

This example shows the effects of updating the diagram.

  1. Create the following model.

  2. Select Display > Signals & Ports > Port Data Types.

    The data types of the output ports of the Constant and Gain blocks appear. The data type of both ports is double, the default value.

  3. In the Constant block dialog box, set Output data type to single.

    The output port data type displays on the block diagram do not show this change.

  4. Select Simulation > Update Diagram.

    The updated block diagram shows the change to the output data type for the Constant block.

    In this example, Simulink infers a data type for the output of the Gain block because you did not specify a data type for it. The data type inferred is single, because single precision is all that is needed to simulate the model accurately given that the precision of the block input is single.

Simulate a Model

For any type of model you build in Simulink, you need to know how to simulate the model. Simulating performs the operations specified by the blocks in the model and its specific configuration and produces results. See Simulationfor complete information, such as how to configure your model for simulation.

Use any of these methods to simulate a model:

  • Select Simulation > Run.

  • Press Ctrl+T.

  • Click the Run button .

Was this topic helpful?