kbanks
03-31-2009, 02:36 PM
from an email...
We are attempting to further qualify the links between specific modules in a multi node network, and were hoping you could clarify a couple items.
(1) “scanEnergy()” does not seem to return a “readable” 16 byte string in Portal as described in the SNAP Reference Manual.
Using the following function:
print “scanEnergy= -”, scanEnergy(),"dBm"
we see the following values returned at Portal:
scanEnergy= -________________dBm
scanEnergy= -__________H=M___dBm
Can you clarify the letter/underscore significance and whether a “decode” of the string must be performed?
Since SNAPpy does not currently support arrays, we sometimes have to make do with character strings. Such was the case with the scanEnergy() function.
Each character in the returned string should be interpreted based on it's ordinal value. For example, you saw a value of "H" on one of your channels. This corresponds to 0x48, or 72 decimal. The energy reading on that channel at the time of the scan was 72 dBm, from a possible range of 18 dBm (strong) to 95 dBm (weak).
In SNAPpy (as well as in "full" Python) you can use the ord() builtin to convert from a "character" value to numeric one.
(2) There does not appear to be a means to differentiate or specify which node has sent the packet which is being used to calculate the received link quality of a node with the “getLq()” function. The SNAP Reference Manual states that the received link quality is derived from “the most recently received packet, regardless of which node the packet came from”.
In a network with many nodes, how would we determine the link quality between two specific nodes?
When a RPC is invoked on a node, the rpcSourceAddr() built-in can be used to see who the "invoker" is (refer to page 52 of the SNAP reference Manual).
So, for example, you can determine the links between a node "A" and "B" by having node B invoke rpc(nodeA,"callback","tellLq","getLq") and having a function like the following in Node B.
def tellLq(otherLq):
# Here otherLQ is how well the other node heard US
# rpcSourceAddr() reminds us WHO that node is
# getLq() here tells us how well we hear HIM
# Do something here with BOTH pieces of info
We are attempting to further qualify the links between specific modules in a multi node network, and were hoping you could clarify a couple items.
(1) “scanEnergy()” does not seem to return a “readable” 16 byte string in Portal as described in the SNAP Reference Manual.
Using the following function:
print “scanEnergy= -”, scanEnergy(),"dBm"
we see the following values returned at Portal:
scanEnergy= -________________dBm
scanEnergy= -__________H=M___dBm
Can you clarify the letter/underscore significance and whether a “decode” of the string must be performed?
Since SNAPpy does not currently support arrays, we sometimes have to make do with character strings. Such was the case with the scanEnergy() function.
Each character in the returned string should be interpreted based on it's ordinal value. For example, you saw a value of "H" on one of your channels. This corresponds to 0x48, or 72 decimal. The energy reading on that channel at the time of the scan was 72 dBm, from a possible range of 18 dBm (strong) to 95 dBm (weak).
In SNAPpy (as well as in "full" Python) you can use the ord() builtin to convert from a "character" value to numeric one.
(2) There does not appear to be a means to differentiate or specify which node has sent the packet which is being used to calculate the received link quality of a node with the “getLq()” function. The SNAP Reference Manual states that the received link quality is derived from “the most recently received packet, regardless of which node the packet came from”.
In a network with many nodes, how would we determine the link quality between two specific nodes?
When a RPC is invoked on a node, the rpcSourceAddr() built-in can be used to see who the "invoker" is (refer to page 52 of the SNAP reference Manual).
So, for example, you can determine the links between a node "A" and "B" by having node B invoke rpc(nodeA,"callback","tellLq","getLq") and having a function like the following in Node B.
def tellLq(otherLq):
# Here otherLQ is how well the other node heard US
# rpcSourceAddr() reminds us WHO that node is
# getLq() here tells us how well we hear HIM
# Do something here with BOTH pieces of info