03.08.2013 Views

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.3.3 String Parameters<br />

Expressions<br />

Some parameters have values that are always strings of characters. Such parameters support a simple<br />

string substitution mechanism where the value of the string can reference other parameters in scope<br />

by name using the syntax $name, where name is the name of the parameter in scope. For example, the<br />

StringCompare actor in figure 3.4 has as the value of firstString “The answer is $PI”. This references<br />

the built-in constant PI. The value of secondString is “The answer is 3.1415926535898”. As shown in<br />

the figure, these two strings are deemed to be equal because $PI is replaced with the value of PI.<br />

3.3.4 Expression Actor<br />

The Expression actor is a particularly useful actor found in the math library. By default, it has one<br />

output and no inputs, as shown in Figure 3.5(a). The first step in using it is to add ports, as shown in (b)<br />

and (c), resulting in a new icon as shown in (d). Note: In (c) when you click on Add, you will be<br />

prompted for a Name (pick one) and a Class. Leave the Class entry blank and click OK. You then<br />

specify an expression using the port names, as shown in (e), resulting in the icon shown in (f).<br />

FIGURE 3.3. Sinewave actor, showing its port parameters, and their use at the lower level of the hierarchy.<br />

100 Ptolemy <strong>II</strong>

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

Saved successfully!

Ooh no, something went wrong!