public class MetroIIPtidesDirector extends MetroIIDEDirectorForPtides
isCausallyAffected(Collection, PtidesEvent)
.
Most methods are identical to PtidesDirector except directors are mapped to MetroIIPtidesdirector instead of PtidesDirector.
MetroIIDEDirectorForPtides.Pair<F,S>
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<TypedIOPort,java.util.Set<TypedIOPort>> |
_inputPortGroups
Map an input port to a set which is its input port group.
|
protected java.util.List<TypedIOPort> |
_inputPorts
List of all input ports in the model (actuator and network transmitter
ports are also considered input ports).
|
protected Time |
_nextFireTime
The earliest time this director should be refired.
|
protected java.util.Map<IOPort,java.util.Map<IOPort,SuperdenseDependency>> |
_superdenseDependencyPair
Store the superdense dependency between pairs of input ports using nested
Maps.
|
SharedParameter |
clockSynchronizationErrorBound
Bounds on clock synchronization error across all platforms.
|
_actorDictionary, _eventList, printTrace
_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 |
---|
MetroIIPtidesDirector(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()
Model time is only used for correct execution of actors and the scheduler
will determine whether another event can be fired in the current firing
of the platform, so this method isn't needed.
|
protected void |
_enqueueTriggerEvent(IOPort ioPort,
Token token,
Receiver receiver)
Put a trigger event into the event queue.
|
protected double |
_getDeadline(Actor actor,
Time timestamp)
Compute the deadline for an actor that requests a firing at time
timestamp.
|
protected static java.lang.Double |
_getDoubleParameterValue(NamedObj object,
java.lang.String parameterName)
Return the value stored in a parameter associated with the NamedObj.
|
protected static java.lang.Integer |
_getIntParameterValue(NamedObj object,
java.lang.String parameterName)
Return the value stored in a parameter associated with the NamedObj.
|
protected Actor |
_getNextActorToFire()
Return the actor to fire in this iteration, or null if no actor should
be fired.
|
protected PtidesEvent |
_getNextEventToFire()
Returns the actor to fire in this iteration, or null if no actor should
be fired.
|
protected void |
_resetLogicalTime()
Reset logical time to null.
|
protected void |
_setLogicalTime(PtidesEvent ptidesEvent)
Set logical time to that of the ptidesEvent.
|
void |
addInputEvent(MetroIIPtidesPort sourcePort,
PtidesEvent event,
double deviceDelay)
Add a new event to the input queue.
|
void |
attributeChanged(Attribute attribute)
Update the director parameters when attributes are changed.
|
boolean |
causallyAffect(PtidesEvent e1,
PtidesEvent e2)
Calculate whether Ptides event e1 could possibly affect Ptides
event e2.
|
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace.
|
Dependency |
defaultDependency()
Return the default dependency between input and output ports,
which for the Ptides domain is a
SuperdenseDependency . |
void |
fire()
Before super.fire() is called, transfer all input events that
are ready are transferred.
|
Time |
fireAt(Actor actor,
Time time,
int index)
Add a pure event to the queue of pure events.
|
Time |
getCurrentSourceTimestamp()
Return the source timestamp of the event that is currently
being processed.
|
void |
getfire(ResultHandler<java.lang.Iterable<metroIIcomm.Event.Builder>> resultHandler)
Before super.getfire() is called, transfer all input events that are
ready are transferred.
|
int |
getIndex()
Return a superdense time index for the current time, where the
index is equal to the microstep.
|
int |
getMicrostep()
Return the current microstep or the microstep of the event, if
an actor is currently executing.
|
Time |
getModelTime()
Return the local time or, (i) if an actor is executing or (ii)
an input token is read, (i) the timestamp of the event that
caused the actor execution or (ii) the timestamp of the input
event.
|
void |
initialize()
Initialize all the actors and variables.
|
boolean |
isCausallyAffected(java.util.Collection<PtidesEvent> eventArray,
PtidesEvent event)
Calculate whether any Ptides event in eventArray could causally affect
event.
|
boolean |
isFiringEventCausallyAffect(PtidesEvent event)
Calculate whether any Ptides event currently being processed
could causally affect event.
|
boolean |
isPendingEventCausallyAffect(PtidesEvent event)
Calculates whether any Ptides event pending could causally affect event.
|
double |
minDelayBetween(java.util.Collection<IOPort> ports1,
java.util.Collection<IOPort> ports2)
Calculate the minimal delay in logical time between two ports.
|
Receiver |
newReceiver()
Return a new receiver.
|
boolean |
postfire()
Return false if there are no more actors to be fired or the stop()
method has been called.
|
boolean |
prefire()
Override the base class to not set model time to that of the enclosing
director.
|
void |
preinitialize()
Calls the preinitialize of the super class and create new event Queue.
|
_checkNextEventToFire, adapter, stop
_actorFired, _disableActor, _enqueueEvent, _enqueueTriggerEvent, _fire, _getDepthOfActor, _getDepthOfIOPort, _issueExecutionAspectWarning, _noActorToFire, _requestFiring, _schedule, addDebugListener, cancelFireAt, cancelFireAt, describePriorities, fireAt, fireAtCurrentTime, fireAtRelativeTime, getCausalityInterface, getModelNextIterationTime, getNextEventTime, getStartTime, getStopTime, invalidateSchedule, mutexLockObject, removeDebugListener, resumeActor, setIndex, stopFire, suggestedModalModelDirectors, transferInputs, wrapup
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _transferInputs, _transferOutputs, addInitializable, createSchedule, delayDependency, elapsedTimeSinceStart, finish, fireAt, fireContainerAt, fireContainerAt, getCurrentTime, getDeadline, getEnvironmentTime, getExecutionAspect, getGlobalTime, getModelStartTime, getModelStopTime, 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 SharedParameter clockSynchronizationErrorBound
protected java.util.List<TypedIOPort> _inputPorts
protected java.util.Map<TypedIOPort,java.util.Set<TypedIOPort>> _inputPortGroups
protected Time _nextFireTime
protected java.util.Map<IOPort,java.util.Map<IOPort,SuperdenseDependency>> _superdenseDependencyPair
public MetroIIPtidesDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container of the director.name
- The name of this director.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.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class MetroIIDEDirectorForPtides
workspace
- The workspace for the cloned object.java.lang.CloneNotSupportedException
- Not thrown in this base class.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void addInputEvent(MetroIIPtidesPort sourcePort, PtidesEvent event, double deviceDelay) throws IllegalActionException
sourcePort
- the source port.event
- New input event.deviceDelay
- The device delay.IllegalActionException
- If device delay parameter
cannot be computed.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class DEDirector
attribute
- The changed parameter.IllegalActionException
- If the parameter set is not
valid. Not thrown in this class.public Dependency defaultDependency()
SuperdenseDependency
.defaultDependency
in class Director
Dependency
,
CausalityInterface
,
Actor.getCausalityInterface()
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class DEDirector
IllegalActionException
- If we couldn't process an event
or if an event of smaller timestamp is found within the event queue.DEDirector._fire()
public Time fireAt(Actor actor, Time time, int index) throws IllegalActionException
fireAt
in class DEDirector
actor
- Actor to fire.time
- Time the actor should be fired at.index
- Microstep the actor should be fired at.IllegalActionException
- If firing of the container
doesn't succeed.DEDirector.fireAtCurrentTime(Actor)
public Time getCurrentSourceTimestamp()
public int getIndex()
getIndex
in interface SuperdenseTimeDirector
getIndex
in class DEDirector
DEDirector.setIndex(int)
,
SuperdenseTimeDirector
public Time getModelTime()
getModelTime
in class Director
Director.setModelTime(Time)
public int getMicrostep()
getMicrostep
in class DEDirector
DEDirector.getIndex()
,
DEDirector.setIndex(int)
,
SuperdenseTimeDirector
public double minDelayBetween(java.util.Collection<IOPort> ports1, java.util.Collection<IOPort> ports2)
ports1
- The source port.ports2
- The sink port.public boolean causallyAffect(PtidesEvent e1, PtidesEvent e2) throws IllegalActionException
e1
- The first Ptides event.e2
- The second Ptides event.IllegalActionException
- Thrown if causality interface
cannot be computed.public boolean isCausallyAffected(java.util.Collection<PtidesEvent> eventArray, PtidesEvent event) throws IllegalActionException
eventArray
- A collection of Ptides eventevent
- An eventIllegalActionException
- If the causality interface
cannot be computed.public boolean isFiringEventCausallyAffect(PtidesEvent event) throws IllegalActionException
event
- An eventIllegalActionException
- If the causality interface
cannot be computed.public boolean isPendingEventCausallyAffect(PtidesEvent event) throws IllegalActionException
event
- A Ptides eventIllegalActionException
- Thrown if causality interface cannot be computed.public void getfire(ResultHandler<java.lang.Iterable<metroIIcomm.Event.Builder>> resultHandler) throws CollectionAbortedException, IllegalActionException
getfire
in interface GetFirable
getfire
in class MetroIIDEDirectorForPtides
resultHandler
- iterable of events 'yield returned'.IllegalActionException
- If any called method of one of the associated actors throws
it.CollectionAbortedException
- If any called method of one of the associated actors throws
it.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class MetroIIDEDirectorForPtides
IllegalActionException
- If thrown while calculating
the superdense dependencies, delay offset or relative deadlines.public Receiver newReceiver()
MetroIIPtidesReceiver
.newReceiver
in class DEDirector
public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class DEDirector
IllegalActionException
- If the stopWhenQueueIsEmpty parameter does not contain a
valid token, or refiring can not be requested.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class DEDirector
IllegalActionException
- If thrown while getting the local time.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class DEDirector
IllegalActionException
- If the preinitialize() method of the
container or one of the deeply contained actors throws it, or the
parameters, minBinCount, binCountFactor, and isCQAdaptive, do not have
valid tokens.protected boolean _checkForNextEvent()
_checkForNextEvent
in class DEDirector
protected void _enqueueTriggerEvent(IOPort ioPort, Token token, Receiver receiver) throws IllegalActionException
The trigger event has the same timestamp as that of the director. The microstep of this event is always equal to the current microstep of this director. The depth for the queued event is the depth of the destination IO port. Finally, the token and the destination receiver are also stored in the event.
If the event queue is not ready or the actor that contains the destination port is disabled, do nothing.
ioPort
- The destination IO port.token
- The token associated with this event.receiver
- The destination receiver.IllegalActionException
- If the time argument is not
the current time, or the depth of the given IO port has not be
calculated, or the new event can not be enqueued.protected double _getDeadline(Actor actor, Time timestamp) throws IllegalActionException
actor
- The actor that requests firing.timestamp
- The time when the actor wants to be fired.IllegalActionException
- If time objects cannot be created.protected static java.lang.Double _getDoubleParameterValue(NamedObj object, java.lang.String parameterName) throws IllegalActionException
object
- The object that has the parameter.parameterName
- The name of the parameter to be retrieved.IllegalActionException
- If thrown while getting the
value of the parameter.protected static java.lang.Integer _getIntParameterValue(NamedObj object, java.lang.String parameterName) throws IllegalActionException
object
- The object that has the parameter.parameterName
- The name of the parameter to be retrieved.IllegalActionException
- If thrown while getting the
value of the parameter.protected PtidesEvent _getNextEventToFire() throws IllegalActionException
_getNextEventToFire
in class MetroIIDEDirectorForPtides
IllegalActionException
- If thrown while getting the next event
from either the pure Events or the eventQueue.protected Actor _getNextActorToFire() throws IllegalActionException
_getNextActorToFire
in class DEDirector
IllegalActionException
- If thrown while getting the
next event to fire.protected void _setLogicalTime(PtidesEvent ptidesEvent)
_setLogicalTime
in class MetroIIDEDirectorForPtides
ptidesEvent
- Ptides event the logical time is set to.protected void _resetLogicalTime()
_resetLogicalTime
in class MetroIIDEDirectorForPtides