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.
| Yellow (yuhong) |
| Yellow (eal) |
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, LINKSCOMPLETED, 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, workspaceequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreateReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortListisFireFunctional, isStrict, iterate, stop, stopFire, terminateaddInitializable, preinitialize, removeInitializabledescription, getContainer, getDisplayName, getFullName, getName, getName, setNamegetDerivedLevel, getDerivedList, propagateValuepublic 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 RandomSourceattribute - 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 RandomSourceworkspace - 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 Executablefire in class RandomSourceIllegalActionException - If there is no director.@Deprecated public double getStopTime()
getModelStopTime()public Time getModelStopTime()
public void initialize()
throws IllegalActionException
initialize in interface Initializableinitialize in class RandomSourceIllegalActionException - 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 Executablepostfire in class RandomSourceIllegalActionException - 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 Executableprefire in class SourceIllegalActionException - If there is no director.public void wrapup()
throws IllegalActionException
wrapup in interface Initializablewrapup in class AtomicActor<TypedIOPort>IllegalActionException - Not thrown in this base class.protected void _generateRandomNumber()
throws IllegalActionException
_generateRandomNumber in class RandomSourceIllegalActionException - If parameter values are incorrect.