[kepler-users] IterateOverArray - Type conversion problem
Ali, Muhannad
muhannad.ali at student.kit.edu
Thu Jan 12 09:14:34 PST 2012
Hello,
I need to develop a composite actor (programmatically) using eclipse. Before I code it, I designed it on Kepler canvas (see file IterateOverArray.xml attached) in order to test the functionality and then encapsulate it in my own composite actor. When I designed it, it worked perfectly but when I coded it and tried to run the program .. I always get the following error:
"
ptolemy.kernel.util.IllegalActionException: Conversion is not supported from ptolemy.data.ArrayToken '{"1 - 1"}' to the type string because the type of the token is higher or incomparable with the given type.
at ptolemy.data.StringToken.convert(StringToken.java:172)
at ptolemy.data.type.BaseType$StringType.convert(BaseType.java:615)
at ptolemy.data.ArrayToken.<init>(ArrayToken.java:151)
at ptolemy.actor.lib.hoc.IterateOverArray$IterateDirector.transferOutputs(IterateOverArray.java:706)
at ptolemy.actor.CompositeActor.fire(CompositeActor.java:469)
at ptolemy.actor.CompositeActor.iterate(CompositeActor.java:1069)
at ptolemy.actor.sched.StaticSchedulingDirector.fire(StaticSchedulingDirector.java:188)
at ptolemy.actor.CompositeActor.fire(CompositeActor.java:458)
at ptolemy.actor.Manager.iterate(Manager.java:742)
at ptolemy.actor.Manager.execute(Manager.java:351)
at ptolemy.actor.Manager.run(Manager.java:1111)
at ptolemy.actor.Manager$PtolemyRunThread.run(Manager.java:1641
"
My code is:
"
package org.helloworld;
import ptolemy.actor.TypedCompositeActor;
import ptolemy.actor.TypedIOPort;
import ptolemy.actor.TypedIORelation;
import ptolemy.actor.lib.ElementsToArray;
import ptolemy.actor.lib.Expression;
import ptolemy.actor.lib.hoc.IterateOverArray;
import ptolemy.actor.lib.hoc.MirrorPort;
import ptolemy.kernel.CompositeEntity;
import ptolemy.kernel.util.IllegalActionException;
import ptolemy.kernel.util.NameDuplicationException;
public class HelloWorld extends TypedCompositeActor {
public HelloWorld(CompositeEntity container, String name)
throws NameDuplicationException, IllegalActionException {
super(container, name);
params = new TypedIOPort(this, "params", true, false);
params.setMultiport(true);
output = new TypedIOPort(this, "output", false, true);
elems2Arr = new ElementsToArray(this, "elems2Arr");
relation1 = new TypedIORelation(this, "realtion1");
params.link(relation1);
elems2Arr.input.link(relation1);
iter = new IterateOverArray(this, "iter");
mpInput = new MirrorPort(iter, "input"); mpInput.setInput(true);
mpOutput = new MirrorPort(iter, "output"); mpOutput.setOutput(true);
exp = new Expression(iter, "exp");
exp.expression.setExpression("input + ' - ' + iterationCount");
relation2 = new TypedIORelation(this, "realtion2");
elems2Arr.output.link(relation2);
iter.getPort("input").link(relation2);
relation3 = new TypedIORelation(this, "realtion3");
iter.getPort("output").link(relation3);
output.link(relation3);
}
public TypedIOPort params;
public TypedIOPort output;
private MirrorPort mpInput;
private MirrorPort mpOutput;
private ElementsToArray elems2Arr;
private IterateOverArray iter;
private Expression exp;
private TypedIORelation relation1;
private TypedIORelation relation2;
private TypedIORelation relation3;
@Override
public void fire() throws IllegalActionException {
super.fire();
}
}
"
I guess the problem is related to the director inside IterateOverArray actor .. any help please?
Thank you!
Muhannad Ali
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20120112/7d190177/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IterateOverArray.xml
Type: application/xml
Size: 46034 bytes
Desc: IterateOverArray.xml
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20120112/7d190177/attachment-0001.xml>
More information about the Kepler-users
mailing list