[kepler-users] modifying ptolemy.actor.lib.Ramp to accept init as an input port

Christopher Brooks cxh at eecs.berkeley.edu
Mon Jan 18 12:38:01 PST 2010


Hi Matt,
Change init to use a PortParameter instead of a Parameter.
Probably the easiest thing to do is to copy ptolemy/actor/lib/Ramp.java
and create a new actor as per
https://kepler-project.org/developers/reference/adding-a-new-java-actor-to-kepler-a-quick-tutorial

In your new version of Ramp, look at the code for step, which uses a
PortParameter already.  Note that you will need call init.update() to
get the value of the PortParameter before using it, see
http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest/ptII/doc/codeDoc/ptolemy/actor/parameters/PortParameter.html

So, Ramp.attributeChanged() and Ramp.initialize() would need a call to
   init.update() before calling init.getToken()

_Christopher


On 1/18/10 6:39 AM, Matt Luck wrote:
> Greetings,
>
> I am a new Kepler user just getting started with modifying actor code.
> I am hoping that someone can help me figure out how to modify the
> ptolemy.actor.lib.Ramp actor to accept the init value as an integer via
> an input port (e.g., a Const actor).
>
> Thanks in advance!
>
> Matt
>
>
>
> _______________________________________________
> Kepler-users mailing list
> Kepler-users at kepler-project.org
> http://mercury.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 fax:510.642.2718	      (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670



More information about the Kepler-users mailing list