Class BandlimitedNoise

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

    public class BandlimitedNoise
    extends Gaussian
    This actor generates continuous-time noise with a Gaussian distribution and controlled bandwidth. The power spectrum of the noise produced is given by
      S(f) = T s^2 sinc^4(pi f T)
    
    where f is frequency, s is the standard deviation, and the sinc function is given by
      sinc(a) = sin(a)/a
    
    Here, T = 1/b, where b is the value of the bandwidth parameter. Notice that the power declines as the fourth power of one over the frequency. The bandwidth parameter specifies the frequency (in Hertz) at which the first zero occurs, or, equivalently, roughly the width of the main lobe.

    This actor may affect the step size taken by the solver. Specifically, it ensures that the solver provides executions at least as frequently as twice the specified bandwidth. This is nominally the Nyquist frequency of an ideally bandlimited noise frequency, but since this noise process is not ideally bandlimited, the solver samples will typically have aliasing distortion. If you need to control that aliasing distortion, then you can set the maxStepSize parameter to something smaller than 1/2b, where b is the bandwidth.

    For some uses, the effect that this actor has on the step size may be undesirable because it increases the cost of simulation. If a less rigorous form of noise is desired (for rough models or simple demonstrations), you can use the Noise actor.

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

      • bandwidth

        public Parameter bandwidth
        The bandwidth of the noise random process in Hertz. The bandwidth is the frequency where the power spectral density first hits zero. This is a double that defaults to 10.0 Hertz.
    • Method Detail

      • fire

        public void fire()
                  throws IllegalActionException
        Produce a number that is linearly interpolated within the current integration step, if linearlyInterpolate is true, or the random number for the beginning of the integration step otherwise.
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class Gaussian
        Throws:
        IllegalActionException - If the superclass throws it.
      • initialize

        public void initialize()
                        throws IllegalActionException
        Initialize the random number generator with the seed, if it has been given. A seed of zero is interpreted to mean that no seed is specified. In such cases, a seed based on the current time and this instance of a RandomSource is used to be fairly sure that two identical sequences will not be returned.
        Specified by:
        initialize in interface Initializable
        Overrides:
        initialize in class RandomSource
        Throws:
        IllegalActionException - If the parent class throws it.
      • postfire

        public boolean postfire()
                         throws IllegalActionException
        If we are at the end of the current interval, then generate a new random number for the new interval, and request a refiring at the end of that interval.
        Specified by:
        postfire in interface Executable
        Overrides:
        postfire in class RandomSource
        Returns:
        True if it is OK to continue.
        Throws:
        IllegalActionException - If the base class throws it.
      • _generateRandomNumber

        protected void _generateRandomNumber()
                                      throws IllegalActionException
        Generate a new random number. This gets called in initialize() and in the first fire() method of an iteration. It produces a number that is to be the random number at the end of the current iteration.
        Overrides:
        _generateRandomNumber in class Gaussian
        Throws:
        IllegalActionException - If parameter values are incorrect.