Class Pulse

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

    public class Pulse
    extends SequenceSource
    Produce a pulse with a shape specified by the parameters. The values parameter contains an ArrayToken, which specifies the sequence of values to produce at the output. The indexes parameter contains an array of integers, which specifies when those values should be produced. The array in the indexes parameter must have the same length as that in the values parameter or an exception will be thrown by the fire() method. Also, the indexes array must be increasing and non-negative, or an exception will be thrown when it is set.

    Eventually, this actor will support various kinds of interpolation. For now, it outputs a zero (of the same type as the values) whenever the iteration count does not match an index in indexes.

    The default for the values parameter is an integer vector of form {1, 0}. The default indexes array is {0, 1}. Thus, the default output sequence will be 1, 0, 0, ...

    However, the Pulse actor has a repeat parameter. When set to true, the defined sequence is repeated indefinitely. Otherwise, the default sequence of zero values result.

    The type of the output can be any token type. This type is inferred from the element type of the values parameter.

    The Ptolemy Expression language has several constructs that are useful for creating arrays for use as values or indexes:

    [0:1:100].toArray()
    Matlab style array construction that creates an array of 100 elements, 0 through 99.
    repeat(100, {1}(0))
    Creat a sequence of one hundred 1's.

    NOTE: A reset input for this actor would be useful. This would reset the iterations count, to cause the pulse to emerge again.

    Since:
    Ptolemy II 0.2
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Yellow (cxh)
    Pt.ProposedRating:
    Yellow (eal)