Page 614 - ExtendSim User Guide
P. 614

Creating a Custom User Interface
Interacting with the model user
The Slider is useful to output a number in a range when the number does not need to be exact or to experiment with model parameters. For example, if you have an Activity block where you want to specify the delay as the simulation is running and a delay of 8 is slow but a delay of 2 is fast, you might put in a Slider with 8 as the maximum and 2 as a minimum. Then, as the simulation is running, simply drag the Slider’s bar up and down to indicate slow and fast.
The Switch control looks like a standard LED switch that glows green when it is on. It has two inputs and one output.
Off On
Switch showing off and on states
The Switch outputs either a 0 (zero) or a 1
(one) depending on the state of the LED. When you click on the left side, the Switch turns off, the LED turns dark gray and the Switch outputs a 0 (zero). Clicking on the right side (the side with the LED) causes the Switch to turn on, the LED to glow green, and the Switch to output a 1 (one).
The Switch control is valuable in controlling blocks that have true-false inputs. For example, you might attach a Switch to the SelectIn connector of a Select Value Out block, as shown below.
The input connectors at the bottom of the Switch are used to change the state of the Switch by setting their side of the Switch to true from within your model. For example, you might want to set the Switch to off when a model starts, then change it to on after some period of time. The next time you run the model, the Switch would be automatically set to off again when the model begins.
When either of the Switch’s inputs gets a true value (defined as 0.5 or greater), it selects that side of the Switch. If the other input later gets a true value, the Switch will shift to that side.
Using a Switch (on state) with a Select Value In block
☞ If an input receives a true value and that side of the Switch is already selected, no change is made.
The Meter visually displays how values vary between a known maximum and minimum. Set the maximum and mini- mum values through the Meter’s dialog or by connecting other blocks (such as Constant blocks) to the top and bottom connectors.
This is a good control to use if you want to see values while
the simulation runs but you don’t need to save them to a plotter.
Interacting with the model user
Using a Slider with an Activity block
Some ExtendSim blocks provide a convenient method for monitoring conditions in the model, requesting input from the user, and reporting changes. In addition, if you build your own blocks you can add customized alerts and prompts to display results and prompt for input data.
Maximum Current Minimum
How To

   612   613   614   615   616