A CTDirector may have more than one ODE solver. In each phase of execution, one ODE solver takes charge of solving the behavior of a model. This solver is called the current ODE solver.
The continuous time (CT) domain is a timed domain. There is a global notion of time that all the actors are aware of. Time is maintained by the director. The method getModelTime() returns the current notion of model time. Time can be set by the setModelTime() method, but this method should not the called by the actors. Time can only be set by directors or their ODE solvers. Because ODE solvers can change time in their fire() methods, we need to record the beginning time of an iteration to support roll back. The _setIterationBeginTime() method is just designed for this purpose. It is called in the prefire() method of each iteration to store the beginning time, and the getIterationBeginTime() returns the lastest stored time.
This base class maintains a list of parameters that may be used by ODE solvers and actors. These parameters are:
startTime
: The start time of the simulation. This parameter is effective only if the director is at the top level. The default value is 0.0. stopTime
: The stop time of the simulation. This parameter is effective only if the director is at the top level. The default value is Infinity, which results in execution that does not stop on its own. initStepSize
: The suggested integration step size by the user. This will be the step size for fixed step size ODE solvers if there is no breakpoint. However, it is just a hint. The default value is 0.1 minStepSize
: The minimum step size that users want to use in the simulation. The default value is 1e-5. maxStepSize
: The maximum step size that users want to use in the simulation. Usually used to control the simulation speed. The default value is 1.0. maxIterations
: Used only in implicit ODE solvers. This is the maximum number of iterations for finding the fixed point at one time point. The default value is 20. errorTolerance
: This is the local truncation error tolerance, used for controlling the integration accuracy in variable step size ODE solvers. If the local truncation error at some step size control actors are greater than this tolerance, then the integration step is considered to have failed, and should be restarted with a reduced step size. The default value is 1e-4. valueResolution
: This is used to control the convergence of fixed point iterations. If in two successive iterations the difference of the state variables is less than this resolution, then the fixed point is considered to have reached. The default value is 1e-6. This director maintains a breakpoint table to record all predictable breakpoints that are greater than or equal to the current time. The breakpoints are sorted in their chronological order. Breakpoints at the same time are considered to be identical, and the breakpoint table does not contain duplicate time points. A breakpoint can be inserted into the table by calling the fireAt() method. The fireAt method may be requested by the director, which inserts the stop time of the execution. The fireAt method may also be requested by actors and the requested firing time will be inserted into the breakpoint table. @author Jie Liu, Haiyang Zheng @version $Id: CTDirector.java,v 1.203 2007/12/06 18:21:49 cxh Exp $ @since Ptolemy II 0.2 @Pt.ProposedRating Green (hyzheng) @Pt.AcceptedRating Green (hyzheng)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|