⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 faq(trace分析,常见问题分析).txt

📁 SEASON的PPT,介绍NS2中mflood移植的方法,源码进行了修改,与书上有所不同
💻 TXT
📖 第 1 页 / 共 2 页
字号:
Note: A few answers come from the discussion in Ns2 mail list and are proved
to be effective.

----------------------------------------------------------------------------
Question 1: 

Scheduler:: Event UID not valid! 

Answer: 

Each event in NS2 has a unique UID. The scheduler toggles the UID twice, 
once during dispatching and once during scheduling. Thus, the event has a 
positive UID after being scheduled and a negative one before being scheduled. 
If the event has been scheduled but not dispatched, then it will have a 
positive UID and cannot be scheduled again. 

In implementing a new protocol, this error can happen in two cases:

1. You are using timers. When a timer is scheduled again without the 
previous schedule expiring - Trace which timer is scheduled and when it 
will expire.

2. You are dealing with packets. A packet is also a kind of event to be 
scheduled and a UID is associated with it. When you create a 
copy or alloc again before freeing it, due to the same packet with a positive 
UID, it cannot be scheduled again. 
-----------------------------------------------------------------------------

Question 2:  

What is the role of GOD?

Answer:

GOD, called general operations director, is an object which is aware of the 
whole mobile wireless network topology during the period of simulation.

GOD is used to store global information about the states of the simulated mobile 
wireless network, i. e. , GoD is an omniscient observer, but the global 
information GOD owns should not be totally available to any nodes in the 
simulation, a node can obtain its partial information when needed.

Currently, GOD is only used to store an array of the shortest number of hops 
required to reach from one node to another. GOD does not calculate them 
on the fly during the simulation, since it can be quite time consuming. 
The information is loaded into GOD from the movement pattern file where 
the lines similar to 

$ns_ at 666.66 "$god_ set-dist 10 20 2"
 
are used to load GOD with the information that the shortest path 
between node 10 and node 20 is changed to 2 hops at time 666.66. 
------------------------------------------------------------------------------

Question 3: 

How to debug my extension to ns2?

Answer:

There are two levels to debug:

1. C++ level: 

(1) To enable debug information in ns as follows:

in your ns-allinone directory, edit the install file. 

In a section which includes "# Build Tcl8.3.2", you need to add the option 

--enable-symbols, such that:
./configure --enable-gcc --disable-shared --prefix=$CUR_PATH || ....

becomes:
./configure --enable-gcc --enable-symbols --disable-shared --prefix=$CUR_PATH || ....

In another section which includes "# Build tclcl",  you need to add --enable-debug 
to your configure line, such that:

./configure ||  ...

becomes 

./configure --enable-debug || ...

(2) To enter your ns-allinone/ns directory, and open your Makefile.in. You need to
change the line 

CFLAGS  = $(CCOPT) $(DEFINE)

to 

CFLAGS  = -g $(CCOPT) $(DEFINE)

(3) To go back to ns-allinone directory and type ./install

(4)  the C++ debug with gdb
    . gdb ns
    .(gdb) set args myscript.tcl
    .(gdb) b MyClass::myfunction 
      # This line set breakpoint
    .run

2. Tcl Level

You need to find a software which is called tcl-debug.

(1) To place tcl-debug-2.0/ parallel to ns-2.26/
(2) cd ns-2.26
    ./configure --enable-debug --with-tcldebug and examine Makefile to ensure tcl-debug 
options enabled.
(3) make clean; make; make install

