TOC PREV NEXT

2.5 Annotations and Parameterization

In this section, we will enhance the model in figure 2.25 in a number of ways.

2.5.1 Parameters in Hierarchical Models

First, notice from figure 2.26 that the noise overwhelms the sinusoid, making it barely visible. A useful channel model would have a parameter that sets the level of the noise. Look inside the channel model, and add a parameter by dragging one in from the Utilities library, Parameters sublibrary, as shown in figure 2.27. Right click1 on the parameter to change its name to "noisePower". (In order to be able to use this parameter in expressions, the name cannot have any spaces in it.) Also, right click or double click on the parameter to change its default value to 0.1.

Now we can use this parameter. First, let's use it to set the amount of noise. The Gaussian actor has a parameter called standardDeviation. In this case, the power of the noise is equal to the variance of the Gaussian, not the standard deviation. If you recall from basic statistics, the standard deviation is equal to the square root of the variance. Change the standardDeviation parameter of the Gaussian actor so its value is "sqrt(noisePower)", as shown in figure 2.28. This is an expression that references the noisePower parameter. We will explain the expression language in the next chapter. But first, let check our improved model. Return to the top-level model, and edit the parameters of the Channel actor (by either double clicking or right clicking and selecting "Configure"). Change the noise power from the default 0.1 to 0.01. Run the model. You should now get a relatively clean sinusoid like that shown in figure 2.29.

Note that you can also add parameters to a composite actor without dragging from the Utilities library by clicking on the "Add" button in the edit parameters dialog for the Channel composite. This dialog can be obtained by either double clicking on the Channel icon, or by right clicking and selecting "Configure", or by right clicking on the background inside the composite and selecting "Edit Parameters". However, parameters that are added this way will not be visible in the diagram when you look inside the Channel actor. Instead, you would have to right click on the background and select Configure to see the parameter.

2.5.2 Decorative Elements

There are several other useful enhancements you could make to this model. Try dragging an Annotation from the Utilities library, Decorative sublibrary, and creating a title on the diagram. A limited number of other decorative elements like geometric shapes can also be added to the diagram from this same library.

2.5.3 Creating Custom Icons

A (rather primitive) icon editor is also provided with Vergil. To create a custom icon, right click on the icon and select "Edit Custom Icon," as shown in figure 2.30. The box in the middle of the icon editor displays the size of the default icon, for reference. Try creating an icon like the one shown in figure 2.31. Hint: The fill color of the rectangle is set to "none" and the fill color of the trapezoid is first selected using the color selector, then modified to have an alpha (transparency) of 0.5. Finally, since the icon itself has the actor name in it, the Customize Name dialog is used to deselect "show name."
1 On a Macintosh, control-click.

TOC PREV NEXT