|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.actor.sched.Scheduler
ptolemy.domains.ct.kernel.CTScheduler
public class CTScheduler
The Static scheduler for the CT domain.
A CT (sub)system can be mathematically represented as:
dx/dt = f(x, u, t) y = g(x, u, t)where x is the state of the system, u is the input, y is the output, f() is the state transition map and g() is the output map.
The system is built using actors. That is, all the functions, f() and g(), are built up by chains of actors. For higher order systems, x is a vector, built using more than one integrator. In general, actors that have the functionality of integration from their inputs to their outputs are called dynamic actors. Other actors are called arithmetic actors.
In order to interact with discrete domains, some actors in the CT domain are able to convert continuous waveforms to discrete events, and vice versa. An actor that has continuous input and discrete output is call an event generator; an actor that has discrete input and continuous output is called a waveform generator.
The interaction with some discrete domains requires that the CT simulation be able to remember its state and roll-back to the remembered state when needed. This in turn requires that all actors that have internal states to be able to remember and restore their states. These actors are called stateful actors.
In continuous-time simulation, time progresses in a discrete way. The distance between two consecutive time points is called the integration step size or step size, for short. Some actors may put constraints on the choice of the step size. These actors are called step size control actors. Examples of step size control actors include integrators, which control the accuracy and speed of numerical ODE solutions, and event generators, which produce discrete events.
To help with scheduling, the actors are partitioned into several clusters, including continuous actors, discrete actors, arithmetic actors, stateTransition actors, dynamic actors, sink actors, event generators, waveform generators, CT subsystems , and non-CT subsystems. This scheduler uses the cluster information and the system topology to provide the firing sequences for evaluating f() and g(). It also provides a firing order for all the dynamic actors. The firing sequence for evaluating f() is called the state transition schedule; the firing sequence for evaluating g() is called the output schedule; and the firing sequence for dynamic actors is called the dynamic actor schedule.
The state transition schedule is the actors in the f() function sorted in topological order, such that, after the integrators emit their state x, a chain of firings according to the schedule evaluates the f() function and returns tokens corresponding to dx/dt to the integrators.
The output schedule is the actors in the g() function sorted in their topological order.
The dynamic actor schedule is a list of dynamic actors in their reverse topological order.
If there are loops of arithmetic actors or loops of integrators, then the (sub)system are not schedulable, and a NotSchedulableException will be thrown if schedules are requested.
This CTScheduler does not support mutation.
Scheduler
,
Serialized Form
Red (hyzheng) |
Yellow (hyzheng) |
Nested Class Summary | |
---|---|
private class |
CTScheduler.SignalTypeMap
|
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
private CTScheduler.SignalTypeMap |
_signalTypeMap
|
private static java.lang.String |
_STATIC_NAME
|
static CTReceiver.SignalType |
CONTINUOUS
These are syntactic sugar for signal types, which are defined in CTReceiver. |
static CTReceiver.SignalType |
DISCRETE
Signal type: DISCRETE. |
static CTReceiver.SignalType |
UNKNOWN
Signal type: UNKNOWN. |
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, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Constructor Summary | |
---|---|
CTScheduler()
Construct a CT scheduler in the default workspace with an empty string as the name. |
|
CTScheduler(Workspace workspace)
Construct a CT scheduler in the given workspace with the name "CTScheduler". |
Method Summary | |
---|---|
protected Schedule |
_getSchedule()
Return the CTSchedule. |
private static void |
_setOrCreate(NamedObj container,
java.lang.String name,
java.lang.String value)
Set or create a not-visible, not-persistent parameter with the specified name in the specified container with the specified value. |
private void |
_setPortSignalTypes(CTScheduler.SignalTypeMap typeMap)
Create and set a parameter in each port according to the resolved. continuous/discrete nature of the port. |
private DirectedAcyclicGraph |
_toArithmeticGraph(java.util.List list)
Convert the given list of actors to a directed acyclic graph. |
private DirectedAcyclicGraph |
_toGraph(java.util.List list)
Convert the given actors to a directed acyclic graph. |
boolean |
isContinuous(Actor actor)
Return true if the given actor is in the continuous cluster of the model. |
boolean |
isDiscrete(Actor actor)
Return true if the given actor is in the discrete cluster of the model. |
java.util.List |
predecessorList(Actor actor)
Return the predecessors of the given actor in the same level of hierarchy. |
java.lang.String |
signalTypeToString(CTReceiver.SignalType signalType)
Return the SignalType as a String. |
java.util.List |
successorList(Actor actor)
Return the successive actors of the given actor in the same level of hierarchy. |
java.lang.String |
toString()
Return the full name of this scheduler. |
Methods inherited from class ptolemy.actor.sched.Scheduler |
---|
clone, getSchedule, isValid, setContainer, setValid |
Methods inherited from class ptolemy.kernel.util.Attribute |
---|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final CTReceiver.SignalType CONTINUOUS
public static final CTReceiver.SignalType DISCRETE
public static final CTReceiver.SignalType UNKNOWN
private static final java.lang.String _STATIC_NAME
private CTScheduler.SignalTypeMap _signalTypeMap
Constructor Detail |
---|
public CTScheduler()
public CTScheduler(Workspace workspace)
workspace
- The workspace.Method Detail |
---|
public boolean isContinuous(Actor actor) throws IllegalActionException
actor
- The given actor.
IllegalActionException
- If this method is called before
initialization, where the schedule is computed.public boolean isDiscrete(Actor actor) throws IllegalActionException
actor
- The given actor.
IllegalActionException
- If this method is called before
initialization, where the schedule is computed.public java.util.List predecessorList(Actor actor)
actor
- The given actor.
public java.lang.String signalTypeToString(CTReceiver.SignalType signalType)
signalType
- The type of signal.
public java.util.List successorList(Actor actor)
actor
- The specified actor. If the actor is null, returns null.
public java.lang.String toString()
toString
in class NamedObj
protected Schedule _getSchedule() throws NotSchedulableException, IllegalActionException
_getSchedule
in class Scheduler
NotSchedulableException
- If the CompositeActor is not
schedulable. Not thrown in this base class, but may be thrown
by derived classes.
IllegalActionException
- If the scheduling algorithm
throws it. Not thrown in this base class, but may be thrown
by derived classes.CompositeEntity.deepEntityList()
private static void _setOrCreate(NamedObj container, java.lang.String name, java.lang.String value) throws IllegalActionException
container
- The container for the parameter.name
- The name for the parameter.value
- The value for the parameter.
IllegalActionException
- If the parameter cannot
contain the specified value.private void _setPortSignalTypes(CTScheduler.SignalTypeMap typeMap)
typeMap
- A map from ports toprivate DirectedAcyclicGraph _toArithmeticGraph(java.util.List list)
list
- The list of actors to be scheduled.
private DirectedAcyclicGraph _toGraph(java.util.List list)
list
- The list of actors to be converted to a graph.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |