|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.domains.wireless.lib.TerrainProperty
public class TerrainProperty
This actor models an obstacle that attenuates signals that traverse it. The obstacle has a geometry given by the xyPoints parameter. By default, the attenuation is infinite, meaning that the obstacle completely blocks a signal. By increasing the attenuationDepth parameter you can specify partial attenuation that depends on the geometry of the obstacle. If attenuationDepth has value x and the signal traverses distance y through the obstacle, then the power of the signal is reduced by a factor of
exp(log(0.5) * y / x)Thus, if x = y, then the power is reduced to half (3dB). The algorithm used here only works for convex obstacle shapes.
This actor implements the PropertyTransformer interface. It register itself with the wireless channel specified by the channelName parameter. The channel may call it getProperty() method to get the property.
Red (pjb2e) |
Yellow (eal) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.Entity |
---|
Entity.ContainedObjectsIterator |
Field Summary | |
---|---|
private double |
_attenuation
|
private WirelessChannel |
_channel
|
private java.lang.String |
_channelName
|
private EditorIcon |
_icon
|
private int |
_number
|
private int |
_numberOfPoints
|
private double[] |
_offset
|
private FilledShapeAttribute |
_terrain
|
private int[] |
_xPoints
|
private int[] |
_yPoints
|
Parameter |
attenuationDepth
The width of material that will attenuate a signal power by 50% (3dB). |
StringParameter |
channelName
The name of the channel. |
private static java.lang.String |
LOCATION_ATTRIBUTE_NAME
|
Parameter |
xyPoints
The x/y coordinates of the obstable. |
Fields inherited from class ptolemy.actor.AtomicActor |
---|
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _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 | |
---|---|
TerrainProperty(CompositeEntity container,
java.lang.String name)
Construct an actor with the specified container and name. |
Method Summary | |
---|---|
private double[] |
_lineSegmentIntersectionPoint(double[] a1,
double[] a2,
double[] b1,
double[] b2)
Return the point where two lines segments intersect. |
private double[] |
_locationOf(WirelessIOPort port)
Return the location of the given WirelessIOPort. |
private double[] |
_polygonCenter()
Return the center coordinates of the polygon icon. |
private double |
_polygonDepthBetweenPorts(double[] p1,
double[] p2)
Return the depth of the terrain that resides directly between the two points. |
void |
attributeChanged(Attribute attribute)
Override the base class to parse the model specified if the attribute is modelFileOrURL. |
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace. |
void |
initialize()
Register PropertyTransformers with the Channel. |
RecordToken |
transformProperties(RecordToken properties,
WirelessIOPort sender,
WirelessIOPort destination)
Check whether the path between the sender and receiver is intersected with the terrain shape. |
void |
wrapup()
Override the base class to call wrap up to unregister this with the channel. |
Methods inherited from class ptolemy.actor.TypedAtomicActor |
---|
_addPort, _fireAt, _fireAt, attributeTypeChanged, clone, newPort, typeConstraintList, typeConstraints |
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.InstantiableNamedObj |
---|
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition |
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.actor.Executable |
---|
fire, isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate |
Methods inherited from interface ptolemy.actor.Initializable |
---|
addInitializable, preinitialize, removeInitializable |
Methods inherited from interface ptolemy.kernel.util.Nameable |
---|
description, getContainer, getDisplayName, getFullName, getName, getName, setName |
Methods inherited from interface ptolemy.kernel.util.Derivable |
---|
getDerivedLevel, getDerivedList, propagateValue |
Field Detail |
---|
public StringParameter channelName
public Parameter attenuationDepth
public Parameter xyPoints
private WirelessChannel _channel
private int[] _xPoints
private int[] _yPoints
private EditorIcon _icon
private FilledShapeAttribute _terrain
private int _numberOfPoints
private double _attenuation
private int _number
private double[] _offset
private java.lang.String _channelName
private static final java.lang.String LOCATION_ATTRIBUTE_NAME
Constructor Detail |
---|
public TerrainProperty(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name.
IllegalActionException
- If the entity cannot be contained
by the proposed container.
NameDuplicationException
- If the container already has an
actor with this name.Method Detail |
---|
public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class NamedObj
attribute
- The attribute that changed.
IllegalActionException
- If the change is not acceptable
to this container (not thrown in this base class).public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class AtomicActor
workspace
- The workspace for the cloned object.
java.lang.CloneNotSupportedException
- Not thrown in this base classNamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class AtomicActor
IllegalActionException
- If a derived class throws it.public RecordToken transformProperties(RecordToken properties, WirelessIOPort sender, WirelessIOPort destination) throws IllegalActionException
transformProperties
in interface PropertyTransformer
properties
- The transform properties.sender
- The sending port.destination
- The receiving port.
IllegalActionException
- If failed to execute the model.public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class AtomicActor
IllegalActionException
- Not thrown in this base class.private double[] _locationOf(WirelessIOPort port) throws IllegalActionException
port
- A port with a location.
IllegalActionException
- If a valid location attribute cannot
be found.private double[] _polygonCenter()
private double _polygonDepthBetweenPorts(double[] p1, double[] p2)
p1
- The first reference point.p2
- The second reference point.
private double[] _lineSegmentIntersectionPoint(double[] a1, double[] a2, double[] b1, double[] b2) throws IllegalActionException
a1
- Endpoint on the first line segment.a2
- Endpoint on the first line segment.b1
- Endpoint on the second line segment.b2
- Endpoint on the second line segment.
IllegalActionException
- If the line segments do not intersect
or if the math results in a determinate of 0.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |