Note that IterateOverArray is demos at:
$PTII/actor/lib/hoc/demo/IterateOverArray/IterateOverArray.xml There is also RunCompositeActor, which can be used to have a model run repeatedly to completion. Demo here: $PTII/actor/lib/hoc/demo/MultipleRuns/MultipleRuns.xml Consitionally executing a model is demod here: $PTII/actor/lib/hoc/demo/Case/Case.xml Parallel execution over a parameterized number of channels is shown here: $PTII/actor/lib/hoc/demo/HocDE/HocDE.xml and $PTII/actor/lib/hoc/demo/DFTSubSet/DFTSubSet.xml Applying a function defined in the expression language to a subsequence of the input is shown here: $PTII/actor/lib/hoc/demo/ApplyFFT/ApplyFFT.xml Edward On 5/1/12 9:00 PM, Christopher Brooks wrote:
Hi Stefan, We talked about these sorts of model today. Edward's main comment was that we need to have better documentation about how to do control flow with actor-oriented models. Also, we talked about using IterateOverArray for the sorts of models, which is probably your best bet. My brute force method would be to have write an actor that read a directory and produced a file or directory on the output each time the actor was fired. When all the files and/or directories had been written to the output, then prefire() would return false. An even more brute force method would be to have a separate output that would be written to when the directory had been completely read. This output could be connected to a Stop actor. _Christopher On 4/30/12 1:07 AM, Stefan Proell wrote:Dear Christopher, thanks for the hints. I do not know the size of the array in advance and I also need to terminate the looping in a reliable way. There hopefully exists a more elegant solution to this problem, but I now decided to model the process in a way it stays dynamic regarding the array size and terminating after hitting a counter-limit. I attach the project file to this mail. What this simple example does is fetching a directory of files (MP3s) and storing it on my local hard drive for further processing (not implemented yet :-) ). I used a DDF director. Kind regards, Stefan Am 2012-04-26 16:54, schrieb Christopher Brooks:Stefan, 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:29 AM, Tomasz Żok wrote: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, TomekDear Kepler Community, I am rathre new to Kepler and I have a question regarding looping. I searched the documentation and the mailing list archive, but could not find a proper answer. For a specific workflow, I need to fetch several files from a Web server and process these. For this purpose, I use the DirectoryListing - Actor. Fetching the URLs of the files works fine, but how would I iterate over all the URLs for further processing? I would like to use the "URL to File" actor, but how would I iterate over the elements/URLs I receive? Is there an elegant way, or do I have to assemble (rather complicated) loops just for going through all the elements? So far I would use the Actor ArrayElement, but then I have to feed an index variable to it, which I would have to iterate after each token. This seems to be a bit of an overhead to me. Thanks in advance, Kind regards, Stefan
<<attachment: eal.vcf>>
_______________________________________________ Kepler-users mailing list Kepler-users@kepler-project.org http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users