Top Up Prev Next Bottom Contents Index Search

2.7 Creating universes


If you are following this chapter sequentially, then you still have Ptolemy running from previous sections. To see how Ptolemy will behave when started in your own directory, exit pigi. Do this by typing a control-d character in the vem console window. A dialog box may appear with a menu of facets that vem thinks have been changed. Since all of these belong to the user "ptolemy", you do not want to save them. If it appears, do not select any of them. Just click "OK". A a warning window may then appear telling you that closing the console window will terminate the program. Just click "Yes".

In this section, we will show how to create your own universes with a simple example that is very similar to the sinMod demo explored above. First, be sure you are in a directory where you have write permission, like your home directory.

mkdir example 
cd example
pigi
You will see the message:

creating initial facet "init.pal"
Wait until the welcome window with the picture of Ptolemy appears. We are now ready to learn about the basics of using vem.

2.7.1 Opening working windows

Now we are ready to create a simple universe. Let's create a simulation that generates a sine wave and displays it.

2.7.2 Some basic vem commands

At this time, it is worth exploring some basic vem commands for manipulating window displays. Vem uses post-fix commands. This means that the user enters the arguments to a command before the command name itself. Arguments appear in the vem console window as the user enters them. Note that although the text of what the user enters is displayed in the console window, the cursor should be in one of the facet windows.

There are several types of arguments. Each argument type is entered in a different way. All graphics arguments are created with the left mouse button. The five types of arguments are listed below:

Point:
Position the cursor, click the left mouse button.
Box:
Position the cursor, drag1 the left mouse button.
Line:
Make a point, position the cursor on the point, and drag the left mouse button.
Object:
Use select-objects and unselect-objects commands (explained later).
Text:
Enclose text in double quotes. Arguments can be removed from the command line by typing the delete key, backspace key, or "control-u", which deletes all the current arguments. There are three ways to enter commands:

Menus: Click the middle-button for vem commands, shift-middle-button for pigi commands. Menus are of the "walking" variety, as explained before.
Key bindings: Commands can be bound to single keys and activated by just pressing the key. Key bindings are also called "single-key accelerators", and are case sensitive. The key bindings are summarized in table 2-2 on page 2-7 and table 2-3 on page 2-11.
Type-in: Type a colon followed by the command name. This is rarely used by Ptolemy users, but vem experts use it occasionally.
Let's try a few examples, some of which should be familiar by now. Place the cursor in one of the palette windows (containing library stars) and:

2.7.3 Building an example

We now have three icons: a Ramp, a Sin, and an XMgraph. Your facet should look something like this:

Next, we will connect them together.

A new window with a graph of a rough sine wave should appear. The system generates the sine wave by taking the sine of a sequence of increasing numbers generated by the Ramp star. The execution of the XMgraph star created this new window to show the output of our simulation. To remove this window, click on the "Close" button or press "control-d" in it.

To be able to conveniently access this example again, you should create an icon for it. We will do this with the pigi command "Extend:make-schem-icon", or "@".



Top Up Prev Next Bottom Contents Index Search

1 "Drag" means to press down on a mouse button, move the mouse while holding it down, and then release the button.

Copyright © 1990-1997, University of California. All rights reserved.