public class LMSAdaptive extends FIR
When used correctly, this LMS adaptive filter will adapt to try to minimize the mean-squared error of the signal at its error input. In order for this to be possible, the output of the filter should be compared (subtracted from) some reference signal to produce an error signal. That error signal should be fed back to the error input.
The stepSize parameter determines the rate of adaptation. If its magnitude is too large, or if it has the wrong sign, then the adaptation algorithm will be unstable.
The errorDelay parameter must equal the total number of delays in the path from the output of the filter back to the error input. This ensures correct alignment of the adaptation algorithm. The number of delays must be greater than zero.
This actor is type polymorphic, supporting any data type that supports multiplication by a scalar (the stepSize) and addition.
The algorithm is simple. Prior to each invocation of the parent class (an FIR filter), which computes the output given the input, this actor updates the coefficients according to the following formula,
newTapValue = oldTapValue + error * stepSize * tapDatawhere tapData is the contents of the delay line at the tap in question. This assumes that the decimation parameter is set to 1 (the default). If it has a value different from 1, the algorithm is slightly more involved. Similarly, this assumes that the errorDelay is 1.
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
TypedIOPort |
error
The error input port.
|
Parameter |
errorDelay
The number of samples of delay in the feedback loop that
brings the error back.
|
Parameter |
initialTaps
The initial taps of the filter.
|
Parameter |
stepSize
The adaptation step size.
|
TypedIOPort |
tapValues
The output of tap values.
|
_data, _decimationPhaseValue, _decimationValue, _interpolationValue, _mostRecent, _phaseLength, _reinitializeNeeded, _taps, _zero, decimation, decimationPhase, interpolation, taps
input, input_tokenConsumptionRate, output, output_tokenInitProduction, output_tokenProductionRate
_typesValid
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
LMSAdaptive(CompositeEntity container,
java.lang.String name)
Construct an actor with the given container and name.
|
Modifier and Type | Method and Description |
---|---|
void |
attributeChanged(Attribute attribute)
Override the base class to set the taps parameter if the
initialTaps parameter is changed.
|
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace.
|
void |
fire()
Consume the inputs, update the taps, and produce the outputs.
|
void |
initialize()
Override the base class to re-initialize the taps.
|
boolean |
prefire()
Return false if the error input does not have enough tokens to fire.
|
_customTypeConstraints, _initializeTaps, _reinitialize
_containedTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate, postfire, stop, stopFire, terminate
addInitializable, preinitialize, removeInitializable, wrapup
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public TypedIOPort error
public Parameter errorDelay
public Parameter initialTaps
public Parameter stepSize
public TypedIOPort tapValues
public LMSAdaptive(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name of this actor.IllegalActionException
- If the actor cannot be contained
by the proposed container.NameDuplicationException
- If the container already has an
actor with this name.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class FIR
attribute
- The attribute that changed.IllegalActionException
- If the attribute contains
an invalid value or if the super method throws it.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class FIR
workspace
- The workspace for the new object.java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class FIR
IllegalActionException
- If parameter values are invalid,
or if there is no director, or if runtime type conflicts occur.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class FIR
IllegalActionException
- If the superclass throws it.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class FIR
IllegalActionException
- If the superclass throws it.