Class ATCDirector
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.actor.Director
-
- ptolemy.domains.de.kernel.DEDirector
-
- ptolemy.domains.atc.kernel.AbstractATCDirector
-
- ptolemy.domains.atc.kernel.policy2.ATCDirector
-
- All Implemented Interfaces:
java.lang.Cloneable
,Executable
,Initializable
,SuperdenseTimeDirector
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class ATCDirector extends AbstractATCDirector
A director for modeling air traffic control systems. This director provides a receiver that consults the destination actor to determine whether it can accept an input, and provides mechanisms for handling rejection of an input.- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Maryam Bagheri
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.domains.de.kernel.DEDirector
_actorsFinished, _actorsInExecution, _disabledActors, _eventQueue, _eventQueueLock, _isInitializing, _microstep, _noMoreActorsToFire, _stopFireRequested, binCountFactor, enforceMicrostepSemantics, isCQAdaptive, minBinCount, stopWhenQueueIsEmpty, synchronizeToRealTime
-
Fields inherited from class ptolemy.actor.Director
_actorsFinishedExecution, _aspectForActor, _aspectsPresent, _defaultMicrostep, _executionAspects, _finishRequested, _initializables, _nextScheduleTime, _stopRequested, _tokenSentToCommunicationAspect, _zeroTime, localClock, startTime, stopTime
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _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
Constructors Constructor Description ATCDirector(CompositeEntity container, java.lang.String name)
Create a new director in the specified container with the specified name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArrayToken
handleAirplaneColor(int id)
Return airplane's color.void
handleInitializedAirport(Airport airport)
Handle initializing of an airport.void
handleInitializedDestination(DestinationAirport destinationAirport)
Handle initializing of a destination airport.void
handleInitializedTrack(Track track)
Put an entry into _neighbors , _stormyTrack and _inTransit for the initialized track.double
handleRejectionWithDelay(Track track)
Return an additional delay for a track to keep an aircraft in transit.void
handleTrackAttributeChanged(Track track)
Update _stormyTracks array because of a change in condition of a track.void
initialize()
Initialize the state of this director.Receiver
newReceiver()
Return a new ATCReceiver.java.util.Map<java.lang.String,Token>
rerouteUnacceptedAircraft(Token aircraft)
Reroute an aircraft.boolean
returnTrackStatus(Token trackId)
Return status of the track.RecordToken
routing(Token aircraft, Token trackId)
Routing an aircraft based on its flight map.void
setInTransitStatusOfTrack(Token trackId, boolean trackStatus)
Update inTransit status of a track.-
Methods inherited from class ptolemy.domains.de.kernel.DEDirector
_actorFired, _checkForNextEvent, _disableActor, _enqueueEvent, _enqueueTriggerEvent, _fire, _getDepthOfActor, _getDepthOfIOPort, _getNextActorToFire, _issueExecutionAspectWarning, _noActorToFire, _requestFiring, _schedule, addDebugListener, attributeChanged, cancelFireAt, cancelFireAt, clone, describePriorities, fire, fireAt, fireAt, fireAtCurrentTime, fireAtRelativeTime, getCausalityInterface, getIndex, getMicrostep, getModelNextIterationTime, getNextEventTime, getStartTime, getStopTime, invalidateSchedule, mutexLockObject, postfire, prefire, preinitialize, removeDebugListener, resumeActor, setIndex, stop, stopFire, suggestedModalModelDirectors, transferInputs, wrapup
-
Methods inherited from class ptolemy.actor.Director
_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
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_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
-
-
-
-
Constructor Detail
-
ATCDirector
public ATCDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Create a new director in the specified container with the specified name. The name must be unique within the container or an exception is thrown. The container argument must not be null, or a NullPointerException will be thrown.- Parameters:
container
- The container.name
- The name of this actor within the container.- Throws:
IllegalActionException
- If this actor cannot be contained by the proposed container (see the setContainer() method).NameDuplicationException
- If the name coincides with an entity already in the container.
-
-
Method Detail
-
handleAirplaneColor
public ArrayToken handleAirplaneColor(int id) throws IllegalActionException
Return airplane's color. If the airplane has not color, set a color for that and store it.- Specified by:
handleAirplaneColor
in classAbstractATCDirector
- Parameters:
id
- id of the airplane- Returns:
- The color of the airplane
- Throws:
IllegalActionException
- If thrown while creating an ArrayToken.
-
handleInitializedAirport
public void handleInitializedAirport(Airport airport) throws IllegalActionException
Handle initializing of an airport.- Specified by:
handleInitializedAirport
in classAbstractATCDirector
- Parameters:
airport
- The airport- Throws:
IllegalActionException
- If the id is invalid.
-
handleInitializedDestination
public void handleInitializedDestination(DestinationAirport destinationAirport) throws IllegalActionException
Handle initializing of a destination airport. This function stores airport id in _airportsId- Specified by:
handleInitializedDestination
in classAbstractATCDirector
- Parameters:
destinationAirport
- The destination airport.- Throws:
IllegalActionException
- If the id is invalid, the id is a duplicate of the idea of another airport or if the airport id is the same as the a track id.
-
handleTrackAttributeChanged
public void handleTrackAttributeChanged(Track track) throws IllegalActionException
Update _stormyTracks array because of a change in condition of a track.- Specified by:
handleTrackAttributeChanged
in classAbstractATCDirector
- Parameters:
track
- The track- Throws:
IllegalActionException
- If the entry for the track has not been set in the the stormyTrack array.
-
handleInitializedTrack
public void handleInitializedTrack(Track track) throws IllegalActionException
Put an entry into _neighbors , _stormyTrack and _inTransit for the initialized track.- Specified by:
handleInitializedTrack
in classAbstractATCDirector
- Parameters:
track
- The track.- Throws:
IllegalActionException
- If there track is invalid.
-
handleRejectionWithDelay
public double handleRejectionWithDelay(Track track) throws IllegalActionException
Return an additional delay for a track to keep an aircraft in transit.- Specified by:
handleRejectionWithDelay
in classAbstractATCDirector
- Parameters:
track
- The track- Returns:
- An additional delay, or -1.0 to indicate that a rerouting is possible.
- Throws:
IllegalActionException
- Not thrown in this method.
-
initialize
public void initialize() throws IllegalActionException
Initialize the state of this director.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classDEDirector
- Throws:
IllegalActionException
- If thrown by the parent method.
-
newReceiver
public Receiver newReceiver()
Return a new ATCReceiver.- Overrides:
newReceiver
in classDEDirector
- Returns:
- a new ATCReceiver.
-
routing
public RecordToken routing(Token aircraft, Token trackId) throws IllegalActionException
Routing an aircraft based on its flight map.- Specified by:
routing
in classAbstractATCDirector
- Parameters:
aircraft
- (this token is a record of "aircraftId","aircraftSpeed","flightMap" and "priorTrack"and ...)trackId
- The track Id.- Returns:
- The routing.
- Throws:
IllegalActionException
- If there is a routing problem.
-
returnTrackStatus
public boolean returnTrackStatus(Token trackId)
Return status of the track.- Specified by:
returnTrackStatus
in classAbstractATCDirector
- Parameters:
trackId
- The track Id.- Returns:
- The status
-
rerouteUnacceptedAircraft
public java.util.Map<java.lang.String,Token> rerouteUnacceptedAircraft(Token aircraft) throws IllegalActionException
Reroute an aircraft.- Specified by:
rerouteUnacceptedAircraft
in classAbstractATCDirector
- Parameters:
aircraft
- The aircraft- Returns:
- A Map of rerouted aircraft.
- Throws:
IllegalActionException
- If thrown while getting the flightMap or setting parameters.
-
setInTransitStatusOfTrack
public void setInTransitStatusOfTrack(Token trackId, boolean trackStatus) throws IllegalActionException
Update inTransit status of a track.- Specified by:
setInTransitStatusOfTrack
in classAbstractATCDirector
- Parameters:
trackId
- The track idtrackStatus
- The track status- Throws:
IllegalActionException
- If thrown while getting the track Id.
-
-