Simulating a Behavior with Interaction
Input Elements
If prepared for, you can execute and modify interactively the behavior of the
components in a diagram.
By modifying the behavior, you can provide your own input into a simulation.
Interaction is limited to 2D only; if your model includes 3D, this is displayed, but you
cannot interact with it.
The command is used for models with 2D diagrams containing interactive elements, which
can be manipulated during simulation. Several types of interactive element exist (push
buttons, sliders, text, etc.) exist. The following elements from the UserInteraction
library are supported by this command:
Element
Comment on Usage
UserInteraction.Inputs.NumericInputIO
Input field to specify a numeric value. Click the
field to specify a value, press Enter to validate
the change.
UserInteraction.Inputs.Slider
Slider to specify a numeric value.
Important:
You must click the wanted position. Dragging is not
supported.
UserInteraction.Inputs.Knob
Knob to specify a numeric value.
Important:
You must click the wanted position. Dragging is not
supported.
UserInteraction.Inputs.TrigButton
Button to specify a Boolean signal to "on". Click to
activate.
UserInteraction.Inputs.ToggleButton
Button to toggle a Boolean signal. Click to toggle.
The interactive elements are created using specific Modelica annotations. This means that
other elements using the same annotations in the same way are also supported.
In this scenario you open, simulate, and modify interactively the model example
UserInteraction.Examples.TestInteraction to see the three
first elements in the table in work.
Note:
To see the Boolean elements in work, you can
open UserInteraction.Examples.TestBooleanInteraction instead.
Before you begin: To open the model and specify a suitable stop time of the simulation, do the following:
Note:
The library UserInteraction can
only be opened using search.
Display the Simulation Setup dialog box, see Setting up a Simulation. In the
General tab, specify the Stop
time to 60s to have enough time to work with the example while
it simulates.
To simulate with interaction, you must, in the simulation setup,
the
General tab, activate the option
Interactive simulation.