(4) Add breakpts for tcl-debug
Add "debug 1" (it's one not 'L') into your script file where you want to 
debug.
------------------------------------------------------------------------------------

Question 4: 

Difference between Thresholds in wireless-phy.cc

Answer:

(1) RXThreshold: If a packet reaches a node with a power level that is below
RxThrehold, the node will receive the packet with error (i.e. will not be able
to read the packet), but will understand that a packet is being transmitted for
[0,T] sec.

(2) CSThreshold: If a packet reaches a node with a power level that is below
CSThresh_ , the node will not be able to understand that a packet is being
transmitted for [0,T] sec; i.e. it will perceive the channel to be idle.

(3) CPThreshold: Let a packet 'A' is being received by a node during [0,T] sec. If
another packet ('B') transmission begins during [0,T] so that 'B' reaches the
node with a power that is CPThreshold below the received power of packet 'A'
(in dB scale), packet 'A' will survive (i.e. the node will be able to read
packet 'A'). Otherwise, packet 'A' will "collide" with packet 'B' (so
that the node will not be able to read either of the packets).
-------------------------------------------------------------------------------------

Question 5:

What does it mean when ns gives the message "scheduler going
backwards from 73.9587457845 to -1417846817.3257839 ?

Answer:

Most likely, one of the events gave rise to some other event in "past". If you 
know how discrete event simulators work, this will be clear to you. However, 
it seems that this occurred due to an overflow in calculating the timing for a 
future event somewhere.
------------------------------------------------------------------------------------

Question 6:

How to set up the wireless bandwidth (such as 802.11 a,b,g) in NS2?

Answer:

In ns2.26 and ns2.27, you can change (basicRate_ and dataRate_ ):

Mac/802_11 set basicRate_ 1Mb 
Mac/802_11 set dataRate_  11Mb 

in your tcl script.

FHSS (IEEE802.11)
   Mac/802_11 set SlotTime_          0.000050        ;# 50us
   Mac/802_11 set SIFS_              0.000028        ;# 28us
   Mac/802_11 set PreambleLength_    0               ;# no preamble
   Mac/802_11 set PLCPHeaderLength_  128             ;# 128 bits
   Mac/802_11 set PLCPDataRate_      1.0e6           ;# 1Mbps
   Mac/802_11 set dataRate_          1.0e6           ;# 11Mbps
   Mac/802_11 set basicRate_         1.0e6           ;# 1Mbps

DSSS (IEEE802.11b)
   Mac/802_11 set SlotTime_          0.000020        ;# 20us
   Mac/802_11 set SIFS_              0.000010        ;# 10us
   Mac/802_11 set PreambleLength_    144             ;# 144 bit
   Mac/802_11 set PLCPHeaderLength_  48              ;# 48 bits
   Mac/802_11 set PLCPDataRate_      1.0e6           ;# 1Mbps
   Mac/802_11 set dataRate_          11.0e6          ;# 11Mbps
   Mac/802_11 set basicRate_         1.0e6           ;# 1Mbps

Note: 

-if using the short preamble option: you can change the line as:
Mac/802_11 set PreambleLength_ 72

-  # frequency is 2.4 GHz
   Phy/WirelessPhy set freq_ 2.4e+9
   # transmit power
   Phy/WirelessPhy set Pt_ 3.3962527e-2
   # Receive sensitivity.
   Phy/WirelessPhy set RXThresh_ 6.309573e-12
   Phy/WirelessPhy set CSThresh_ 6.309573e-12

Note that the radio range that results from this configuration may or may
not coincide with open field tests. If you want setup a specific range,
use the program ~/indep-utils/propagation/threshold.cc to obtain the
desired RXThresh_ (rx sensitivity) based on the above frequency, transmit
power and your desired range.


802.11g:

#define DSSS_CWMin			15
#define DSSS_CWMax			1023
#define DSSS_SlotTime		0.000009	
#define DSSS_CCATime 		0.000003	
#define DSSS_RxTxTurnaroundTime	0.000002	
#define DSSS_SIFSTime		0.000016 	
#define DSSS_PreambleLength	 96
#define DSSS_PLCPHeaderLength	40	
#define DSSS_PLCPDataRate		6.0e6	// 6Mbps
#define DSSS_MaxPropagationDelay     0.0000005	// 0.5us






Note: bandwidth is different with achievable throughput.

- In NS ACK are always sent at 1Mbps
- NS use always the long PLCP preamble format sent at 1Mbps
- by default NS uses RTS/CTS handshake
- Packet's size has also an impact in the % of overhead.

All this factor can  bound the achievable throughput

-----------------------------------------------------------------------------------
Question 7:

When do we need to "make clean; make depend; make" in ns2?

Answer:





A trick: 

- after making the changes in any tcl file I go into ns-lib.tcl, and 
make a small change e.g delete a full stop in a comment or add my on 
comment anywhere (note that this change should be in the cmmented area 
not the actual code).
- save the ns-lib.tcl file.
- run "make" only.

In this way I find that all the changes in all other tcl files take 
effect. 

the same trick whenever u change a .h  file only  i.e. 
make some  trivial change in the corresponding  .cc file

------------------------------------------------------------------------------------

Question 8:

How to deal with Very large trace files?

Answer:

(1) Don't trace-all

(2) To Turn off some unused packet header

(3) Two simple solutions using "pipe":
    . To use tool (i.e awk) to filter only interesting events

    set tr [open "| awk -f filter.awk >out.tr" w]
    $ns trace-all $tr

    .if You are not interested in traces and only results (average, 
variation, distribution, count etc.)

    set tr [open "| awk -f my_measure_tool.awk >my_results.txt" w]
    $ns trace-all $tr
(4) To try other compression skill, such as 
You may reduce the size of the trace file by using the
sed command on solaris machines.
For example, if all you need is just the RTR and AGT
trace lines, you may remove the MAC trace using
cat tracefile.tr | sed -e "/MAC/d" >
smallertracefile.tr

------------------------------------------------------------------------------------

Question 9:

How to disable RTS/CTS?

Answer:

(1) If you are using ns-2.27, include the line:

Mac/802_11 set RTSThreshold_ 3000  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -