sdm spa Repeat is a duplicate of a Ptolemy actor
FIXME: No documentation? If possible, Deprecate and extend
#2 Updated by Christopher Brooks almost 8 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 7 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 7 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.
#10 Updated by Christopher Brooks over 7 years ago
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 7 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.