Dials & Gauges Blockset | ![]() ![]() |
Simulating a Multiple-Needle Stopwatch
This example model simulates a typical sailing stopwatch. The model uses the Stop Watch block, which displays three needles on individual angular scales. The needles mark simulation time simultaneously, as follows:
To open this example, enter dng_stopwatch
in the MATLAB Command Window. Run the simulation and watch how the three needles move.
These sections describe how the model works:
How NeedleID Values Correspond to Needles
To explain how the model controls three needles, this section first explains how the block makes its needles accessible to you. Each needle on the block has an associated pair of NeedleID and Value parameters, where
You can view or control these parameters via the Needles panel of the block's ActiveX Control Properties dialog box.
To find out which needle and range of values correspond to a given ID number, use this procedure:
0
, 1
, or 2
in this case.
The table below summarizes what the procedure reveals.
NeedleID |
Needle on Block |
Range of Values |
0 |
Large needle |
[0 , 60 ] seconds |
1 |
Small needle on right |
[0 , 15 ] minutes |
2 |
Small needle on left |
[0 , 5 ] fifths of a second |
For more information about ID properties, see Understanding ID Properties.
Configuration of the Stop Watch Block
After you run the model, the number 6
appears near the connector line that represents the input to the Stop Watch block. This indicates that the signal on that line is a vector of length 6. To understand why, first right-click on the Stop Watch block and choose Block Parameters.
Then notice that the Input property field in the dialog box is set to
By contrast, the default value for this property is NeedleValue
, which you can see by examining the block in the Angular Gauges library.
The comma-separated list in this example model causes the Stop Watch block to use the six values in its vector input signal to assign these parameters to the block, in sequence:
0
, of the large needle
2
, of the small needle on the left
1
, of the small needle on the right
Note It is important that each needle's ID number precede its numerical value. Referring first to the ID number tells the block which needle to apply changes to. |
Preparing the Input Signal for the Stop Watch Block
The model aims to reflect the time on the Stop Watch block. However, it is necessary to process the Clock block's output somewhat to prepare it for the Stop Watch block. Double-click on the Subsystem block to open it. The subsystem accomplishes two key tasks:
![]() | Controlling Multiple Graphical Elements | Updating Multiple Portions of a Pie Chart | ![]() |