ptolemy.domains.ct.kernel.solver
Class DerivativeResolver

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

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, t),
   
the current time is t0, and
   x(t0) = x0,
   
then this method calculates
   x'(t0) = f(x(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. It assumes that state variables are continuous after the breakpoint. This may not be true if there are impulses in the system. In that case, use ImpulseBESolver as the breakpoint solver for a better result.

Since:
Ptolemy II 0.4
Version:
$Id: DerivativeResolver.java,v 1.36 2004/04/13 05:12:51 cxh Exp $
Author:
Jie Liu
See Also:
Serialized Form
Accepted Rating:
Yellow (liuxj)
Proposed Rating:
Yellow (liuj)

Nested Class Summary
 
Nested classes inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _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
 int getHistoryCapacityRequirement()
          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)
          Provides the fire() method for 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.
 boolean resolveStates()
          Resolve the derivative of the integrators at the current time.
 
Methods inherited from class ptolemy.domains.ct.kernel.ODESolver
_makeSolverOf, _prefireIfNecessary, getContainer, getRound, incrementRound, resetRound
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getContainedObject, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateExistence, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setName, setPersistent, setSource, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

getHistoryCapacityRequirement

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

Specified by:
getHistoryCapacityRequirement 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
Provides the fire() method for the given integrator. This remembers the input token, and use it for x'(t).

Specified by:
integratorFire in class ODESolver
Parameters:
integrator - The integrator of that calls this method.
Throws:
IllegalActionException - Not thrown in this base class. May be needed by the derived class.

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.

resolveStates

public boolean resolveStates()
                      throws IllegalActionException
Resolve the derivative of the integrators at the current time. It gets the state transition schedule from the scheduler and fire for one iteration.

Specified by:
resolveStates in class ODESolver
Throws:
IllegalActionException - Not thrown in this base class May be needed by the derived class.