
SmallWorldRouter |
ptolemy.domains.wireless.demo.SmallWorld.SmallWorldRouter |
This actor implements a routing algorithm to route a message to the
destination via a short path based only on local information. It
assumes that it knows which nodes are in range and the location of
that node. It also assumes that the location of the destination is
known. Based on this information, it finds the node that is closest
to the destination from its connected node set.
<p> We assume that the actor are connected to nodes inside a
particular range, specified by the <i>sureRange<i> parameter, for
sure. Outside this range, it may connected to a node with
probability propotional to the r-th inverse power of the distance
between them. Whether it is connected to a particular node is
independent of whether it is connected to any other node.
<p> For convenience, a variable named "distance" is available and
equal to the distance between this actor and other actors. The loss
probability can be given as an expression that depends on this
distance.
<p> The distance between the transmitter and receiver is determined
by the protected method _distanceBetween(), which is also used to
set the value of the <i>distance</i> variable that can be used in
the expression for loss probability.
Author(s): Yang Zhao
Version:$Id: SmallWorldRouter.doc.html,v 1.1 2006/02/22 18:42:26 mangal Exp $
Pt.Proposed Rating:Yellow (eal)
Pt.Accepted Rating:Red (pjb2e)
input
The input port for messages to route. It requires the received
token to be a record token has type:
{data=double, destination=String, routeTo=String, hops=int}.
output
The output port that send a message to connected nodes.
This has type:
{data=double, destination=String, routeTo=String, hops=int}.
test
This port is for analysis uses. When the destination node
receives the message, it outputs an int token to indicate
how many hops from the source.
inputChannelName
Name of the input channel. This is a string that defaults to
"InputChannel".
outputChannelName
Name of the output channel. This is a string that defaults to
"OutputChannel".
testChannelName
Name of the test channel. This is a string that defaults to
"testChannel".
lossProbability
The probability that a connection between two node will fail
to happen. This is a double that defaults to 0.0, which means that
no loss occurs.
FIXME: get a better name for it.
sureRange
The for sure connected range between two nodes. This is a double that
defaults to 100.0. The icon for this sensor node includes
a circle with this as its radius.
delay
The time required for relaying a message. This is a double that
defaults to 1.0.
seed
The seed that controls the random number generation.
A seed of zero is interpreted to mean that no seed is specified,
which means that each execution of the model could result in
distinct data. For the value 0, the seed is set to
System.currentTimeMillis() + hashCode(), which means that
with extremely high probability, two distinct actors will have
distinct seeds. However, current time may not have enough
resolution to ensure that two subsequent executions of the
same model have distinct seeds.
This parameter contains a LongToken, initially with value 0.
doublePath
If true, then this actor will also route the message to the
node that is the second closest to the destination among all
its connected nodes. FIXME: This is still under
experiment. The issue I try to address is that some links may
fail and long links may fail with higher probability. If so,
routing a message to two paths may improve the hit
probability. However, this will also cost more energy and also
lower the capacity of the network. There is a tradeoff. A
simple idea is to use a threshold to control the exponentially
increased branches. For example, with a threshold equals 2, it
only route to two pathes for the first hop.