A polymorphic commutator, which merges a set of input sequences into a
single output sequence. The commutator has an input port (a
multiport) and an output port (a single port). The types of the ports
are undeclared and will be resolved by the type resolution mechanism,
with the constraint that the output type must be greater than or equal
to the input type. On each call to the fire method, the actor reads
N tokens from each input channel and sends the tokens to the output
port, where N is the value of <i>blockSize</i>. The order in which
the tokens are produced is the order of the channels in the input
multiport. If any input channel has no tokens, then the fire method
returns without producing output. In the next iteration, the actor will
begin reading at the channel that had no input token in the previous
iteration. If no input token is available on the first channel being
read, then no output is produced.
<p>
For the benefit of domains like SDF, which need to know the token
consumption or production rate for all ports before they can construct
a firing schedule, this actor sets the <i>tokenProductionRate</i> parameter
for the output port to equal the number of input channels times the value
of the <i>blockSize</i> parameter. This
parameter is set each time that a link is established with the input
port, or when a link is removed. The director is notified that the
schedule is invalid, so that if the link is modified at run time, the
schedule will be recalculated if necessary.
Mudit Goel, Edward A. Lee
$Id: Commutator.java 70402 2014-10-23 00:52:20Z cxh $
Ptolemy II 0.2
Yellow (mudit)
Yellow (cxh)
The number of tokens read from each input channel on each firing.
This is an integer that defaults to 1.
The parameter controlling the input port consumption rate.
This parameter contains an IntToken, initially with a value of 1.
The parameter controlling the output port production rate.
This parameter contains an IntToken, initially with a value of 0.
When connections are made and/or the <i>blockSize</i> parameter
is set, this is changed to the width of the input times the
value of the <i>blockSize</i> parameter.