Commutator
ptolemy.actor.lib.Commutator

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 one token from each input channel and sends the token to the output port. The order in which the tokens are produced is the order of the channels in the input multiport. If any input channel has no token, then the fire method returns. 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.

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 tokenProductionRate parameter for the output port to equal the number of input channels. 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.

Author(s): Mudit Goel, Edward A. Lee
Version:$Id: Commutator.java,v 1.54 2005/10/28 20:14:38 cxh Exp $
Pt.Proposed Rating:Yellow (mudit)
Pt.Accepted Rating:Yellow (cxh)




output_tokenProductionRate
The parameter controlling the output port production rate. This parameter contains an IntToken, initially with a value of 0.