Animations

From Support

Jump to: navigation, search

Contents

Building Animations

Animations created with SIGMA are fundamentally different from those using other simulation animation software. Most simulation modeling environments have a separate program for the simulation and an add-on program that does the animation; in SIGMA the simulation and the animation are identical. The event graph model becomes the animation. Animating a SIGMA model is extremely simple; you are limited only by your imagination and the speed and memory of your computer. In the tutorial that follows, we will develop a simple animation, use it to find an error in our model, and then fix the error.

Perspective and Basic Principles

Animations are one of the more entertaining aspects of simulation modeling. However, it is important to keep them in perspective. Animations are most useful during model development and testing. Their main strength is in helping to find gross logic errors in a model. Once a model is developed and experiments are being run, animations have almost no practical value. Output plots and spreadsheet statistics are the major tools for analysis. Finally, after a study is completed and different systems are being demonstrated, animations once again become very useful.

While animations are useful verification and demonstration techniques, there are some disadvantages to keep in mind. Animations have little analytical value. Modifying a system based on the experiences of a few minutes or even hours of animated operations is not wise. Even as a demonstration, the time spent by managers watching even the most carefully crafted animation is typically just a few minutes. The requirements for an animation will almost always force you to develop a more cumbersome model than necessary, with many details that are added simply to support the animation. Take, for example, a system with 100 machines processing thousands of parts an hour. We can simulate this system with an event graph having only three or four vertices. If one hundred machines are added, the model does not change To animate the system, a different representation will be needed for each machine. This is true regardless of the particular simulation software your are using. However, it is easy to add the detail necessary for an animation to an event graph by connecting additional subgraphs.

Animating a SIGMA model is simple. The balls that represent event vertices are replaced by two types of pictures: one image appears when the vertex executes, and the other appears when the vertex is inactive. These two pictures are in the form of bitmaps that are selected from the Edit Vertex dialog box by clicking on the Active Picture or Inactive Picture buttons. For fancy animations, the pictures can be actual scanned photographs; they can also be simple drawings created by a drawing program. In our tutorial, we will use pictures created with Windows Paint.

Each individual picture used in SIGMA cannot be larger than 64,000 bytes; however, you can use as many pictures as your computer's memory or version of SIGMA will allow. Hint: If you are creating pictures using Windows Paint, limit the picture sizes to less than two or three inches square using the Image/Attributes menu item. Save the picture as a 16 color bitmaps or monochrome bitmap (which are good for sequencing video files) using the Save As option.

The fancier the pictures, the more impressive the animation will be. However, remember that others will probably not spend more than a few minutes looking at your animation. You can use an inexpensive digital camera to take the pictures for your simulation (of course, crop the pictures so that the bitmaps are less than 64,000 bytes in size).

Classes of Animated Objects

To get started, it will be helpful if we think of the physical entities in a system as belonging to one of three classes:

  1. Static resident entities (such as halls and windows in a building): These entities do not change their appearance when the state of the system changes during a simulation run.
  2. Dynamic resident entities (such as machines): These entities may change their appearance when the state of the system changes, but they remain at the same location.
  3. Transient entities (such as parts, customers, and cars): These entities may change their appearance and location while the simulation is running.

The three classes of physical entities are represented by different combinations of active and inactive pictures. For static resident entities, the active and inactive pictures are identical.

Dynamic resident entities typically will have different active and inactive pictures; the active picture represents a transitional state, and the inactive picture represents the state immediately after the vertex executes. Furthermore, a dynamic resident entity will often have several vertices stacked (or "grouped") on top of each other so that the picture of the current state of the entity is showing. You can think of the inactive pictures for the grouped vertices associated with a dynamic resident entity as the frames of a video of the entity and the active pictures as transitions between these video frames that smooth out the motion.

Transient entities will have an active picture that is a representation of the entity and a inactive picture that is blank. Some of the vertices in our original event graph might trigger some movement of a transient entity. For example, in our carwash model, the ENTER event might trigger a dirty car to enter the carwash and a LEAVE event might trigger a clean car to move away from the carwash. This movement is represented by a string of vertices along the transient entity path of motion triggered by the event. For example this figure shows our original carwash model with a string of vertices attached to the ENTER and LEAVE events.

Strings of Vertices added to ENTER and LEAVE Events of CARWASH.MOD.Cars Entering and Leaving Facility.
Strings of Vertices added to ENTER and LEAVE Events of CARWASH.MOD.Cars Entering and Leaving Facility.

When the active pictures are represented by clean and dirty cars and the inactive pictures are represented by blank pictures the size of the cars, the result will be like this figure. (The Select All button in the Edit menu was pressed to show all the animation elements.)

