Main Content

Promote Block Parameters on a Mask

Blocks and subsystems can have multiple parameters associated with them. Block masks allow you to expose one or more of these parameters while hiding others from view. You can promote any underlying parameter of a block either to a block mask or to a subsystem mask. For any subsystem, you have a single view of all the nested blocks, the block parameters, and internal parameters. You can click on any node to access any promotable parameter within the nested blocks. By promoting parameters from the block dialog box to the mask you can:

  • Customize the mask dialog box by moving the required parameters from the block dialog box to the mask dialog box.

  • Reuse a library block at different instances of a model. For each instance of the library block, you can create individual mask dialog box by promoting parameters for each block.

  • Simplify the interface and specify the parameters that the user of the block can view and set.

These options are available for promoting parameters:

Promote One-to-One: Use this option on the Mask Editor for one-to-one correspondence between the block parameter and the mask parameter. For each block parameter, one mask parameter is created. For example, consider the block dialog box of the Gain block, which has parameters such as Gain, Multiplication. To expose only the Gain parameter, mask the Gain block and promote the Gain parameter to the mask dialog box.

Promote Many-to-One: Use this option to create a many-to-one correspondence between the block parameter and the mask parameter. You can associate a single mask parameter with multiple promoted parameters For example, you can promote multiple Gain parameters in a subsystem to a single parameter on your mask.

Note:

  • If the parameter is of data type popup or DataType, the options must also be the same for the parameters to be promoted.

  • The Evaluate attribute must be the same for all the promoted parameters.

  • You can also change the attributes of a promoted parameter. For example, you can make a promoted parameter read-only or hidden. For more information on attributes, see Property editor.

Explore the Model

The model contains two subsystem blocks: one for promoting on-to-one parameters, Selective Promotion of Parameters and one for promoting many to one parameters, Promote Many to One.

 open_system('slexMaskParameterPromotionExample.slx');

Promote One-to-One

You can create an one-to-one correspondence for each underlying block parameters and the mask parameter.

Consider the model containing the subsystem Selective Promotion of Parameters, which contains three Gain blocks. The value of one of the Gain blocks is fixed. To simplify the user interface, the parameters of the variable Gain blocks are promoted to the mask.

To promote the parameters:

1. Go to Mask Editor > Parameters & Dialog > Parameter > Promote One-to-One.

2. Select the variable Gain parameters Gain and Gain1, then click Promote.

Note: You can modify the prompt of the promoted parameter.

3. Save the mask and simulate the model. Note that the value of the Gain1 block is taken from the mask parameter gain1_promoted.

4. Simulate the model. Notice that the value of the Gain3 block is fixed and set in the initialization. The variable Gain parameters appear in the mask dialog box.

Promote Many-to-One

Use the option Promote-Many-to-One in the Mask Editor to promote multiple block parameters to a single mask parameter. For example, this model contains a subsystem named Promote Many to One that has three Gain blocks ( Gain1, Gain2, and Gain3 ). The variable K represents the Gain parameter for these Gain blocks. You can promote only the Gain parameter of each of these Gain blocks to the block mask as a single parameter. When you do so, the parameter K is available on the mask for editing, and its value will be applied to Gain1, Gain2, and Gain3 blocks.

1. Go to Mask Editor > Parameters & Dialog > Promote-Many-to-One.

2. Select the Gain parameters Gain1, Gain2, and Gain3.

3. Click Promote.

4. Simulate the model. Notice that the value 4 is passed from the mask to the underlying blocks Gain1, Gain2 , and Gain3 . In this case, the output shows 64.

Best Practices

  • Set the value of a promoted parameter only in the mask dialog box and not in the underlying block dialog box or from the command line.

  • Parameters once promoted cannot be promoted again to any other mask.

  • Do not edit the Evaluate attribute of the promoted parameter. This property is inherited from the block parameter.

  • If you are promoting a nontunable parameter, do not edit the Tunable attribute.

  • Parameters of a masked or linked child block cannot be viewed or promoted.

  • Callbacks associated with a block parameter are promoted to the block mask and not to the subsystem mask. User-defined callbacks are sequentially executed after the dynamic dialog callback execute.