Interactive Simulation

TANGRAM-II allows to be performed. Then all state variables described in the model are updated during the evolution of the simulation. This kind of simulation is useful for debugging the model, and for educational purposes.

Animation is another feature available to the user. In this case, the object has pre-defined animations that are executed according to the states the object reaches.

The animation is specified by the user, by introducing a new attribute to an object: the Animation attribute. Using this attribute, the user should specify the animation of the object and others related objects. Note that the object being used in the model specification should not be used for simulation with animation. A separate TGIF object should perform the animation. The procedures, of calling an animated object and of specifying an animation, has to be done using TGIFs internal commands, that are similar to a programming language. TGIF supports a few animation primitives that can be used to perform the animations. A good reference of all supported commands can be found in the TGIF manual (http://bourbon.cs.umd.edu:8001/tgif). After a simulation step, the animation starts and a pre-defined number of animation steps are executed before resuming the simulation. ``Simultaneous'' animation of different objects are allowed and each animation is performed only at specified steps. The Interactive Simulation Module is shown in Figure [*].

Figure: The Interactive Simulation Module.
\includegraphics[width=4in]{figuras/iterativesimulation.eps}

We have three types of interactive simulations. The first, called step simulation, allows the user to specify the number of steps to be executed before the simulation is interrupted. In the second type, continuous simulation, the simulation is stopped at each transition of the model. Finally, the third type is simulation with . Each time the simulation stops, the user can observe on the canvas the current values of the model's state variables.

The following parameters must be given to an interactive simulation :

  1. Step Simulation - The parameter to be given is the number of events executed between two consecutive stopping points.
  2. Continuous Simulation - In this case, the parameter is the time, in milliseconds, that the interface, will be frozen before the next transition takes place.
  3. Animation - The user can choose one of the following parameters: time between steps or time scale. The first parameter is the same as the parameter ``time'' defined for the continuous simulation. The second is defined to allow the user to observe the transitions of the model at a time scale proportional to the rate that they occur. For example, if the time till the next transition is $10$ units and the time scale is $100$ms, when this transition fires, the simulation stops for $1000$ms.
After entering the parameters, the user can click on the Simulate button. Then, a box appears with the options start, step, end and close as shown in Figure [*]. To start, the user should click on the start button, and a screen with the model is opened (in this screen a new box at the upper left-hand corner appears with the number of transitions of the model and the simulation time - see figure [*]).

The simulation behavior depends on the type previously chosen. If the user choose , the values of the state variables are displayed at each step. To proceed to the next step, the user has to click on the step button (see Figure [*]). To end the simulation, the user has to click on the end button which closes the interface, and then on the close button.

If the option chosen by the user, was continuous simulation, he/she should click on the step button. Then, after each transition of the model, the values of the states variables are displayed at intervals equal to the given time between steps. To stop the simulation, the user must click on the progress indicator of the TGIF interface (see Figure [*]). After stopping, she can resume the simulation by clicking on the step button or she can finish the simulation by clicking on the end button.

If the option chosen by the user, was , he/she should click on the step button. Then, after each transition of the model, the values of the states variables are displayed at intervals equal to the given time between steps. To stop the simulation, the user must click on the progress indicator of the interface (see Figure [*]). After stopping, she can resume the simulation by clicking on the step button, or she can finish the simulation by clicking on the end button.

In the animation option, the procedure to be employed by the user is the same as for continuous simulation.

Figure: The box used to control interactive simulation
\includegraphics[width=3in]{figuras/box-iter-simul.eps}

Figure: TGIF interface - Progress Indicator - Interactive simulation
\includegraphics[width=3in]{figuras/indicator.eps}

Guilherme Dutra Gonzaga Jaime 2010-10-27