ptolemy.domains.de.kernel
Class DEDirector

java.lang.Object
  extended byptolemy.kernel.util.NamedObj
      extended byptolemy.kernel.util.Attribute
          extended byptolemy.actor.Director
              extended byptolemy.domains.de.kernel.DEDirector
All Implemented Interfaces:
Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable
Direct Known Subclasses:
HDEDirector, WirelessDirector

public class DEDirector
extends Director

This director implements the discrete-event model of computation (MoC). It should be used as the local director of a CompositeActor that is to be executed according to this MoC. This director maintain a notion of current time, and processes events chronologically in this time. An event is a token with a time stamp. Much of the sophistication in this director is aimed at handling simultaneous events intelligently, so that deterministic behavior can be achieved.

The bottleneck in a typical DE simulator is in the maintenance of the global event queue. By default, a DE director uses the calendar queue as the global event queue. This is an efficient algorithm with O(1) time complexity in both enqueue and dequeue operations.

Sorting in the CalendarQueue class is done according to the order defined by the DEEvent class, which implements the java.lang.Comparable interface. A DE event has a time stamp, a microstep, and a depth. The time stamp indicates the time when the event occurs. The microstep represents the phase of execution when processing simultaneous events in directed loops, or when an actor schedules itself for firing later at the current time (using fireAt()). The depth is the index of the destination actor in a topological sort. A larger value of depth represents a lower priority when processing events. The depth is determined by topologically sorting the actors according to data dependencies over which there is no time delay. Note that the zero-delay data dependencies are determined on a per port basis.

Ports in the DE domain may be instances of DEIOPort. The DEIOPort class should be used whenever an actor introduces time delays between the inputs and the outputs. When an ordinary IOPort is used, the director assumes, for the purpose of calculating priorities, that the delay across the actor is zero. On the other hand, when DEIOPort is used, the delay across the actor can be declared to be non-zero by calling the delayTo() method on output ports.

Directed loops with no delay are not permitted; they would make it impossible to assign priorities. Such a loop can be broken by inserting an instance of the Delay actor. If zero delay around the loop is truly required, then simply set the delay parameter of that actor to zero. The directed loops are based on the port connections rather than the actor connections because the port connections reflect the data flow more accurately. The information of port connections are stored in a nonpersistent attribute FunctionDependency, which is constructed during run time.

Input ports in a DE model contain instances of DEReceiver. When a token is put into a DEReceiver, that receiver enqueues the event to the director by calling the _enqueueEvent() method of this director. This director sorts all such events in a global event queue (a priority queue).

An iteration, in the DE domain, is defined as processing all the events whose time stamp equals to the current time of the director. At the beginning of the fire() method, this director dequeues a subset of the oldest events (the ones with smallest time stamp, microstep, and depth) from the global event queue, and puts those events into their destination receivers. The actor(s) to which these events are destined are the ones to be fired. The depth of an event is the depth of the actor to which it is destined. The depth of an actor is its position in a topological sort of the graph. The microstep is usually zero, but is incremented when a pure event is queued with time stamp equal to the current time.

The actor that is fired must consume tokens from its input port(s), and will usually produce new events on its output port(s). These new events will be enqueued in the global event queue until their time stamps equal the current time. It is important that the actor actually consume tokens from its inputs, even if the tokens are solely used to trigger reactions. This is how polymorphic actors are used in the DE domain. The actor will be fired repeatedly until there are no more tokens in its input ports with the current time stamp. Alternatively, if the actor returns false in prefire(), then it will not be invoked again in the same iteration even if there are events in its receivers.

A model starts from the time specified by startTime, which has default value 0.0

The stop time of the execution can be set using the stopTime parameter. The parameter has default value Double.MAX_VALUE, which means the execution stops only when the model time reaches that (rather large) number.

Execution of a DE model ends when the time stamp of the oldest events exceeds a preset stop time. This stopping condition is checked inside the prefire() method of this director. By default, execution also ends when the global event queue becomes empty. Sometimes, the desired behaviour is for the director to wait on an empty queue until another thread makes new events available. For example, a DE actor may produce events when a user hits a button on the screen. To prevent ending the execution when there are no more events, set the stopWhenQueueIsEmpty parameter to false.

