[kepler-users] PN Director Question
Edward A. Lee
eal at eecs.berkeley.edu
Wed Oct 21 17:28:52 PDT 2009
Right... hasToken() always returns true in PN.
The semantics of the model of computation is explained here:
http://ptolemy.eecs.berkeley.edu/publications/papers/95/processNets/
Edward
Peter Reutemann wrote:
>> I am trying to implement an actor that has two input ports-input and window.
>> In the implementation, I want that the actor should execute different set of
>> lines depending on if the tokens are present or not present at the window
>> port. I am trying to do something like:
>> if(window.hasToken()){
>> ArrayToken tokenD = (ArrayToken) input.get(0);
>> System.out.println("There is a token at the window port");
>> }
>> else
>> System.out.println("There is no token at the window port");
>>
>> I observer that when I use a PN director, the value of window.hasToken() is
>> true even if there is no token at the window port. I actually used an
>> arraytosequence actor to output the array tokens to my actor.So even if the
>> input to arraytosequence is { }, my actor returns true for window.hasToken()
>> and enters the "if" block. However after executing the first line of the
>> "if" block, it stops i.e it does not print the next line. Can someone tell
>> me why the PN director sets the value false when there is no token at the
>> window port?
>
> Stumbled across that myself...
>
>>From what I understand: the PN domain always assumes that there are
> tokens available in the queues, at one point or another (the
> ptolemy.domains.pn.kernel.PNQueueReceiver class always returns "true"
> in the "hasToken()" method). Only when using the "get(int)"-method of
> the port it is attempted to obtain a token. If none is present at the
> moment, then the method won't exit until a token shows up or the
> workflow terminates.
>
> Cheers, Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eal.vcf
Type: text/x-vcard
Size: 351 bytes
Desc: not available
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20091021/6dd3880c/attachment.vcf>
More information about the Kepler-users
mailing list