Class DelayChannel
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity<T>
-
- ptolemy.actor.AtomicActor<TypedIOPort>
-
- ptolemy.actor.TypedAtomicActor
-
- ptolemy.domains.wireless.kernel.AtomicWirelessChannel
-
- ptolemy.domains.wireless.lib.ErasureChannel
-
- ptolemy.domains.wireless.lib.DelayChannel
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,ChannelListener
,PropertyTransformer
,WirelessChannel
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
,ValueListener
- Direct Known Subclasses:
LimitedRangeChannel
public class DelayChannel extends ErasureChannel
Model of a wireless channel with a specified propagation speed and loss probability. The propagation speed introduces delay that depends on the distance between the transmitter and receiver at the time that the transmitter initiates the communication. This channel model assumes that the duration of the message is (effectively) zero, so that neither the transmitter nor the receiver move during the transmission. It also assumes that the receiver does not move during propagation. I.e., it assumes that the propagation of the message is much faster than the node movement.A speed equal to Infinity (the default) results in no propagation delay. If the loss probability is greater than zero then on each call to the transmit() method, for each receiver in range, with the specified probability, the transmission to that receiver will not occur. Whether a transmission occurs to a particular receiver is independent of whether it occurs to any other receiver.
- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Edward A. Lee
- Pt.AcceptedRating:
- Yellow (cxh)
- Pt.ProposedRating:
- Green (cxh)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description Parameter
propagationSpeed
The propagation speed.-
Fields inherited from class ptolemy.domains.wireless.lib.ErasureChannel
_random, distance, lossProbability, seed
-
Fields inherited from class ptolemy.domains.wireless.kernel.AtomicWirelessChannel
_receiversInRangeCacheValid, defaultProperties, name
-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _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
Constructors Constructor Description DelayChannel(CompositeEntity container, java.lang.String name)
Construct a channel with the given name contained by the specified entity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_transmitTo(Token token, WirelessIOPort sender, WirelessReceiver receiver, RecordToken properties)
Transmit the specified token to the specified receiver with the specified properties.void
attributeChanged(Attribute attribute)
If the specified attribute is propagationSpeed, then check that a positive number is given.java.lang.Object
clone(Workspace workspace)
Clone the object into the specified workspace.void
fire()
If the current time matches one of the times that we have previously recorded as the reception time for a transmission, then deliver the token to the receiver.-
Methods inherited from class ptolemy.domains.wireless.lib.ErasureChannel
initialize
-
Methods inherited from class ptolemy.domains.wireless.kernel.AtomicWirelessChannel
_distanceBetween, _isInRange, _locationOf, _receiversInRange, addChannelListener, channelNotify, declareDelayDependency, getChannelPort, listeningInputPorts, listeningOutputPorts, registerPropertyTransformer, removeChannelListener, sendingInputPorts, sendingOutputPorts, transformProperties, transmit, unregisterPropertyTransformer, valueChanged
-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
-
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
_addPort, _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 ptolemy.kernel.util.NamedObj
_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
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable, wrapup
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
propagationSpeed
public Parameter propagationSpeed
The propagation speed. This determines the delay between transmission and reception. This is a double that defaults to Infinity, which means that there is no delay.
-
-
Constructor Detail
-
DelayChannel
public DelayChannel(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a channel with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown. This relation will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. This constructor write-synchronizes on the workspace.- Parameters:
container
- The container.name
- The name of the relation.- Throws:
IllegalActionException
- If the container is incompatible with this relation.NameDuplicationException
- If the name coincides with a relation already in the container.
-
-
Method Detail
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
If the specified attribute is propagationSpeed, then check that a positive number is given. Otherwise, defer to the base class.- Overrides:
attributeChanged
in classNamedObj
- Parameters:
attribute
- The attribute that changed.- Throws:
IllegalActionException
- If the change is not acceptable to this container.
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Clone the object into the specified workspace. The new object is not added to the directory of that workspace (you must do this yourself if you want it there).- Overrides:
clone
in classErasureChannel
- Parameters:
workspace
- The workspace for the cloned object.- Returns:
- The new Attribute.
- Throws:
java.lang.CloneNotSupportedException
- Not thrown in this base class- See Also:
NamedObj.exportMoML(Writer, int, String)
,NamedObj.setDeferringChangeRequests(boolean)
-
fire
public void fire() throws IllegalActionException
If the current time matches one of the times that we have previously recorded as the reception time for a transmission, then deliver the token to the receiver.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- If the _transmitTo() method of the base class throws it, i.e. the token attribute of the reception cannot be converted or the token attribute is null and the receiver attribute of the receptions does not support clear.
-
_transmitTo
protected void _transmitTo(Token token, WirelessIOPort sender, WirelessReceiver receiver, RecordToken properties) throws IllegalActionException
Transmit the specified token to the specified receiver with the specified properties. If propagationSpeed is less than Infinity, then this results in a call to fireAt() of the director for each receiver that is in range. The token is not actually transmitted to the receiver until the corresponding invocation of fire() occurs. The time delay is equal to distance/propagationSpeed. See the class comments for the assumptions that make this correct.If the lossProbability is zero, (the default) then the specified receiver will receive the token if it has room. If lossProbability is greater than zero, the token will be lost with the specified probability, independently for each receiver in range. Note that in this base class, a port is in range if it refers to this channel by name and is at the right place in the hierarchy. This base class makes no use of the properties argument. But derived classes may limit the range or otherwise change transmission properties using this argument.
- Overrides:
_transmitTo
in classErasureChannel
- Parameters:
token
- The token to transmit, or null to clear the specified receiver.sender
- The sending port.receiver
- The receiver to which to transmit.properties
- The transmit properties (ignored in this base class).- Throws:
IllegalActionException
- If the token cannot be converted or if the token argument is null and the destination receiver does not support clear.
-
-