[kepler-dev] Ports
Ivens
ivensportugal at gmail.com
Sun Aug 1 12:16:35 PDT 2010
Edward,
the output port of my actor is an instance of TypedIOPort
and it is multiport.
but i could not find that method...
On Sun, Aug 1, 2010 at 4:07 PM, Edward A. Lee <eal at eecs.berkeley.edu> wrote:
>
> I think that if your actor does this in the constructor,
> it should work:
>
> output.setWidthEquals(input, false);
>
> This assumes that the output is a multiport, and it constrains
> the width inference algorithm to yield the same width on the
> output as on the input.
>
> Edward
>
>
>
> On 8/1/10 11:57 AM, Ivens wrote:
>
>> Hi...
>>
>>
>> First, thank you all for your help.
>> Ilkay and Edward, I read part of the documents you sent and that made me
>> understand more about the conversions... fortunatelly i could solve the
>> problem i had.
>>
>> but another one appeared.
>> please, take a look at the picture below:
>>
>>
>>
>> addsubproblem.jpg
>> i forgot to mention that the big "square" is a CompositeActor
>>
>> my actor should receive both tokens 2 and 3 and deliver them to
>> AddOrSubtract Actor.
>> AddOrSubtract actor should *add* them and deliver the result to Display
>> Display should show 5.
>>
>> my actor has two ports (an input one, and an output one)
>> both are multiport.
>>
>> its fire() method is similar to this:
>>
>> for(i = 0; i < input.getWidth(); i++) {
>> Token t = input.get(i);
>> output.send(i, t);
>> }
>>
>> i dont know why, but input.getWidth() returns *2,* because my actor
>> receives 2 tokens
>> but when i send the tokens,
>>
>> send(0, t) works
>> send(1, t) does not work,
>>
>> because there is not a channel 1 in the ouput of my actor, and then
>> Display shows only the first token
>> (when i add a second line (or channel) from my actor to AddOrSubtract,
>> everthing runs correctly)
>>
>> my question is:
>> as i receive 2 tokens (from 2 different channels) through the same line,
>> is there a way to correctly deliver those tokens to AddOrSubtract actor,
>> so that it can add those tokens and deliver them to Display...?
>>
>> note that i cannot add more lines between myActor and AddOrSubtract
>> and the line between those actors must have width = 0
>>
>>
>> Thank you for your help one more time
>>
>> Ivens
>>
>>
>> On Sat, Jul 31, 2010 at 8:23 AM, Edward A. Lee <eal at eecs.berkeley.edu
>> <mailto:eal at eecs.berkeley.edu>> wrote:
>>
>>
>> The type system is explained in Chapter 5 here:
>>
>> http://www.eecs.berkeley.edu/Pubs/TechRpts/2008/EECS-2008-29.html
>>
>> Edward
>>
>>
>>
>> On 7/30/10 8:01 AM, Ivens wrote:
>>
>> Hi (again),
>>
>> I read Kepler User Manual to discover how Port Constraints work
>> but i
>> could not understand.
>> I looked some actors in Kepler and I noticed that Parameters are
>> passed
>> to setTypeAtLeast(...) method...
>> so... i dont know how these Constrainst work...
>>
>> can you please explain me?
>>
>> thanks
>>
>> On Fri, Jul 30, 2010 at 10:32 AM, Ivens <ivensportugal at gmail.com
>> <mailto:ivensportugal at gmail.com>
>> <mailto:ivensportugal at gmail.com
>>
>> <mailto:ivensportugal at gmail.com>>> wrote:
>>
>> When i tried to link an UNKNOWN port to a GENERAL port, i
>> got error
>> messages...
>> why?
>>
>>
>> help.JPG
>>
>>
>>
>> error.JPG
>>
>> On Fri, Jul 30, 2010 at 10:00 AM, Ivens
>> <ivensportugal at gmail.com <mailto:ivensportugal at gmail.com>
>> <mailto:ivensportugal at gmail.com
>>
>> <mailto:ivensportugal at gmail.com>>> wrote:
>>
>> Hi ilkay,
>>
>> yes i can add the actor do Display, and it works well.
>> But Display Actor has a port from General Type and
>> accepts every
>> type of Token.
>>
>> The problem is... my actor must send the Token he
>> received...
>> but i dont know the type of that Token.
>>
>> For instance:
>> suppose i have (SDF Director) a String Constant ---
>> myActor ---
>> String to Int --- Display
>>
>> my actor must get a String from String Constant (which
>> is easy
>> using an input Port from GENERAL type) and send this String
>> Token through a STRING type Port, because String to Int
>> must
>> receive a StringToken.
>>
>> But..
>> Suppose (SDF Director) Const --- myActor ---
>> AddOrSubtract ---
>> Display
>>
>> my actor must get a Integer and send it through a
>> INTEGER type
>> Port, because AddOrSubtract expects that.
>>
>> In other words, the output Port may be generic...
>> but if i declare it as GENERAL, it won't work
>>
>> and i cannot use output.setTypeAtLeast(input), because
>> my input
>> port is GENERAL.
>>
>> did you understand?
>>
>> On Wed, Jul 28, 2010 at 4:42 PM, Ilkay Altintas
>> <altintas at sdsc.edu <mailto:altintas at sdsc.edu>
>> <mailto:altintas at sdsc.edu <mailto:altintas at sdsc.edu>>> wrote:
>>
>> Hi,
>>
>> The general data type is the most inclusive of the
>> types.
>> Can you link your actor to display?
>>
>> There's some more information on the type system
>> conversions
>> in the ptolemy documentation (section 4.5.4:
>> Conversions)
>> at:
>> http://www.eecs.berkeley.edu/Pubs/TechRpts/2008/EECS-2008-28.html
>>
>> -ilkay
>>
>>
>> --
>> Ilkay ALTINTAS
>> Deputy Coordinator for Research, San Diego
>> Supercomputer
>> Center (SDSC)
>> Lab Director, Scientific Workflow Automation
>> Technologies
>> (SWAT @ SDSC)
>>
>> University of California, San Diego
>> 9500 Gilman Drive, MC: 0505 La Jolla, CA 92093-0505
>> Phone: (858) 210-5877 Fax: (858)
>> 534-8303
>> Web: http://users.sdsc.edu/~altintas
>> Skype: ilkay.altintas
>>
>>
>>
>>
>>
>>
>>
>>
>> On Jul 28, 2010, at 10:32 AM, Ivens wrote:
>>
>> Hi,
>>
>> I wrote an Actor in Java that has 2 ports: one
>> is input
>> and the other one is output.
>> Both are from GENERAL type. (deal with GENERAL
>> tokens)
>>
>> The output port sends the same data the input
>> port receives.
>> And then, i connect the output port to any other
>> Kepler
>> Actor (for instance, String to Int.string)
>>
>> When i click 'play' to start the execution, i get
>> an
>> error message.
>> i think that is because my output port is from
>> GENERAL
>> type... and it is connected to a port from
>> STRING type
>>
>> So, i changed that type to UNKNOWN... but the error
>> persists...
>> Can you help me?
>>
>> Thanks
>> _______________________________________________
>> Kepler-dev mailing list
>> Kepler-dev at kepler-project.org <mailto:
>> Kepler-dev at kepler-project.org>
>> <mailto:Kepler-dev at kepler-project.org
>> <mailto:Kepler-dev at kepler-project.org>>
>>
>> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Kepler-dev mailing list
>> Kepler-dev at kepler-project.org <mailto:
>> Kepler-dev at kepler-project.org>
>>
>> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercury.nceas.ucsb.edu/kepler/pipermail/kepler-dev/attachments/20100801/e8fce887/attachment-0001.html>
More information about the Kepler-dev
mailing list