|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.domains.ct.kernel.ODESolver
ptolemy.domains.ct.kernel.solver.TrapezoidalRuleSolver
public class TrapezoidalRuleSolver
This is a second order variable step size ODE solver that uses the trapezoidal rule algorithm. Unlike the solvers with fixed step size, this solver adjusts its step size based on the estimation of the local truncation error.
NOTE: The design of this solver, in particular, the design of estimation of the local truncation error, is still preliminary.
For an ODE
x' = f(x, t) x(0) = x0the solver iterates:
x(t+h) = x(t) + (h/2)*(x'(t) + x'(t+h))This solver uses an implicit algorithm, which involves a fixed-point iteration to find x(t+h) and x'(t+h).
The local truncation error (LTE) control is based on the formula 9.78 in "Modeling and Simulation of Dynamic Systems" by Robert L. Woods and Kent L. Lawrence.
The basic idea is that once states and derivatives are resolved, denoted as x(t+h) and x'(t+h), use a two-step method with the calculated derivatives to recalculate the states, denoted as xx(t+h). Since this solver is second order, the LTE is approximately:
abs(x(t+h) - xx(t+h))/(2^2 - 1)This is used to adjust the step size.
Green (hyzheng) |
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. |
private boolean |
_firstStep
|
private boolean |
_recalculatingWithTwoSteps
|
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 | |
---|---|
TrapezoidalRuleSolver()
Construct a solver in the default workspace with an empty string as name. |
|
TrapezoidalRuleSolver(Workspace workspace)
Construct a solver in the given workspace. |
Method Summary | |
---|---|
void |
fireDynamicActors()
Fire dynamic actors. |
void |
fireStateTransitionActors()
Fire state transition actors. |
int |
getAmountOfHistoryInformation()
Return 0 to indicate that this solver needs no history information. |
int |
getIntegratorAuxVariableCount()
Return 2 to indicate that an integrator under this solver needs 2 auxiliary variables. |
void |
integratorFire(CTBaseIntegrator integrator)
Fire the given integrator. |
boolean |
integratorIsAccurate(CTBaseIntegrator integrator)
Perform the integratorIsAccurate() test for the integrator under this solver. |
double |
integratorPredictedStepSize(CTBaseIntegrator integrator)
Provide the suggestedNextStepSize() method for integrators under this solver. |
boolean |
resolveStates()
Return true if the resolved states have converged. |
Methods inherited from class ptolemy.domains.ct.kernel.ODESolver |
---|
_advanceModelTime, _getRoundCount, _getSchedule, _incrementRoundCount, _isConverged, _makeSolverOf, _resetRoundCount, _setConverged, _voteForConverged, getContainer |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String _DEFAULT_NAME
private boolean _recalculatingWithTwoSteps
private boolean _firstStep
Constructor Detail |
---|
public TrapezoidalRuleSolver()
public TrapezoidalRuleSolver(Workspace workspace)
workspace
- Object for synchronization and version trackingMethod Detail |
---|
public void fireDynamicActors() throws IllegalActionException
fireDynamicActors
in class ODESolver
IllegalActionException
- If thrown in the super class or the
model time can not be set.public void fireStateTransitionActors() throws IllegalActionException
fireStateTransitionActors
in class ODESolver
IllegalActionException
- If thrown in the super class.public int getAmountOfHistoryInformation()
getAmountOfHistoryInformation
in class ODESolver
public int getIntegratorAuxVariableCount()
getIntegratorAuxVariableCount
in class ODESolver
public void integratorFire(CTBaseIntegrator integrator) throws IllegalActionException
integratorFire
in class ODESolver
integrator
- The integrator of that calls this method.
IllegalActionException
- If there is no director, or can not
read input, or send output.public boolean integratorIsAccurate(CTBaseIntegrator integrator)
integratorIsAccurate
in class ODESolver
integrator
- The integrator that calls this method.
public double integratorPredictedStepSize(CTBaseIntegrator integrator)
h* max(0.5, power((3.0*tolerance/localError), 1.0/3.0))
integratorPredictedStepSize
in class ODESolver
integrator
- The integrator of that calls this method.
public boolean resolveStates() throws IllegalActionException
resolveStates
in class ODESolver
IllegalActionException
- Not thrown in this base class.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |