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

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

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

In this method, we classify all actors <strong>in</strong>to three categories: actors that are not enabled,<br />

actors that are enabled but deferrable, and actors that are enabled and not deferrable. We<br />

also search those actors for a parameter named requiredFir<strong>in</strong>gsPerIteration, which<br />

specifies the number of times the actor must be fired <strong>in</strong> one iteration. S<strong>in</strong>ce some actors<br />

may not get fired <strong>in</strong> one basic iteration, one iteration consists of several basic iterations<br />

(possible <strong>in</strong>f<strong>in</strong>ite if the model is ill-designed). The reason we <strong>in</strong>troduce this mechanism to<br />

def<strong>in</strong>e an iteration is to match the user’s expectation. For example, <strong>in</strong>tuitively a user<br />

would expect to see one token consumed and plotted by a s<strong>in</strong>k actor <strong>in</strong> each iteration,<br />

which can be achieved by add<strong>in</strong>g the parameter to the s<strong>in</strong>k plotter with value 1.<br />

prefire()<br />

If the DDF doma<strong>in</strong> is embedded <strong>in</strong> another doma<strong>in</strong>, we first check the <strong>in</strong>put ports of the<br />

conta<strong>in</strong>er composite actor to see whether they have enough tokens. It is tricky to do that<br />

because unlike SDF, it is undecidable for DDF to determ<strong>in</strong>e the exact number of tokens<br />

required to f<strong>in</strong>ish one iteration. This po<strong>in</strong>t will be further elaborated <strong>in</strong> section 3.5 when<br />

we mix DDF doma<strong>in</strong> with other <strong>Ptolemy</strong> <strong>II</strong> doma<strong>in</strong>s. We also reset to zero the count<strong>in</strong>g<br />

variables for those actors which are required to fire specified number of times <strong>in</strong> each<br />

iteration.<br />

fire()<br />

This is the place where the bulk of computation is performed. Each <strong>in</strong>vocation of this<br />

method corresponds to one iteration of the model, which by default is one basic iteration.<br />

However, if some actor has a parameter named requiredFir<strong>in</strong>gsPerIteration, cont<strong>in</strong>ue to<br />

execute basic iterations until the actor has been fired at least the number of times given<br />

32

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

Saved successfully!

Ooh no, something went wrong!