|
|||||||||
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.kernel.util.Attribute
ptolemy.actor.Director
ptolemy.actor.sched.StaticSchedulingDirector
ptolemy.domains.ct.kernel.CTDirector
ptolemy.domains.ct.kernel.CTMultiSolverDirector
ptolemy.domains.ct.kernel.CTMixedSignalDirector
public class CTMixedSignalDirector
A CTDirector that supports the interaction of the continuous-time simulation with event-based domains. This director can both serve as a top-level director and an inside director that is contained by a composite actor in an event-based domain. If it is a top-level director, it behaves exactly like a CTMultiSolverDirector. If it is embedded in an event-based domain, it will run ahead of the global time and prepare to roll back if necessary.
This director has an extra parameter compared to the
CTMultiSolverDirector, the maximum run ahead of time length
(runAheadLength
). Its default value is 1.0.
The running ahead of time is achieved by the following mechanism.
runAheadLength
, t3. The fire end time is t1 + min(t2, t3)
At the prefire stage, the local current time is compared with the current time of the executive director. If the local time is later than the executive director time, then the directed system will rollback to a "known good" state. The "known good" state is the state of the system at the time when local time is equal to the current time of the executive director
.
Red (hyzheng) |
Yellow (hyzheng) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
private boolean |
_isTop
|
private Time |
_knownGoodTime
|
private long |
_mutationVersion
|
private Time |
_outsideTime
|
private double |
_runAheadLength
|
Parameter |
runAheadLength
Parameter of the run ahead length. |
Fields inherited from class ptolemy.domains.ct.kernel.CTMultiSolverDirector |
---|
_initialStatesNotReady, breakpointODESolver, ODESolver |
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 | |
---|---|
CTMixedSignalDirector()
Construct a director in the default workspace with an empty string as its name. |
|
CTMixedSignalDirector(CompositeEntity container,
java.lang.String name)
Construct a director in the given container with the given name. |
|
CTMixedSignalDirector(Workspace workspace)
Construct a director in the workspace with an empty name. |
Method Summary | |
---|---|
protected void |
_initParameters()
Initialize parameters in addition to the parameters inherited from CTMultiSolverDirector. |
protected boolean |
_isTopLevel()
Return true if this is a top-level director. |
protected void |
_rollback()
Rollback the system to a "known good" state. |
void |
attributeChanged(Attribute attribute)
React to a change in an attribute. |
boolean |
canBeInsideDirector()
Return true indicating that this director can be an inside director. |
void |
fire()
Record the current model time as a known good time for roll back and call the super.fire() method. |
void |
initialize()
Initialize the execution. |
boolean |
postfire()
If this is not a top-level director, request a refiring at the current model time. |
boolean |
prefire()
Always returns true, indicating that the (sub)system is always ready for one iteration. |
Methods inherited from class ptolemy.actor.sched.StaticSchedulingDirector |
---|
_setScheduler, addDebugListener, getScheduler, invalidateSchedule, isScheduleValid, removeDebugListener, setScheduler |
Methods inherited from class ptolemy.kernel.util.Attribute |
---|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent |
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 |
---|
public Parameter runAheadLength
private boolean _isTop
private Time _knownGoodTime
private long _mutationVersion
private Time _outsideTime
private double _runAheadLength
Constructor Detail |
---|
public CTMixedSignalDirector()
public CTMixedSignalDirector(Workspace workspace)
workspace
- The workspace of this object.public CTMixedSignalDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- Name of this director.
IllegalActionException
- If the director is not compatible
with the specified container. May be thrown in a derived class.
NameDuplicationException
- If the container is not a
CompositeActor and the name collides with an entity in the container.Method Detail |
---|
public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class CTMultiSolverDirector
attribute
- The changed attribute.
IllegalActionException
- If the runAhendLength does not have
a valid token, or the superclass throws it.public boolean canBeInsideDirector()
canBeInsideDirector
in class CTMultiSolverDirector
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class CTMultiSolverDirector
IllegalActionException
- If thrown by the super class.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class CTMultiSolverDirector
IllegalActionException
- If thrown by the initialize method
of super class, or the quest for refiring can not be accepted, or if the director does not
agree to fire the actor at the specified time.CTMultiSolverDirector.initialize()
public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class CTMultiSolverDirector
IllegalActionException
- If thrown in the postfire method
in the super class or the refiring can not be granted, or if the director does not
agree to fire the actor at the specified time.public boolean prefire() throws IllegalActionException
If this is not a top-level director, some additional work is done
to synchronize time with the executive director. In particular,
it will compare its local time, say t, with the current time
of the executive director, say t0.
If t == t0, do nothing.
If t > t0, then rollback to the "known good" time (which should be
less than the outside time).
If t < t0, then throw an exception because the CT subsystem
should always run ahead of the outside event-based system.
If this director is not a top-level director, the iteration end time is
resolved from the current time of the outside system, say t1,
the next iteration time of the outside system, say t2, and
the runAheadLength parameter of this director, say t3.
The iteration end time is set to be t5 = t1 + min(t2, t3)
.
The iteration end time may be further refined in the fire() method
due to possible event generated during the iteration.
In particular, when the first event is detected, say at t5 and t5 < t4,
then the iteration ends at t5.
This method updates the suggested step size.
prefire
in interface Executable
prefire
in class CTMultiSolverDirector
IllegalActionException
- If the local time is
less than the current time of the executive director,
or thrown by a directed actor.protected void _initParameters()
runAheadLength
). The default value is 1.0.
_initParameters
in class CTMultiSolverDirector
protected final boolean _isTopLevel()
_isTopLevel
in class Director
protected void _rollback() throws IllegalActionException
IllegalActionException
- If thrown by the goToMarkedState()
method of an actor, or the schedule does not exist.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |