Class SequentialClock

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

    @Deprecated
    public class SequentialClock
    extends TypedAtomicActor
    implements SequenceActor
    Deprecated.
    Use Clock instead.
    A clock source for sequence-capable domains. This actor is considerably simpler than the Clock actor. On each firing, it produces the next value from its values parameter, and schedules another firing at a future time determined by the offsets and period parameters.

    This actor can be used in the DE domain to generate a sequence of events at regularly spaced intervals. It cannot be used in CT, because CT will invoke it at times where it has not requested a firing, and it will inappropriately advance to the next output value.

    At the beginning of each time interval of length given by period, it initiates a sequence of output events with values given by values and offset into the period given by offsets. These parameters contain arrays, which are required to have the same length. The offsets array must be nondecreasing and nonnegative, or an exception will be thrown when it is set. Moreover, its largest entry must be smaller than period or an exception will be thrown by the fire() method.

    The values parameter by default contains an array of IntTokens with values 1 and 0. The default offsets array is {0.0, 1.0}. Thus, the default output will be alternating 1 and 0 with 50% duty cycle. The default period is 2.0.

    The actor uses the fireAt() method of the director to request firing at the beginning of each period plus each of the offsets. It assumes that all of its firings are in response to such requests.

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

    This actor is a timed source; the untimed version is Pulse.

    Since:
    Ptolemy II 1.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Red (yuhong)
    Pt.ProposedRating:
    Yellow (eal)
    • Field Detail

      • output

        public TypedIOPort output
        Deprecated.
        The output port. The type of this port is determined by from the values parameter.
      • offsets

        public Parameter offsets
        Deprecated.
        The offsets at which the specified values will be produced. This parameter must contain an array of doubles, and it defaults to {0.0, 1.0}.
      • period

        public Parameter period
        Deprecated.
        The period of the output waveform. This parameter must contain a DoubleToken, and defaults to 2.0.
      • values

        public Parameter values
        Deprecated.
        The values that will be produced at the specified offsets. This parameter must contain an ArrayToken, and defaults to {1, 0}.
    • Method Detail

      • attributeChanged

        public void attributeChanged​(Attribute attribute)
                              throws IllegalActionException
        Deprecated.
        If the argument is the offsets parameter, check that the array is nondecreasing and has the right dimension; if the argument is period, check that it is positive. Other sanity checks with period and values are done in the fire() method.
        Overrides:
        attributeChanged in class NamedObj
        Parameters:
        attribute - The attribute that changed.
        Throws:
        IllegalActionException - If the offsets array is not nondecreasing and nonnegative, or it is not a row vector.
      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Deprecated.
        Clone the actor into the specified workspace. This calls the base class and then sets the parameter public members to refer to the parameters of the new actor.
        Overrides:
        clone in class TypedAtomicActor
        Parameters:
        workspace - The workspace for the new object.
        Returns:
        A new actor.
        Throws:
        java.lang.CloneNotSupportedException - If a derived class contains an attribute that cannot be cloned.
        See Also:
        NamedObj.exportMoML(Writer, int, String), NamedObj.setDeferringChangeRequests(boolean)
      • fire

        public void fire()
                  throws IllegalActionException
        Deprecated.
        Output the current value of the clock.
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class AtomicActor<TypedIOPort>
        Throws:
        IllegalActionException - If the values and offsets parameters do not have the same length, or if the value in the offsets parameter is encountered that is greater than the period, or if there is no director.
      • postfire

        public boolean postfire()
                         throws IllegalActionException
        Deprecated.
        Update the state of the actor and schedule the next firing, if appropriate.
        Specified by:
        postfire in interface Executable
        Overrides:
        postfire in class AtomicActor<TypedIOPort>
        Returns:
        True if execution can continue into the next iteration.
        Throws:
        IllegalActionException - If the director throws it when scheduling the next firing, or if the length of the values and offsets parameters don't match.