ptolemy.domains.ct.kernel.solver
Class DerivativeResolver

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.domains.ct.kernel.ODESolver
          extended by ptolemy.domains.ct.kernel.solver.DerivativeResolver
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, BreakpointODESolver, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class DerivativeResolver
extends ODESolver
implements BreakpointODESolver

This solver finds the derivatives of the state variables of an ODE with respect to the current time. For example, if the ODE is

 x' = f(x, u, t),
 
the current time is t0, and
 x(t0) = x0,
 
then this method calculates
 x'(t0) = f(x(t0), u(t0), t0).
 

The derivative is obtained by firing the system for one iteration. This is used for preparing the history for other methods. Note that time does not progress under this solver. So, this class implements BreakpointODESolver and can only be used as a breakpoint solver.

Since:
Ptolemy II 0.4
Version:
$Id: DerivativeResolver.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Jie Liu, Haiyang Zheng
See Also:
Serialized Form
Accepted Rating:
Green (hyzheng)
Proposed Rating:
Green (hyzheng)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
private static java.lang.String _DEFAULT_NAME
          Name of this Solver.
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
DerivativeResolver()
          Construct a solver in the default workspace with the name "CT_Derivative_Resolver".
DerivativeResolver(Workspace workspace)
          Construct a solver in the given workspace with the name "CT_Derivative_Resolver".
 
Method Summary
 void fireStateTransitionActors()
          Fire state transition actors, set converged flag to true indicating a fixed-point states have been reached.
 int getAmountOfHistoryInformation()
          Return 0 to indicate that no history information is needed by this solver.
 int getIntegratorAuxVariableCount()
          Return 0 to indicate that the solver needs no auxiliary variable.
 void integratorFire(CTBaseIntegrator integrator)
          Fire the given integrator.
 boolean integratorIsAccurate(CTBaseIntegrator integrator)
          Return true, since there is no step size control.
 double integratorPredictedStepSize(CTBaseIntegrator integrator)
          Return the initial step size of the director.
 
Methods inherited from class ptolemy.domains.ct.kernel.ODESolver
_advanceModelTime, _getRoundCount, _getSchedule, _incrementRoundCount, _isConverged, _makeSolverOf, _resetRoundCount, _setConverged, _voteForConverged, fireDynamicActors, getContainer, resolveStates
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getContainedObject, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateExistence, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setName, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_DEFAULT_NAME

private static final java.lang.String _DEFAULT_NAME
Name of this Solver.

See Also:
Constant Field Values
Constructor Detail

DerivativeResolver

public DerivativeResolver()
Construct a solver in the default workspace with the name "CT_Derivative_Resolver". The solver is added to the list of objects in the workspace. Increment the version number of the workspace.


DerivativeResolver

public DerivativeResolver(Workspace workspace)
Construct a solver in the given workspace with the name "CT_Derivative_Resolver". If the workspace argument is null, use the default workspace. The solver is added to the list of objects in the workspace. Increment the version number of the workspace.

Parameters:
workspace - Object for synchronization and version tracking
Method Detail

fireStateTransitionActors

public void fireStateTransitionActors()
                               throws IllegalActionException
Fire state transition actors, set converged flag to true indicating a fixed-point states have been reached.

Overrides:
fireStateTransitionActors in class ODESolver
Throws:
IllegalActionException - If thrown in the super class.

getAmountOfHistoryInformation

public final int getAmountOfHistoryInformation()
Return 0 to indicate that no history information is needed by this solver.

Specified by:
getAmountOfHistoryInformation in class ODESolver
Returns:
0.

getIntegratorAuxVariableCount

public final int getIntegratorAuxVariableCount()
Return 0 to indicate that the solver needs no auxiliary variable.

Specified by:
getIntegratorAuxVariableCount in class ODESolver
Returns:
0.

integratorFire

public void integratorFire(CTBaseIntegrator integrator)
                    throws IllegalActionException
Fire the given integrator. Build history information by recording the current input as the derivative and using the old state as the tentative state. Note that this method is called during the discrete phase of execution of an integration. See the _propagateResolvedStates() and _discretePhaseExecution() methods in CTMultiSolverDirector class.

Specified by:
integratorFire in class ODESolver
Parameters:
integrator - The integrator of that calls this method.
Throws:
IllegalActionException - If can not read input.

integratorIsAccurate

public boolean integratorIsAccurate(CTBaseIntegrator integrator)
Return true, since there is no step size control.

Specified by:
integratorIsAccurate in class ODESolver
Parameters:
integrator - The integrator of that calls this method.
Returns:
True always.

integratorPredictedStepSize

public double integratorPredictedStepSize(CTBaseIntegrator integrator)
Return the initial step size of the director. Since this solver is always used as the breakpoint solver, the next integration step will use the initial step size.

Specified by:
integratorPredictedStepSize in class ODESolver
Parameters:
integrator - The integrator of that calls this method.
Returns:
The initial step size.