Strings of Vertices added with Active Pictures Showing; represents Cars Entering and Leaving the Carwash Facility.
Strings of Vertices added with Active Pictures Showing; represents Cars Entering and Leaving the Carwash Facility.

These paths of motion are very easy to create. Simply use the Create Single Edge tool to create the first vertex in the string. Edit the active picture for the new vertex to be a bitmap of the transient entity and the inactive picture to be a blank bitmap the same size as the transient entity. Now select the Create Process tool and click a string of vertices that can later be moved along the desired path of motion. (The string of vertices will have the previous pictures as defaults.)

Bitmaps of the proper size are easily created using the Windows Paint utility and sized using the Attributes command in the Image menu. Clipping scanned photographs of the transient entity will make the animation look more like a video movie.

The delay times on the edges between these transient entity motion vertices can be set to represent actual move times, including acceleration and deceleration. The Time Steps run default mode along with a TIMER vertex should help make the motion smoother. (A "timer" is a self-scheduling vertex with an edge delay time of one time unit.). If you have a slow computer, you might change some of the edges between the transient entity motion vertices to be pre-emptive edges (delay=*). However, have no more than four or five pre-emptive edges execute in a sequence. If there are more than five in a sequence, increase your Windows stack to avoid a stack overflow.

The three types of entities are summarized in the table below.

Physical Entity and Picture Representations for Animations
Physical Entity	             Active Picture or Inactive Picture     "Groups" of Stacked Vertices
Dynamic Resident Entity      Transition/ Ending State	             Yes
Static Resident Entity	     Same Pictures for both	             No
Transient Entity	     Picture/blank	                     No

Tutorial: Animating Resident Entities

We will animate a simulation model from the SIGMA directory, BRKDN.MOD. This model represents a single machine, with periodic failures, that processes parts that arrive at random times. We will use each of the three basic types of animated objects discussed earlier, beginning with resident entities. The event graph for BRKDN.MOD is shown in this figure. Follow along on your computer as we animate this model.

Event Graph of BRKDN.MOD
Event Graph of BRKDN.MOD
Start a SIGMA session.
Open the model, BRKDN.MOD.

To represent the states of the queue (a dynamic resident entity), we will use a subgraph on your SIGMA directory called, QSIZE.MOD. You should minimize the current SIGMA window and open a separate SIGMA session from the Windows Start menu. Read QSIZE.MOD into this new SIGMA session. The event graph should look like this figure

Click the Minimize button on the BRKDN.MOD SIGMA session.
Return to the Start Menu and open a second session.
Click the Open/Event Graph command under the File menu, locate QSIZE.MOD, and double-click on it.

In QSIZE.MOD, simple active and inactive pictures drawn with the Windows Paint utility represent the different states of a queue. Vertices represent 0, 1, 2, 3, and >3 customers in the queue. The variable, QSIZE, represents the current size of the queue. If you explore QSIZE.MOD a bit, you will notice that vertex 0 has QSIZE passed to it as a parameter. Also note that the values of QSIZE are tested on each of the edges to see which picture is appropriate. Click on the vertices and edges to see how QSIZE.MOD works. It is very simple and serves no purpose other than animation. Do not "save" QSIZE.MOD if you mess it up, but rather "read" it into your SIGMA session again.

Event Graph for QSIZE.MOD, with Inactive Pictures Showing
Event Graph for QSIZE.MOD, with Inactive Pictures Showing

The next step will be to copy QSIZE.MOD and paste it into your other SIGMA session with the model BRKDN.MOD.

For QSIZE.MOD, click the Select All command under the File menu.
Click the Copy command under the Edit menu.
Click the Minimize button on the QSIZE.MOD simulation window.
Activate the BRKDN.MOD SIGMA session.
Press the Paste command under the Edit menu for BRKDN.MOD.
BRKANAM1.MOD After Pasting QSIZE.MOD into BRKDN.MOD
BRKANAM1.MOD After Pasting QSIZE.MOD into BRKDN.MOD

Hold the mouse button down on one of the newly copied vertices of QSIZE.MOD and drag the entire subgraph off to the side. (You might have to re-select these vertices by holding [Shift] and clicking on them before you can drag the selected subgraph out of the way.) If your screen looks something like this figure, the transfer was successful, and you can close the SIGMA session with QSIZE.MOD. The model in this figure is called BRKANAM1.MOD in your SIGMA directory.

With the QSIZE.MOD subgraph still highlighted, drag it off to the side of BRKDN.MOD.
Click the Minimize button on the BRKDN.MOD event graph.
Close the QSIZE.MOD SIGMA session.
Re-open BRKDN.MOD.

