|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.domains.ct.kernel.CTBaseIntegrator
Base class for integrators in the continuous time (CT) domain. An integrator has one input port and one output port. Conceptually, the input is the derivative of the output w.r.t. time. So an ordinary differential equation dx/dt = f(x, t) can be built by:
+---------------+dx/dt | | x+--------->| Integrator |---------+----->| | | || +---------------+ || || |---------| |+-------------| f(x, t) |<-----------+|---------|
An integrator is a dynamic actor that can emit a token (the state) without knowing the input. An integrator is a step size control actor that can control the accuracy of the ODE solution by adjusting step sizes. An integrator has memory, which is its state.
To help solving the ODE, a set of variables are used:
state: This is the value of the state variable at a time point,
which has beed confirmed by all the step size control actors.
tentative state: This is the value of the state variable
which has not been confirmed. It is a starting point for other actors
to estimate the accuracy of this integration step.
history: The previous states and their derivatives. History may
be used by multistep methods.
For different ODE solving methods, the functionality of an integrator may be different. The delegation and strategy design patterns are used in this class, ODESolver class, and the concrete ODE solver classes. Some solver-dependent methods of integrators are delegated to the ODE solvers.
An integrator has one parameter: the initialState. At the initialization stage of the simulation, the state of the integrator is set to the initial state. Changes of the initialState parameter are ignored after the execution starts, unless the initialize() method is called again. The default value of the parameter is 0.0 of type DoubleToken.
An integrator can possibly have several auxiliary variables for the the ODE solvers to use. The number of the auxiliary variables is checked before each iteration. The ODE solver class provides the number of variables needed for that particular solver. The auxiliary variables can be set and get by setAuxVariables() and getAuxVariables() methods.
ODESolver,
CTDirector,
Serialized Form
| Green (yuhong) |
| Green (liuj) |
| Nested Class Summary | |
protected class |
CTBaseIntegrator.History
The history information, state and derivatives, at equidistance past time points. |
| Nested classes inherited from class ptolemy.kernel.Entity |
Entity.ContainedObjectsIterator |
| Field Summary | |
protected CTBaseIntegrator.History |
_history
The history states and their derivative. |
Parameter |
initialState
The initial state of type DoubleToken. |
TypedIOPort |
input
The input port. |
TypedIOPort |
output
The output port. |
| 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 | |
CTBaseIntegrator(CompositeEntity container,
java.lang.String name)
Construct an integrator, with a name and a container. |
|
| Method Summary | |
void |
clearHistory()
Clear the history information. |
void |
emitTentativeOutputs()
Emit the tentative output, which is the tentative state of the integrator. |
void |
fire()
Delegate to the integratorFire() of the current ODE solver. |
double[] |
getAuxVariables()
Return the auxiliary variables in a double array. |
double |
getDerivative()
Return the latest updated derivative of the state variable. |
double[] |
getHistory(int index)
Return the history information of the last index-th step. |
int |
getHistoryCapacity()
Return the history capacity. |
double |
getState()
Return the state of the integrator. |
double |
getTentativeState()
Return the tentative state. |
int |
getValidHistoryCount()
Return the number of valid history entries. |
void |
goToMarkedState()
Go to the marked state. |
void |
initialize()
Initialize the integrator. |
boolean |
isThisStepAccurate()
Return true if this integration step is accurate from this integrator's point of view. |
void |
markState()
Mark and remember the current state. |
boolean |
postfire()
Update the state and its derivative, and push them into history. |
double |
predictedStepSize()
Return the predicted next step size. |
boolean |
prefire()
Setup the integrator to operate with the current ODE solver. |
void |
pruneDependencies()
Override the base class to declare that the output does not depend on the input in a firing. |
double |
refinedStepSize()
Return the estimation of the refined next step size. |
void |
setAuxVariables(int index,
double value)
Set the value of an auxiliary variable. |
void |
setHistoryCapacity(int cap)
Set history capacity. |
void |
setTentativeDerivative(double value)
Set the tentative derivative, dx/dt. |
void |
setTentativeState(double value)
Set the tentative state. |
| 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, 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 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 |
public TypedIOPort input
public TypedIOPort output
public Parameter initialState
protected CTBaseIntegrator.History _history
| Constructor Detail |
public CTBaseIntegrator(CompositeEntity container,
java.lang.String name)
throws NameDuplicationException,
IllegalActionException
container - The container.name - The name
NameDuplicationException - If the name is used by another
actor in the container.
IllegalActionException - Not thrown in this base class.| Method Detail |
public void clearHistory()
public void emitTentativeOutputs()
throws IllegalActionException
emitTentativeOutputs in interface CTDynamicActorIllegalActionException - If the data transfer is not
completed.
public void fire()
throws IllegalActionException
fire in interface Executablefire in class AtomicActorIllegalActionException - If thrown by integratorFire()
of the solver.public double[] getAuxVariables()
public final double getDerivative()
public double[] getHistory(int index)
index - The index.
public final int getHistoryCapacity()
public final double getState()
public double getTentativeState()
public final int getValidHistoryCount()
public void goToMarkedState()
goToMarkedState in interface CTStatefulActor
public void initialize()
throws IllegalActionException
initialize in interface Executableinitialize in class AtomicActorIllegalActionException - If there's no director or
the director has no ODE solver, or thrown by the
integratorInitialize() of the solver.public boolean isThisStepAccurate()
isThisStepAccurate in interface CTStepSizeControlActorpublic void markState()
markState in interface CTStatefulActor
public boolean postfire()
throws IllegalActionException
postfire in interface Executablepostfire in class AtomicActorIllegalActionException - Not thrown in this base class.public double predictedStepSize()
predictedStepSize in interface CTStepSizeControlActor
public boolean prefire()
throws IllegalActionException
prefire in interface Executableprefire in class AtomicActorIllegalActionException - If there's no director or
the director has no ODE solver.public double refinedStepSize()
refinedStepSize in interface CTStepSizeControlActor
public void setAuxVariables(int index,
double value)
throws InvalidStateException
index - The index in the auxVariables array.value - The value to be set.
InvalidStateException - If the index is out of the range
of the auxiliary variable array.public void pruneDependencies()
pruneDependencies in class AtomicActorTimedDelay,
AtomicActor.removeDependency(IOPort, IOPort),
FunctionDependencyOfAtomicActorpublic final void setHistoryCapacity(int cap)
cap - The capacity.public final void setTentativeDerivative(double value)
value - The value to be set.public final void setTentativeState(double value)
value - The value to be set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||