Parameters, isCQAdaptive, minBinCount, and binCountFactor, are used to configure the calendar queue. Changes to these parameters are ignored when the model is running.

If the parameter synchronizeToRealTime is set to true, then the director will not process events until the real time elapsed since the model started matches the time stamp of the event. This ensures that the director does not get ahead of real time, but, of course, it does not ensure that the director keeps up with real time.

This director tolerates changes to the model during execution. The change should be queued with a component in the hierarchy using requestChange(). While invoking those changes, the method invalidateSchedule() is expected to be called, notifying the director that the topology it used to calculate the priorities of the actors is no longer valid. This will result in the priorities being recalculated the next time prefire() is invoked.

However, there is one subtlety. If an actor produces events in the future via DEIOPort, then the destination actor will be fired even if it has been removed from the topology by the time the execution reaches that future time. This may not always be the expected behavior. The Delay actor in the DE library behaves this way.

Since:
Ptolemy II 0.2
Version:
$Id: DEDirector.java,v 1.201.2.8 2004/07/31 17:22:13 cxh Exp $
Author:
Lukito Muliadi, Edward A. Lee, Jie Liu, Haiyang Zheng
See Also:
DEReceiver, CalendarQueue, Serialized Form
Accepted Rating:
Yellow (eal)
Proposed Rating:
Green (liuj)

Nested Class Summary
 
Nested classes inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
protected  java.util.Hashtable _actorToDepth
           
protected  java.util.Set _disabledActors
           
protected  DEEventQueue _eventQueue
          The queue used for sorting events.
protected  boolean _exceedStopTime
           
protected  int _microstep
           
protected  boolean _noMoreActorsToFire
          Set to true when it is time to end the execution.
protected  long _realStartTime
           
protected  long _sortValid
           
protected  boolean _stopWhenQueueIsEmpty
           
protected  boolean _synchronizeToRealTime
           
 Parameter binCountFactor
          The factor when adjusting the bin number.
 Parameter isCQAdaptive
          Specify whether the calendar queue adjusts its bin number at run time.
 Parameter minBinCount
          The minimum (initial) number of bins in the calendar queue.
 Parameter startTime
          The start time of model.
 Parameter stopTime
          The stop time of the model.
 Parameter stopWhenQueueIsEmpty
          Specify whether the execution stops when the queue is empty.
 Parameter synchronizeToRealTime
          Specify whether the execution should synchronize to the real time.
 Parameter timeResolution
          The resolution in comparing time.
 
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
DEDirector()
          Construct a director in the default workspace with an empty string as its name.
DEDirector(CompositeEntity container, java.lang.String name)
          Construct a director in the given container with the given name.
DEDirector(Workspace workspace)
          Construct a director in the workspace with an empty name.
 
Method Summary
protected  Actor _dequeueEvents()
          Dequeue the events from the event queue that have the smallest time stamp and depth.
protected  void _disableActor(Actor actor)
          Disable the specified actor.
protected  void _enqueueEvent(Actor actor, double time)
          Put a pure event into the event queue with the specified time stamp.
protected  void _enqueueEvent(DEReceiver receiver, Token token)
          Put an event into the event queue with the specified destination receiver, and token.
protected  void _enqueueEvent(DEReceiver receiver, Token token, double time)
          Put an event into the event queue with the specified destination receiver, token, and time stamp.
protected  int _getDepth(Actor actor)
          Return the depth of the actor.
protected  void _requestFiring()
           
