We will now show an example of an done with the M/M/1/k
model. This animation consists of two parts. The packet being sent from the
source to the queue, and the increase/decrease of the queue size. The animation
of the queue size is done by an rectangle object named ``_BAR_''. This
object stretches its size to the appropriate value of its variable . The object
Exp_Server has the following Animation attribute:
Animation= get_line_in_attr(result1, Watches, 1); tokenize(result2, $(result1), "="); get_line_in_attr(q, result2, 2); assign(_BAR_.n, $(q)); if("$(__SIMULATION_STEP__.Ani_T_Steps)"== "$(__SIMULATION_STEP__.Ani_C_Step)", _BAR_.animate, NULL);This code gets the current value of the queue state variable and sets the variable
To animate the movement of the packet from the source to the queue it is
necessary to modify the behavior of the object Packet_Source. The
can depend only on an object's state variables changes. In
order for the animation to occur only when a packet is transmitted, a state
variable change must occur. We modify the dummy state variable to switch
between states 0 and 1. Every time a packet is transmitted the state changes. By
doing this, the Animation attribute can decide when to play the animation of the
packet movement.
Animation= get_line_in_attr(result1, Watches, 1); tokenize(result2, $(result1), "="); get_line_in_attr(s, result2, 2); if("$(s)"!="$(s_ant)", _PAC_.animate, NULL); if("$(__SIMULATION_STEP__.Ani_T_Steps)" == "$(__SIMULATION_STEP__.Ani_C_Step)", Reset_S, NULL); Reset_S= assign(s_ant, $(s));This code checks to see if the state variable
At the last animation step, it stores the new value for the state variable .
The object _PAC_, illustrated in Figure
, has the
animate function which moves the object horizontally to the left. At the first
step, this object records its position. For every step it uses
the number of the animation step to calculate the new
coordinate and shift
the object to the left. At the last step of the animation it restores its
original position.
Many other complex animations can be specified. The user can basically define any possible graphic command supported by . Sometimes the user will need to modify the behavior of the object in order to get the desired .
Guilherme Dutra Gonzaga Jaime 2010-10-27