Class AbstractUnscentedKalmanFilter
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity
-
- ptolemy.kernel.CompositeEntity
-
- ptolemy.actor.CompositeActor
-
- ptolemy.actor.TypedCompositeActor
-
- org.ptolemy.machineLearning.particleFilter.AbstractUnscentedKalmanFilter
-
- All Implemented Interfaces:
java.lang.Cloneable,Actor,Executable,FiringsRecordable,Initializable,TypedActor,Changeable,Debuggable,DebugListener,Derivable,Instantiable,ModelErrorHandler,MoMLExportable,Moveable,Nameable
- Direct Known Subclasses:
UnscentedKalmanFilterSSM
public abstract class AbstractUnscentedKalmanFilter extends TypedCompositeActor
Abstract Unscented Kalman Filter Base Class.- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Shuhei Emoto
- See Also:
ParticleFilter- Pt.AcceptedRating:
- Red
- Pt.ProposedRating:
- Red (shuhei)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractUnscentedKalmanFilter.InputType-
Nested classes/interfaces inherited from class ptolemy.kernel.CompositeEntity
CompositeEntity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected IORelation[]_inputRelationsArray of input Relations.protected double[][]_SigmaMeasurement covariance matrix.protected java.lang.String[]_sigmaPointLabelsLabels of sigma points, that contains state names and a weight label.protected Type[]_sigmaPointTypesTypes of each sigma point dimension.protected java.lang.String[]_stateLabelsLabels of states.protected ArrayToken_stateNamesCached State variable names.protected Type[]_stateTypesTypes of each state dimension.protected boolean_upToDateFlag indicating whether the contained model is up to date.protected static java.lang.StringMEASUREMENT_NOISEprotected static java.lang.StringMEASUREMENT_POSTFIXParameterpriorCovarianceA matrix value used in initialization of sigma points.ParameterpriorMeanStateAn array value used in initialization of state variables.ParameterprocessNoiseCovariancea matrix value which determine process noise.TypedIOPortsigmaPointOutputThe output port that outputs the sigma-points of distribution of state variable at each firing.protected static java.lang.StringSTATE_VARIABLE_NAMESTypedIOPortstateEstimateState estimate output.ParametertThe value of current time.protected static java.lang.StringUPDATE_POSTFIX-
Fields inherited from class ptolemy.actor.CompositeActor
_actorFiringListeners, _causalityInterface, _derivedPiggybacks, _initializables, _notifyingActorFiring, _piggybacks, _publishedPorts, _publisherRelations, _stopRequested, _subscribedPorts
-
Fields inherited from class ptolemy.kernel.CompositeEntity
_levelCrossingLinks
-
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 AbstractUnscentedKalmanFilter(CompositeEntity container, java.lang.String name)Construct the composite actor with a name and a container.AbstractUnscentedKalmanFilter(Workspace workspace)Construct a UKF in the specified workspace with no container and an empty string as a name.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void_checkParameters()Check the dimensions of all parameters and ports.voidattributeChanged(Attribute attribute)If the argument is any parameter other than stateVariableNames t, or any parameter matching an input port, then request reinitialization.voidfire()Override the base class to first set the value of the parameter t to match current time, then to set the local parameters that mirror input values, and then to fire the contained actors.protected abstract AbstractUnscentedKalmanFilter.InputTypegetInputType(java.lang.String inputName)protected abstract ParametergetMeasurementParameter(java.lang.String fullName)protected java.lang.StringgetMeasurementParameterExpression(java.lang.String fullName)protected abstract ParametergetNoiseParameter(java.lang.String inputName)protected abstract ParametergetUserDefinedParameter(java.lang.String parameterName)Return the Parameter that is part of a state space model.protected java.lang.StringgetUserDefinedParameterExpression(java.lang.String parameterName)Return the expression for a user-defined parameter.voidpreinitialize()Create the model inside from the parameter values.voidwrapup()If this actor is opaque, then invoke the wrapup() method of the local director.-
Methods inherited from class ptolemy.actor.TypedCompositeActor
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _destinationTypeConstraints, attributeTypeChanged, isBackwardTypeInferenceEnabled, newPort, newRelation, resolveTypes, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.CompositeActor
_actorFiring, _actorFiring, _finishedAddEntity, _setDirector, _transferPortParameterInputs, addActorFiringListener, addInitializable, addPiggyback, clone, connectionsChanged, createReceivers, createSchedule, getCausalityInterface, getDirector, getExecutiveDirector, getManager, getPublishedPort, getPublishedPortChannel, getPublishedPorts, getSubscribedPortChannel, inferringWidths, inferWidths, initialize, inputPortList, isFireFunctional, isOpaque, isPublishedPort, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, postfire, prefire, recordFiring, registerPublisherPort, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, unregisterPublisherPort
-
Methods inherited from class ptolemy.kernel.CompositeEntity
_adjustDeferrals, _containedDecorators, _deepOpaqueEntityList, _description, _exportMoMLContents, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepCompositeEntityList, deepEntityList, deepGetEntities, deepNamedObjList, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyAllCompositeTransparentAndOpaqueEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, clone, 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, 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, postfire, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, initialize, removeInitializable
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
sigmaPointOutput
public TypedIOPort sigmaPointOutput
The output port that outputs the sigma-points of distribution of state variable at each firing.
-
stateEstimate
public TypedIOPort stateEstimate
State estimate output. A record token with one field per state variable.
-
t
public Parameter t
The value of current time. This parameter is not visible in the expression screen except in expert mode. Its value initially is just 0.0, a double, but upon each firing, it is given a value equal to the current time as reported by the director.
-
priorCovariance
public Parameter priorCovariance
A matrix value used in initialization of sigma points.
-
priorMeanState
public Parameter priorMeanState
An array value used in initialization of state variables.
-
processNoiseCovariance
public Parameter processNoiseCovariance
a matrix value which determine process noise.
-
_upToDate
protected boolean _upToDate
Flag indicating whether the contained model is up to date.
-
_stateNames
protected ArrayToken _stateNames
Cached State variable names.
-
_inputRelations
protected IORelation[] _inputRelations
Array of input Relations.
-
_sigmaPointLabels
protected java.lang.String[] _sigmaPointLabels
Labels of sigma points, that contains state names and a weight label.
-
_sigmaPointTypes
protected Type[] _sigmaPointTypes
Types of each sigma point dimension.
-
_stateLabels
protected java.lang.String[] _stateLabels
Labels of states.
-
_stateTypes
protected Type[] _stateTypes
Types of each state dimension.
-
_Sigma
protected double[][] _Sigma
Measurement covariance matrix.
-
STATE_VARIABLE_NAMES
protected static final java.lang.String STATE_VARIABLE_NAMES
- See Also:
- Constant Field Values
-
MEASUREMENT_NOISE
protected static final java.lang.String MEASUREMENT_NOISE
- See Also:
- Constant Field Values
-
UPDATE_POSTFIX
protected static final java.lang.String UPDATE_POSTFIX
- See Also:
- Constant Field Values
-
MEASUREMENT_POSTFIX
protected static final java.lang.String MEASUREMENT_POSTFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractUnscentedKalmanFilter
public AbstractUnscentedKalmanFilter(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
Construct the composite actor with a name and a container. This constructor creates the ports, parameters, and the icon.- Parameters:
container- The container.name- The name.- Throws:
NameDuplicationException- If another entity already had this name.IllegalActionException- If there was an internal problem.
-
AbstractUnscentedKalmanFilter
public AbstractUnscentedKalmanFilter(Workspace workspace) throws IllegalActionException, NameDuplicationException
Construct a UKF in the specified workspace with no container and an empty string as a name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace.- Parameters:
workspace- The workspace that will list the actor.- Throws:
IllegalActionException- If the name has a period in it, or the director is not compatible with the specified container.NameDuplicationException- If the container already contains an entity with the specified name.
-
-
Method Detail
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
If the argument is any parameter other than stateVariableNames t, or any parameter matching an input port, then request reinitialization.- Overrides:
attributeChangedin classTypedCompositeActor- Parameters:
attribute- The attribute that changed.- Throws:
IllegalActionException- If the numerator and the denominator matrix is not a row vector.
-
fire
public void fire() throws IllegalActionExceptionOverride the base class to first set the value of the parameter t to match current time, then to set the local parameters that mirror input values, and then to fire the contained actors.- Specified by:
firein interfaceExecutable- Overrides:
firein classCompositeActor- Throws:
IllegalActionException- If there is no director, or if the director's fire() method throws it, or if the actor is not opaque.
-
preinitialize
public void preinitialize() throws IllegalActionExceptionCreate the model inside from the parameter values. This method gets write access on the workspace.- Specified by:
preinitializein interfaceInitializable- Overrides:
preinitializein classCompositeActor- Throws:
IllegalActionException- If there is no director, or if any contained actors throws it in its preinitialize() method.
-
getInputType
protected abstract AbstractUnscentedKalmanFilter.InputType getInputType(java.lang.String inputName)
-
wrapup
public void wrapup() throws IllegalActionExceptionDescription copied from class:CompositeActorIf this actor is opaque, then invoke the wrapup() method of the local director. This method is read-synchronized on the workspace.- Specified by:
wrapupin interfaceInitializable- Overrides:
wrapupin classCompositeActor- Throws:
IllegalActionException- If there is no director, or if the director's wrapup() method throws it, or if this actor is not opaque.
-
_checkParameters
protected abstract void _checkParameters() throws IllegalActionExceptionCheck the dimensions of all parameters and ports.- Throws:
IllegalActionException- If the dimensions are illegal.
-
getUserDefinedParameterExpression
protected java.lang.String getUserDefinedParameterExpression(java.lang.String parameterName) throws IllegalActionExceptionReturn the expression for a user-defined parameter.- Parameters:
parameterName- Name of parameter- Returns:
- parameter expression
- Throws:
IllegalActionException
-
getUserDefinedParameter
protected abstract Parameter getUserDefinedParameter(java.lang.String parameterName) throws IllegalActionException
Return the Parameter that is part of a state space model.- Parameters:
parameterName- Name of parameter- Returns:
- Parameter object
- Throws:
IllegalActionException
-
getMeasurementParameterExpression
protected java.lang.String getMeasurementParameterExpression(java.lang.String fullName) throws IllegalActionException- Throws:
IllegalActionException
-
getMeasurementParameter
protected abstract Parameter getMeasurementParameter(java.lang.String fullName) throws IllegalActionException
- Throws:
IllegalActionException
-
getNoiseParameter
protected abstract Parameter getNoiseParameter(java.lang.String inputName) throws IllegalActionException
- Throws:
IllegalActionException
-
-