[kepler-users] Iterating over Elements / Looping
Christopher Brooks
cxh at eecs.berkeley.edu
Thu Apr 26 08:55:02 PDT 2012
There is also IterateOverArray, see
http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/doc/codeDoc/ptolemy/actor/lib/hoc/IterateOverArray.html
and
http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/ptolemy/actor/lib/hoc/demo/IterateOverArray/IterateOverArray.htm
Christopher wrote:
> DirectoryListing produces an Array an output.
> If you know the number of files in the directory in advance, then you
> can use ArrayToSequence and have a SDF Director.
> The reason you need to know the number of files is because you need to
> know the size of the array so that SDF can calculate a schedule. An
> alternative is to set the allowRateChanges in SDFDirector to true, see
> DirectorySDFRateChange.xml
> One issue with this model is that it does not terminate naturally.
>
> Or, you can use the PN Director and terminate the model with a test
> that looks for a file name that has already been seen.
>
> An alternative is to put the DirectoryListing inside a Composite that
> has a SDF Director. I ran in to issue with terminating the model
> though. Attached is DirectoryListing2.xml.
>
> I'm probably missing an easier way to do this though.
>
> See also
> https://kepler-project.org/users/faq#how-do-i-branch
>
> _Christopher
On 4/26/12 7:37 AM, Stefan Proell wrote:
> Dear Tomasz,
> thank you very much for your reply. I know the tutorial pages, but I
> was wondering if there exists a
> simpler way for retrieving a list of files and store the files located
> at the URLs on my machine. I attached a screen shot of my current
> attempt, which works but seems a bit complicated for performing a
> rather simple task.
> After using the DirectoryListing Actor, I already have an array of
> the URL-Strings. There also exists an ArrayElement-Actor, which I
> thought would iterate over the elements by itself. What I needed to do
> was to use a Ramp (for-loop) and a manually created index to iterate
> over the elements in the ArrayElement-Actor. Is there a more compact
> solution?
>
> I ask because in the workflow I try to design there are several
> iteration steps, the depicted one is actual the easiest. When I have
> to design such a complicated structure for every such iteration, the
> result will be unreadable and hard to understand for other users.
>
> Thank you very much in advance,
> kind regards,
> Stefan
>
> Am 2012-04-26 16:29, schrieb Tomasz Z.ok:
>> Dear Stefan,
>>
>> please take a look at this tutorial session:
>> http://scilla.man.poznan.pl:8080/confluence/x/oAFU
>>
>> You can jump straight to sections dedicated to looping in Kepler,
>> there are
>> several possible solutions presented.
>>
>> Best regards,
>> Tomek
>>
>
>
>
> _______________________________________________
> Kepler-users mailing list
> Kepler-users at kepler-project.org
> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
--
Christopher Brooks, PMP University of California
CHESS Executive Director US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust Berkeley, CA 94720-1774
ph: 510.643.9841 (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20120426/2aafb0c3/attachment.html>
More information about the Kepler-users
mailing list