pigi. Do this by typing a control-d character in the
vemconsole window. A dialog box may appear with a menu of facets that
vemthinks 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
sinModdemo explored above. First, be sure you are in a directory where you have write permission, like your home directory.
init.pal", is special because
pigialways opens a facet by this name in the directory in which it starts. Convention in Ptolemy dictates that "
init.pal" should be used to store icons representing complete applications, so instead of using this facet, we will create a new one.
- Select the open-facet command from the "Window"
pigimenu (shift-middle-button). Alternatively, type an "F". You will get a directory browser that looks like this:
- Replace the name "init.pal" in the text widget with "wave" and click the "OK" button (or hit the return key). A quick way to delete the "init.pal" is using control-u. A new blank window will appear.
- Select the open-palette command from the "Window"
pigimenu. Alternatively, type an "O".
Pigiwill present a palette menu. Select the "sdf" palette by clicking the left button in the box next to "$PTOLEMY/src/domains/sdf/icons/main.pal" (the first entry) and then click on "OK".
- The palette that opens is shown on the left of figure 2-9.
vemcommands for manipulating window displays.
Vemuses post-fix commands. This means that the user enters the arguments to a command before the command name itself. Arguments appear in the
vemconsole 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:
vemcommands, shift-middle-button for
pigicommands. Menus are of the "walking" variety, as explained before.
vemexperts use it occasionally.
Vemdoes not display these labels if they would be too small.
vempan command can also take as an argument a point which will indicate the new center of the window. Recall that the argument must be entered first. Place a point somewhere in the palette window by clicking the left button, and type "p". The location of your point became the center of the window.
vemopen-window command can take a box as an argument. Draw a box in the palette window by dragging the left mouse button and then type "o", or find the open-window command in the
Vemhas an implicit grid to which points snap. The default snap resolution is suitable for making Ptolemy universes.
vemwindow) with "control-d".
Ramp". This star is at the upper right of the sources palette. Its icon has an orange triangle. To do this:
- Create a point anywhere in the window by clicking the left button.
- Move the cursor over the "
Ramp" icon in the palette and press the "c" key. This is a key binding that executes the
- You have just created an instance of the "
Ramp" icon. The actual data that describes how the "
Ramp" icon should be drawn is stored in another facet (an "interface facet"). An instance of the "
Ramp" icon points to this facet.
Rampinstance and then delete it.
Rampinstance next to the first one: place a point near the original
Ramp, place the cursor over the
Rampicon in the palette and press "c". Actually, you don't have to use the icon in the palette - you could also put the cursor over the already existing
Rampicon to achieve the same effect.
- Place the cursor over the new
Rampicon and execute select-objects by typing "s". This creates an object argument on the
vemcommand line. This is necessary because the
vemdelete-objects command takes arguments of type "object". The select-objects command takes point, box, and/or line arguments and turns the items underneath them into object arguments. The unselect-objects command ("u") does the reverse of select-objects.
- Execute delete-objects by typing "D" (upper-case!). This deletes the objects we selected previously.
- You could also have deleted the newly created Ramp with the undo command ("U"). This is an infinite undo, so you can backtrack through all changes you have made since starting the
vemsession by repeatedly executing the undo command.
- Occasionally when you use the select and unselect commands, the objects are not redrawn correctly. When this happens, use the
vemredraw-window command, "control-l" (lower case L), to redraw.
Sin" icon to the right of the Ramp. "
Sin" is in the "nonlinear" palette, where icons are arranged alphabetically by name. Make sure it does not overlap with the Ramp icon. If it overlaps, you can delete it and create a new one.
- Create an "
XMgraph" instance to the right of the
XMgraph" is the first icon in the first row of the "sinks" palette.
We now have three icons: a
Sin, and an
XMgraph. Your facet should look something like this:
Next, we will connect them together.
Rampoutput to the
Sininput using the following steps:
- Draw a line between the output of the
Rampand the input of the
Sin: put the cursor over the
Rampoutput, double-click on the left mouse button, drag the cursor to the
Sininput, and then let up on the mouse button. If the two terminals are not on a horizontal line, you can bend the line by momentarily releasing the mouse button while dragging it.
- Type "c" (for create) to create a wire. Notice that the create command creates wires or instances depending on the type of arguments it is called with.
- If you need to delete a wire, you can draw a box around it (click and drag with the mouse), select it (press "s"), and then delete it ("D").
Sinoutput to the
XMgraphinput in a similar way.
pigi"Exec" menu, or type an "R".
- Enter "100" for "When to stop". Do this by typing "control-u" to remove the default entry in the text widget and typing 100. This specifies that the system should be run through 100 "iterations". What constitutes an iteration is explained in chapter 3, "SDF Domain" on page 3-65. For this simple system, it is just the number of samples processed.
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
Rampstar. The execution of the
XMgraphstar 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.
vemsave-window command. It is wise to periodically save your work in case the editor or computer system fails unexpectedly.
Rampstar has a set of default parameters which cause it to generate output values with an increment that is too large. We can change the parameters of as follows:
Rampicon and execute edit-params in the
pigimenu (or type "e"). A dialog box will appear that shows the current parameters.
- Replace the value of step with "PI/50". (You can use "control-u" to erase the old value.) Finally, click the "OK" button to store the new parameters. This is an example of Ptolemy's parameter expression syntax, explained above.
pigicommand "Extend:make-schem-icon", or "@".
pigiin this same directory, the first window you will see will be this "init.pal" window.
- Type "control-d" in the
vemconsole window. If nothing needed to be saved, the program exits immediately. Otherwise, a dialog box appears asking you to choose buffers to be saved. Unfortunately, as of this writing, some of the buffers listed may have already been saved and do not need to be saved again. The program is overly cautious. To indicate which of the listed buffers you wish to save, click on the box to the left of each name. Then click on the "OK" button.
- A final warning appears telling you that closing the console window will terminate the program. Click on "Yes".
Copyright © 1990-1997, University of California. All rights reserved.