PTOLEMY II - CiteSeerX
PTOLEMY II - CiteSeerX
PTOLEMY II - CiteSeerX
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Appendix C: Example<br />
MoML<br />
Figures 7.11 and 7.12 show a simple Ptolemy <strong>II</strong> model in the SDF domain. Figure 7.13 shows the<br />
execution window for this model. This model generates two sinusoidal waveforms and multiplies them<br />
together. This appendix gives the complete MoML code. The MoML code is divided into two files.<br />
The first of these defined a component, a sinewave generator. The second creates two instances of this<br />
sinewave generator and multiplies their outputs. The code listings are (hopefully) self-explanatory.<br />
C.1 Sinewave Generator<br />
The Sinewave component is defined in the file $PT<strong>II</strong>/ptolemy/actor/lib/Sinewave.xml, which is<br />
listed below. This file defines a MoML class, which can then be referenced by the class name<br />
ptolemy.actor.lib.Sinewave. The Vergil rendition of this model is shown in figure 7.11.<br />
<br />
<br />
<br />
<br />
<br />
This composite actor generates a sine wave.<br />
<br />
The sampling frequency, in the same units as the frequency.<br />
<br />
Settable<br />
+getExpression() : String<br />
+setExpression(expression : String)<br />
Location<br />
-_location : double[]<br />
-_valueListeners : List<br />
+Location(container : NamedObj, name : String)<br />
+Location(w : Workspace)<br />
+addValueListener(listener : ValueListener)<br />
+getLocation() : double[]<br />
+removeValueListener(listener : ValueListener)<br />
+setLocation(location : double[])<br />
Vertex<br />
-_linked : Vertex<br />
-_ports : List<br />
+Vertex(container : Relation, name : String)<br />
+addLinkedPort(port : Port)<br />
+getLinkedVertex() : Vertex<br />
+linkedPorts() : List<br />
+removeLinkedPort(port : Port)<br />
+setLinkedVertex(vertex : Vertex)<br />
+Vertex(w : Workspace)<br />
Relation<br />
FIGURE 7.10. Attributes in the moml package.<br />
Attribute<br />
MoMLAttribute<br />
-_momlDescription : List<br />
+MoMLAttribute(container : NamedObj, name : String)<br />
+MoMLAttribute(w : Workspace)<br />
+appendMoMLDescription(moml : String)<br />
+writeMoMLDescription(output : Writer, depth : int)<br />
CompositeEntity<br />
SingletonConfigurableAttribute<br />
LibraryAttribute<br />
+LibraryAttribute()<br />
+LibraryAttribute(workspace : Workspace)<br />
+LibraryAttribute(container : NamedObj, name : String)<br />
+getLibrary() : CompositeEntity<br />
+setLibrary(library : CompositeEntity)<br />
ParserAttribute<br />
Documentation<br />
-_value : String<br />
+consolidate(object : NamedObj) : String<br />
+getValue() : String<br />
+setValue(value : String)<br />
SingletonAttribute<br />
+ParserAttribute(container : NamedObj, name : String)<br />
+getParser() : MoMLParser<br />
+setParser(parser : MoMLParser)<br />
222 Ptolemy <strong>II</strong>