public class PoissonClock extends RandomSource implements TimedActor
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.
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
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.
|
_generatorSeed, _needNew, _needNewGenerator, _random, privateSeed, resetOnEachRun, seed
_triggered, output, trigger
_typesValid
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
_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 |
---|
PoissonClock(CompositeEntity container,
java.lang.String name)
Construct an actor with the specified container and name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_generateRandomNumber()
Generate a new random number.
|
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
getModelStopTime() |
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.
|
_createGenerator
_customTypeConstraints
_containedTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate, stop, stopFire, terminate
addInitializable, preinitialize, removeInitializable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public Parameter fireAtStart
public Parameter meanTime
public Parameter stopTime
public Parameter values
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.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.@Deprecated public double getStopTime()
getModelStopTime()
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<TypedIOPort>
IllegalActionException
- Not thrown in this base class.protected void _generateRandomNumber() throws IllegalActionException
_generateRandomNumber
in class RandomSource
IllegalActionException
- If parameter values are incorrect.