Project

General

Profile

Bug #5655

sdm spa Repeat is a duplicate of a Ptolemy actor

Added by Christopher Brooks almost 7 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
actors
Target version:
Start date:
08/06/2012
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
5655

Description

./actors/src/org/sdm/spa/Repeat.java
FIXME: No documentation? If possible, Deprecate and extend
ptolemy/src/ptolemy/domains/sdf/lib/Repeat.java

ptolemy-repeat-demo-in-PN.xml (23.5 KB) ptolemy-repeat-demo-in-PN.xml jianwu jianwu, 09/11/2012 02:07 PM
kepler-repeat-demo-in-SDF.xml (35 KB) kepler-repeat-demo-in-SDF.xml jianwu jianwu, 09/11/2012 02:08 PM
ptolemy-repeat-demo-in-SDF.xml (33.9 KB) ptolemy-repeat-demo-in-SDF.xml jianwu jianwu, 09/11/2012 02:08 PM
kepler-repeat-demo-PN.xml (26.2 KB) kepler-repeat-demo-PN.xml jianwu jianwu, 09/11/2012 02:09 PM

History

#1 Updated by jianwu jianwu almost 7 years ago

These two actors have different ports and parameters. Ptolemy one has one input port and two parameters; Sdm one has two input ports and no parameter.

#2 Updated by Christopher Brooks almost 7 years ago

Kepler actors/src/org/sdm/spa/Repeat.java has:
public TypedIOPort portOutput;
public TypedIOPort portInput;
public TypedIOPort portNum;

Ptolemy sdf/lib/Repeat has:
/** The repetition factor. It is of type integer and has a default * value of 2. It must be greater than zero.
*/
public Parameter numberOfTimes;

/** The number of tokens in a block.  It is of type integer and has a  
     *  default value of 1.  It must be greater than zero.
*/
public Parameter blockSize;
input and output ports from SDFTransformer

The way I would handle is to modify Ptolemy's sdf/lib/Repeat.java so that
numberOfTimes is a PortParmeter. See actor/lib/Ramp.java for an example.
Basically, with PortParameters, the update() method should be called once.

Then, modify the Kepler moml/filter classes to change the name of the actor
and the name of the ports. There could be some trickyness here, you probably
want to change the name of the ports first.

#3 Updated by jianwu jianwu over 6 years ago

I dig more into the two actors and found more differences:

1) sdf/lib/Repeat works with SDF, not PN (no output with PN director); org/sdm/spa/Repeat works with PN, not SDF (only 1 can be set for SDF iterations parameter)

2) sdf/lib/Repeat has a parameter called 'blockSize' and can accept a serial of input tokens (e.g. from Ramp actor); org/sdm/spa/Repeat doesn't has such as parameter, and only the first token is processed if a serial of input tokens are sent to portInput port.

I don't know why org/sdm/spa/Repeat is built. My guess is that it tries to have repeat behavior with PN.

With such big differences, it might not be a good choice to merge them. Maybe we should updates their documents, having a 'see also' link to the other repeat actor?

#4 Updated by Christopher Brooks over 6 years ago

Could you add the sdf/lib/Repeat PN test case as an attachment?
I'll take a look and possibly fold it in to the Ptolemy II tests.

Maybe the thing to do is update the sdm/spa/Repeat documentation
and then retarget this to 2.X?

The Ptolemy documentation should probably not be updated to mention Kepler until we verify that Repeat will not work in PN.

#9 Updated by jianwu jianwu over 6 years ago

I updated the all four workflows. I'll update Kepler repeat actor documentation and re-target it to 2.X.

#10 Updated by Christopher Brooks over 6 years ago

ptolemy-repeat-actor-in-PN at
http://bugzilla.ecoinformatics.org/attachment.cgi?id=434
will work if the FiringCountLimit of the Const is set to 2 instead of 1.

If FiringCountLimit is set to 1, then under PN the Const actor fires
only once, which means the Repeat actor gets only one token instead
of the two that it requires.

#11 Updated by jianwu jianwu over 6 years ago

Hi Christopher, you are right. Either setting FiringCountLimit of Const actor to be 2, or setting blockSize of Repeat actor to be 1 will work. If I just replace the PN with SDF, the same workflow will throw an exception of Repeat when I tried to run it. But PN director doesn't throw an exception. That's why I thought repeat actor doesn't work with PN. Also its class name (ptolemy.domains.sdf.lib.Repeat) seams it might only work with SDF. :)

After discussion with Dan, I think the best way now is only updating ptolemy/domains/sdf/lib/Repeat.java by changing its numberOfTimes from parameter to portparameter. It will cover all the behaviors we need for Repeat. As for sdm/spa/Repeat.java, since its behavior is a little different when using SDF (it only output 1). I will comment the code to be deprecated. Old workflows using this actor can still be opened and run. And since sdm/spa/Repeat.java is not in the actor tree, new workflows will not use it.

#12 Updated by jianwu jianwu over 6 years ago

after discussion, we will go with comment 11.

#13 Updated by jianwu jianwu over 6 years ago

The changes are done based on comment 11. The bug is fixed at kepler version 30712 and ptolemy version 64693.

#14 Updated by Redmine Admin about 6 years ago

Original Bugzilla ID was 5655

Also available in: Atom PDF