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.

2.7 Classes and Inheritance<br />

Using Vergil<br />

One of the major new capabilities introduced with version 4.0 of Ptolemy <strong>II</strong> is the ability to define<br />

actor-oriented classes with instances and subclasses with inheritance. The key idea is that you can<br />

specify that a component definition is a class, in which case all instances and subclasses inherit its<br />

structure. This improves modularity in designs. We will illustrate this capability with an example.<br />

2.7.1 Creating and Using Actor-Oriented Classes<br />

Consider the model that we developed in section 2.4, shown for reference in figure 2.34. Suppose<br />

that we wish to create multiple instances of the channel, as shown in figure 2.35. In that figure, the sinewave<br />

signal passes through five distinct channels (note the use of a relation to broadcast the same signal<br />

to each of the five channels). The outputs of the channels are added together and plotted. The result<br />

is a significantly cleaner sine wave than the one that results from one channel alone 1 . However, this is<br />

FIGURE 2.31. Custom icon for the Channel actor.<br />

1. In communication systems, this technique is known as diversity, where multiple channels with independent<br />

noise are used to achieve more reliable communication.<br />

66 Ptolemy <strong>II</strong>

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

Saved successfully!

Ooh no, something went wrong!