Documentation

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 asupdating 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 selectSimulation>Update Diagram, or pressCtrl+D.

This example shows the effects of updating the diagram.

  1. Create the following model.

  2. SelectDisplay>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 isdouble, the default value.

  3. In theConstantblock dialog box, setOutput data typetosingle.

    displa输出端口数据类型ys on the block diagram do not show this change.

  4. SelectSimulation>Update Diagram.

    The updated block diagram shows the changes to the output data types of theConstantandGainblocks.

    When you update a block diagram, by default, aGainblock chooses an output data type based on the data types of the input signal and theGainparameter. In this example, the block chooses the same data type as the input signal.

Simulate a Model

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

Use any of these methods to simulate a model:

  • SelectSimulation>Run.

  • PressCtrl+T.

  • Click theRunbutton.

Related Topics

Was this topic helpful?