ptolemy.domains.ct.kernel
Class CTMultiSolverDirector

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.actor.Director
              extended by ptolemy.actor.sched.StaticSchedulingDirector
                  extended by ptolemy.domains.ct.kernel.CTDirector
                      extended by ptolemy.domains.ct.kernel.CTMultiSolverDirector
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Executable, Initializable, TimedDirector, CTGeneralDirector, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
Direct Known Subclasses:
CTEmbeddedDirector, CTMixedSignalDirector

public class CTMultiSolverDirector
extends CTDirector

A CTDirector that uses multiple ODE solvers. The reason for using different solvers is that we need to handle both normal integration of ODEs over a time interval and abrupt changes in signals (or actors' functions) that happen at discrete time points.

At the time points where abrupt changes happen, a special ODE solver, called breakpointODESolver, is used. Typically, breakpointODESolver does not advance time. The job for a breakpointODESolver is to find the states of the system at a breakpoint. Usually, the system has more than one state at such time points, which is also known as discontinuities. We call the first state at a discontinuity the initial state, and the last state the final state. Therefore, a breakpointODESolver is responsible to resolve the final state of a discontinuity from the inputs and the initial states.

The following paper gives a detailed explanation of initial and final states and how the initial and final states are resolved.

This director handles both predictable breakpoints, whose appearance can be assured before reaching the time points they happen, and unpredictable breakpoints, whose appearance is unknown before the simulation passes the time points they happen.

This director can only be a top-level director. For a CT model as an opaque composite actor inside another model, use CTMixedSignalDirector (if the outer model is a discrete-event model) or CTEmbeddedDirector (if the outer model is a CT model or a Modal model with a HSFSMDirector.)

This director recognizes actors that implement the CTStepSizeControlActor interface and adjusts the step size by polling such actors. If all actors are content with the current step size, then it attempts to raise the step size. If any actor is not satisfied with the current step size, then this director reduces the step size. A special case is that if there are no CT step size control actors, then this director uses 5 times of the current step size or the maximum step size, whichever is smaller.

This director has two more parameters than the CTDirector base class.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
private  ODESolver _breakpointSolver
          The breakpoint solver.
private  java.lang.String _breakpointSolverClassName
          The classname of the breakpoint ODE solver.
protected  boolean _initialStatesNotReady
          Flag indicating the initial states are not ready.
private  ODESolver _normalSolver
          The normal solver.
private  java.lang.String _normalSolverClassName
          The classname of the normal ODE solver.
private static java.lang.String _solverClasspath
          The classpath for solvers.
 Parameter breakpointODESolver
          The class name of the ODE solver that is used in the breakpoint iterations.
 Parameter ODESolver
          The class name of the normal ODE solver used in iterations for normal integration.
 
Fields inherited from class ptolemy.domains.ct.kernel.CTDirector
_timeBase, errorTolerance, initStepSize, maxIterations, maxStepSize, minStepSize, startTime, stopTime, synchronizeToRealTime, valueResolution
 
Fields inherited from class ptolemy.actor.sched.StaticSchedulingDirector
_postfireReturns
 
Fields inherited from class ptolemy.actor.Director
_actorsFinishedExecution, _currentTime, _finishRequested, _initializables, _stopRequested, timeResolution
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
 
Constructor Summary
CTMultiSolverDirector()
          Construct a director in the default workspace with an empty string as its name.
CTMultiSolverDirector(CompositeEntity container, java.lang.String name)
          Construct a director in the given container with the given name.
CTMultiSolverDirector(Workspace workspace)
          Construct a director in the workspace with an empty name.
 
Method Summary
protected  void _continuousPhaseExecution()
          This method performs a continuous phase of execution.
protected  void _discretePhaseExecution()
          Perform a discrete phase of execution by processing all discrete events happening at the current model time.
protected  void _initParameters()
          Initialize parameters to their default values.
protected  boolean _isOutputAccurate()
          Return true if all step size control actors in the output schedule agree that the current step is accurate.
protected  boolean _isStateAccurate()
          Return true if all step size control actors in the dynamic actor schedule and the state transition schedule agree that the current step size is accurate.
protected  void _iterateEventGenerators(CTSchedule schedule)
          Iterate all event generators .
protected  void _iteratePurelyDiscreteActors(CTSchedule schedule)
          Iterate all purely discrete-event actors.
private  void _iterateSchedule(ScheduleElement schedule)
          Iterate all the actors inside a given schedule, by prefiring, firing and postfiring them.
protected  void _iterateWaveformGenerators(CTSchedule schedule)
          Iterate all wave generators.
private  void _markStates()
          Mark the current state as the known good state.
protected  double _predictNextStepSize()
          Predict the next step size.
protected  void _propagateResolvedStates()
          Use breakpoint ODE solver to propagate the resolved states at the current phase of execution.
private  double _refinedStepWRTBreakpoints()
          Adjust step size so that the first breakpoint is not in the middle of this step.
protected  double _refinedStepWRTOutput()
          Return the refined step size with respect to the output actors.
protected  double _refinedStepWRTState()
          Return the refined step size with respect to state accuracy requirement.
protected  boolean _removeCurrentTimeFromBreakpointTable()
          Return true if the current time is the first element in the breakpoint table, and remove that element from the breakpoint table.
protected  void _resolveInitialStates()
          Resolve the initial states with a normal ODE solver at a further time.
 void attributeChanged(Attribute attribute)
          React to a change in an attribute.
 boolean canBeInsideDirector()
          Return false always, since this director cannot be an inside director.
 boolean canBeTopLevelDirector()
          Return true since this director can be a top-level director.
 void establishInitialStates()
          Establish the initial states for discrete phase of execution.
 void fire()
          Fire the system for one iteration.
 void fireEventGenerators()
          Fire event generators.
 ODESolver getBreakpointSolver()
          Return the breakpoint ODE solver.
 CTGeneralDirector getExecutiveCTGeneralDirector()
          Always return null, because this director can not be an inside director.
 ODESolver getNormalODESolver()
          Return the ODE solver for normal integration.
 java.lang.String getODESolverClassName()
          Return the class name for the ODE solver.
 boolean hasCurrentEvent()
          Return true if there is an event at the current time.
 void initialize()
          Initialize the model for a simulation.
 boolean postfire()
          Return true if this director wants to be fired again.
 void postfireEventGenerators()
          Postfire event generators.
 boolean prefire()
          Call the prefire() method of the super class and return its value.
 void preinitialize()
          After calling the preinitialize() method of the super class, instantiate all the solvers.
 void produceOutput()
          Fire all the actors in the output schedule.
 void setInitialStatesNotReady()
          Set the flag indicating that the initial states are not ready.
 void setModelTime(Time newTime)
          Set a new value to the current time of the model, where the new time can be earlier than the current time to support rollback.
 void updateContinuousStates()
          Call the postfire() method on all continuous actors in the schedule.
 
Methods inherited from class ptolemy.domains.ct.kernel.CTDirector
_instantiateODESolver, _setCurrentODESolver, _setDiscretePhase, _setExecutionPhase, _setIterationBeginTime, clone, delayDependency, fireAt, getBreakPoints, getCurrentODESolver, getCurrentStepSize, getErrorTolerance, getExecutionPhase, getInitialStepSize, getIterationBeginTime, getMaxIterations, getMaxStepSize, getMinStepSize, getModelNextIterationTime, getModelStartTime, getModelStopTime, getSuggestedNextStepSize, getValueResolution, isDiscretePhase, newReceiver, prefireClear, prefireDynamicActors, setCurrentStepSize, setSuggestedNextStepSize, suggestedModalModelDirectors
 
Methods inherited from class ptolemy.actor.sched.StaticSchedulingDirector
_setScheduler, addDebugListener, getScheduler, invalidateSchedule, isScheduleValid, removeDebugListener, setScheduler
 
Methods inherited from class ptolemy.actor.Director
_description, _fireContainerAt, _isEmbedded, _isTopLevel, _transferInputs, _transferOutputs, addInitializable, createSchedule, defaultDependency, finish, fireAt, fireAtCurrentTime, getCausalityInterface, getCurrentTime, getGlobalTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, implementsStrictActorSemantics, initialize, invalidateResolvedTypes, isFireFunctional, isStopRequested, isStrict, iterate, preinitialize, removeInitializable, requestInitialization, setContainer, setCurrentTime, stop, stopFire, supportMultirateFiring, terminate, transferInputs, transferOutputs, wrapup
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, attributeList, attributeList, attributeTypeChanged, 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, propagateExistence, propagateValue, propagateValues, removeChangeListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.actor.TimedDirector
getModelTime, getTimeResolution
 

Field Detail

breakpointODESolver

public Parameter breakpointODESolver
The class name of the ODE solver that is used in the breakpoint iterations. The default value is a string: "ptolemy.domains.ct.kernel.solver.DerivativeResolver".


ODESolver

public Parameter ODESolver
The class name of the normal ODE solver used in iterations for normal integration. The default value is a string: "ptolemy.domains.ct.kernel.solver.ExplicitRK23Solver".


_initialStatesNotReady

protected boolean _initialStatesNotReady
Flag indicating the initial states are not ready. FIXME: This isn't clear.... What is this flag for? Why is it so publically visible?


_breakpointSolver

private ODESolver _breakpointSolver
The breakpoint solver.


_breakpointSolverClassName

private java.lang.String _breakpointSolverClassName
The classname of the breakpoint ODE solver.


_normalSolver

private ODESolver _normalSolver
The normal solver.


_normalSolverClassName

private java.lang.String _normalSolverClassName
The classname of the normal ODE solver.


_solverClasspath

private static java.lang.String _solverClasspath
The classpath for solvers.

Constructor Detail

CTMultiSolverDirector

public CTMultiSolverDirector()
Construct a director in the default workspace with an empty string as its name. The director is added to the list of objects in the workspace. Increment the version number of the workspace. All the parameters take their default values.


CTMultiSolverDirector

public CTMultiSolverDirector(CompositeEntity container,
                             java.lang.String name)
                      throws IllegalActionException,
                             NameDuplicationException
Construct a director in the given container with the given name. The container argument must not be null, or a NullPointerException will be thrown. If the name argument is null, then the name is set to the empty string. Increment the version number of the workspace. All the parameters take their default values.

Parameters:
container - The container.
name - Name of this director.
Throws:
IllegalActionException - If the director is not compatible with the specified container. May be thrown in derived classes.
NameDuplicationException - If the container is not a CompositeActor and the name collides with an entity in the container.

CTMultiSolverDirector

public CTMultiSolverDirector(Workspace workspace)
Construct a director in the workspace with an empty name. The director is added to the list of objects in the workspace. Increment the version number of the workspace. All the parameters take their default values.

Parameters:
workspace - The workspace of this object.
Method Detail

attributeChanged

public void attributeChanged(Attribute attribute)
                      throws IllegalActionException
React to a change in an attribute. If the changed attribute matches a parameter of the director, then the corresponding private copy of the parameter value will be updated. In particular, if the ODESolver parameter is changed, then the corresponding solver will be instantiated. If the new ODEsolver can not be instantiated, an IllegalActionException will be thrown, and the original ODESolver will be unchanged.

Overrides:
attributeChanged in class CTDirector
Parameters:
attribute - The changed attribute.
Throws:
IllegalActionException - If the new solver can not be instantiated, or the change to other attributes is invalid.

canBeInsideDirector

public boolean canBeInsideDirector()
Return false always, since this director cannot be an inside director.

Specified by:
canBeInsideDirector in class CTDirector
Returns:
false.

canBeTopLevelDirector

public boolean canBeTopLevelDirector()
Return true since this director can be a top-level director.

Specified by:
canBeTopLevelDirector in class CTDirector
Returns:
true.

establishInitialStates

public void establishInitialStates()
                            throws IllegalActionException
Establish the initial states for discrete phase of execution. This method should be called if the initial states are not available. For example, the first iteration of the simulation, or the first execution of an enabled CT refinement.

Throws:
IllegalActionException - If any actor can not be iterated, or can not ODE solver can not be set.

fire

public void fire()
          throws IllegalActionException
Fire the system for one iteration. One iteration is defined as solving the states of a system over a time interval [t_0, t_1]. A complete iteration includes resolving final states at t_0, resolving the initial states at t_1, and producing outputs. This process includes a discrete phase of execution and a continuous phase of execution.

To resolve the final states at the time point t_0, a discrete phase of execution is performed. A discrete phase of execution at a time point is a fixed-point iteration, where the fixed point is reached when no more events exist and there will be no more events to be generated at that time point. To be concrete, at a discrete phase execution, event generators, purely discrete actors, waveform generators, and continuous actors are repeatedly iterated. The discrete phase of execution stops only when no event generators generate any more events. At the ending of the execution, the system states are resolved, which are called the final states at t_0. These states are marked as known good states for roll back purpose. The solver for the discrete phase of execution is a breakpoint ODE solver.

The way we find the fixed point is based on the synchronous reactive semantics. To be specific, the directors resolve the value of each signal from unknown to be either absent or present. This design is simple but firing all actors at each breakpoint causes overhead.

We could have used a smarter event queue like the one used by the DE director. Therefore only those actors with trigger events will be executed. However, this design will increase the complexity of this class. We assume that a CT model does not have many DE actors inside. If the discrete part of the model is complicated with a lot of DE actors, we would suggest using an opaque DE composite actor to encapsulate these DE actors and associate the composite actor with a DE director to take charge of the execution of those DE actors.

A continuous phase of execution immediately follows a discrete one, which solves the initial states at t_1. The initial states at t_1 are resolved by a normal ODE solver. This process is a normal integration over a time interval.

The ending time point t_1 of an iteration is determined by the step sizes suggested by the step size control actors and the earliest entry in the breakpoint table. A correct step size is no greater than the smallest suggested step size, and the current time plus the step size should not be later than the first entry in the breakpoint table.

Because of the existence of unpredictable events, a step size may need to be refined. Another reason to adjust step size is to achieve a reasonably accurate approximation of states. The mechanism to control step size is described below. After the states are resolved, step size control actors in the dynamic actor schedule and the state transition schedule are queried for the accuracy of the current step size. If any one of them is not satisfied with the current step size, then the states will be recalculated with a refined step size, which is the minimum of the refined step sizes from all step size control actors in the dynamic actor schedule and the state transition schedule. On the other hand, if all the above actors are satisfied with the current step, then the actors in the output path will be fired according to the output schedule. Then, the step size control actors in the output path will be checked for accuracy. If any actor is not satisfied with the current step size, the current step size is refined. Note that states have to be resolved again with this new step size. States are completely resolved only when all actors agree that the step size is accurate.

Specified by:
fire in interface Executable
Specified by:
fire in class CTDirector
Throws:
IllegalActionException - If thrown in discrete or continuous phase of execution.

fireEventGenerators

public void fireEventGenerators()
                         throws IllegalActionException
Fire event generators. This method is only called in a continuous phase of execution. Note that event generators are only fired but not postfired in this method.

Throws:
IllegalActionException - If the schedule does not exist, or any actor can not be prefired, or any actor throws it during firing.

getBreakpointSolver

public ODESolver getBreakpointSolver()
Return the breakpoint ODE solver.

Returns:
The breakpoint ODE solver.
See Also:
getNormalODESolver()

getExecutiveCTGeneralDirector

public CTGeneralDirector getExecutiveCTGeneralDirector()
Always return null, because this director can not be an inside director.

Returns:
Null, always.

getNormalODESolver

public ODESolver getNormalODESolver()
Return the ODE solver for normal integration.

Returns:
The ODE solver for normal integration.
See Also:
getBreakpointSolver()

getODESolverClassName

public java.lang.String getODESolverClassName()
Description copied from interface: CTGeneralDirector
Return the class name for the ODE solver.

Returns:
The class name for the ODE solver.

hasCurrentEvent

public boolean hasCurrentEvent()
Return true if there is an event at the current time. The event may be generated by event generators or if the current time was registered as a breakpoint.

Returns:
True if there is an event at current time.

initialize

public void initialize()
                throws IllegalActionException
Initialize the model for a simulation. Construct a valid schedule. Invoke the initialize() method of the super class to set the current time and initialize all the actors directed by this director. Set the step size and the suggested next step size for the first firing. Register the stop time as a breakpoint. This method is called after data types are resolved.

Specified by:
initialize in interface Initializable
Overrides:
initialize in class CTDirector
Throws:
IllegalActionException - If the initialize() method of the super class throws it, or the stop time can not be registered as a breakpoint.

postfire

public boolean postfire()
                 throws IllegalActionException
Return true if this director wants to be fired again. Return false, if the stop time is reached and no more actors need to be fired at that time, or if any actor returned false from its postfire() method.

Specified by:
postfire in interface Executable
Overrides:
postfire in class CTDirector
Returns:
false If the simulation is finished.
Throws:
IllegalActionException - If thrown by the super class, or the current model time is bigger than the stop time.

prefire

public boolean prefire()
                throws IllegalActionException
Call the prefire() method of the super class and return its value. Record the current model time as the beginning time of the current iteration.

Specified by:
prefire in interface Executable
Overrides:
prefire in class StaticSchedulingDirector
Returns:
True if this director is ready to fire.
Throws:
IllegalActionException - If thrown by the super class.

preinitialize

public void preinitialize()
                   throws IllegalActionException
After calling the preinitialize() method of the super class, instantiate all the solvers.

Specified by:
preinitialize in interface Initializable
Overrides:
preinitialize in class CTDirector
Throws:
IllegalActionException - If thrown by the super class, or not all solvers can be instantiated, or the current solver can not be set.

produceOutput

public void produceOutput()
                   throws IllegalActionException
Fire all the actors in the output schedule.

If they have not be prefired, prefire them first. The abstract semantics require that prefire() be called exactly once in an iteration. This is important because, for example, time can only be tested reliably in prefire(). The time tested indicates the starting point of an integration step. During the following possibly multiple firings, time may progress, depending on the ODE solver used. Hierarchies in CT and hybrid systems cases actually rely on this fact to control internal step sizes.

FIXME: If we treat time as a state, it should not change until the postfire method!

Throws:
IllegalActionException - If there is no schedule, or any output actor can not be prefired or fired, or any output actor returns false from its prefire method.

postfireEventGenerators

public void postfireEventGenerators()
                             throws IllegalActionException
Postfire event generators. This method is only called in the continuous phase of execution, after the current step size is accepted by the output step size controllers. Note that discrete events must not be generated in this method. Instead, they will be generated in the immediately following discrete phase of execution.

Throws:
IllegalActionException - If the schedule does not exist, or any actor throws it during postfiring.

setInitialStatesNotReady

public void setInitialStatesNotReady()
Set the flag indicating that the initial states are not ready. This method should only be used by the HSFSMDirector.


setModelTime

public final void setModelTime(Time newTime)
Set a new value to the current time of the model, where the new time can be earlier than the current time to support rollback. This overrides the setCurrentTime() in the Director base class. This is a critical parameter in an execution, and the actors are not supposed to call it.

Overrides:
setModelTime in class Director
Parameters:
newTime - The new current simulation time.
See Also:
Director.getModelTime()

updateContinuousStates

public void updateContinuousStates()
                            throws IllegalActionException
Call the postfire() method on all continuous actors in the schedule. For a correct CT simulation, the state of a continuous actor can only change at this stage of an iteration.

If the synchronizeToRealTime parameter is true, then this method will block execution until the real time catches up with current model time. The units for time are seconds.

Throws:
IllegalActionException - If the synchronizeToRealTime parameter does not have a valid token, or the sleep is interrupted, or there is not a schedule, or any of the actors in the schedule can not be postfired.

_continuousPhaseExecution

protected void _continuousPhaseExecution()
                                  throws IllegalActionException
This method performs a continuous phase of execution. At this phase, a normal ODE solver tries to solve the initial states at a further time t_1, based on the inputs and final states at t_0, where t_0 < t_1. At the end of this method, outputs are generated.

Note that t_1 can be adjusted by the normal ODE solver with respect to the accuracy requirements from step size control actors. Therefore, this method starts with a guess of t_1, or an integration step size as (t_1 - t_0). If all step size control actors are satisfied with the guess, this method returns. Otherwise, the normal ODE solver chooses a smaller step size and tries to solve the states. Therefore, this method ends up with either resolved states or an exception complaining that states can not be resolved even with the preconfigured minimum step size.

Throws:
IllegalActionException - If ODESolver can not be set or one of the continuous actors throws it.

_discretePhaseExecution

protected void _discretePhaseExecution()
                                throws IllegalActionException
Perform a discrete phase of execution by processing all discrete events happening at the current model time. In this method, event generators, purely discrete actors, waveform generators, and continuous actors are repeatedly iterated until the execution reaches a fixed point, where no more events exist at the current time.

Throws:
IllegalActionException - If one of the actors throws it or the schedule does not exist.

_initParameters

protected void _initParameters()
Initialize parameters to their default values.

Overrides:
_initParameters in class CTDirector

_isOutputAccurate

protected boolean _isOutputAccurate()
Return true if all step size control actors in the output schedule agree that the current step is accurate.

Returns:
True if all step size control actors agree with the current step size.

_isStateAccurate

protected boolean _isStateAccurate()
Return true if all step size control actors in the dynamic actor schedule and the state transition schedule agree that the current step size is accurate.

Returns:
True if all state step size control actors agree with the current step size.

_iteratePurelyDiscreteActors

protected void _iteratePurelyDiscreteActors(CTSchedule schedule)
                                     throws IllegalActionException
Iterate all purely discrete-event actors. Purely discrete-event actors are those take discrete signals as inputs and generate discrete signals as outputs.

Parameters:
schedule - The schedule that contains purely discrete-event actors.
Throws:
IllegalActionException - If any actor can not be iterated.

_iterateEventGenerators

protected void _iterateEventGenerators(CTSchedule schedule)
                                throws IllegalActionException
Iterate all event generators .

Parameters:
schedule - The schedule that contains event generators.
Throws:
IllegalActionException - If any actor can not be iterated.

_iterateWaveformGenerators

protected void _iterateWaveformGenerators(CTSchedule schedule)
                                   throws IllegalActionException
Iterate all wave generators.

Parameters:
schedule - The schedule that contains wave generators.
Throws:
IllegalActionException - If any actor can not be iterated.

_predictNextStepSize

protected double _predictNextStepSize()
                               throws IllegalActionException
Predict the next step size. If the current integration step is accurate, estimate the step size for the next iteration. The predicted step size is the minimum of predictions from all step size control actors, and it never exceeds 10 times of the current step size. If there are no step-size control actors at all, then return the current step size times 5. However, it never exceeds the maximum step size.

Returns:
the prediced next step size.
Throws:
IllegalActionException - If the scheduler throws it.

_refinedStepWRTOutput

protected double _refinedStepWRTOutput()
                                throws IllegalActionException
Return the refined step size with respect to the output actors. All the step size control actors in the output schedule are queried for a refined step size. The smallest one is returned.

Returns:
The refined step size.
Throws:
IllegalActionException - If the scheduler throws it or the refined step size is less than the time resolution.

_refinedStepWRTState

protected double _refinedStepWRTState()
                               throws IllegalActionException
Return the refined step size with respect to state accuracy requirement. All the step size control actors in the state transition and dynamic actor schedule are queried for a refined step size. Then the smallest one is returned.

Returns:
The refined step size.
Throws:
IllegalActionException - If the scheduler throws it, or the refined step size is less than the minimum step size parameter of the director.

_removeCurrentTimeFromBreakpointTable

protected boolean _removeCurrentTimeFromBreakpointTable()
                                                 throws IllegalActionException
Return true if the current time is the first element in the breakpoint table, and remove that element from the breakpoint table. Otherwise, the breakpoint table is unchanged.

Returns:
true if the current time is a breakpoint.
Throws:
IllegalActionException - If a breakpoint is missed.

_propagateResolvedStates

protected void _propagateResolvedStates()
                                 throws IllegalActionException
Use breakpoint ODE solver to propagate the resolved states at the current phase of execution.

Throws:
IllegalActionException - If one of the actors throws it or the ODE solver can not be set.

_resolveInitialStates

protected void _resolveInitialStates()
                              throws IllegalActionException
Resolve the initial states with a normal ODE solver at a further time. The future time is the current time pulse the step size used by the solver. Return immediately if any actor returns false in their prefire() method. After this method is called, time advances to the future time.

Throws:
IllegalActionException - If one the actors throws it in its execution methods.

_iterateSchedule

private void _iterateSchedule(ScheduleElement schedule)
                       throws IllegalActionException
Iterate all the actors inside a given schedule, by prefiring, firing and postfiring them.

Throws:
IllegalActionException

_markStates

private void _markStates()
                  throws IllegalActionException
Mark the current state as the known good state. Call the markStates() method on all CTStatefulActors.

Throws:
IllegalActionException - If thrown by the scheduler.

_refinedStepWRTBreakpoints

private double _refinedStepWRTBreakpoints()
Adjust step size so that the first breakpoint is not in the middle of this step. Return the refined step size.