Class SmoothZeroCrossingDetector

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

    public class SmoothZeroCrossingDetector
    extends TypedAtomicActor
    A zero-crossing detector designed for use with quantized-state systems. The input is of type double, and it is assumed to represent a piecewise smooth signal. When presented with an input, if the has either crossed or hit zero since the last seen input, then an output will be produced. If derivatives are available on the input, then they are used to predict the time of the next zero crossing (or touching), and this actor will request a refiring at that time. If it refires at that time, and no other input has arrived in the intervening interval, then it will produce an output in that firing.

    NOTE: This actor currently discards all derivatives of the input higher than the second derivative. Hence, it could miss a zero crossing by a substantial margin if there are higher-order derivatives.

    Since:
    Ptolemy II 11.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    See Also:
    QSSDirector
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Yellow (eal)
    • Field Detail

      • direction

        public StringParameter direction
        A parameter that can be used to limit the detected level crossings to rising or falling. There are three choices: "falling", "rising", and "both". The default value is "both".
      • errorTolerance

        public Parameter errorTolerance
        The error tolerance specifying how close the time needs to be to the zero crossing to produce the output event. This is a double with default 1e-4.
      • input

        public TypedIOPort input
        Input signal. This has type double and is normally a SmoothToken.
      • level

        public Parameter level
        The parameter that specifies the level threshold. By default, it contains a double with value 0.0. Note, a change of this parameter at run time will not be applied until the next iteration.
      • output

        public TypedIOPort output
        Output event with value 0.0 when the zero crossing occurs.
      • value

        public Parameter value
        The output value to produce when a level-crossing is detected. This can be any data type. It defaults to the same value as the level parameter.
      • _level

        protected double _level
        The level threshold this actor detects.