|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.backtrack.automatic.ptolemy.actor.lib.RandomSource ptolemy.backtrack.automatic.ptolemy.actor.lib.PoissonClock
public class PoissonClock
This actor produces discrete events according to a Poisson process. The time between events is given by independent and identically distributed exponential random variables. The values produced rotate sequentially through those given in the values parameter, which is an array of anything and defaults to {1, 0}. The type of the output can be any token type. This type is inferred from the element type of the values parameter. The mean time between events is given by the meanTime parameter, which defaults to 1.0.
In the initialize() method and postfire() methods, the actor uses the fireAt() method of the director to request the next firing. The first firing is always at the start time, unless the parameter fireAtStart is changed to false.
If the trigger input is connected, then any event on it will cause the Poisson process to immediately produce the next event, as if the time for that event had arrived.
If this actor is inactive at the time at which it would have otherwise produced an output, then it will stop producing outputs. This should not happen.
Yellow (yuhong) |
Yellow (eal) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.Entity |
---|
Entity.ContainedObjectsIterator |
Field Summary | |
---|---|
private double |
_current
|
private boolean |
_executing
|
private int |
_length
|
private Time |
_nextFiringTime
|
private int |
_nextOutputIndex
|
private Time |
_stopTime
|
private FieldRecord |
$RECORD$_current
|
private FieldRecord |
$RECORD$_executing
|
private FieldRecord |
$RECORD$_length
|
private FieldRecord |
$RECORD$_nextFiringTime
|
private FieldRecord |
$RECORD$_nextOutputIndex
|
private FieldRecord |
$RECORD$_stopTime
|
private FieldRecord[] |
$RECORDS
|
Parameter |
fireAtStart
If true, then this actor will request a firing at the start time. |
Parameter |
meanTime
The mean time between events, where the output value transitions. |
Parameter |
stopTime
The time at which postfire() should return false. |
Parameter |
values
The values that will be produced at the output. |
Fields inherited from class ptolemy.backtrack.automatic.ptolemy.actor.lib.RandomSource |
---|
_generatorSeed, _needNew, _needNewGenerator, _random, $CHECKPOINT, $RECORD$$CHECKPOINT, resetOnEachRun, seed |
Fields inherited from class ptolemy.actor.lib.Source |
---|
output, trigger |
Fields inherited from class ptolemy.actor.AtomicActor |
---|
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _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 | |
---|---|
PoissonClock(CompositeEntity container,
java.lang.String name)
Construct an actor with the specified container and name. |
Method Summary | |
---|---|
protected void |
_generateRandomNumber()
Generate a new random number. |
private Token |
_getValue(int index)
|
private double |
$ASSIGN$_current(double newValue)
|
private boolean |
$ASSIGN$_executing(boolean newValue)
|
private int |
$ASSIGN$_length(int newValue)
|
private Time |
$ASSIGN$_nextFiringTime(Time newValue)
|
private int |
$ASSIGN$_nextOutputIndex(int newValue)
|
private Time |
$ASSIGN$_stopTime(Time newValue)
|
private int |
$ASSIGN$SPECIAL$_nextOutputIndex(int operator,
long newValue)
|
void |
$COMMIT(long timestamp)
Commit changes up to the given timestamp, but not including changes made at timestamp and afterward. |
void |
$RESTORE(long timestamp,
boolean trim)
Restore a previous state to all the private fields of this rollbackable object. |
void |
attributeChanged(Attribute attribute)
If the argument is the meanTime parameter, check that it is positive. |
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace. |
void |
fire()
Output the current value. |
Time |
getModelStopTime()
Get the stop time. |
double |
getStopTime()
Deprecated. As of Ptolemy II 4.1, replaced by{ |
void |
initialize()
Request the first firing either at the start time or at a random time, depending on fireAtStart. |
boolean |
postfire()
Generate an exponential random number and schedule the next firing. |
boolean |
prefire()
If the current time matches the expected time for the next output, then return true. |
void |
wrapup()
Override the base class to reset a flag that indicates that the model is executing. |
Methods inherited from class ptolemy.backtrack.automatic.ptolemy.actor.lib.RandomSource |
---|
_createGenerator, $GET$CHECKPOINT, $SET$CHECKPOINT |
Methods inherited from class ptolemy.actor.TypedAtomicActor |
---|
_addPort, _fireAt, _fireAt, attributeTypeChanged, clone, newPort, typeConstraintList, typeConstraints |
Methods inherited from class ptolemy.kernel.ComponentEntity |
---|
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName |
Methods inherited from class ptolemy.kernel.Entity |
---|
_description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName |
Methods inherited from class ptolemy.kernel.InstantiableNamedObj |
---|
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ptolemy.backtrack.Rollbackable |
---|
$GET$CHECKPOINT, $SET$CHECKPOINT |
Methods inherited from interface ptolemy.actor.Actor |
---|
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList |
Methods inherited from interface ptolemy.actor.Executable |
---|
isFireFunctional, isStrict, iterate, stop, stopFire, terminate |
Methods inherited from interface ptolemy.actor.Initializable |
---|
addInitializable, preinitialize, removeInitializable |
Methods inherited from interface ptolemy.kernel.util.Nameable |
---|
description, getContainer, getDisplayName, getFullName, getName, getName, setName |
Methods inherited from interface ptolemy.kernel.util.Derivable |
---|
getDerivedLevel, getDerivedList, propagateValue |
Field Detail |
---|
public Parameter fireAtStart
public Parameter meanTime
public Parameter stopTime
public Parameter values
private double _current
private boolean _executing
private transient int _length
private transient Time _nextFiringTime
private transient int _nextOutputIndex
private Time _stopTime
private transient FieldRecord $RECORD$_current
private transient FieldRecord $RECORD$_executing
private transient FieldRecord $RECORD$_length
private transient FieldRecord $RECORD$_nextFiringTime
private transient FieldRecord $RECORD$_nextOutputIndex
private transient FieldRecord $RECORD$_stopTime
private transient FieldRecord[] $RECORDS
Constructor Detail |
---|
public PoissonClock(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name of this actor.
IllegalActionException
- If the entity cannot be contained
by the proposed container.
NameDuplicationException
- If the container already has an
actor with this name.Method Detail |
---|
public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class RandomSource
attribute
- The attribute that changed.
IllegalActionException
- If the meanTime value is
not positive.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class RandomSource
workspace
- The workspace for the new object.
java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class RandomSource
IllegalActionException
- If there is no director.public double getStopTime()
public Time getModelStopTime()
public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class RandomSource
IllegalActionException
- If the fireAt() method of the
director throws it, or if the director does not
agree to fire the actor at the specified time.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class RandomSource
IllegalActionException
- If the director throws it when
scheduling the next firing, or if the director does not
agree to fire the actor at the specified time.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class Source
IllegalActionException
- If there is no director.public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class AtomicActor
IllegalActionException
- Not thrown in this base class.protected void _generateRandomNumber() throws IllegalActionException
_generateRandomNumber
in class RandomSource
IllegalActionException
- If parameter values are incorrect.private Token _getValue(int index) throws IllegalActionException
IllegalActionException
private final double $ASSIGN$_current(double newValue)
private final boolean $ASSIGN$_executing(boolean newValue)
private final int $ASSIGN$_length(int newValue)
private final Time $ASSIGN$_nextFiringTime(Time newValue)
private final int $ASSIGN$_nextOutputIndex(int newValue)
private final int $ASSIGN$SPECIAL$_nextOutputIndex(int operator, long newValue)
private final Time $ASSIGN$_stopTime(Time newValue)
public void $COMMIT(long timestamp)
Rollbackable
$COMMIT
in interface Rollbackable
$COMMIT
in class RandomSource
timestamp
- The timestamp.public void $RESTORE(long timestamp, boolean trim)
Rollbackable
$RESTORE
in interface Rollbackable
$RESTORE
in class RandomSource
timestamp
- The timestamp taken at the time when the previous
state was recorded.trim
- Whether to delete the records used for the rollback.Checkpoint.rollback(long, boolean)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |