Class BandlimitedNoise
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity<T>
-
- ptolemy.actor.AtomicActor<TypedIOPort>
-
- ptolemy.actor.TypedAtomicActor
-
- ptolemy.actor.lib.Source
-
- ptolemy.actor.lib.RandomSource
-
- ptolemy.actor.lib.Gaussian
-
- ptolemy.domains.continuous.lib.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 byS(f) = T s^2 sinc^4(pi f T)
where f is frequency, s is the standard deviation, and the sinc function is given bysinc(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)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description Parameter
bandwidth
The bandwidth of the noise random process in Hertz.-
Fields inherited from class ptolemy.actor.lib.Gaussian
_current, mean, standardDeviation
-
Fields inherited from class ptolemy.actor.lib.RandomSource
_generatorSeed, _needNew, _needNewGenerator, _random, privateSeed, resetOnEachRun, seed
-
Fields inherited from class ptolemy.actor.lib.Source
_triggered, output, trigger
-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description BandlimitedNoise(CompositeEntity container, java.lang.String name)
Construct an actor with the given container and name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
_generateGaussian()
Generate a new random number.protected void
_generateRandomNumber()
Generate a new random number.void
fire()
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.void
initialize()
Initialize the random number generator with the seed, if it has been given.boolean
postfire()
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.-
Methods inherited from class ptolemy.actor.lib.RandomSource
_createGenerator, attributeChanged, clone
-
Methods inherited from class ptolemy.actor.lib.Source
_customTypeConstraints, prefire
-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable, wrapup
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
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.
-
-
Constructor Detail
-
BandlimitedNoise
public BandlimitedNoise(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
Construct an actor with the given container and name.- Parameters:
container
- The container.name
- The name of this actor.- Throws:
IllegalActionException
- If the actor cannot be contained by the proposed container.NameDuplicationException
- If the container already has an actor with this name.
-
-
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 interfaceExecutable
- Overrides:
fire
in classGaussian
- 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 interfaceInitializable
- Overrides:
initialize
in classRandomSource
- 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 interfaceExecutable
- Overrides:
postfire
in classRandomSource
- Returns:
- True if it is OK to continue.
- Throws:
IllegalActionException
- If the base class throws it.
-
_generateGaussian
protected double _generateGaussian() throws IllegalActionException
Generate a new random number.- Returns:
- A random number.
- Throws:
IllegalActionException
- If parameter values are incorrect.
-
_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 classGaussian
- Throws:
IllegalActionException
- If parameter values are incorrect.
-
-