public class GiottoDirector extends StaticSchedulingDirector implements Decorator
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.
GiottoScheduler
,
GiottoReceiver
Red (eal) |
Yellow (cm) |
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected static double |
_DEFAULT_GIOTTO_PERIOD
The static default Giotto period is 100ms.
|
Parameter |
iterations
The number of times that postfire may be called before it
returns false.
|
Parameter |
period
The period of an iteration.
|
Parameter |
synchronizeToRealTime
Specify whether the execution should synchronize to the
real time.
|
_postfireReturns, _prefire
_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 |
---|
GiottoDirector()
Construct a director in the default workspace with an empty string
as its name.
|
GiottoDirector(CompositeEntity container,
java.lang.String name)
Construct a director in the given container with the given name.
|
GiottoDirector(Workspace workspace)
Construct a director in the given workspace with an empty name.
|
Modifier and Type | Method and Description |
---|---|
void |
attributeChanged(Attribute attribute)
If the specified attribute is filename, then close
the current file (if there is one) and open the new one.
|
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace.
|
DecoratorAttributes |
createDecoratorAttributes(NamedObj target)
Return the decorated attributes for the target NamedObj.
|
java.util.List<NamedObj> |
decoratedObjects()
Return a list of the entities deeply contained by the container
of this resource scheduler.
|
void |
fire()
Fire a complete iteration and advance time to the current time plus
the period value.
|
Time |
fireAt(Actor actor,
Time time,
int microstep)
Request a firing of the given actor at the given absolute
time.
|
static int |
getActorFrequency(NamedObj actor,
GiottoDirector director)
Return the frequency of the specified actor by accessing a
parameter named "frequency".
|
int |
getIntPeriod()
Get the period of the giotto director in ms.
|
Time |
getModelNextIterationTime()
Return the next time that this director expects activity.
|
double |
getPeriod()
Get the period of the giotto director in ms.
|
void |
initialize()
Initialize the actors associated with this director.
|
boolean |
isGlobalDecorator()
Return false to indicate that this decorator should not
decorate objects across opaque hierarchy boundaries.
|
Receiver |
newReceiver()
Return a new receiver consistent with the Giotto domain.
|
boolean |
postfire()
Return false if the system has finished executing, either by
reaching the iteration limit, or by having an actor in the model
return false in postfire.
|
boolean |
prefire()
This method always return true.
|
void |
preinitialize()
Preinitialize the actors associated with this director.
|
void |
setContainer(NamedObj container)
Override the base class to first set the container, then establish
a connection with any decorated objects it finds in scope in the new
container.
|
java.lang.String[] |
suggestedModalModelDirectors()
Return an array of suggested directors to be used with
ModalModel.
|
boolean |
transferInputs(IOPort port)
Transfer data from an input port of the container to the ports
it is connected to on the inside.
|
boolean |
transferOutputs(IOPort port)
Transfer data from this port to the ports it is connected to on
the outside.
|
_setScheduler, addDebugListener, getScheduler, invalidateSchedule, isScheduleValid, removeDebugListener, resumeActor, setScheduler
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _schedule, _transferInputs, _transferOutputs, addInitializable, createSchedule, defaultDependency, delayDependency, finish, fireAt, fireAt, fireAtCurrentTime, fireContainerAt, fireContainerAt, getCausalityInterface, getCurrentTime, getDeadline, getEnvironmentTime, getErrorTolerance, getExecutionAspect, getGlobalTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, implementsStrictActorSemantics, initialize, invalidateResolvedTypes, isEmbedded, isFireFunctional, isStopRequested, isStrict, iterate, mutexLockObject, notifyTokenSentToCommunicationAspect, preinitialize, removeInitializable, requestInitialization, resume, scheduleContainedActors, setCurrentTime, setEmbedded, setModelTime, setTimeResolution, stop, stopFire, supportMultirateFiring, suspend, terminate, transferOutputs, wrapup
_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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
description, getContainer, getDisplayName, getFullName, getName, getName, setName
public Parameter iterations
public Parameter period
public Parameter synchronizeToRealTime
protected static final double _DEFAULT_GIOTTO_PERIOD
public GiottoDirector() throws IllegalActionException, NameDuplicationException
IllegalActionException
- If the name has a period in it, or
the director is not compatible with the specified container.NameDuplicationException
- If the container already contains
an entity with the specified name.public GiottoDirector(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.NameDuplicationException
- If the name collides with an
attribute in the container or if there is a name duplication during
initialization.public GiottoDirector(Workspace workspace) throws IllegalActionException, NameDuplicationException
workspace
- The workspace for this object.IllegalActionException
- If there is an exception thrown by
the super class or while initializing parameters.NameDuplicationException
- If the container reports an entity
that duplicates an existing name during initialization.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class Director
attribute
- The attribute that has changed.IllegalActionException
- If the specified attribute
is filename and the file cannot be opened.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class StaticSchedulingDirector
workspace
- The workspace for the cloned object.java.lang.CloneNotSupportedException
- Not thrown in this base classNamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public DecoratorAttributes createDecoratorAttributes(NamedObj target)
createDecoratorAttributes
in interface Decorator
target
- The NamedObj that will be decorated.public java.util.List<NamedObj> decoratedObjects()
decoratedObjects
in interface Decorator
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class StaticSchedulingDirector
IllegalActionException
- If this director does not have a
container.public Time fireAt(Actor actor, Time time, int microstep) throws IllegalActionException
fireAt
in class Director
actor
- The actor scheduled to be fired.time
- The requested time.microstep
- The microstep (ignored by this director).IllegalActionException
- If the operation is not
permissible (e.g. the given time is in the past).Director.fireAtCurrentTime(Actor)
,
Director.fireContainerAt(Time)
public static int getActorFrequency(NamedObj actor, GiottoDirector director) throws IllegalActionException
actor
- The actor.director
- The director.IllegalActionException
- If thrown while getting the value
of the frequency decorator attribute.public int getIntPeriod()
public Time getModelNextIterationTime()
getModelNextIterationTime
in class Director
Director.getModelTime()
public double getPeriod()
public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class StaticSchedulingDirector
IllegalActionException
- If the initialize() method of
one of the associated actors throws it.public boolean isGlobalDecorator()
isGlobalDecorator
in interface Decorator
public Receiver newReceiver()
newReceiver
in class Director
public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class StaticSchedulingDirector
IllegalActionException
- If the iterations parameter does
not have a valid token.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class StaticSchedulingDirector
IllegalActionException
- If time is set backwards.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class Director
IllegalActionException
- If the preinitialize() method of
one of the associated actors throws it.public void setContainer(NamedObj container) throws IllegalActionException, NameDuplicationException
setContainer
in class Director
container
- The container to attach this attribute to..IllegalActionException
- If this attribute is not of the
expected class for the container, or it has no name,
or the attribute and container are not in the same workspace, or
the proposed container would result in recursive containment.NameDuplicationException
- If the container already has
an attribute with the name of this attribute.Attribute.getContainer()
public java.lang.String[] suggestedModalModelDirectors()
suggestedModalModelDirectors
in class Director
Director.suggestedModalModelDirectors()
public boolean transferInputs(IOPort port) throws IllegalActionException
transferInputs
in class Director
port
- The port to transfer tokens from.IllegalActionException
- If the port is not an opaque
input port.public boolean transferOutputs(IOPort port) throws IllegalActionException
transferOutputs
in class Director
port
- The port to transfer tokens from.IllegalActionException
- If the port is not an opaque
output port.