public class MetroIIDEDirector extends DEDirector implements GetFirable
In DE director, events are totally ordered and executed. In MetroIIDEDirector, these events are called Ptolemy events that are still totally ordered. But the execution of Ptolemy events has some variances. Typically, a Ptolemy event is associated with a fire() action of an actor. Executing the Ptolemy event triggers the firing of the actor. In MetroIIDEDirector, the firing has two variances, depending on the types of the actor:
A MetroII actor is a Ptolemy actor that implements GetFirable interface, which includes MetroIICompositeActor. To understand MetroII event and its states (e.g. PROPOSED, WAITING, NOTIFIED), please @see MetroIIDirector.
By using a MetroII actor under the MetroIIDEDirector, the user understands the firing of the MetroII actor might be delayed because the scheduling is not solely determined by the MetroIIDEDirector but also determined by MetroIIDirector on the upper level and the architectural model which the MetroII actor is mapped onto. This introduces some non-determinisms. But these non-determinisms are desirable and can be used to optimize the architectures.
It is highly recommend not to place MetroIIDEDirector in a MetroIICompositeActor under another MetroIIDEDirector because there would be a semantic conflict if the enclosed MetroIIDEDirector directs a normal Ptolemy actor.
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
Parameter |
printTrace
True if the trace information is printed.
|
_actorsFinished, _actorsInExecution, _disabledActors, _eventQueue, _eventQueueLock, _isInitializing, _microstep, _noMoreActorsToFire, _stopFireRequested, binCountFactor, enforceMicrostepSemantics, isCQAdaptive, minBinCount, stopWhenQueueIsEmpty, synchronizeToRealTime
_actorsFinishedExecution, _aspectForActor, _aspectsPresent, _defaultMicrostep, _executionAspects, _finishRequested, _initializables, _nextScheduleTime, _stopRequested, _tokenSentToCommunicationAspect, _zeroTime, localClock, startTime, stopTime
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
MetroIIDEDirector(CompositeEntity container,
java.lang.String name)
Construct a director in the given container with the given name.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
_checkForNextEvent()
Enforce a firing of a DE director only handles events with the same tag.
|
protected Pair<Actor,java.lang.Integer> |
_checkNextActorToFire()
Return the actor that is about to fire and its state.
|
YieldAdapterIterable<java.lang.Iterable<metroIIcomm.Event.Builder>> |
adapter()
Since the MetroIIDEDirector is always used inside a
MetroIICompositeActor, the adapter() in MetroIICompositeActor
is responsible for creating the iterator of getfire(), this
adapter() should never be called.
|
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace.
|
void |
getfire(ResultHandler<java.lang.Iterable<metroIIcomm.Event.Builder>> resultHandler)
Fire actors according to events in the event queue.
|
void |
initialize()
Initialize the model controlled by this director.
|
(package private) void |
processMappableActorEventsUntil(ResultHandler<java.lang.Iterable<metroIIcomm.Event.Builder>> resultHandler,
metroIIcomm.Event.Builder event)
Process the mappable actors.
|
void |
stop()
Request the execution of the current iteration to stop.
|
_actorFired, _disableActor, _enqueueEvent, _enqueueTriggerEvent, _fire, _getDepthOfActor, _getDepthOfIOPort, _getNextActorToFire, _issueExecutionAspectWarning, _noActorToFire, _requestFiring, _schedule, addDebugListener, attributeChanged, cancelFireAt, cancelFireAt, describePriorities, fire, fireAt, fireAt, fireAtCurrentTime, fireAtRelativeTime, getCausalityInterface, getIndex, getMicrostep, getModelNextIterationTime, getNextEventTime, getStartTime, getStopTime, invalidateSchedule, mutexLockObject, newReceiver, postfire, prefire, preinitialize, removeDebugListener, resumeActor, setIndex, stopFire, suggestedModalModelDirectors, transferInputs, wrapup
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _transferInputs, _transferOutputs, addInitializable, createSchedule, defaultDependency, delayDependency, elapsedTimeSinceStart, finish, fireAt, fireContainerAt, fireContainerAt, getCurrentTime, getDeadline, getEnvironmentTime, getExecutionAspect, getGlobalTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getTimeResolution, implementsStrictActorSemantics, initialize, invalidateResolvedTypes, isEmbedded, isFireFunctional, isStopRequested, isStrict, iterate, notifyTokenSentToCommunicationAspect, preinitialize, removeInitializable, requestInitialization, resume, scheduleContainedActors, setContainer, setCurrentTime, setEmbedded, setModelTime, setTimeResolution, supportMultirateFiring, suspend, terminate, transferOutputs, transferOutputs
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, 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, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
public Parameter printTrace
public MetroIIDEDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- Container of the director.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.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class DEDirector
workspace
- The workspace for the cloned object.java.lang.CloneNotSupportedException
- Not thrown in this base classNamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void initialize() throws IllegalActionException
This method should typically be invoked once per execution, after the preinitialization phase, but before any iteration. It may be invoked in the middle of an execution, if reinitialization is desired.
This method is not synchronized on the workspace, so the caller should be.
initialize
in interface Initializable
initialize
in class DEDirector
IllegalActionException
- If the initialize() method of
one of the associated actors throws it.public void stop()
stop
in interface Executable
stop
in class DEDirector
protected Pair<Actor,java.lang.Integer> _checkNextActorToFire() throws IllegalActionException
IllegalActionException
- If the firing actor throws
it, or event queue is not ready, or an event is missed, or time
is set backwards.protected boolean _checkForNextEvent() throws IllegalActionException
_checkForNextEvent
in class DEDirector
IllegalActionException
- If model time is set backwards.void processMappableActorEventsUntil(ResultHandler<java.lang.Iterable<metroIIcomm.Event.Builder>> resultHandler, metroIIcomm.Event.Builder event) throws IllegalActionException, CollectionAbortedException
IllegalActionException
- If there is problem with
starting or resuming an event, prefiring or postfiringCollectionAbortedException
- If thrown while handling
the resulting events.public void getfire(ResultHandler<java.lang.Iterable<metroIIcomm.Event.Builder>> resultHandler) throws CollectionAbortedException, IllegalActionException
The time advancing is via proposing a MetroII event with time tag as its
quantity, see TimeScheduler
.
getfire
in interface GetFirable
resultHandler
- iterable of events 'yield returned'.IllegalActionException
- If we couldn't process an event or if an event of smaller
timestamp is found within the event queue.CollectionAbortedException
public YieldAdapterIterable<java.lang.Iterable<metroIIcomm.Event.Builder>> adapter()
adapter
in interface GetFirable