Class DB

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

    public class DB
    extends Transformer
    Produce a token that is the value of the input in decibels. That is, if the input is z, then the output is k*log10(z). The constant k depends on the value of the inputIsPower parameter. If that parameter is true, then k = 10. Otherwise (the default) k = 20. Normally, you would set inputIsPower to true if the input is the square of a signal, and to false otherwise.

    The output is never smaller than the value of the min parameter. This makes it easier to plot by limiting the range of output values. If the input is zero or negative, then the output is the value of the min parameter.

    The input and output both have type double.

    Since:
    Ptolemy II 1.0
    Version:
    $Id$
    Author:
    Bart Kienhuis and Edward A. Lee
    Pt.AcceptedRating:
    Yellow (ssachs)
    Pt.ProposedRating:
    Yellow (eal)
    • Field Detail

      • inputIsPower

        public Parameter inputIsPower
        If the input is proportional to power, then set this to true. This must be a boolean, and defaults to false.
      • min

        public Parameter min
        The minimum value of the output. This is a double, and defaults to -100.0.
    • Method Detail

      • iterate

        public int iterate​(int count)
                    throws IllegalActionException
        Invoke a specified number of iterations of this actor. Each iteration converts a single token to decibels. An invocation of this method therefore applies the conversion to count successive input tokens.

        This method should be called instead of the usual prefire(), fire(), postfire() methods when this actor is used in a domain that supports vectorized actors. This leads to more efficient execution.

        Specified by:
        iterate in interface Executable
        Overrides:
        iterate in class AtomicActor<TypedIOPort>
        Parameters:
        count - The number of iterations to perform.
        Returns:
        COMPLETED if the actor was successfully iterated the specified number of times. Otherwise, return NOT_READY, and do not consume any input tokens.
        Throws:
        IllegalActionException - If iterating cannot be performed.