03.08.2013 Views

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

MoML<br />

ptolemy command assumes that the file defines an executable Ptolemy <strong>II</strong> model, and opens a control<br />

panel to execute it. The ptexecute command executes it without a control panel. The vergil<br />

command opens a graphical editor to edit and execute the model. The moml command uses the specified<br />

configuration file (a MoML file containing a Ptolemy <strong>II</strong> configuration) to invoke some set of customized<br />

views or editors on the model. The filename extension can be “.xml” or “.moml” for MoML<br />

files. And the same XML file can be used in an applet 2 .<br />

To get a quick start, try entering the following into a file called test.xml (This file is also available<br />

as $PT<strong>II</strong>/ptolemy/moml/demo/test.xml):<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

This code defines a model in a top-level entity called “test”. By convention, we use the same name for<br />

the top-level model and the file in which it resides. The top-level model is an instance of the Ptolemy <strong>II</strong><br />

class ptolemy.actor.TypedCompositeActor. It contains a director, two entities, a relation, and<br />

two links. The model is depicted in figure 7.1, where the director is not shown. It can be run using the<br />

command<br />

ptolemy test.xml<br />

You should get a window looking like that in figure 7.2. Enter “10” in the iterations box and hit the<br />

“Go” button to execute the model for 10 iterations (leaving the default “0” in the iterations box exe-<br />

test<br />

ramp<br />

output<br />

FIGURE 7.1. Simple example in the file $PT<strong>II</strong>/ptolemy/moml/demo/test.xml.<br />

1. These commands are executed this way on Unix systems and on Windows systems with Cygwin installed. On<br />

other configurations, the equivalent commands are invoked in some other way.<br />

2. An applet is a Java program that is downloaded from a web server by a browser and executed in the client’s<br />

computer (usually within a plug-in for the browser).<br />

192 Ptolemy <strong>II</strong><br />

r<br />

plot<br />

input

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!