03.08.2013 Views

Dynamic Dataflow Modeling in Ptolemy II - Ptolemy Project ...

Dynamic Dataflow Modeling in Ptolemy II - Ptolemy Project ...

Dynamic Dataflow Modeling in Ptolemy II - Ptolemy Project ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

4 Application Examples<br />

This section gives several examples to show how conditionals, data-dependent iterations,<br />

recursion and other dynamic constructs can be modeled <strong>in</strong> DDF doma<strong>in</strong>.<br />

4.1 An OrderedMerge example<br />

The first example <strong>in</strong> Figure 4.1 is due to Kahn and MacQueen. It calculates <strong>in</strong>tegers<br />

whose prime factors are only 2, 3 and 5, with no redundancies. It uses the OrderedMerge<br />

actor, which takes two monotonically <strong>in</strong>creas<strong>in</strong>g <strong>in</strong>put sequences and merges them <strong>in</strong>to<br />

one monotonically <strong>in</strong>creas<strong>in</strong>g output sequence. This model was orig<strong>in</strong>ally implemented<br />

<strong>in</strong> PN doma<strong>in</strong> and is adapted here to show the concept of an iteration <strong>in</strong> DDF doma<strong>in</strong>.<br />

Although no static or quasi-static schedule can be computed for this model, by add<strong>in</strong>g a<br />

requiredFir<strong>in</strong>gsPerIteration parameter to Display actor and sett<strong>in</strong>g its value to one, we<br />

have effectively def<strong>in</strong>ed one iteration of this model such that there is one output per<br />

iteration. This iteration does not br<strong>in</strong>g the model to its orig<strong>in</strong>al state or anyth<strong>in</strong>g close to<br />

that, but matches well with our <strong>in</strong>tuition and serves to precisely control the progress of<br />

the simulation by specify<strong>in</strong>g the number of iterations (i.,e. how many output tokens) we<br />

want <strong>in</strong> one execution.<br />

50

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

Saved successfully!

Ooh no, something went wrong!