[ns] (A naive solution) how to set different transmit range for different node

2010-11-13 Thread alizey Khan

Hi All,

I URGENTLY needs to get some Pt_ values for certain  distances. I saw a post 
with the title [ns] (A naive solution) how to  set different transmit range 
for different node with a reply that  phenix has modified threshold.cc to 
get 
Pt_values. But there was no attachment with the message.

Can i get that..
I need in a bit urgency
ANy help will be welcomed

Regards,
ALizey



Re: [ns] (A naive solution) how to set different transmit range for different node

2009-01-05 Thread Phenix


Hi All,

   After hacking threshold.cc, I've known the formula used to calculate 
receive
threshold (ATTENTION: threshold.cc only generates RXThresh_, NOT Pt_). I 
modified

TwoRayGround formula in threshold.cc, as below :

Pr * d^4 * L
 Pt = ---
Gt * Gr * (ht^2 * hr^2)

Pr is replace with RXThresh_ whose value is 3.652e-10.
If a distance is given, Pt can be calculated by above formula.
e.g.
 Tx Range   Pt_
  100m 0.00721383
  150m 0.03652
  200m 0.115421
  250m 0.28179
  300m 0.58432
   ...  ...
I attached modified threshold.cc renamed threshold_Pt.cc .
After compiling it, you can use like this:
./threshold_Pt  -m TwoRayGround Required TxRange

But unluckily, if the tx range is smaller than crossover_dist (always should 
be 86.1425m),

the generated Pt_ value is incorrect either using Friis or TwoRay.
If you know why, please let me know.

I've developed a simple tcl script in order to validate transmit range
with different Pt_ value. I attached this script named TxRangeTest.tcl.
The routing protocol used in the script is MFlood, which is just a simple
flooding algorithm. Trace format has been changed a little, like:

s 1.0 1   1.00 200.00 AGT  --- 0 cbr 512  [0 0 0 0] ---  
[1:0 0:0 32 0] [0] 0 0
r 1.004860003 0   0.00 200.00 AGT  --- 0 MFlood 532 [mflood 1.0 
1.00 200.00 ]
 The trace format of cbr packet can be referred to NS2 manual. The explain 
of trace format about

MFlood packet is below:

   event = $1;
curr_time = $2;
curr_node_id = $3;
curr_position_x = $4;
curr_position_y = $5;
trace_type = $6;

pkt_seq = $8;
pkt_type = $9;
pkt_generate_time = $12;

prev_hop_position_x = $13;
prev_hop_position_y = $14;

  Finally, a AWT file is used to calculate the transmit range.
#
BEGIN {
RecvNum = 0;
final_curr_position_x = 0;
final_curr_position_y = 0;

final_prev_hop_position_x = 0;
final_prev_hop_position_y = 0;
}

{
event = $1;
curr_time = $2;
curr_node_id = $3;
curr_position_x = $4;
curr_position_y = $5;
trace_type = $6;

pkt_seq = $8;
pkt_type = $9;
pkt_generate_time = $12;

prev_hop_position_x = $13;
prev_hop_position_y = $14;

if ( event == r  curr_node_id == 0  trace_type == AGT  )
{
RecvNum++;
#   printf( %3d[Time : %f]N0(%.2f,%.2f)    
N1(%.2f,%.2f)\n,
#  RecvNum,
#  curr_time,
#  curr_position_x,
#  curr_position_y,
#  prev_hop_position_x,
#  prev_hop_position_y);

final_curr_position_x = curr_position_x;
final_curr_position_y = curr_position_y;

final_prev_hop_position_x = prev_hop_position_x;
final_prev_hop_position_y = prev_hop_position_y;
}

}

END{
dx = final_prev_hop_position_x - final_curr_position_x ;
dy = final_prev_hop_position_y - final_curr_position_y ;
tx_range = sqrt(dx * dx + dy * dy) ;

printf( \nNum of Recv pkts : %d \n, RecvNum);
printf( \nTx Range of Node 1: %f \n, tx_range);
}

This is just a reference. You should do some changes according to
your trace file if you use other routing protocol.

Regards,
Phenix

--
From: kavan sheth shethka...@gmail.com
Sent: Sunday, January 04, 2009 1:24 PM
To: Phenix phenix...@hhu.edu.cn
Subject: Re: [ns] how to set different transmit range for different node


Hi Phenix,

  As far as I know threshold.cc generates particular transmission
power(Pt_) based on the propagation model and distance specified by
you. different propagation model have different equations for
receiving power based on its characteristics. different equations are
given in the threshold.cc. you can know more by studying this
threshold.cc

Kavan

On 1/3/09, Phenix phenix...@hhu.edu.cn wrote:


Hi Sidney,

After times of trials, I've succeeded in letting different nodes own
different
Tx Range by configuring different value of Pt_ for each node. I get
different
values of Pt_ from a script:
   # The transimssion radio range
 Pt_ 6.9872e-4;# ?m
 Pt_ 8.5872e-4;# 40m
 Pt_ 1.33826e-3   ;# 50m
 Pt_ 7.214e-3 ;# 100m
 Pt_ 0.2818   ;# 250m

And in my script, I have test range of 250m and 40m. It really works 
well.

But It's a pity that I don't know how to obtain these values. The tool
threshold
(~ns/lidep-utils/propagation/threshold.cc) only generate RXThresh_ other
than Pt_.

Is there somebody knowing how to get value of