Class Accumulator

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class Accumulator
    extends Transformer
    Output the initial value plus the sum of all the inputs since the last time a true token was received at the reset port. One output is produced each time the actor is fired. The inputs and outputs can be any token type that supports addition. The output type is constrained to be greater than or equal to the input type and the type of the init parameter.

    If the input and init data type are scalars, then you can also set the lowerBound and upperBound parameters to limit the range of the accumulated value.

    Since:
    Ptolemy II 2.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Yellow (neuendor)
    Pt.ProposedRating:
    Green (eal)
    • Field Detail

      • lowerBound

        public Parameter lowerBound
        The lower bound. If this is set, then its type must be the same as that of the init parameter, and the output will be constrained to never drop below the lower bound. By default, this is not set, so there is no lower bound.
      • init

        public Parameter init
        The value produced by the actor on its first iteration. The default value of this parameter is the integer 0.
      • reset

        public TypedIOPort reset
        If this port receives a True token on any channel, then the accumulator state will be reset to the initial value. This is a multiport and has type boolean.
      • upperBound

        public Parameter upperBound
        The upper bound. If this is set, then its type must be the same as that of the init parameter, and the output will be constrained to never rise above the upper bound. By default, this is not set, so there is no upper bound.