ptolemy.actor.lib
Class RecursiveLattice

java.lang.Object
  extended byptolemy.kernel.util.NamedObj
      extended byptolemy.kernel.InstantiableNamedObj
          extended byptolemy.kernel.Entity
              extended byptolemy.kernel.ComponentEntity
                  extended byptolemy.actor.AtomicActor
                      extended byptolemy.actor.TypedAtomicActor
                          extended byptolemy.actor.lib.Transformer
                              extended byptolemy.actor.lib.RecursiveLattice
All Implemented Interfaces:
Actor, Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable, TypedActor
Direct Known Subclasses:
VariableRecursiveLattice

public class RecursiveLattice
extends Transformer

A recursive (all-pole) filter with a lattice structure. The coefficients of such a filter are called "reflection coefficients." Recursive lattice filters are typically used as synthesis filters for random processes because it is easy to ensure that they are stable. A recursive lattice filter is stable if its reflection coefficients are all less than unity in magnitude. To get the reflection coefficients for a linear predictor for a particular random process, you can use the LevinsonDurbin actor. The inputs and outputs are of type double.

The default reflection coefficients correspond to the following transfer function:

   1
   H(z) =  --------------------------------------
   1 - 2z-1 + 1.91z-2 - 0.91z-3 + 0.205z-4
   

The structure of the filter is as follows:

   y[0]          y[1]                 y[n-1]           y[n]
   X(n) ---(+)->--o-->----(+)->--o--->-- ... ->--(+)->--o--->---o--->  Y(n)
   \   /          \   /                  \   /        |
   +Kn /        +Kn-1 /                  +K1 /         |
   X              X                      X          |
   -Kn \        -Kn-1 \                  -K1 \         V
   /   \          /   \                  /   \        |
   (+)-<--o--[z]--(+)-<--o--[z]- ... -<--(+)-<--o--[z]--/
   w[1]           w[2]                   w[n]

   
where the [z] are unit delays and the (+) are adders and "y" and "w" are variables representing the state of the filter.

The reflection (or partial-correlation (PARCOR)) coefficients should be specified right to left, K1 to Kn as above. Using exactly the same coefficients in the Lattice actor will result in precisely the inverse transfer function.

Note that the definition of reflection coefficients is not quite universal in the literature. The reflection coefficients in reference [2] are the negative of the ones used by this actor, which correspond to the definition in most other texts, and to the definition of partial-correlation (PARCOR) coefficients in the statistics literature. The signs of the coefficients used in this actor are appropriate for values given by the LevinsonDurbin actor.

References

[1] J. Makhoul, "Linear Prediction: A Tutorial Review", Proc. IEEE, Vol. 63, pp. 561-580, Apr. 1975.

[2] S. M. Kay, Modern Spectral Estimation: Theory & Application, Prentice-Hall, Englewood Cliffs, NJ, 1988.

Since:
Ptolemy II 1.0
Version:
$Id: RecursiveLattice.java,v 1.23 2004/04/13 03:04:05 cxh Exp $
Author:
Edward A. Lee, Christopher Hylands, Steve Neuendorffer
See Also:
IIR, LevinsonDurbin, Lattice, VariableRecursiveLattice, Serialized Form
Accepted Rating:
Yellow (cxh)
Proposed Rating:
Yellow (cxh)

Nested Class Summary
 
Nested classes inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
 
Field Summary
 Parameter reflectionCoefficients
          The reflection coefficients.
 
Fields inherited from class ptolemy.actor.lib.Transformer
input, output
 
Fields inherited from class ptolemy.actor.AtomicActor
_stopRequested
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
 
Constructor Summary
RecursiveLattice(CompositeEntity container, java.lang.String name)
          Construct an actor with the given container and name.
 
Method Summary
 void attributeChanged(Attribute attribute)
          If the argument is the reflectionCoefficients parameter, then reallocate the arrays to use.
 void fire()
          Consume one input token, if there is one, and produce one output token.
 void initialize()
          Initialize the state of the filter.
 boolean postfire()
          Update the backward and forward prediction errors that were generated in fire() method.
 boolean prefire()
          Check to see if this actor is ready to fire.
 
Methods inherited from class ptolemy.actor.TypedAtomicActor
_addPort, attributeTypeChanged, clone, newPort, typeConstraintList
 
Methods inherited from class ptolemy.actor.AtomicActor
_createReceivers, clone, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, inputPortList, iterate, newReceiver, outputPortList, preinitialize, pruneDependencies, removeDependency, setContainer, stop, stopFire, terminate, wrapup
 
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, propagateExistence, setName
 
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.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition
 
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, 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
 
Methods inherited from interface ptolemy.actor.Actor
getDirector, getExecutiveDirector, getFunctionDependency, getManager, inputPortList, newReceiver, outputPortList
 
Methods inherited from interface ptolemy.actor.Executable
iterate, preinitialize, stop, stopFire, terminate, wrapup
 
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getFullName, getName, getName
 

Field Detail

reflectionCoefficients

public Parameter reflectionCoefficients
The reflection coefficients. This is an array of doubles with default value {0.804534, -0.820577, 0.521934, -0.205}. These are the reflection coefficients for the linear predictor of a particular random process.

Constructor Detail

RecursiveLattice

public RecursiveLattice(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

attributeChanged

public void attributeChanged(Attribute attribute)
                      throws IllegalActionException
If the argument is the reflectionCoefficients parameter, then reallocate the arrays to use.

Overrides:
attributeChanged in class NamedObj
Parameters:
attribute - The attribute that changed.
Throws:
IllegalActionException - If the base class throws it.

fire

public void fire()
          throws IllegalActionException
Consume one input token, if there is one, and produce one output token. If there is no input, then produce no output.

Specified by:
fire in interface Executable
Overrides:
fire in class AtomicActor
Throws:
IllegalActionException - If there is no director.

initialize

public void initialize()
                throws IllegalActionException
Initialize the state of the filter.

Specified by:
initialize in interface Executable
Overrides:
initialize in class AtomicActor
Throws:
IllegalActionException - If a derived class throws it.

postfire

public boolean postfire()
                 throws IllegalActionException
Update the backward and forward prediction errors that were generated in fire() method.

Specified by:
postfire in interface Executable
Overrides:
postfire in class AtomicActor
Returns:
False if the number of iterations matches the number requested.
Throws:
IllegalActionException - If there is no director.

prefire

public boolean prefire()
                throws IllegalActionException
Check to see if this actor is ready to fire.

Specified by:
prefire in interface Executable
Overrides:
prefire in class AtomicActor
Returns:
True if this actor is ready for firing, false otherwise.
Throws:
IllegalActionException - If there is no director.