Peter Lorenz German smaller fonts Simulation und Animation

2.1.3. Animation Time and Animation Commands


In the Run-Mode an Animation Time or Animation Clock starts running. It runs at a constant but adjustable Speed. The Animation Trace file (ATF) contains Animation Commands, that are being processed in Run Mode. They relate to animation time, objects, positioning of objects, changing the state of objects and motion. Apart from that they relate to Messages, Bars and Plots, that change during the runtime of the animation.
This Chapter deals with animation commands for generating, placing,moving, rotating and terminating objects

Run-Mode of Proof AnimationTop Line

The Run Mode is for starting and controling an animation run. The run of a animation can be understood as a sequential processing of an ATF. The run ends, when the final End command has been processed. The following figure shows how a running animation can be controlled.

Run-Menu

Menu and Tool Bar in the Run Mode

:

Start animation Start
starts the animation from the begin of from the time when the run has been stopped.
Stop Stop
appears during a run in red color and is used for stopping an animation run.
Jump ahead/back in time Jump
allows the animation start from a point of time to be specified by the user
Adjust viewing speed Adjust Viewing Speed
specifies the relation of viewing and real time. The default value is 6. Six units of animation time are presented in one second.
.

Animation Time and Real TimeTop Line

.

Simulationszeit oder simulierte Zeit beginnt ihren Lauf beim Zeitpunkt Null, dem Startpunkt eines Simulationslaufes. Von dort aus schreitet sie von einem Ereigniszeitpunkt zum nächsten fort."," The simulation system GPSS/H, which will be introduced and explained in the following chapters, uses positive real values to represent the time. The simulation time or simulated time starts to run at zero which is the beginning of the simulation runtime. From there it steps forward from one event to the next") ?>

Animationszeit in Proof Animation beginnt bei Null und hat wachsende, reelle Werte. Im Unterschied zur Simulationszeit verändert sie sich während eines Animationslaufes, also im Run-Modus, in kleinen äquidistanten Schritten. Für jeden Schritt wird ein neues Bild errechnet und gezeigt. Dabei ist das Animationssystem darum bemüht, eine möglichst strenge Proportionalität zwischen Realzeit und Animationszeit einzuhalten und muss dazu bei Bildern mit sehr vielen bewegten Objekten die Bildwiederholfrequenz der Rechenleistung anpassen.", "The animation time in Proof Animation starts at zero. Other than the simulated time, the animation time changes during the animation runtime, that is in the run mode, in small steps. For each step a new picture is calculated and displayed. The animation system tries to keep a realistic proportion between realtime and animation time. In the case of very many moving objects the refresh rate has to be adapted to the computing performance.") ?>

Einheit der Animationszeit kann frei interpretiert werden. Es ist dem Nutzer überlassen, ob er eine Sekunde, eine Minute, eine Stunde oder einen Monat als Zeiteinheit benutzt und die Animationszeit entsprechend interpretiert. Generell ist davor zu warnen, für die Simulation eine andere Interpretation der Zeiteinheit zu wählen, als für die Animation. Wenn die Zeiteinheit des Simulationsmodells als Minute interpretiert wird, sollte dieselbe Interpretation auch für die Zeiteinheit der Animation gelten.", "The unit of the animation time is left to individual interpretation. It is for the user to decide whether to interpret a unit of the animation time as a second, a minute, an hour or a whole month. Generally it is to be avoided to use different interpretations for simulation and animation. If one step of time in the simulation model is interpreted as a minute, the same interpretation should be used for the animation.") ?>

Select the animation time unit and format

View selektiert und Toolbar Date/Time Format wählt, erhält man das nebenstehende Bild. Hier kann man nun die gewählte Zeiteinheit eintragen und eine Startzeit spezifizieren.", "After the decision about the animation time unit the format of the display of thisw time can be specified. The current animation time is displayed on the right of the toolbar. The display format can be specified in the Draw mode. After selecting View and Date/Time Format the window shown on the left hand appears. Here the animation time unit and a starting time can be selected.") ?>

The step by step steady run of the animation time contains certain points when the runtime system of Proof Animation™ gets new instructions. Those points are defined by Time and DT commands in the ATF.
At the start of the animation runtime the clock starts running at 0 and the first animation commands (ATF-commands) are processed, which are placed at the beginning of the ATF. The commands can create, put and move Objects. The runtime system controls started motions until their end.

Time
is a command that triggers all following actions until the chain of commands is broken by the next Time or DT-command . The syntax is:
Time value
value Animation time, that has to been wait for until executing the following commands

DT
is a command, that marks a time difference or the length of a time interval, that passes until the following actions are executed The syntax looks like this:
DT value
value Length of the time interval until the next actions take place.

Time and DT are of essential meaning for the understanding of ATF's and shall be explained by the following example:

The ATF - Commands used in this example are explained in the following chapters.

Creating, Positioning and Destroying ObjectsTop Line

In the following the already used ATF commands for creating, positioning and destroying objects are described.

Create
is a command for creating objects of a class defined( and by that usable) in the layout file. The syntax is:
Create classID objectID
classID Name of the class, of which an object shall be created
objectID Name or number as identifier of the object
Destroy
is a command to destroy an existing object. Its syntax is
Destroy objectID
Place at
is a command for positioning an object on a specific position on screen. The syntax is
Place objectID at x y
x, y Coordinates in the global coordinate system of Proof. They set the place for the center of the local coordinate system of the object.
Please note that Circle, CIRCLE and circle are three different names.
After being generated by Create an Object remains invisible until it is assigned at a location by Place at. After executing Destroy it disappears.

Moving ObjectsTop Line

The commands that have been introduced are already enough to make objects move on the screen. Only a sequence of Time and Place at commands is necessary to move an object in small steps across the screen and by that give the impression of continuous motion. The user of Proof Animation™ is disburdened from this cumbersome way of describing motions. Objects can be

nächsten Abschnitt behandelt. Im folgenden geht es um die Bewegung zwischen zwei Punkten", "Objects on paths will be explained in the next chapter. The following explains the motion from one point to another") ?>.

Move
is an animation command that initiates (without specifying an acceleration) the straight motion of an object from one point to another. Therefore are two different syntax variants:
Move objectID duration xtarget ytarget [relative]
Move objectID speed s xtarget ytarget [relative]

Operand
duration is the duration of the motion
s is the speed (distance/time)
relative specifies that xtarget- and ytarget values are interpreted not absolute but relative to the origin point
:
Move objectID speed s acceleration a xdest ydest [relative]
Move objectID speed s1 endspeed s2 xdest ydest [relative]
The following ATF uses three Move commands. As you see, the motions of the objects (T1 and Cnew) can overlap each other in time.
Time 20                20 time steps are executed
Create Triangle T1     creates the triangle T1
Place T1 20 5          puts it on the location (20, 5)
Move T1 30 80 5        moves it during 30 time steps to the location (80, 5)
Time 30                Debug-Stop at T1(x)=20+(80-20)x(10/30)=40
Time 40                T1(x)=60
Time 50                T1(x)=80
Time 70               
Move T1 20 10 15       T1 is moved obliquely up left
Create Circle Cnew     Cnew is created,
Place Cnew 10 10       placed
Move Cnew 20 80 10     and moved to the right.
Time 80
Time 90
Time 100
Destroy Cnew           Cnew is destroyed
End
The processing of this ATF needs a layout file where the classes Triangle and Circle are defined. The following Layoutfile is suitable for that
Download Layout ATF
Define View "(Home)" center 40 30 Width 99.2969 Grid Size 1 10 Ortho Aspect 1 0.5 Speed 6
Define View "(Class)" center 0 0 Width 9.9297 Grid Size 0.1 1 Ortho
Define color Backdrop  0.8 0.749 0.549
Define color F1 0 0 0.6667
Define color F2 1 0 0
................
Color F1
Define Class Circle
Arc 4 0 0 0 360 6.2832
Fill -0.5512 -1.3024
End
Color F2
Define Class Triangle
Line 0 4 -4 -4
Line -4 -4 4 -4
Line 4 -4 0 4
Fill 0.6512 -1.8364
End
Color F7
Define Class Square
Line -1.6 1.6 -1.6 -1.6
Line -1.6 -1.6 1.6 -1.6
Line 1.6 -1.6 1.6 1.6
Line 1.6 1.6 -1.6 1.6
Fill 0.0696 -0.6932
End
Color F3
Line 0 26 86 26
Line 10 1 10 0
Line 30 1 30 0
Line 40 1 40 0
Line 50 1 50 0
Line 60 1 60 0
Text 1 1 LJ 0 -2 0
Line 86 0 0 0
Line 20 1 20 0
Text 1 1.2 LJ 9 -2 10
Line 86 26 86 0
Line 70 1 70 0
Line 80 1 80 0
Line 0 0 0 26
Line 0 10 1 10
Line 0 20 1 20
Color F2
Text 1 1.8 LJ 2 22 Layout23
Color F3
Text 1 1.2 LJ 79 -2 80
Text 1 1.2 LJ 49 -2 50
End

I advise to use the Debug Mode of Proof and process the ATF in single steps.

hier klickt, sieht man die Animation aus dem aktuellen Beispiel.", "Proof animations can also be saved and presented as videos. Click here to view the animation of the current example.") ?>

Coloring ObjectsTop Line

During the animation runtime the color of an object can be changed e. g. to emphasize changes of state. For that the command Set Color is used.

