ptolemy.actor.lib
Class DB
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.actor.lib.Transformer
ptolemy.actor.lib.DB
- All Implemented Interfaces:
- Actor, Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable, TypedActor
- 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: DB.java,v 1.19 2004/04/13 03:02:45 cxh Exp $
- Author:
- Bart Kienhuis and Edward A. Lee
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
|
Constructor Summary |
DB(CompositeEntity container,
java.lang.String name)
Construct an actor in the specified container with the specified
name. |
|
Method Summary |
void |
fire()
Read a token from the input and convert its value into a
decibel representation. |
int |
iterate(int count)
Invoke a specified number of iterations of this actor. |
| Methods inherited from class ptolemy.actor.AtomicActor |
_createReceivers, clone, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, initialize, inputPortList, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, removeDependency, setContainer, stop, stopFire, terminate, wrapup |
| Methods inherited from class ptolemy.kernel.Entity |
_description, _exportMoMLContents, _removePort, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName, validateSettables |
| Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, toplevel, toString, workspace |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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.
DB
public DB(CompositeEntity container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
- Construct an actor in the specified container with the specified
name.
- Parameters:
container - The container.name - The name of this actor within the container.
- Throws:
IllegalActionException - If the actor cannot be contained
by the proposed container.
NameDuplicationException - If the name coincides with
an actor already in the container.
fire
public void fire()
throws IllegalActionException
- Read a token from the input and convert its value into a
decibel representation. If the input does not contain any tokens,
do nothing.
- Specified by:
fire in interface Executable- Overrides:
fire in class AtomicActor
- Throws:
IllegalActionException - If there is no director.
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
- 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.