ptolemy.domains.giotto.kernel
Class GiottoScheduler

java.lang.Object
  extended byptolemy.kernel.util.NamedObj
      extended byptolemy.kernel.util.Attribute
          extended byptolemy.actor.sched.Scheduler
              extended byptolemy.domains.giotto.kernel.GiottoScheduler
All Implemented Interfaces:
Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable

public class GiottoScheduler
extends Scheduler

This class generates schedules for the actors in a CompositeActor according to the Giotto semantics.

A schedule is represented by a list. Consider the following CompositeActor:

   +-----------------------+
   |           A           |
   +-----------------------+
   +-----------------------+
   |           B           |
   +-----------------------+
   +---------+   +---------+
   |    C    |   |    C    |
   +---------+   +---------+
   
There are three actors A, B, and C, where C runs twice as often as A and B. The list representing the schedule for this CompositeActor looks as follows:
   +-------+                         +-------+
   | | | --------------------------->| | |nil|
   +-|-----+                         +-|-----+
   |                                 |
   V                                 V
   +-------+  +-------+  +-------+   +-------+
   | | | ---->| | | ---->| | |nil|   | | |nil|
   +-|-----+  +-|-----+  +-|-----+   +-|-----+
   |          |          |           |
   V          V          V           V
   +---+      +---+      +---+       +---+
   | A |      | B |      | c |       | c |
   +---+      +---+      +---+       +---+

   

Since:
Ptolemy II 1.0
Version:
$Id: GiottoScheduler.java,v 1.31 2004/04/13 05:13:14 cxh Exp $
Author:
Christoph Kirsch, Haiyang Zheng
See Also:
Serialized Form
Accepted Rating:
Red (eal)
Proposed Rating:
Yellow (cm)

Nested Class Summary
 
Nested classes inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
protected static int _DEFAULT_GIOTTO_FREQUENCY
          The default Giotto frequency.
 
Fields inherited from class ptolemy.actor.sched.Scheduler
_DEFAULT_SCHEDULER_NAME
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
GiottoScheduler()
          Construct a Giotto scheduler with no container (director) in the default workspace.
GiottoScheduler(Workspace workspace)
          Construct a Giotto scheduler in the given workspace.
 
Method Summary
protected  double _getMinTimeStep(double period)
          Return the unit of time increment for director.
protected  Schedule _getSchedule()
          Return the scheduling sequence.
static int getFrequency(Actor actor)
          Return the frequency of the given actor.
 
Methods inherited from class ptolemy.actor.sched.Scheduler
clone, getSchedule, isValid, setContainer, setValid
 
Methods inherited from class ptolemy.kernel.util.Attribute
_getContainedObject, _propagateExistence, getContainer, setName
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, 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, removeDebugListener, 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

_DEFAULT_GIOTTO_FREQUENCY

protected static int _DEFAULT_GIOTTO_FREQUENCY
The default Giotto frequency. Actors without a frequency parameter will execute with this frequency.

Constructor Detail

GiottoScheduler

public GiottoScheduler()
Construct a Giotto scheduler with no container (director) in the default workspace.


GiottoScheduler

public GiottoScheduler(Workspace workspace)
Construct a Giotto scheduler in the given workspace. If the workspace argument is null, use the default workspace. The scheduler is added to the list of objects in the workspace. Increment the version number of the workspace.

Parameters:
workspace - Object for synchronization and version tracking.
Method Detail

getFrequency

public static int getFrequency(Actor actor)
Return the frequency of the given actor. If the actor has a frequency parameter with a valid integer value, return that value. For actors without a frequency parameter, their frequency is _DEFAULT_GIOTTO_FREQUENCY.

Parameters:
actor - An actor.
Returns:
The frequency of the actor.

_getMinTimeStep

protected double _getMinTimeStep(double period)
Return the unit of time increment for director. This method will be called by the director. It should not be called until the director call getSchedule() and the returned schedule is invalid. It is not synchronized on the workspace.

Parameters:
period - Giotto model period given in 'period' parameter of director
Returns:
unit of time increment for director.

_getSchedule

protected Schedule _getSchedule()
                         throws NotSchedulableException
Return the scheduling sequence. This method should not be called directly; rather the getSchedule() method will call it when the schedule is invalid. It is not synchronized on the workspace.

Overrides:
_getSchedule in class Scheduler
Returns:
A schedule.
Throws:
NotSchedulableException - If the model is not schedulable.
See Also:
CompositeEntity.deepGetEntities()