protected  boolean _writeAccessRequired()
          Override the default Director implementation, because in DE domain, we don't need write access inside an iteration.
 void addDebugListener(DebugListener listener)
          Append the specified listener to the current set of debug listeners.
 void attributeChanged(Attribute attribute)
          Update the director parameters when the attributes are changed.
 void fire()
          Advance current time to the next event in the event queue, and fire one or more actors that have events at that time.
 void fireAt(Actor actor, double time)
          Schedule an actor to be fired at the specified absolute time.
 void fireAtCurrentTime(Actor actor)
          Schedule a firing of the given actor as soon as possible.
 void fireAtRelativeTime(Actor actor, double time)
          Schedule an actor to be fired at the specified relative time.
 DEEventQueue getEventQueue()
          Return the event queue.
 double getNextIterationTime()
          Return the time stamp of the next event in the queue with time stamp strictly greater than the current time.
 long getRealStartTimeMillis()
          Return the system time at which the model begins executing.
 double getStartTime()
          Return the time of the start time in the model as set by the startTime parameter.
 double getStopTime()
          Return the stop time of the execution as set by the stopTime parameter.
 void initialize()
          Invoke the initialize() method of each deeply contained actor, and then check the event queue for any events.
 void invalidateSchedule()
          Indicate that the topological depth of the ports in the model may no longer be valid.
 Receiver newReceiver()
          Return a new receiver of a type DEReceiver.
 boolean postfire()
          Return false if there are no more actors to fire or if stop() has been called.
 boolean prefire()
          Return true if there are input to this composite actor, and the current time of the outside domain is greater than or equal to the current time.
 void preinitialize()
          Set current time to zero, invoke the preinitialize() methods of all actors deeply contained by the container, and calculate priorities for simultaneous events.
 void removeDebugListener(DebugListener listener)
          Unregister a debug listener.
 void stop()
          Request that execution of the current iteration stop.
 void stopFire()
          Request that execution of the current iteration complete.
 boolean transferOutputs(IOPort port)
          Override the base class method to transfer all the available tokens from a DE model.
 
Methods inherited from class ptolemy.actor.Director
_description, _isEmbedded, _isTopLevel, domainPolymorphicTransferInputs, domainPolymorphicTransferOutputs, getCurrentTime, getTimeResolution, initialize, invalidateResolvedTypes, iterate, needWriteAccess, requestInitialization, setContainer, setCurrentTime, setTimeResolution, terminate, transferInputs, 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

startTime

public Parameter startTime
The start time of model. This parameter must contain a DoubleToken. The value defaults to 0.0.


stopTime

public Parameter stopTime
The stop time of the model. This parameter must contain a DoubleToken. The value defaults to MaxDouble.


stopWhenQueueIsEmpty

public Parameter stopWhenQueueIsEmpty
Specify whether the execution stops when the queue is empty. This parameter must contain a BooleanToken. If this parameter is true, the execution of the model will be stopped when the queue is empty. The value defaults to true.


synchronizeToRealTime

public Parameter synchronizeToRealTime
Specify whether the execution should synchronize to the real time. This parameter must contain a BooleanToken. If this parameter is true, then do not process events until the elapsed real time matches the time stamp of the events. The value defaults to false.


isCQAdaptive

public Parameter isCQAdaptive
Specify whether the calendar queue adjusts its bin number at run time. This parameter must contain a BooleanToken. If this parameter is true, the calendar queue will adapt its bin number with respect to the distribution of events. Changes to this parameter are ignored when the model is running. The value defaults to true.


minBinCount

public Parameter minBinCount
The minimum (initial) number of bins in the calendar queue. This parameter must contain an IntToken. Changes to this parameter are ignored when the model is running. The value defaults to 2.


binCountFactor

public Parameter binCountFactor
The factor when adjusting the bin number. This parameter must contain an IntToken. Changes to this parameter are ignored when the model is running. The value defaults to 2.


timeResolution

public Parameter timeResolution
The resolution in comparing time. The default value is 1e-10, of type DoubleToken.


_eventQueue

protected DEEventQueue _eventQueue
The queue used for sorting events.


_noMoreActorsToFire

protected boolean _noMoreActorsToFire
Set to true when it is time to end the execution.


_disabledActors

protected java.util.Set _disabledActors

_microstep

protected int _microstep

_exceedStopTime

protected boolean _exceedStopTime

_realStartTime

protected long _realStartTime

_stopWhenQueueIsEmpty

protected boolean _stopWhenQueueIsEmpty

_synchronizeToRealTime

protected boolean _synchronizeToRealTime

_sortValid

protected long _sortValid

_actorToDepth

protected java.util.Hashtable _actorToDepth
Constructor Detail

DEDirector

public DEDirector()
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.