Set Color
is a command to change the color of an object during the animation runtime. Its Syntax looks like this
Set objectID Color color/Class.
Operand
objectID
color is the color which is coded by F1 to F32 (Foreground), L1 to L32 (Layout) and Backdrop for the default background color. The RGB-components of those colors can be changed selecting Setup->Colors.
Class restores the predefined color for this object class

To understand color effects that occur when picture components collide a three layer model can be used.

  1. Backdrop. Sie wird durch die beiden darüberliegenden Schichten verdeckt.", "In the lowest layer is the background color Backdrop. It is covered by the next two layers.") ?>
  2. L1 bis L32.", "In the second layer are the picture background colors L1 up to L32)") ?>
  3. F1 bis F32. Sie verdecken die Farben beider darunterliegender Schichten.", "In the upper layer are the foreground colors F1 to F32. They cover the two layers below.") ?>

Rotating Objects Top Line

Objects can be rotated on a spot or during the motion. The rotation is initiated by the ATF command Rotate. Similar to the Move command the runtime system of Proof Animation™ executes the execution of the process. It can be limited in time or unlimited. Time unlimited rotations end with the end of the animation run.

Rotate
is a command that starts the rotation of an object around the center of its local coordinate system. The rotation speed (degree/time) is constant. The syntax is:

Rotate objectID [to] angle [Time duration] [Step stepsize]
Rotate objectID [to] angle [Speed rotspeed stepsize]


Operand
to initiates the rotation from its actual position to the angle specified by angle. If the to is left out the object is rotated relative to its actual position by the specified angle
angle is the angle to rotate the object clockwise.
duration sets the duration of the rotation.
rotspeed sets the speed of the rotation in degrees/timestep. If the speed is set to 0 the rotation is stopped.
stepsize sets the quality of the representation of the rotation. It is preset to 30 degrees. If that is too coarse it can be changed by this operand. Please note that for every used direction a bitmap of the object has to be created. Too small steps can therefore cause an overflow of the bitmap memory.
Examples For Rotate Commands
Rotate 1 to 50           rotates object 1 to 50 degree from normal position in no time.
Rotate 1 -120 Time 10    rotates object 1 120 degrees clockwise and takes 10 timesteps for it
Rotate 1 -120 Speed 12   does the same thing as the last command.
Rotate 1 Speed 6         rotates the objects 6 degrees/ timestep without an end.
Rotate 1 Speed -1 Step 6 rotates the object clockwise like a second hand.

The following picture shows the schematic representation of a vehicle that is originally moving in horizontal direction over the screen. Meanwhile the wheels are rotating with a rotation speed that has to be adjusted to the speed of the vehicle.

Figure: Moving car with rotating wheels
Download AVI LAY ATF

Generate a Trace File Using GPSS/H

The following GPSS/H example generates an ATF with Time-, Create-, Place-, Move- und Rotate- Statements.


Extracts from the Layout file are displayed below.

Color F1
Define Class Small
Fill -4.7461 3.9453
Arc 0.8 -5.5 3.5 0 360 0
Arc 1 -5.5 3.5 0 360 0
End
Color F11
Define Class Big
Fill -16.8359 8.6563
Arc 10 -12.5 8 0 360 0
End
Color F7
Define Class Medium
Fill 7.3938 5.2258
Arc 5 9.5 5.5 0 360 0
End

Download AVI LAY ATF

Animation Trace Files and Other Proof Files

Up to now Layout files and ATF's have been introduced as the probably most important files that Proof Animation™ works with. At this point an overview over important files that Proof can read or write is listed below.

Name+Content
Layout-FileLAY Background picture, Paths, Classes, Messages, Bars and Diagram
Animation Trace File ATF Animation commands controling the animation run
Presentation File PSF Presentation commands for performing a presentation
Log-FileLOG Error messages from the animation run
LinkageFileLKG Data about start and end positions and the length of Paths

The column marked with a + contains the file extensions. The colors are used to mark files of the specific type and make them easier to identify.

Quizzes for Chapter 2.3 Top Line

  1. !
  2. ?
  3. Time und DT", "Explain how the ATF commands Time and DT work") ?>!
  4. Time-Kommandos und seine Stellung im Animationstracefile", "Explain the effects of the Time command and its position in the ATF") ?>!
  5. Run-Modus", "Please remember some functions of the Run Mode's main menue") ?>!
  6. ?
  7. ?
  8. Move-Kommandos gibt es?", "Explain two versions of the Move command!") ?>
  9. ?
  10. ?
  11. ?

SAHome previous next up Germansmaller fonts Top Line
Last Modified Fri 05-27-11 06:54 GMT Valid CSS!
English Translation:K. Eidner

Comments please to:pelosim@yahoo.com