ptolemy.domains.wireless.lib
Class LimitedRangeChannel
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
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.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, ChannelListener, PropertyTransformer, WirelessChannel, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, ValueListener
- Direct Known Subclasses:
- 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: LimitedRangeChannel.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Edward A. Lee
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Method Summary |
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.kernel.AtomicWirelessChannel |
_distanceBetween, _locationOf, _receiversInRange, addChannelListener, channelNotify, getChannelPort, listeningInputPorts, listeningOutputPorts, preinitialize, registerPropertyTransformer, removeChannelListener, sendingInputPorts, sendingOutputPorts, transformProperties, transmit, unregisterPropertyTransformer |
Methods inherited from class ptolemy.actor.AtomicActor |
_actorFiring, _actorFiring, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, 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 |
_description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName |
Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeList, attributeList, 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, propagateValue, propagateValues, removeChangeListener, removeDebugListener, 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 |
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.
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 interface ValueListener
- Overrides:
valueChanged
in class AtomicWirelessChannel
- 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 class AtomicWirelessChannel
- 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).