Products & Services Solutions Academia Support User Community Company

Learn more about Gauges Blockset   

Placing Controls in a Different Model

Example Overview

This example modifies the Simulink demo, sldemo_bounce, by displaying the position and velocity signals on Gauges Blockset blocks contained in another model window.

To open the original demo model, enter sldemo_bounce in the MATLAB Command Window. To open the modified version, enter gauges_bounce. The modified version includes two ActiveX Control blocks on the signals that feed into the Scope block, as in the figure below.

Creating a Model Window Containing Gauges

Create a new model called gauges_bounce_gui and copy the following Gauges Blockset blocks into it:

Customizing the Gauges

If you want to customize the gauges, particularly the range of values that they can display, then use this optional procedure:

  1. Open the ActiveX Control Properties dialog box for the Position (Generic Linear Gauge) block.

  2. From the Scales panel, set ScaleMax to 30. This enables the gauge to display values between 0 and 30.

  3. From the Ticks panel, set StopValue to 30, set DeltaValue to 5, check the Label On/Off check box, and set Width to 0.012. This creates labeled major ticks.

  4. Still on the Ticks panel, set Ticks to 2, set TickID to 1, set DeltaValue to 1, set Inner to 0.4, and set Outer to 0.75. This creates a set of unlabeled minor ticks.

  5. From the Pointers panel, click Color, choose the color that matches the pointer on the Velocity (Amp Meter) block, and click OK. Also, set Value to 0.

  6. Click OK.

  7. Open the ActiveX Control Properties dialog box for the Velocity (Amp Meter) block.

  8. From the Captions panel, set Captions to 0. This removes the word Amps.

  9. From the Annulars panel, set Annulars to 1. This removes the colored shading of the annular region.

  10. From the Needles panel, set Value to 0. This moves the needle so that it points to zero.

  11. From the Scales panel, set Min to -30, set Max to 30, select Backward, set Start to 10, and set Stop to 170. This causes the block to display values between -30 and 30 along the right half of a circle.

  12. Still on the Scales panel, set X to -1.06 and set Y to 0.04. This helps center the control in the block.

  13. From the Ticks panel, set DeltaValue to 5. This creates labeled major ticks.

  14. Still on the Ticks panel, set TickID to 1 and set DeltaValue to 1. This creates unlabeled minor ticks.

  15. Click OK.

You might also want to enlarge the blocks. They should now look like this.

Associating the Main Model with the Gauges

Open the original sldemo_bounce model and save it in your working directory as gauges_bounce. Insert two ActiveX Control blocks on the signals that feed into the Scope block. To connect the ActiveX Control blocks to the controls, make these changes in the Block Parameters dialog box in each of the ActiveX Control blocks:

  1. Clear the In-block control check box, because the signal is being communicated between ActiveX Control blocks in one window and ActiveX Control blocks in another window. When you clear the In-block control check box, the number of fields on the dialog box changes.

  2. In the Input property field, specify NeedleValue for the velocity display and PointerValue property for the position display. This property controls the current values of these gauges. Doing this passes the value of the input signal to this property.

      Note   If you adapt this example to use the Strip Chart control instead, then set Input property to Y. For other controls in this blockset, set Input property to the value used in the corresponding parameter field in the library block.

  3. Specify the path of each gauge in the Handle location field. In this case, the new model is named gauges_bounce_gui.

The dialog boxes should look like those in the following figures. Now, when you simulate the main model window, the gauges in the auxiliary model window reflect the velocity and position of the bouncing ball.

For Displaying the Velocity

For Displaying the Position

  


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