|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.actor.Director
ptolemy.actor.sched.StaticSchedulingDirector
ptolemy.domains.ct.kernel.CTDirector
ptolemy.domains.ct.kernel.CTMultiSolverDirector
A CTDirector that uses multiple ODE solvers. The reason for switching solvers is that when abrupt changes in signals or actor functions (also called breakpoints) occur, the state of the system has to be recalculated. At these points, a special ODE solver, called the "breakpointODESolver" is used. The simulation is executed as if the breakpoint is a new starting point. Typically, breakpointODESolvers do not advance time.
This director handles both predictable breakpoints, which are breakpoints that are registered in the breakpoint table, and unpredictable breakpoints, which are breakpoints that are not known before hand.
This director can only be a top-level director. For a CT domain inside an opaque composite actor, use CTMixedSignalDirector (if the outer domain is discrete) or CTEmbeddedDirector (if the outer domain is a CT domain or a HS domain.)
This director recognizes actors that implement the CTStepSizeControlActor interface. To adjust step sizes, it polls such actors. If all are content with the current step size, then it attempts to raise the step size. If any is not content, then it reduces the step size. If there are no such actors, then it leaves the step size where it is.
This director has two more parameters than the CTDirector base
class.
CTDirector,
Serialized Form
| Green (chf) |
| Green (liuj) |
| Nested Class Summary |
| Nested classes inherited from class ptolemy.kernel.util.NamedObj |
ptolemy.kernel.util.NamedObj.ContainedObjectsIterator |
| Field Summary | |
ptolemy.data.expr.Parameter |
breakpointODESolver
The name of the ODE solver that is used in the iterations just after the breakpoint. |
ptolemy.data.expr.Parameter |
ODESolver
The name of the normal ODE solver used in nonbreakpoint iterations. |
| Fields inherited from class ptolemy.domains.ct.kernel.CTDirector |
_postfireReturns, _refireActors, errorTolerance, initStepSize, maxIterations, maxStepSize, minStepSize, startTime, stopTime, synchronizeToRealTime, timeResolution, valueResolution |
| Fields inherited from class ptolemy.actor.Director |
_currentTime, _stopRequested |
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _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(ptolemy.kernel.CompositeEntity container,
java.lang.String name)
Construct a director in the given container with the given name. |
|
CTMultiSolverDirector(ptolemy.kernel.util.Workspace workspace)
Construct a director in the workspace with an empty name. |
|
| Method Summary | |
protected void |
_continuousPhaseExecution()
Continuous phase execution. |
protected void |
_discretePhaseExecution()
Process discrete events in the system. |
protected void |
_fireOneIteration()
Fire one iteration. |
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 is accurate. |
protected double |
_predictNextStepSize()
Predict the next step size. |
protected boolean |
_prefireDynamicActors()
Invoke prefire() on all DYNAMIC_ACTORS, such as integrators, and emit their tentative outputs. |
protected void |
_processBreakpoints()
Clear obsolete breakpoints, switch to breakpointODESolver if this is the first fire after a breakpoint, and adjust step sizes accordingly. |
protected double |
_refinedStepWRTOutput()
Return the refined the step size with respect to the outputs. |
protected double |
_refinedStepWRTState()
Return the refined step size with respect to resolving the new state. |
void |
attributeChanged(ptolemy.kernel.util.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 |
fire()
Fire the system for one iteration. |
ODESolver |
getBreakpointSolver()
Return the breakpoint ODE solver. |
ODESolver |
getODESolver()
Return the ODE solver. |
boolean |
hasCurrentEvent()
Return true if there is an event at current time. |
void |
initialize()
Initialization after type resolution. |
boolean |
postfire()
Return false if the stop time is reached or if any actor returned false to postfire(). |
boolean |
prefire()
Return true always, indicating that the system is always ready for one iteration. |
void |
preinitialize()
After performing super.preinitialize(), instantiate all the solvers. |
| Methods inherited from class ptolemy.actor.sched.StaticSchedulingDirector |
_setScheduler, addDebugListener, getScheduler, invalidateSchedule, isScheduleValid, removeDebugListener, setScheduler, setScheduleValid |
| Methods inherited from class ptolemy.actor.Director |
_description, _isEmbedded, _isTopLevel, domainPolymorphicTransferInputs, domainPolymorphicTransferOutputs, fireAtCurrentTime, getCurrentTime, getTimeResolution, initialize, invalidateResolvedTypes, iterate, needWriteAccess, requestInitialization, setContainer, setTimeResolution, stop, stopFire, terminate, transferInputs, transferOutputs, wrapup |
| Methods inherited from class ptolemy.kernel.util.Attribute |
_getContainedObject, _propagateExistence, clone, getContainer, setName |
| Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, attributeList, attributeList, attributeTypeChanged, 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, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, toplevel, toString, uniqueName, validateSettables, workspace |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public ptolemy.data.expr.Parameter ODESolver
public ptolemy.data.expr.Parameter breakpointODESolver
| Constructor Detail |
public CTMultiSolverDirector()
public CTMultiSolverDirector(ptolemy.kernel.util.Workspace workspace)
workspace - The workspace of this object.
public CTMultiSolverDirector(ptolemy.kernel.CompositeEntity container,
java.lang.String name)
throws ptolemy.kernel.util.IllegalActionException,
ptolemy.kernel.util.NameDuplicationException
container - The container.name - Name of this director.
ptolemy.kernel.util.IllegalActionException - If the director is not compatible
with the specified container. May be thrown in derived classes.
ptolemy.kernel.util.NameDuplicationException - If the container is not a
CompositeActor and the name collides with an entity in the container.| Method Detail |
public void attributeChanged(ptolemy.kernel.util.Attribute attribute)
throws ptolemy.kernel.util.IllegalActionException
attributeChanged in class CTDirectorattribute - The changed attribute.
ptolemy.kernel.util.IllegalActionException - If the new solver that is specified
is not valid.public boolean canBeInsideDirector()
canBeInsideDirector in class CTDirectorpublic boolean canBeTopLevelDirector()
canBeTopLevelDirector in class CTDirector
public void fire()
throws ptolemy.kernel.util.IllegalActionException
An iteration begins with processing events, which includes that all waveform generators consuming current input events and all event generators producing current output events. Then the new values of the state variables are resolved. If the state is resolved successfully, the outputs are produced.
The step size of one iteration is determined by the suggested
next step size and the breakpoints. If the first breakpoint in
the breakpoint table is in the middle of the "intended" step.
Then the current step size is reduced to the
breakpoint - current time .
The result of such a step is the left limit of the states
at the breakpoint.
The new state is resolved by the resolveStates() method of the current ODE solver. After that, the step size control actors in the dynamic actor schedule and the state transition schedule are checked for the accuracy of the this step. If any one of the step size control actors do not think it is accurate, then the integration step will be restarted with a refined step size, which is the minimum of the refinedStepSize() from all step size control actors in the dynamic actor schedule and the state transition schedule. If all the actors in the dynamic actor and the state transition schedules think the current step is accurate, 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. The above procedure is followed again to refine the step size and restart the iteration. The iteration is complete when all actors agree that the step is accurate.
All the actors are prefired before an iteration begins. If any one of them returns false, then the iteration is cancelled, and the function returns.
ptolemy.kernel.util.IllegalActionException - If thrown by the ODE solver.public ODESolver getBreakpointSolver()
public ODESolver getODESolver()
public boolean hasCurrentEvent()
public void initialize()
throws ptolemy.kernel.util.IllegalActionException
initialize in interface ptolemy.actor.Executableinitialize in class CTDirectorptolemy.kernel.util.IllegalActionException - If the instantiation of the solvers
does not succeed or one of the directed actors throws it.
public boolean postfire()
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If thrown by registering
breakpoint
public boolean prefire()
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - Not thrown in this base class.
public void preinitialize()
throws ptolemy.kernel.util.IllegalActionException
preinitialize in interface ptolemy.actor.Executablepreinitialize in class CTDirectorptolemy.kernel.util.IllegalActionException - If thrown by one
of the actors.
protected void _continuousPhaseExecution()
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If one of the continuous actors
throws it.
protected void _discretePhaseExecution()
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If one of the event generators
or discrete actors throws it.
protected void _fireOneIteration()
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If one the actors throws it
in its execution methods.protected void _initParameters()
_initParameters in class CTDirector
protected boolean _isOutputAccurate()
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If the scheduler throws it.
protected boolean _isStateAccurate()
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If the scheduler throws it.
protected double _predictNextStepSize()
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If the scheduler throws it.
protected boolean _prefireDynamicActors()
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException
protected void _processBreakpoints()
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If the breakpoint solver is
illegal.
protected double _refinedStepWRTOutput()
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If the scheduler throws it.
protected double _refinedStepWRTState()
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If the scheduler throws it.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||