Package ptolemy.domains.wireless.lib
Class LimitedRangeChannel
- 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
-
- ptolemy.domains.wireless.lib.LimitedRangeChannel
-
- 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:
BluetoothChannel
,PowerLossChannel
public class LimitedRangeChannel extends DelayChannel
This is a model of a wireless channel with a specified transmission range. The transmission range can be specified in one of two ways. Either it is the value of the range field in the defaultProperties parameter (a record) of this channel, or it is provided by the transmitter on each call to transmit() as a property argument. To use the latter mechanism, it is necessary that the property token be an instance of RecordToken with a field named "range" that can be converted to a double (i.e., it can be a double, an int, or a byte). The default value for range is Infinity, which indicates that by default, there is no range limit.Any receiver that is within the specified range when transmit() is called will receive the transmission. The distance between the transmitter and receiver is determined by the protected method _distanceBetween(). In this base class, that method uses the _location attribute of the transmit and receive actors, which corresponds to the position of the icon in the Vergil visual editor. Subclasses may override this protected method to provide some other notion of distance.
- 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 inherited from class ptolemy.domains.wireless.lib.DelayChannel
propagationSpeed
-
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 LimitedRangeChannel(CompositeEntity container, java.lang.String name)
Construct a channel with the given name and container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
_isInRange(WirelessIOPort source, WirelessIOPort destination, RecordToken properties)
Return true if the specified port is in range of the specified source port, assuming the source port transmits with the specified properties.void
valueChanged(Settable settable)
React to a change of the specified Settable value.-
Methods inherited from class ptolemy.domains.wireless.lib.DelayChannel
_transmitTo, attributeChanged, clone, fire
-
Methods inherited from class ptolemy.domains.wireless.lib.ErasureChannel
initialize
-
Methods inherited from class ptolemy.domains.wireless.kernel.AtomicWirelessChannel
_distanceBetween, _locationOf, _receiversInRange, addChannelListener, channelNotify, declareDelayDependency, getChannelPort, listeningInputPorts, listeningOutputPorts, registerPropertyTransformer, removeChannelListener, sendingInputPorts, sendingOutputPorts, transformProperties, transmit, unregisterPropertyTransformer
-
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
-
-
-
-
Constructor Detail
-
LimitedRangeChannel
public LimitedRangeChannel(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a channel with the given name and container. The container argument must not be null, or a NullPointerException will be thrown. If the name argument is null, then the name is set to the empty string.- Parameters:
container
- The container.name
- The name of the channel.- Throws:
IllegalActionException
- If the container is incompatible.NameDuplicationException
- If the name coincides with an actor already in the container.
-
-
Method Detail
-
valueChanged
public void valueChanged(Settable settable)
React to a change of the specified Settable value. This class registers as a listener to attributes that specify transmit properties. If those change, then it is necessary to invalidate the cache of receivers in range. This method simply invalidates the cache if it is called, so subclasses should be careful to not register as value listeners unnecessarily to objects that do not affect the validity of this cache.- Specified by:
valueChanged
in interfaceValueListener
- Overrides:
valueChanged
in classAtomicWirelessChannel
- Parameters:
settable
- The object that has changed value.
-
_isInRange
protected boolean _isInRange(WirelessIOPort source, WirelessIOPort destination, RecordToken properties) throws IllegalActionException
Return true if the specified port is in range of the specified source port, assuming the source port transmits with the specified properties. The properties are an instance of RecordToken. If the properties have a "range" field given by a double value, then that value is assumed to be the range of the transmission. Otherwise, use the "range" field value of the defaultProperties as the range of the transmission. This method returns true if the distance between the source and the destination is less than or equal to the value of the properties. If the properties argument is not a DoubleToken, then it simply returns true.- Overrides:
_isInRange
in classAtomicWirelessChannel
- Parameters:
source
- The source port.destination
- The destination port.properties
- Properties of the transmission.- Returns:
- True if the destination is in range of the source.
- Throws:
IllegalActionException
- If it cannot be determined whether the destination is in range (not thrown in this base class).
-
-