[kepler-dev] problem with unconnected ports in composite actors

Edward A. Lee eal at eecs.berkeley.edu
Tue Feb 21 05:09:53 PST 2006


Ah, we actually had quite a bit of debate a couple of years ago
about what the right semantics was here...

In fact, if you look in the Source actor (I'm guessing this is a base
class for BinaryFileReader), it has the following code in the fire()
method:

         // NOTE: It might seem that using trigger.numberOfSources() is
         // correct here, but it is not. It is possible for channels
         // to be connected, for example, to other output ports or
         // even back to this same trigger port, in which case higher
         // numbered channels will not have their inputs read.
         for (int i = 0; i < trigger.getWidth(); i++) {
             if (trigger.hasToken(i)) {
                 trigger.get(i);
             }
         }

In your case, the width of the trigger port will be 1 even though
there is no source of data connected. Consequently, since in PN
hasToken() always returns true, the actor will block trying to read
from the trigger.

Despite the comment above, it might be correct to skip this code
in trigger.numberOfSources() returns 0... This would solve this
problem...

Edward


At 04:09 PM 2/19/2006, Tristan King wrote:
>I'm using the PN director.
>
>On Sun, 2006-02-19 at 10:38 -0800, Edward A. Lee wrote:
> > This depends on the director(s) you are using... What are you using?
> >
> > Edward
> >
> > At 07:25 PM 2/16/2006, Tristan King wrote:
> > >Hi,
> > >I've found a possible problem with composite actors.
> > >
> > >Say you have a BinaryFileReader (BFR) actor inside a Composite Actor
> > >(CA), and you have two input ports into the CA that link to the BFR's
> > >ports (the trigger and fileOrURL ports). If there is no connection from
> > >the outside to the CA's trigger port, but there is a connection inside
> > >to the BFR's trigger port, then the BFR will never fire. Only when the
> > >internal connection is removed or an external connection is made will
> > >the BFR fire.
> > >
> > >Is this a bug or is this intentional?
> > >
> > >--
> > >Tristan King                            | Ph: (07) 4781 6911
> > >DART project team                       | Email: Tristan.King at jcu.edu.au
> > >James Cook University                   | Web: http://dart.edu.au
> > >Townsville QLD 4814                     | http://plone.jcu.edu.au/dart/
> > >Australia                               |
> > >
> > >
> > >_______________________________________________
> > >Kepler-dev mailing list
> > >Kepler-dev at ecoinformatics.org
> > >http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-dev
> >
> > ------------
> > Edward A. Lee
> > Professor, Chair of the EE Division, Associate Chair of EECS
> > 231 Cory Hall, UC Berkeley, Berkeley, CA 94720
> > phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845
> > eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal
> >
>--
>Tristan King                            | Ph: (07) 4781 6911
>DART project team                       | Email: Tristan.King at jcu.edu.au
>James Cook University                   | Web: http://dart.edu.au
>Townsville QLD 4814                     | http://plone.jcu.edu.au/dart/
>Australia                               |

------------
Edward A. Lee
Professor, Chair of the EE Division, Associate Chair of EECS
231 Cory Hall, UC Berkeley, Berkeley, CA 94720
phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845
eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal  



More information about the Kepler-dev mailing list