[ns] How can I get a node distance in ad-hoc routing simulation ?

Kyunghan Lee khanax at gmail.com
Mon Apr 11 15:25:53 PDT 2005


Hi. ns users~

I'm doing a simulation on ad-hoc networks in need of a node distance.

So far, I found that NS internally gets node distance by calculating
d=sqrt{(Xr-Xt)^2+(Yr-Yt)^2+(Zr-Zt)^2} where subscrtip r means
receiver, t means transmitter.
(This equation exists on "/mobile/propagation.cc" )

What is the easiest way to get a node distance in ad-hoc routing
simulation with only "Packet *p" ? (especially AODV)

I wanna use "rx->getNode()->getLoc(&Xr, &Yr, &Zr)" where rx is a
"PacketStamp" class.
There is PacketStamp class "txinfo_" in "Packet *p" but rxinfo is not.
How can I construct a PacketStamp *rx in receiver node? (for example
in AODV, how can I use "PacketStamp *rx" in "recvHello(Packet *p)"
function.

Thanks in advance. :)



More information about the Ns-users mailing list