Now we will simply wire the new QSIZE.MOD subgraph into our model by drawing two edges: One edge from the ENTER event to the 0 vertex of QSIZE.MOD and the other edge from the START event to the 0 vertex of QSIZE.MOD. These two edges should pass the attribute value of QUEUE (into the QSIZE parameter of vertex 0) to let the subgraph know the current number of parts in the system. The delay time for these edges should be an asterisk (delay = *), meaning pre-emptive execution, and they should be unconditional (Condition: 1 == 1). This model is BRKANAM2. Next, select all of the vertices in the QSIZE.MOD subgraph and stack them on top of each other.

Click on the Create Single Edge tool.
Create an edge from the ENTER vertex of BRKDN.MOD to Vertex 0 of the QSIZE.MOD subgraph.
Create another edge from the START vertex of BRKDN.MOD to Vertex 0 of the QSIZE.MOD subgraph.
Click on the Select or Edit tool.
Double-click on each new edge; edit each dialog box so the delay time is *.
Highlight the QSIZE.MOD subgraph by lassoing the vertices or pressing [*Shift] and clicking the mouse.
Click the Group Vertices command under the Edit menu.
The Assignment of Bitmaps to Active and Inactive Pictures for BRKANAM3.MOD
Vertex	 Representing	           Type of Entity	Active Bitmap	Inactive Bitmap
Run	 A Section of Track	   Static Resident	TRACK.BMP	TRACK.BMP
Enter	 A Customer	           Transient Entity	CUSTOMER.BMP	BLANK.BMP
Start	 Machine Working (Yellow)  Dynamic Resident	START.BMP	BUSY.BMP
Leave	 Machine Available (Green) Dynamic Resident	LEAVE.BMP	IDLE.BMP
Fail	 Machine Broken (Red)	   Dynamic Resident	FAIL.BMP	BROKEN.BMP
Fix	 Machine Available (Green) Dynamic Resident	FIX.BMP	        IDLE.BMP

Now we will assign pictures to the other vertices according to the above table. Note that the static resident entity of the track is represented by the RUN vertex and has the same active and inactive pictures. The ENTER vertex represents the transient entity of a part entering the system; it has a blank bitmap for its inactive picture. The four vertices (START, LEAVE, FAIL, and FIX) represent various events for the machine, which is a dynamic resident entity. These vertices have transitional bitmaps as their active pictures; their inactive pictures represent the state of the machine immediately after the event occurs. The resulting model is BRKANAM3.MOD in your SIGMA directory.

Double-click on the RUN vertex to open the Edit Vertex dialog box.
Press the Inactive Picture button to open a dialog box with a list of bitmaps.
Scroll through the list until TRACK.BMP is located; double-click on it.
Press the Active Picture button, locate TRACK.BMP, and double-click on it.
Press the OK button at the bottom of the dialog box.
Repeat this process with all the vertices, using the active and inactive pictures specified in the above table.

Next, we will group the four vertices that represent the various states of the machine (START, LEAVE, FAIL, and FIX) into one machine, and then we will combine the objects on the screen. The animation, BRKANAM4.MOD, looks something like this figure.

Event Graph for BRKANAM4.MOD, A Resident Entity Animation of BRKDN.MOD
Event Graph for BRKANAM4.MOD, A Resident Entity Animation of BRKDN.MOD
Highlight the START, LEAVE, FIX, and FAIL vertices using [*Shift] and the mouse.
Click on the Group Vertices command under the Edit menu.
Click on the Select All command under the Edit menu.
Next, click the Hide Selected Edges command also under the Edit menu.
Drag the objects to locations similar to that in this figure

You should load BRKANAM4.MOD and run it to see what happens. The simulation has become the animation. An add-on animation program would add an unnecessary layer of software between you and your model. Try clicking on some of the objects in BRKANAM4.MOD; you can Ungroup Vertices and Show All Edges using the commands under the Edit menu. You can double-click on vertices or edges and change their behaviors.

A final note about dynamic resident entities: in some cases it may be necessary to offset some of the pictures in a group representing a dynamic resident entity. For example, we may want to have a robot arm sticking out the side of a machine. The robot arm is part of the resident entity representing the states of the machine (the arm would be represented by a vertex that is grouped with the other machine state vertices). However, it has a blank inactive picture so that the arm would appear to retract. The arm is moved off to the side of the rest of the vertices in this group by slowly clicking on the group (so that it is not interpreted as a double click) until the arm appears. It is moved to the side, down, or up using the arrow keys. The other vertices in the group remain in their previous positions. Using the arrow keys to move a single vertex in a group can also give a sense of realism in animations of living things. (See SIGMA model, TOUCAN.MOD, where the body of the bird was moved slightly using the arrow keys to make it appear to "wiggle.") Moving only one of the vertices in a group with the arrow keys is a powerful animation technique. The saved model has vertex groups listed at the bottom of the file. This shows the group members with their "offsets" from the center of the group.

