[kepler-users] loops in loops

Christopher Brooks cxh at eecs.berkeley.edu
Mon Oct 31 11:54:23 PDT 2011


Hi ckw,

The documentation for Run Composite Actor describes how to use the 
output port

http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/doc/codeDoc/ptolemy/actor/lib/hoc/RunCompositeActor.html
says:

> If this actor has output ports and the contained model is executed, 
> then upon completion of that execution, if this actor has parameters 
> whose names match those of the output ports, then the final value of 
> those parameters is sent to the output ports. If such a parameter is 
> an instance of Variable (or its derived class Parameter), then its 
> contained token is sent to the output token. Otherwise, if it is an 
> instance of Settable, then a string token is produced on the output 
> with its value equal to that returned by getExpression() of the 
> Settable. Output ports should not be multiports. If they are, then all 
> but the first channel will be ignored. A typical use of this actor 
> will use the SetVariable actor inside to define the value of the 
> output port.
>

Unfortunately, Kepler had no documentation for this actor, so there was 
no easy way for you to find this information.

I created " Documentation for some actors such as Run Composite Actor is 
empty"
http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5529

Attached is a modified model with a parameter named "port6".

_Christopher




On 10/27/11 9:15 PM, kianwee chen wrote:
> This is my attempt to create the loop in the loop in kepler using the 
> run composite actor. I manage to get what I wanted but however it 
> seems that run composite actor is not allowed to have an output port ?
>
> In the run composite actor I manage to process the array and produce 
> another array of doubles, I want to output it out and use it for some 
> comparison but however whenever I put an output port in the run 
> composite actor there is an error.
>
> regards
> ckw
>
> On Wed, Oct 26, 2011 at 1:58 PM, kianwee chen <chenkianwee at gmail.com 
> <mailto:chenkianwee at gmail.com>> wrote:
>
>     I downloaded your workflow and try it out and it works, then I did
>     some changes to it, in which I move the sequence to array node
>     inside the composite actor, and change the number of array to 20
>     and kept the sdf director iteration to 10, amazingly the random()
>     expression still fired 20 times, each giving me a different
>     number. So it seems that the sdf director is not essential to the
>     workflow instead  i just need the sequence to array to control the
>     number of times random() is firing ?
>
>     Basically what I am planning to achieve with this is that, the
>     random() will generate a series of numbers, it will then be map to
>     a discrete parameter (e.g. length = [1,5,10,15,25], width
>     [5,10,15,20]) then the parameters are send to construct an already
>     parameterise model to develop the model.
>
>     ckw
>
>
>     On Tue, Oct 25, 2011 at 11:47 PM, Christopher Brooks
>     <cxh at eecs.berkeley.edu <mailto:cxh at eecs.berkeley.edu>> wrote:
>
>         Hi Kianwee,
>         Problem 1 has to do with multirate systems.
>         The attached model has a top level that fires once and an
>         inside opaque composite that fires 10 times.
>         I use a sequence to array actor to cause the inside opaque
>         composite to fire 10 times.
>         See *http://ptolemy*.eecs.berkeley.edu/~eal/ee225a/lab/
>         <http://eecs.berkeley.edu/%7Eeal/ee225a/lab/>*sdf*.pdf
>
>         About problem #2, the Repeat actor repeats the input, it does
>         not cause the upstream actors to be fired.
>
>         BTW - test cases would help here.
>
>         Also, take a look at some of the example models in the Ptolemy
>         II distribution.
>         In the Kepler source distribution look for models in
>         ptolemy/src/ptolemy/domains/sdf/kernel/test/auto/
>         See also
>         ptolemy/src/ptolemy/domains/sdf/lib/test/auto/DynamicRateChange.xml
>
>         _Christopher
>
>
>         On 10/25/11 3:06 AM, kianwee chen wrote:
>>         Hi all kepler users, I am trying to do a loop in a loop,
>>         something like a for loop in a for loop. The task is as follow :
>>
>>         1.) So what I did was I setup a sdf director and set the
>>         iteration to 1, then create a composite actor and put a sdf
>>         director in it and set the iteration to 10. I was hoping that
>>         it would be for 1 iteration outside, the composite actor will
>>         do the action 10 times inside, thus creating a looop within a
>>         loop. However it did not work.
>>
>>         2.) I went on to try to do a repeat actor,  it worked, as I
>>         am using random() to produce 10 different random number. The
>>         repeat gives me 10 same number. Thus its not good enough.
>>
>>         Tried to find examples on this issue but did not manage to
>>         find it. Cause I read about the opaque composite actor and I
>>         thought the 1.) should have worked.
>>
>>         Thanks
>>         ckw
>>
>>
>>         _______________________________________________
>>         Kepler-users mailing list
>>         Kepler-users at kepler-project.org  <mailto: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  <tel:510.643.9841>                                 (Office: 545Q Cory)
>         home: (F-Tu)707.665.0131  <tel:707.665.0131>  cell:707.332.0670  <tel:707.332.0670>  
>
>
>

-- 
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/20111031/030806c2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: run_composite_actor2.xml
Type: text/xml
Size: 78667 bytes
Desc: not available
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20111031/030806c2/attachment.xml>


More information about the Kepler-users mailing list