Dear Liceven,

While I cant give you step-by-step instruction on how to solve your problem. 
But here is the idea. If you were to go to 
ns-allinone2.xx/ns2.xx/mobile/antenna.cc file you will see the function:

Antenna::Antenna()
{
  X_ = 0; Y_= 0; Z_= 0;
  bind("X_", &X_);
  bind("Y_", &Y_);
  bind("Z_", &Z_);
}

Basically this constructors binds the X_ variable in the TCL file with the X_ 
in the C++ file. If you were to add say:

cout << "X position" << X_ << endl;
cout << "Y position" << Y_ << endl;
cout << "Z position" << Z_ << endl;

after   bind("Z_", &Z_); but before }. And then run the "make clean" and "make" 
command at the Linux command terminal in the ns-allinone2.xx/ns2.xx/ prompt 
area. Once thats done, if you were to run your .tcl file, you will see an 
output, which specifies the position of your node in X, Y, Z coordinate.

The glitch with this approach is that it shows you the coordinates for time 
0.0, mean just at the start of the simulation.

For your problem, YOU need to find the .cc file which is responsible for 
changing the X, Y, Z coordinates. Once you locate that .cc file, then locate 
the function which is changing the value of X, Y, Z, and then you can add the 
above cout lines at the end of that function.

This way, when you run the simulation, you will get live time output of the X, 
Y, Z coordinates. If you know C++ half-decent, then I think it will not take 
you more than 2-5 hours to locate the function and find the solution of your 
problem.

PLEASE ONCE YOU SOLVE YOUR PROBLEM, DO SHARE YOUR SOLUTION WITH OTHERS ON THE 
NS MAILING LIST.

Kind Regards
Jalaluddin Qureshi

Research Student @ CeMNet, SCE
Nanayang Technological University
N4-B2c-06, Nanyang Avenue
Singapore 639798
http://www.cemnet.ntu.edu.sg

--Forwarded Message Attachment--
From: [EMAIL PROTECTED]
To: ns-users@ISI.EDU
Date: Wed, 23 Jul 2008 00:00:36 -0700
Subject: [ns] How to get a mobile node's current position


Hello,everyone:
      I want to simulate a wireless scenario with two access points and a
mobile node. This mobile node moves randomly, the question is how to
calculate it's position like(x=?,y=?,z=0) at any given time. It could be
better if you could give me an example. Of course, any suggestion is
welcome.
     Regards.
     Liceven
--
View this message in context: 
http://www.nabble.com/How-to-get-a-mobile-node%27s-current-position-tp18604950p18604950.html
Sent from the ns-users mailing list archive at Nabble.com.



_________________________________________________________________
Check out Barclays Premier League exclusive video clips here!
http://fc.sg.msn.com/index.aspx

Reply via email to