ptolemy.domains.ct.lib
Class ContinuousClock
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.actor.lib.Source
ptolemy.actor.lib.TimedSource
ptolemy.actor.lib.Clock
ptolemy.domains.ct.lib.ContinuousClock
- All Implemented Interfaces:
- Actor, Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable, TimedActor, TypedActor
- Direct Known Subclasses:
- TriggeredContinuousClock
- public class ContinuousClock
- extends Clock
This is a clock source used in continuous time domain.
It extends the clock actor in ptolemy/actor/lib directory
but overrides the fire() method and postfire() method.
The actor uses the fireAt() method of the director to request
firings at the beginning of each period plus each of the offsets,
which are treated as breakpoints. At each breakpoint,
the actor produces two outputs, one at t_minus phase and the other
one at t_plus phase. The time does not advance at these two phases.
For example, with the default settings, at time 1.0, the actor
produces 0 at t_minus phase and 1 at t_plus phase. Note, at
the breakpoint, we treat the output of this actor as any
value between 0 and 1.
There is a defaultValue parameter which is used as output after the
clock reachs the number of cycles. In the triggered continuous clock which
extends this class, the defaultValue parameter is also used as output before
the clock starts. The default value is 0.
The clock has a stopTime parameter and a numberOfCycles parameter. If the
stopTime is a positive double, the whole model will stop execution when the
stop time is reached. If the numberOfCycles is set to a positive integer,
the clock will continue outputting the value of the defaultValue parameter
after the number of cycles are reached.
- Since:
- Ptolemy II 2.2
- Version:
- $Id: ContinuousClock.java,v 1.18.2.2 2004/07/31 17:24:41 cxh Exp $
- Author:
- Edward A. Lee, Haiyang Zheng
- See Also:
Clock,
Serialized Form
- Accepted Rating:
- Proposed Rating:
| Fields inherited from class ptolemy.actor.lib.Clock |
_currentValue, _cycleCount, _cycleStartTime, _done, _offsets, _phase, _startTime, _tentativeCurrentValue, _tentativeCycleCount, _tentativeCycleCountIncrement, _tentativeCycleStartTime, _tentativeDone, _tentativeNextFiringTime, _tentativePhase, _tentativeStartTime, numberOfCycles, offsets, period, values |
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
|
Method Summary |
void |
fire()
Output the current value of the clock. |
void |
initialize()
Schedule the first firing and initialize local variables. |
boolean |
postfire()
Update the state of the actor and schedule the next firing,
if appropriate. |
void |
preinitialize()
Make sure the continuous clock runs inside a CT domain. |
| Methods inherited from class ptolemy.actor.AtomicActor |
_createReceivers, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, inputPortList, iterate, newReceiver, outputPortList, pruneDependencies, removeDependency, setContainer, stop, stopFire, terminate |
| Methods inherited from class ptolemy.kernel.Entity |
_description, _exportMoMLContents, _removePort, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName, validateSettables |
| Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeList, attributeList, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, toplevel, toString, workspace |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
defaultValue
public Parameter defaultValue
- The default value used after the clock stops. In the triggered
continuous clock, which extends this class and has a start
trigger, the default value is used as output before the clock starts.
This parameter must contain a token, and it defaults to 0.
ContinuousClock
public ContinuousClock(CompositeEntity container,
java.lang.String name)
throws NameDuplicationException,
IllegalActionException
- Construct an actor with the specified container and name.
- Parameters:
container - The container.name - The name of this actor.
- Throws:
IllegalActionException - If the entity cannot be contained
by the proposed container.
NameDuplicationException - If the container already has an
actor with this name.
fire
public void fire()
throws IllegalActionException
- Output the current value of the clock.
- Specified by:
fire in interface Executable- Overrides:
fire in class Clock
- Throws:
IllegalActionException - If
the value in the offsets parameter is encountered that is greater
than the period, or if there is no director.
initialize
public void initialize()
throws IllegalActionException
- Schedule the first firing and initialize local variables.
- Specified by:
initialize in interface Executable- Overrides:
initialize in class Clock
- Throws:
IllegalActionException - If the parent class throws it,
or if the values parameter is not a row vector, or if the
fireAt() method of the director throws it.
preinitialize
public void preinitialize()
throws IllegalActionException
- Make sure the continuous clock runs inside a CT domain.
- Specified by:
preinitialize in interface Executable- Overrides:
preinitialize in class AtomicActor
- Throws:
IllegalActionException - If the director is not
a CTDirector or the parent class throws it.
postfire
public boolean postfire()
throws IllegalActionException
- Update the state of the actor and schedule the next firing,
if appropriate.
- Specified by:
postfire in interface Executable- Overrides:
postfire in class Clock
- Throws:
IllegalActionException - If the director throws it when
scheduling the next firing.