[kepler-dev] A weird behavior

Christopher Brooks cxh at eecs.berkeley.edu
Tue Jan 9 14:22:27 PST 2007


If it is a cloning problem, then two common problems:

1) The name of the field that refers to the port or parameter
and the name assigned to it are different.

Right:

    public Ramp(CompositeEntity container, String name)
            throws NameDuplicationException, IllegalActionException {
        super(container, name);
...
        init = new Parameter(this, "init");
        init.setExpression("0");
...
    }
...
    public Parameter init;

Wrong:

    public Ramp(CompositeEntity container, String name)
            throws NameDuplicationException, IllegalActionException {
        super(container, name);
... 
        init = new Parameter(this, "initization value");  //WRONG
        init.setExpression("0");
...
    }
..
    public Parameter init;


If you want to display a different name, use setDisplayName().

or 

2) Some actors need a clone method that properly sets the type
constraints.
See the Designing Actors chapter of the 1st volume of the design doc.
http://ptolemy.eecs.berkeley.edu/papers/05/ptIIdesign1-intro/


Note that the tests in ptolemy/configs looks for this sort of problem
in a configuration.

In Ptolemy II 6.0, The ptolemy.actor.gui.Configuration method includes
a check() method that checks the configuration for common problems.


The Configuration class comment says:

 To access the configuration from a random place, if you have a
 NamedObj, then you can call Configuration.findEffigy().  This is a
 static method.  Then call Effigy.toplevel(). The result will always be
 the configuration.

So, in principle, you could write some code to get the Configuration
and call check() on it.  I'll see if I can hack something up, but
it would require updating Ptolemy II.

_Christopher
--------
    
    Hi,
    
    I tried to modify the web service actor, which inherits from
    TypedAtomicActor.
    
    Here is the problem: I found out that, after cloning the actor
    instances, or after opening a saved file, the actor instances could not
    behave properly. However, if I instantiate the actor and set the
    parameters again, it would work properly. Can anyone tell me what might
    go wrong here?
    
    thanks,
    Alex
    
    --===============0412506775==
    Content-Type: text/plain; charset="us-ascii"
    MIME-Version: 1.0
    Content-Transfer-Encoding: 7bit
    Content-Disposition: inline
    
    _______________________________________________
    Kepler-dev mailing list
    Kepler-dev at ecoinformatics.org
    http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-dev
    
    --===============0412506775==--
--------


More information about the Kepler-dev mailing list