DEDirector

public DEDirector(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.

Parameters:
workspace - The workspace of this object.

DEDirector

public DEDirector(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.

Parameters:
container - Container of the director.
name - Name of this director.
Throws:
IllegalActionException - If the director is not compatible with the specified container.
NameDuplicationException - If the container not a CompositeActor and the name collides with an entity in the container.
Method Detail

addDebugListener

public void addDebugListener(DebugListener listener)
Append the specified listener to the current set of debug listeners. If a calendar queue has been created, register the listener to the calendar queue, too.

Specified by:
addDebugListener in interface Debuggable
Overrides:
addDebugListener in class NamedObj
Parameters:
listener - The listener to add to the list of listeners to which debug messages are sent.

attributeChanged

public void attributeChanged(Attribute attribute)
                      throws IllegalActionException
Update the director parameters when the attributes are changed. Changes to isCQAdaptive, minBinCount, and binCountFactor parameters will only be effective on the next time the model is executed.

Overrides:
attributeChanged in class NamedObj
Parameters:
attribute - The changed parameter.
Throws:
IllegalActionException - If the parameter set is not valid. Not thrown in this class. May be needed by derived classes.

fire

public void fire()
          throws IllegalActionException
Advance current time to the next event in the event queue, and fire one or more actors that have events at that time. If synchronizeToRealTime is true, then before firing, wait until real time matches or exceeds the time stamp of the event. Each actor is iterated repeatedly (prefire(), fire(), postfire()), until either it has no more input tokens at the current time, or its prefire() method returns false. If there are no events in the event queue, then the behavior depends on the stopWhenQueueIsEmpty parameter. If it is false, then this thread will stall until events become available on the event queue. Otherwise, time will advance to the stop time and the execution will halt.

Specified by:
fire in interface Executable
Overrides:
fire in class Director
Throws:
IllegalActionException - If the firing actor throws it.

fireAt

public void fireAt(Actor actor,
                   double time)
            throws IllegalActionException
Schedule an actor to be fired at the specified absolute time. This method is only intended to be called from within main simulation thread. Actors that create their own asynchronous threads should used the fireAtCurrentTime() method to schedule firings.

Overrides:
fireAt in class Director
Parameters:
actor - The scheduled actor to fire.
time - The scheduled time to fire.
Throws:
IllegalActionException - If the specified time is in the past.

fireAtCurrentTime

public void fireAtCurrentTime(Actor actor)
                       throws IllegalActionException
Schedule a firing of the given actor as soon as possible. If this method is called from within the main simulation thread, then this will result in the actor being fired at the current time. This method may also be invoked from a thread other than the main simulation thread, making it useful for actors that perform asynchronous processing, such as waiting for data in another thread. In these cases, calling fireAt(actor, getCurrentTime()) is not sufficient, since there is no way for an asynchronous thread to ensure that time does not advance in the model. When invoked from an asynchronous thread, this method will attempt to fire the actor at the earliest time that this director is fired. This class overrides the base class method to additionally add an pure event for the given actor to the event queue that will be processed before all other events.

Overrides:
fireAtCurrentTime in class Director
Parameters:
actor - The actor to be fired.
Throws:
IllegalActionException - If this method is called before the model is running.

fireAtRelativeTime

public void fireAtRelativeTime(Actor actor,
                               double time)
                        throws IllegalActionException
Schedule an actor to be fired at the specified relative time.

Parameters:
actor - The scheduled actor to fire.
time - The scheduled time to fire.
Throws:
IllegalActionException - If the specified time is in the past.

getEventQueue

public DEEventQueue getEventQueue()
Return the event queue.

Returns:
The event queue.

getNextIterationTime

public double getNextIterationTime()
Return the time stamp of the next event in the queue with time stamp strictly greater than the current time. If there is nothing on the event queue, then return the stop time. The next iteration time, for example, is used to estimate the run-ahead time, when a continuous time composite actor is embedded in the DE domain.

Overrides:
getNextIterationTime in class Director
Returns:
The next larger time on the event queue.

getRealStartTimeMillis

public long getRealStartTimeMillis()
Return the system time at which the model begins executing. That is, the system time (in milliseconds) when the initialize() method of the director is called. The time is in the form of milliseconds counting from 1/1/1970 (UTC).

Returns:
The real start time of the model.

getStartTime

public double getStartTime()
Return the time of the start time in the model as set by the startTime parameter.

Returns:
The start time of the execution.

getStopTime

public double getStopTime()
Return the stop time of the execution as set by the stopTime parameter.

Returns:
The stop time of the execution.

initialize

public void initialize()
                throws IllegalActionException
Invoke the initialize() method of each deeply contained actor, and then check the event queue for any events. If there are any, and the director is embedded in an opaque composite actor, then request a firing of the outside director. This method should be invoked once per execution, after the preinitialization phase, but before any iteration. Since type resolution has been completed, the initialize() method of a contained actor may produce output or schedule events. The real start time of the model is recorded when this method is called. This method is not synchronized on the workspace, so the caller should be.

Specified by:
initialize in interface Executable
Overrides:
initialize in class Director
Throws:
IllegalActionException - If the initialize() method of one of the associated actors throws it.

invalidateSchedule

public void invalidateSchedule()
Indicate that the topological depth of the ports in the model may no longer be valid. This method should be called when topology changes are made. It sets a flag which will cause the topological sort to be redone next time prefire() is called.

Overrides:
invalidateSchedule in class Director

newReceiver

public Receiver newReceiver()
Return a new receiver of a type DEReceiver.

Overrides:
newReceiver in class Director
Returns:
A new DEReceiver.

postfire

public boolean postfire()
                 throws IllegalActionException
Return false if there are no more actors to fire or if stop() has been called. Otherwise, if the director is an embedded director and the queue is not empty, then request that the executive director refire the container of this director at the time of the next event in the event queue of this director.

Specified by:
postfire in interface Executable
Overrides:
postfire in class Director
Returns:
True to continue execution, and false otherwise.
Throws:
IllegalActionException - Not thrown in this base class.

prefire

public boolean prefire()
                throws IllegalActionException
Return true if there are input to this composite actor, and the current time of the outside domain is greater than or equal to the current time. Return false if there are no inputs and the outside time is less than the current time. Throw an exception if there are inputs and the outside time is less than the current time.

Specified by:
prefire in interface Executable
Overrides:
prefire in class Director
Returns:
True if the composite actor is ready to run for one iteration.
Throws:
IllegalActionException - If there are input events in the past, or the outside time is larger than the time stamp of the first event in the event queue.

preinitialize

public void preinitialize()
                   throws IllegalActionException
Set current time to zero, invoke the preinitialize() methods of all actors deeply contained by the container, and calculate priorities for simultaneous events. To be able to calculate the priorities, it is essential that the graph not have a delay-free loop. If it does, then this can be corrected by inserting a DEDelay actor with a zero-valued delay. This has the effect of breaking the loop for the purposes of calculating priorities, without introducing a time delay.

This method should be invoked once per execution, before any iteration. Actors cannot produce output data in their preinitialize() methods. If initial events are needed, e.g. pure events for source actor, the actors should do so in their initialize() methods. This method is not synchronized on the workspace, so the caller should be.

Specified by:
preinitialize in interface Executable
Overrides:
preinitialize in class Director
Throws:
IllegalActionException - If there is a delay-free loop, or if the preinitialize() method of the container or one of the deeply contained actors throws it.

removeDebugListener

public void removeDebugListener(DebugListener listener)
Unregister a debug listener. If the specified listener has not been previously registered, then do nothing.

Specified by:
removeDebugListener in interface Debuggable
Overrides:
removeDebugListener in class NamedObj
Parameters:
listener - The listener to remove from the list of listeners to which debug messages are sent.

stop

public void stop()
Request that execution of the current iteration stop. This is similar to stopFire(), except that the current iteration is not allowed to complete. This is useful if there is actor in the model that has a bug where it fails to consume inputs. An iteration will never terminate if such an actor receives an event. If the director is paused waiting for events to appear in the event queue, then it stops waiting, and calls stopFire() for all actors that are deeply contained by the container of this director.

Specified by:
stop in interface Executable
Overrides:
stop in class Director

stopFire

public void stopFire()
Request that execution of the current iteration complete. If the director is paused waiting for events to appear in the event queue, then it stops waiting, and calls stopFire() for all actors that are deeply contained by the container of this director.

Specified by:
stopFire in interface Executable
Overrides:
stopFire in class Director

transferOutputs

public boolean transferOutputs(IOPort port)
                        throws IllegalActionException
Override the base class method to transfer all the available tokens from a DE model. No data remains at the boundary of a DE model after the model has been fired. This facilitates building multirate DE models. The port argument must be an opaque output port. If any channel of the output port has no data, then that channel is ignored.

Overrides:
transferOutputs in class Director
Parameters:
port - The port to transfer tokens from.
Returns:
True if data are transferred.
Throws:
IllegalActionException - If the port is not an opaque output port.
See Also:
IOPort.transferOutputs()

_dequeueEvents

protected Actor _dequeueEvents()
Dequeue the events from the event queue that have the smallest time stamp and depth. Advance the model time to their time stamp, and mark the destination actor for firing. If the time stamp is greater than the stop time then return null. If there are no events on the event queue, and _stopWhenQueueIsEmpty flag is true (which is set to true by default) then return null, which will have the effect of stopping the simulation. If _stopWhenQueueIsEmpty is false and the queue is empty, then stall the current thread by calling wait() on the _eventQueue until there are events available. If _synchronizeToRealTime is true, then this method may suspend the calling thread using Object.wait(long) to let elapsed real time catch up with the current event.

Returns:
The next actor to fire.

_disableActor

protected void _disableActor(Actor actor)
Disable the specified actor. All events destined to this actor will be ignored. If the argument is null, then do nothing.

Parameters:
actor - The actor to disable.

_enqueueEvent

protected void _enqueueEvent(Actor actor,
                             double time)
                      throws IllegalActionException
Put a pure event into the event queue with the specified time stamp. A "pure event" is one with no token, used to request a firing of the specified actor. Note that the actor may have no new data at its input ports when it is fired. The depth for the queued event is equal to the depth of the actor. A smaller depth corresponds to a higher priority. The microstep for the queued event is equal to zero, unless the time is equal to the current time. If it is, then the event is queued with the current microstep plus one. If there is no event queue, then this method does nothing.

Parameters:
actor - The destination actor.
time - The time stamp of the "pure event".
Throws:
IllegalActionException - If the time argument is in the past.

_enqueueEvent

protected void _enqueueEvent(DEReceiver receiver,
                             Token token,
                             double time)
                      throws IllegalActionException
Put an event into the event queue with the specified destination receiver, token, and time stamp. The depth of the event is the depth of the actor that has the receiver. A smaller depth corresponds to a higher priority. The microstep is always equal to zero, unless the time argument is equal to the current time, in which case, the microstep is equal to the current microstep (determined by the last dequeue, or zero if there has been none). If there is no event queue, then this method does nothing.

Parameters:
receiver - The destination receiver.
token - The token destined for that receiver.
time - The time stamp of the event.
Throws:
IllegalActionException - If the delay is negative.

_enqueueEvent

protected void _enqueueEvent(DEReceiver receiver,
                             Token token)
                      throws IllegalActionException
Put an event into the event queue with the specified destination receiver, and token. The time stamp of the event is the current time, but the microstep is one larger than the current microstep. The depth is the depth of the actor. This method is used by actors that declare that they introduce delay, but where the value of the delay is zero. If there is no event queue, then this method does nothing.

Parameters:
receiver - The destination receiver.
token - The token destined for that receiver.
Throws:
IllegalActionException - If the delay is negative.

_getDepth

protected int _getDepth(Actor actor)
                 throws IllegalActionException
Return the depth of the actor.

Throws:
IllegalActionException - If the actor is not accessible.

_writeAccessRequired

protected boolean _writeAccessRequired()
Override the default Director implementation, because in DE domain, we don't need write access inside an iteration.

Overrides:
_writeAccessRequired in class Director
Returns:
false.

_requestFiring

protected void _requestFiring()
                       throws IllegalActionException
Throws:
IllegalActionException