Products & Services Industries Academia Support User Community Company

Learn more about Simulink   

Working with Reference Blocks

About Reference Blocks

A reference block is an instance of a block type in a model that contains a link to a library block that serves as the block type's prototype. The link consists of the path of the library block that serves as the instance's prototype. The link allows the reference block to update whenever the corresponding prototype in the library changes (Updating a Reference Block). This ensures that your model always uses the latest version of the block.

You can change the values of a reference block's parameters but you cannot mask the block or edit its mask. Also, you cannot set callback parameters for a reference block. If the reference block's prototype is a subsystem, you can make nonstructural changes to the contents of the referenced subsystem (see Modifying Reference Blocks).

Creating a Reference Block

To create a reference block in a model or another library:

  1. Open your model.

  2. Open the Simulink Library Browser (see About the Library Browser).

  3. Use the Library Browser to find the library block that serves as a prototype of the block you want to create (see Browsing Block Libraries and Searching Block Libraries).

  4. Drag the library block from the Library Browser's Library pane and drop it into your model.

Updating a Reference Block

Simulink updates out-of-date reference blocks in a model or library at these times:

Modifying Reference Blocks

You cannot make structural changes to reference blocks, such as adding or deleting lines or blocks to the block diagram of a masked subsystem. If you want to make such changes, you must disable the reference block's link to its library prototype (see Disabling Links to Library Blocks ).

You can, however, change the values of any masked subsystem reference block parameter that does not alter the block's structure, e.g., by adding or deleting lines, blocks, or ports. An example of a nonstructural change is a change to the value of a mathematical block parameter, such as the Gain parameter of the Gain block. A link to a library block from a reference block whose parameter values differ from those of the corresponding library block is called a parameterized link. When saving a model containing a parameterized link, Simulink saves the changes to the local copy of the subsystem together with the path to the library copy in the model's model (.mdl) file. When you reopen the system, Simulink copies the library subsystem into the loaded model and applies the saved changes.

Self-Modifying Linked Subsystems

Simulink allows linked subsystems to change their own structural contents without disabling the link. This allows you to create masked subsystems that modify their structural contents based on mask parameter dialog box values.

Finding a Reference Block's Library Block Prototype

To find the source library and block linked to a reference block, select the reference block. Then choose Go To Library Link from the Link Options submenu of the model window's Edit or context menu. If the library is open, Simulink selects and highlights the library block and makes the source library the active window. If the library is not open, Simulink opens it and selects the library block.

Getting Information About Library Blocks Referenced by a Model

Use the libinfo command to get information about reference blocks in a system.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS