Items tagged "ns2":
-
Hướng dẫn cài đặt NS2 trên Ubuntu 9.04
NS2 hay Network Simulator 2 là bộ mô phỏng mạng rất hữu ích trong việc nghiên cứu đánh giá hiệu năng mạng. Hôm nay tôi xin trình bày các bước để cài đặt bộ mô phỏng này trên hệ điều hành Ubuntu 9.04
+ Đầu tiên các bạn cần tải bản all-in-one phiên bản mới nhất của bộ mô phỏng này tại địa chỉ http://sourceforge.net/project/showfiles.php?group_id=149743&package_id=169689&release_id=684492
+ Mở chương trình Terminal của Ubuntu
+ Bạn cần cài đặt các thư viện cần thiết cho bộ mô phỏng như sau (yêu cầu có kết nối mạng Internet)
sudo apt-get autoconf automake build-essential libxmu-dev
+ Sau đó vào thư mục ns-allinone-2.34 đã được giải nén và gõ:
./install
+ Tiếp đến bạn cần thêm các giá trị của biến môi trường bằng cách gõ
sudo gedit ~./bashrc
+ Sửa file trên bằng cách thêm các nội dung sau
#environment values for NS2/NAM
# LD_LIBRARY_PATH
OTCL_LIB=/your directory/ns-allinone-2.34/otcl-1.13
NS2_LIB=/your directory/ns-allinone-2.34/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB
# TCL_LIBRARY
TCL_LIB=/your directory/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/your directory/ns-allinone-2.34/bin:/your directory/ns-allinone-2.34/tcl8.4.18/unix:/your directory/ns-allinone-2.34/tk8.4.18/unix
NS=/your directory/ns-allinone-2.34/ns-2.34/
NAM=/your directory/ns-allinone-2.34/nam-1.13/
PATH=$PATH:$XGRAPH:$NS:$NAM
Như vậy là bạn đã hoàn thiện xong quá trình cài đặt NS2 và có thể sử dụng để mô phỏng các thí nghiệm của riêng bạn.
P/s: Chi tiết về Ns2 các bạn có thể tham khảo thêm ở địa chỉ sau http://www.isi.edu/nsnam/ns/index.html
-
Shadowing model in ns-2
I wanted to do simulations with a more realistic propagation model in ns-2, to examine the effect of lossy links at the edge of the propagation area. To do this, I had to work with the Shadowing propagation model, and I’ve made some discoveries.

First and foremost, the Phy/WirelessPhy RXThresh_ variable cannot be reduced below something like 10^-12. Thus, to get what I wanted, a more or less sharp cut-off at above 250 m radius, I had to increase the antenna gains from 1 to 20.
The radio propagation application thresholdcan be used to determine the RXThresh_ value for a certain packet reception probability rate at a radius from the node. I used it for a 0.95 probability rate at 250 m. However, without increasing the gain of the antenna reception and transmission to 20.0, the RXThresh_ value was too small, at 4.73e-13, actually producing the same results as setting the RXThresh_ value to 0. Thus, don’t make the same mistake as me, be mindful of the (hidden?) minimum value of the RXThresh_ even if the output from threshold states otherwise.
At the University of Hamburg – Harburg a Matlab-script to plot the packet receival probability at varying distances using the shadowing propagation model with defined parameter settings can be found. Firefox may not like the certificate and block you from the page, but I recommend to make an exception for this page, as the script works perfectly in Matlab. The script is an enormous help in determining the optimal shadowing parameters, and the picture on the right is a graph generated by the script.
The result on the picture to the right was obtained with the following parameter values:
Pt = 0.28183815; % transmit power
Gt = 20.0; % transmit antenna gain
Gr = 20.0; % receive antenna
freq = 2.4e9; % frequency
sysLoss = 1.0; % system loss
pathlossExp = 10.0; % path loss exponent
std_db = 4.0; % shadowing deviation
dist0 = 120.0; % reference distance
lambda = 3.0e8/freq; % lambda
rxThresh_=1.10552e-10; % rx thresholdNow you have no excuse; go run some simulations with shadowing!
Tags
Info
Notes
There are 3 notes on this item.
-
Running TORA in ns-2.34 on Ubuntu 10.04
First, patch the ns-2.34 code using the patch and recipe from http://wpage.unina.it/marcello.caleffi/ns2/tora.html.
Then, to avoid eternal loops making the simulation never ending, fix the line 504 (ns-2.34) in imep/imep.cc which reads
rexmitTimer.start(rexat - CURRENT_TIME);If rexat – CURRENT_TIME is 0, then the same function is called immediately without increasing the simulation time, creating an eternal loop. I would have replaced the line with the following lines:
if (rexat-CURRENT_TIME<0.000001) // Preventing eternal loop.
rexmitTimer.start(0.000001);
else
rexmitTimer.start(rexat - CURRENT_TIME);Then recompile with make, and enjoy.

(Sưu tầm)
Tags
Info
Notes
There are 3 notes on this item.
-
Compiling threshold.cc
threshold.ccis a program to calculate the thresholds for transmission receipt using the relation between various physical parameters (distance, effect, propagation model etc.) related to transmissions in ns-2. It has to be compiled by the user. This is not a difficult task, but could pose some challenges as the compiler over time is updated and no longer accepts the outdated c-code of outdated versions of ns-2.Trying to do
g++ threshold.ccwill break if trying this with a reasonably updated version of Ubuntu and the g++ compiler (v4.3.3) in combination with ns-2.33. Thus, to make it work, delete the line that reads#include <iostream.h>and write these three lines there instead:
#include <iostream>
#include <cstring>
using namespace std;Then try to compile with g++ again:
g++ threshold.cc -o threshold(Sưu tầm)
Tags
Info
Notes
There are 2 notes on this item.