Documentation

Parts of a Model

You create a Simulink® model by adding blocks, specifying block behavior, and using signal lines to connect the blocks to each other according to the dynamics of the system that you want to simulate.

About Blocks

Blocks are the main elements that you use to build models in Simulink. Generally, you add blocks from the supplied Simulink libraries to perform specific operations, such as math, as shown in Build a Simple Model.

You can further classify blocks in Simulink.

  • Virtual blocks — These blocks serve only to organize a model and do not affect simulation. See Nonvirtual and Virtual Blocks.

  • Subsystem blocks — Subsystems help you to organize your models hierarchically. You use a Subsystem block to encapsulate related parts of a model, that is, a representation of a system within the larger system that you are modeling. See Model Hierarchy.

  • Masked blocks — You can add a mask to any block in a model. A mask is a custom interface that enables you to show only the block parameters and settings that you want the user of the block to have access to. A mask also provides an interface for setting parameters on blocks inside a subsystem without having to navigate the hierarchy. You can change the block appearance using a mask. See Block Masks.

  • Referenced models — A model reference is a way to include one model in another model. You use a Model block to reference a model. See Model Reference.

  • Linked blocks — A linked block is an instance of a library block and contains a link to that library block. You can create a library of blocks that you configure for your specific purposes. For example, you can create subsystems and masked blocks and store them in a library for reuse. When you add a block to a model from a library that you created, the block keeps a link to the library version, called a library link. You can modify a linked block only by disabling the link. See Libraries.

Block Parameters and Properties in Simulink

For most blocks, you can specify settings that determine how the block works. These settings are called block parameters. You set block parameters in the block dialog box. To open this dialog box, you can use the Block Parameters command on the block context menu or, for most blocks, double-click the block. These block parameters help you to control block behavior. For example, in the Trigonometric Function block, you specify the trigonometry function that you want to perform. In some blocks, you can specify the number of inputs or outputs. Whether the block has parameters that you can set and the nature of those parameters is specific to each block. See Set Block Parameter Values.

The figure shows the block dialog box for the Trigonometric Function block.

Blocks have properties that you can set using the Block Properties dialog box. Right-click a block and select Properties to specify properties for that block. Unlike the block parameters, these properties are not specific to the purpose of the block. In the Block Properties dialog box, you can configure the block to execute code when you perform actions such as opening the block or starting simulation. For example, you can set up a MATLAB® script to execute, to perform tasks such as loading or defining variables for a block or any other callback functions. See Callbacks for Customized Model Behavior. Block properties also enable you to annotate the block and define callback functions. See Set Block Properties.

Additional Parameters and Properties

Simulink has these additional types of parameters and properties.

  • Programmatically accessible parameters — Blocks and models have parameters whose value you do not set explicitly using a dialog box. For example, each block has a position parameter that is based on where you place the block in the model. There is no single interface to these properties, but you can query and set any of them programmatically. You can also set any of the block-specific parameters programmatically. See Common Block Properties and Model Parameters.

  • Model configuration parameters — Use configuration parameters (Simulation > Model Configuration Parameters) to specify simulation conditions, such as the solver to use, the types of errors and warnings to display, and how you want to store simulation data. See Configuration Parameters Dialog Box Overview.

  • Model properties — The Model Properties dialog box (File > Model Properties > Model Properties) helps you to define callbacks for the model. It also enables you to add a description and specify data to load or scripts to run, along with other settings. See Manage Model Properties.

    Note:   Simulink preferences (File > Simulink Preferences) help you to customize your model editing environment, such as the default font and how your scroll wheel functions. You can also set defaults for your configuration parameters in your Simulink preferences. See Set Simulink Preferences.

Setting Parameter Values in Workspaces

Simulink gives you access to two workspaces where you can set values for parameters. Workspaces enable you to set parameters by using variables rather than setting every value on every block in a model. This approach is especially useful when your model is large and complex because you do not need to locate every block whose parameter value you want to set or change. Instead, assign a variable as the value of a parameter and define the variable in a workspace. This mechanism also allows you to use different sets of parameter values for the same model.

In the MATLAB base workspace, you can define parameters using any MATLAB mechanism for defining a variable. For example, you can use a MAT-file and load the variables when you open the model (see Load Variables When Opening a Model). Using the MATLAB base workspace to define variables is useful when you are using the same set of parameters for more than one model.

You can also define parameters by assigning values to variables in a model workspace. You define a set of parameters that are specific to the model and save them with the model. See Model Workspaces.

Signals

As you can see in Build a Simple Model, you use signal lines to connect blocks in a model. At a minimum, a model takes an input signal, operates on it, and outputs the result. In the Library Browser, the Sources library contains blocks that represent input signals. The Sinks library contains blocks for capturing and displaying outputs.

Simulink represents signals as lines. The line style varies with the type of signal. You create signals between the output port of one block and the input port of another block by drawing or using shortcuts.

For more on signals, see Signals and Block and Signal Line Shortcuts and Actions.

Related Examples

More About

Was this topic helpful?