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 and Edit a Model in the Simulink Editor.

You can further classify blocks in Simulink.

  • Virtual blocks — These blocks help 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 a model in another model. You use a Model block to reference a model. See Model Referencing.

  • Linked blocks — A linked block is an instance of a block from a custom library that links to the 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 parameters that determine how the block works. For example, in the Trigonometric Function block, you specify the trigonometry function that you want the block to perform. For 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. For detailed information on parameter values, see Set Block Parameter Values.

You set block parameters in the Property Inspector or in a block dialog box.

  • To open the Property Inspector, select View > Property Inspector. Select the block whose parameters you want to view or set. The parameters appear in the Parameters tab.

  • To open the block dialog box, select Diagram > Block Parameters or, for most blocks, double-click the block. You can also use the context menu.

To understand the differences between these approaches, see Setting Properties and Parameters.

Some block parameters do not appear in the Property Inspector. For example, some advanced parameters do not appear in the Property Inspector. To open the block dialog box instead, in the Property Inspector, click Open. See the documentation for your product to learn more about setting block parameters in the Property Inspector.

Blocks also have properties which are not specific to the block. Block properties enable you to 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 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 Specify Block Properties.

You can set block properties on the Properties tab of the Property Inspector. Alternatively, you can use the Block Properties dialog box.

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 in the editor. 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 parameters, 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 — Model properties help you to define callbacks for the model. They also enable you to add a description and specify data to load or scripts to run, along with other settings. You can view and set model properties in the Property Inspector when there is no selection in the top level of a model. Otherwise, use File > Model Properties. See Manage Model Properties.

    Note:   Simulink preferences (File > Simulink Preferences) help you to customize your model editing environment, such as how your scroll wheel functions and saving options. 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 and Edit a Model in the Simulink Editor, 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?