You will soon notice that the animated model, BRKANAM4.MOD, is a bit dull. This is because we have not yet added transient entities to our animation. It is the transient entities that move across the screen and bring our animations to life.

Tutorial Continuation: Animating Transient Entity Motion

Adding transient entity motion is quite simple in SIGMA. As discussed earlier, you simply attach a string of vertices to an event that will represent the path of motion of the transient entity when the event occurs. The active picture for transient entity vertices is a picture of the entity. Here a simple colored bitmap of a bar is used to represent the part moving to and from the machine. Transient entities have a blank inactive picture the same size as their active picture. The active picture flashes at the current location of the transient entity. This picture is then blanked out when the transient entity moves on. The vertices in such a string will typically have no state changes associated with them and are connected with an unconditional edge with pre-emptive execution (delay = *). This figure illustrates adding a transient entity leaving the machine after the LEAVE event. (The Select All command was clicked to show the active pictures of the new vertices.)

Adding a String of Vertices to Represent Movement of a Transient Entity
Adding a String of Vertices to Represent Movement of a Transient Entity
IMPORTANT:  Do not connect more than four or five vertices in a row with edges that have a delay
of *. Insert an edge with zero delay to avoid a stack overflow condition.
Open BRKANAM4.MOD or continue with the model you have been developing.
Click once on the group of vertices represented by the box. This will be the starting point for the path followed by a transient entity.
Since the starting point of the transient entity must be a vertex, click the Ungroup Vertices command under the Edit menu to ungroup these vertices.
Click the right button to get into Create Process mode; click the left mouse button on the location of the first point of the transient entity path.
Note that the vertex you create will be a duplicate of the last vertex created when building the model.
After getting into Select or Edit Mod, double click on this new vertex.
Assign CUSTOMER.BMP to the Active Picture and BLANK.BMP to the Inactive Picture. Press the OK button in the dialog box to incorporate the new images into the event graph.
Check if this is successful by clicking on a blank space; the transient entity image should disappear.
Click again under the number of the new vertex; the transient entity image should reappear.
Click on the right button to get into Create Process mode.
Click several times along the path to be followed by the transient entity. (All you should see are the edges of the transient entity path.)
Press the right button to get into Select or Edit mode.
Click on the Select All command under the Edit menu.
Click on the Hide Selected Edges command under the Edit menu.
Click on any blank space to deselect the vertices: All the transient entities should disappear, leaving just the numbers of each break-point in the path.
When you run the simulation, the numbers at the break-point vertices along the transient entity path will disappear.
HINT: Put a very high execution priority (low number) on each edges along the transient entity path if you want the transient entity to complete its movement before any other vertex executes.
Highlight the ungrouped boxes, and group them again.

Press the Start Run tool to see the transient entity path in motion.

A string of vertices was added to the ENTER event to show the part entering and to the FAIL event to show a part being discarded. The model is BRKANAM5.MOD in your SIGMA directory and is shown in this figure. Again, the Select All option was clicked to show all parts of the animation.
BRKANAM5.MOD with Strings of Vertices Representing Transient Entity Paths Added.
BRKANAM5.MOD with Strings of Vertices Representing Transient Entity Paths Added.

You should load and run BRKANAM5.MOD and observe how it works. The local display variables, INPUT, GOOD, and BAD were added to the model, in addition to QSIZE, to show where each part went.

With the animation, it is rather easy to see that there is an error in the model; the count of discarded bad parts is increased even if the machine fails when it is not working. Since what goes into the system must go somewhere, the following equation should hold:

INPUT = GOOD + BAD + QSIZE + SERVER.

Increasing the number of BAD parts discarded even if the machine failed when empty will cause this balance equation to be invalid. Adding a vertex to indicate if the machine fails when empty or loaded solves this problem. (See BRKANAM6.MOD) Note that a puff of smoke is added when the machine fails, using the same technique for adding transient entities.).

Other examples of animations have been included with SIGMA, including one with the ubiquitous carwash, ACARWASH.MOD. Also see SIMAN.MOD for an animation of a process-oriented simulation language. ROBOT.MOD, in this figure, is an actual animation of a loading robot used in semiconductor manufacturing. The model represents an automated robot that processes wafers in vacuum chambers. Wafers enter the system at Station 1, are processed individually at Station 2, are moved to either Station 3 or Station 4 for batch processing, and then leave the system through Station 5.

An Animation Of  Priority Loader Robot (Cluster Tool)
An Animation Of Priority Loader Robot (Cluster Tool)


Back to Topics

Personal tools
Navigation