Documentation Center

  • Trial Software
  • Product Updates

Masking Linked Blocks

Simulink® libraries can contain blocks that have masks. An example of this type of block is the Ramp block. These blocks become library links when copied to a model or another library. You can add a new mask on this linked block. If this linked block is in a library and copied again, you can add another mask to this new linked block thus creating a stack of masks. Masking linked blocks allows you to add a custom interface to the link blocks similar to other Simulink blocks.

The block mask that is present as part of the library is the base mask. A derived mask is the one created on top of the base mask.

For example, in the figure, Library A contains Block A, which has a Mask A. Block A is copied to Library B, and Mask B is added to it. When Block A is copied to Library B, a library link from Library B to Library A is created.

Block B is then copied to a model, and Mask C is added to it. This creates a library link from Library B to Block C. Block C now has Mask A, Mask B, and Mask C. Mask C is the derived mask and Mask B is the base mask.

Note that for Block C:

  • Mask parameter names are unique in the stack.

  • You can set mask parameters for Mask B and Mask C.

  • Mask B and Mask C inherit MaskType and MaskSelfModifiable parameters from Mask A.

  • Mask initialization code for Mask C executes first, followed by Mask B and Mask A.

  • Variables are resolved starting from the mask immediately above the current mask in the stack. If the current mask is the top mask, it follows the regular variable resolution rules.

Guidelines for Mask Parameters

  • You cannot use same names for the mask parameters. The exception is the Promote type mask parameter, for which the name is inherited and is the same as that of the parameter promoted to it.

  • You cannot set mask parameters for masks below the base mask. Mask parameters for masks below the base mask are inherited from the library.

Mask Behavior for Masked, Linked Blocks

The following are some of the behaviors that are important to understand about masked, linked blocks.

  • The MaskType and the MaskSelfModifiable parameters are inherited from the base mask.

  • Mask display code for the derived mask executes first, followed by the display code for the masks below it until we come across a mask whose MaskIconFrame parameter is set to opaque.

  • Mask initialization code for the derived mask executes first, followed by the initialization code for the masks below it.

  • Variables are resolved starting from the mask immediately above the current mask in the stack. If the current mask is the top mask, the regular variable resolution rules apply.

  • When you save a Simulink model or library containing a block with multiple masks, using File > Export Model to > Previous Version... , the Sourceblock parameter is modified to point to the library block having the bottom most mask.

  • The following occurs when you disable, break, or reestablish links to libraries:

    • If you disable the link to the library block, the entire mask hierarchy is saved to the model file so that the block can act as a standalone block.

    • If you break the link to the library block, the block becomes a standalone block.

    • If you reestablish the link after disabling by doing a restore, all changes to the mask are discarded. If you mask subsystems, you must reestablish the link after disabling by doing a push. When you do a push, subsystem changes are pushed to the library block and top mask changes are pushed to the immediate library.

Was this topic helpful?